@@ -83,7 +83,7 @@ |
||
83 | 83 | throw new Exceptions\InvalidArgumentException(sprintf('Package \'%s\' does not exist.', $package)); |
84 | 84 | } |
85 | 85 | |
86 | - $path = $this->repository->findPackage($package)->getPath() . ($localPrefix ? '/' . $localPrefix : '') . ($pos ? substr($path, $pos) : ''); |
|
86 | + $path = $this->repository->findPackage($package)->getPath().($localPrefix ? '/'.$localPrefix : '').($pos ? substr($path, $pos) : ''); |
|
87 | 87 | |
88 | 88 | return Utils\Strings::replace($path, '~\\\~', '/'); |
89 | 89 | } |
@@ -73,7 +73,7 @@ |
||
73 | 73 | |
74 | 74 | foreach ($packages as $package) { |
75 | 75 | $output->writeln(sprintf( |
76 | - '<info>%'. $maxLength .'s</info> | status: <comment>%-12s</comment> | version: <comment>%s</comment>', |
|
76 | + '<info>%'.$maxLength.'s</info> | status: <comment>%-12s</comment> | version: <comment>%s</comment>', |
|
77 | 77 | $package->getName(), |
78 | 78 | $this->packageManager->getStatus($package), |
79 | 79 | $this->packageManager->getVersion($package) |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | throw new \RuntimeException('Package path is missing.'); |
184 | 184 | } |
185 | 185 | |
186 | - if (!file_exists($file = $path . DIRECTORY_SEPARATOR . 'composer.json')) { |
|
186 | + if (!file_exists($file = $path.DIRECTORY_SEPARATOR.'composer.json')) { |
|
187 | 187 | throw new \RuntimeException('\'composer.json\' is missing.'); |
188 | 188 | } |
189 | 189 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | return $packageData['version']; |
194 | 194 | } |
195 | 195 | |
196 | - if (file_exists($file = $this->vendorDir . DIRECTORY_SEPARATOR . 'composer' . DIRECTORY_SEPARATOR . 'installed.json')) { |
|
196 | + if (file_exists($file = $this->vendorDir.DIRECTORY_SEPARATOR.'composer'.DIRECTORY_SEPARATOR.'installed.json')) { |
|
197 | 197 | $installed = Utils\Json::decode(file_get_contents($file), Utils\Json::FORCE_ARRAY); |
198 | 198 | |
199 | 199 | foreach ($installed as $packageData) { |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | |
579 | 579 | // Check if package is registered |
580 | 580 | if (!$packagesConfig->offsetExists($package->getName())) { |
581 | - throw new Exceptions\InvalidStateException(sprintf('Package "%s" is not registered. Please call ' . get_called_class() . '::registerAvailable first.', $package->getName())); |
|
581 | + throw new Exceptions\InvalidStateException(sprintf('Package "%s" is not registered. Please call '.get_called_class().'::registerAvailable first.', $package->getName())); |
|
582 | 582 | } |
583 | 583 | |
584 | 584 | $packagesConfig[$package->getName()][self::PACKAGE_STATUS] = $status; |
@@ -662,6 +662,6 @@ discard block |
||
662 | 662 | */ |
663 | 663 | private function getPackageConfigPath() : string |
664 | 664 | { |
665 | - return $this->configDir . DIRECTORY_SEPARATOR . 'packages.php'; |
|
665 | + return $this->configDir.DIRECTORY_SEPARATOR.'packages.php'; |
|
666 | 666 | } |
667 | 667 | } |
@@ -18,7 +18,6 @@ |
||
18 | 18 | |
19 | 19 | use Nette; |
20 | 20 | use Nette\Utils; |
21 | - |
|
22 | 21 | use IPub\Packages\DependencyResolver; |
23 | 22 | use IPub\Packages\Entities; |
24 | 23 | use IPub\Packages\Exceptions; |
@@ -192,7 +192,7 @@ |
||
192 | 192 | */ |
193 | 193 | private function getConfigPath() : string |
194 | 194 | { |
195 | - return $this->configDir . DIRECTORY_SEPARATOR . $this->configFile; |
|
195 | + return $this->configDir.DIRECTORY_SEPARATOR.$this->configFile; |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -232,7 +232,7 @@ |
||
232 | 232 | $this->packages = []; |
233 | 233 | |
234 | 234 | foreach ($this->paths as $path) { |
235 | - $files = glob($path . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . 'composer.json', GLOB_NOSORT) ?: []; |
|
235 | + $files = glob($path.DIRECTORY_SEPARATOR.'*'.DIRECTORY_SEPARATOR.'*'.DIRECTORY_SEPARATOR.'composer.json', GLOB_NOSORT) ?: []; |
|
236 | 236 | |
237 | 237 | foreach ($files as $file) { |
238 | 238 | /** @var Entities\IPackage $package */ |
@@ -15,35 +15,35 @@ discard block |
||
15 | 15 | declare(strict_types = 1); |
16 | 16 | |
17 | 17 | $rootDir = getcwd(); |
18 | -$libsDir = $rootDir . DIRECTORY_SEPARATOR . 'vendor'; |
|
19 | -$wwwDir = $rootDir . DIRECTORY_SEPARATOR . 'www'; |
|
20 | -$appDir = $rootDir . DIRECTORY_SEPARATOR . 'app'; |
|
21 | -$packagesDir = $appDir . DIRECTORY_SEPARATOR . 'config'; |
|
18 | +$libsDir = $rootDir.DIRECTORY_SEPARATOR.'vendor'; |
|
19 | +$wwwDir = $rootDir.DIRECTORY_SEPARATOR.'www'; |
|
20 | +$appDir = $rootDir.DIRECTORY_SEPARATOR.'app'; |
|
21 | +$packagesDir = $appDir.DIRECTORY_SEPARATOR.'config'; |
|
22 | 22 | |
23 | 23 | if (!file_exists($packagesDir)) { |
24 | 24 | if (is_writable(dirname($packagesDir))) { |
25 | 25 | mkdir($packagesDir); |
26 | 26 | |
27 | 27 | } else { |
28 | - die('Path "' . $packagesDir . '" does not exists.'); |
|
28 | + die('Path "'.$packagesDir.'" does not exists.'); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | 32 | if (!is_writable($packagesDir)) { |
33 | - die('Path "' . $packagesDir . '" it not writable.'); |
|
33 | + die('Path "'.$packagesDir.'" it not writable.'); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | foreach (['log', 'temp'] as $dir) { |
37 | - if (!is_dir($rootDir . DIRECTORY_SEPARATOR . $dir)) { |
|
38 | - mkdir($rootDir . DIRECTORY_SEPARATOR . $dir); |
|
37 | + if (!is_dir($rootDir.DIRECTORY_SEPARATOR.$dir)) { |
|
38 | + mkdir($rootDir.DIRECTORY_SEPARATOR.$dir); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | -if (!file_exists($libsDir . DIRECTORY_SEPARATOR . 'autoload.php')) { |
|
42 | +if (!file_exists($libsDir.DIRECTORY_SEPARATOR.'autoload.php')) { |
|
43 | 43 | die('autoload.php file can not be found.'); |
44 | 44 | } |
45 | 45 | |
46 | -require_once $libsDir . DIRECTORY_SEPARATOR . 'autoload.php'; |
|
46 | +require_once $libsDir.DIRECTORY_SEPARATOR.'autoload.php'; |
|
47 | 47 | |
48 | 48 | $configurator = new Nette\Configurator; |
49 | 49 | $configurator->addParameters([ |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | ]); |
53 | 53 | |
54 | 54 | //$configurator->setDebugMode(TRUE); // Debug mode HAVE TO BE enabled on production server |
55 | -$configurator->enableDebugger($packagesDir . DIRECTORY_SEPARATOR . 'log'); |
|
55 | +$configurator->enableDebugger($packagesDir.DIRECTORY_SEPARATOR.'log'); |
|
56 | 56 | |
57 | -$configurator->setTempDirectory($packagesDir . DIRECTORY_SEPARATOR . 'temp'); |
|
58 | -$configurator->addConfig(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.neon'); |
|
57 | +$configurator->setTempDirectory($packagesDir.DIRECTORY_SEPARATOR.'temp'); |
|
58 | +$configurator->addConfig(dirname(__DIR__).DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.neon'); |
|
59 | 59 | |
60 | 60 | $container = $configurator->createContainer(); |
61 | 61 |
@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | foreach ($this->packageFiles as $packageFile) { |
117 | - if (is_file($path . DIRECTORY_SEPARATOR . $packageFile)) { |
|
118 | - $class = $this->getPackageClassByFile($path . DIRECTORY_SEPARATOR . $packageFile); |
|
117 | + if (is_file($path.DIRECTORY_SEPARATOR.$packageFile)) { |
|
118 | + $class = $this->getPackageClassByFile($path.DIRECTORY_SEPARATOR.$packageFile); |
|
119 | 119 | |
120 | - include_once $path . DIRECTORY_SEPARATOR . $packageFile; |
|
120 | + include_once $path.DIRECTORY_SEPARATOR.$packageFile; |
|
121 | 121 | |
122 | 122 | $package = $this->container->createInstance($class, [$data]); |
123 | 123 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | } |
233 | 233 | |
234 | 234 | if (isset($tokens[$i][1])) { |
235 | - $namespace = $namespace ? $namespace . "\\" . $tokens[$i][1] : $tokens[$i][1]; |
|
235 | + $namespace = $namespace ? $namespace."\\".$tokens[$i][1] : $tokens[$i][1]; |
|
236 | 236 | $dlm = TRUE; |
237 | 237 | } |
238 | 238 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $class_name = $tokens[$i][1]; |
247 | 247 | |
248 | 248 | |
249 | - $classes[] = $namespace . '\\' . $class_name; |
|
249 | + $classes[] = $namespace.'\\'.$class_name; |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 |
@@ -16,13 +16,10 @@ |
||
16 | 16 | |
17 | 17 | namespace IPub\Packages\Loaders; |
18 | 18 | |
19 | -use Composer; |
|
20 | 19 | use Composer\Semver; |
21 | - |
|
22 | 20 | use Nette; |
23 | 21 | use Nette\DI; |
24 | 22 | use Nette\Utils; |
25 | - |
|
26 | 23 | use IPub\Packages\Entities; |
27 | 24 | use IPub\Packages\Exceptions; |
28 | 25 |
@@ -18,7 +18,6 @@ |
||
18 | 18 | |
19 | 19 | use Symfony\Component\Console\Input; |
20 | 20 | use Symfony\Component\Console\Output; |
21 | - |
|
22 | 21 | use IPub\Packages\DependencyResolver; |
23 | 22 | use IPub\Packages\Exceptions; |
24 | 23 |
@@ -18,7 +18,6 @@ |
||
18 | 18 | |
19 | 19 | use Nette; |
20 | 20 | use Nette\Utils; |
21 | - |
|
22 | 21 | use IPub\Packages\Exceptions; |
23 | 22 | |
24 | 23 | /** |
@@ -49,7 +49,7 @@ |
||
49 | 49 | $this->composerData = $composerData; |
50 | 50 | |
51 | 51 | if (!isset($composerData['name'])) { |
52 | - throw new Exceptions\UnexpectedValueException('Unknown package, has no name defined (' . json_encode($composerData) . ').'); |
|
52 | + throw new Exceptions\UnexpectedValueException('Unknown package, has no name defined ('.json_encode($composerData).').'); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 |