1 | <?php |
||
5 | class ProjectPath |
||
6 | { |
||
7 | |||
8 | /** |
||
9 | * La funzione ritorna un array con i path dell'applicazione. |
||
10 | * |
||
11 | * @param $container Container dell'applicazione |
||
12 | * |
||
13 | * @return array Ritorna l'array contenente i path |
||
14 | */ |
||
15 | private $container; |
||
16 | private $rootdir; |
||
17 | private $prjdir; |
||
18 | |||
19 | 3 | public function __construct($container) |
|
26 | |||
27 | 1 | public function getRootPath() |
|
31 | |||
32 | 3 | public function getProjectPath() |
|
36 | |||
37 | 1 | public function getBinPath() |
|
38 | { |
||
39 | 1 | $bindir = $this->getProjectPath() . DIRECTORY_SEPARATOR . 'bin'; |
|
40 | 1 | if (version_compare(\Symfony\Component\HttpKernel\Kernel::VERSION, '3.0') >= 0) { |
|
41 | 1 | if (!file_exists($bindir)) { |
|
42 | $bindir = $this->getProjectPath() . DIRECTORY_SEPARATOR . 'vendor' . |
||
43 | DIRECTORY_SEPARATOR . 'bin'; |
||
44 | } |
||
45 | } |
||
46 | 1 | if (!file_exists($bindir)) { |
|
47 | throw new \Exception("Cartella Bin non trovata", -100); |
||
48 | } |
||
49 | 1 | return $bindir; |
|
50 | } |
||
51 | |||
52 | 1 | public function getVendorBinPath() |
|
53 | { |
||
54 | 1 | $vendorbindir = $this->getProjectPath() . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'bin'; |
|
55 | 1 | if (!file_exists($vendorbindir)) { |
|
56 | 1 | $vendorbindir = $this->getProjectPath() . '/../vendor/bin'; |
|
57 | 1 | if (!file_exists($vendorbindir)) { |
|
58 | throw new \Exception("Cartella Bin in vendor non trovata", -100); |
||
59 | } |
||
60 | } |
||
61 | 1 | return $vendorbindir; |
|
62 | } |
||
63 | |||
64 | 2 | public function getSrcPath() |
|
69 | |||
70 | 2 | public function getAppPath() |
|
75 | |||
76 | 2 | public function getVarPath() |
|
81 | |||
82 | 1 | public function getDocPath() |
|
87 | |||
88 | 2 | public function getCachePath() |
|
89 | { |
||
101 | |||
102 | public function getLogsPath() |
||
115 | |||
116 | 1 | public function getConsole() |
|
130 | } |
||
131 |