<?php

namespace KupShop\KupShopBundle\Util\System;

use KupShop\KupShopBundle\Util\ServiceTrait;

class PathFinder
{
    use ServiceTrait;

    // Directory getters
    public function getDataDir()
    {
        return $this->getShopDir().'data/';
    }

    public function getTmpDir()
    {
        return $this->getDataDir().'tmp/';
    }

    public function getShopDir()
    {
        global $cfg;

        return $cfg['Path']['web_root'];
    }

    public function getEngineDir()
    {
        global $cfg;

        return $cfg['Path']['shared_version'];
    }

    public function getEngineWebDir()
    {
        return $this->getEngineDir().'web/';
    }

    public function getAdminDir()
    {
        return $this->getEngineDir().'admin/';
    }

    // Path construction functions
    public function shopPath($path)
    {
        return $this->getShopDir().$path;
    }

    public function enginePath($path)
    {
        return $this->getEngineDir().$path;
    }

    public function engineWebPath($path)
    {
        return $this->getEngineWebDir().$path;
    }

    public function adminPath($path)
    {
        return $this->getAdminDir().$path;
    }

    public function tmpPath($file)
    {
        return $this->getTmpDir().$file;
    }

    public function dataPath($file)
    {
        return $this->getDataDir().$file;
    }
}
