@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | 'rev-manifest.json', |
30 | 30 | ], |
31 | 31 | // Error handling |
32 | - 'missingAsset' => 'notice', // exception, notice, or ignore |
|
32 | + 'missingAsset' => 'notice', // exception, notice, or ignore |
|
33 | 33 | 'missingManifest' => 'notice', // exception, notice, or ignore |
34 | - 'missingRevision' => 'ignore', // exception, notice, or ignore |
|
34 | + 'missingRevision' => 'ignore', // exception, notice, or ignore |
|
35 | 35 | ]; |
36 | 36 | |
37 | 37 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | private function validateChoices($key, array $choices) |
67 | 67 | { |
68 | - if ( ! in_array($this->config[$key], $choices)) { |
|
68 | + if (!in_array($this->config[$key], $choices)) { |
|
69 | 69 | throw new UnexpectedValueException(sprintf( |
70 | 70 | "Unexpected value '%s' of '%s' configuration key. Allowed values: %s.", |
71 | 71 | $this->config[$key], |
@@ -61,7 +61,7 @@ |
||
61 | 61 | |
62 | 62 | /** |
63 | 63 | * @param string $key |
64 | - * @param array $choices |
|
64 | + * @param string[] $choices |
|
65 | 65 | */ |
66 | 66 | private function validateChoices($key, array $choices) |
67 | 67 | { |
@@ -69,14 +69,13 @@ discard block |
||
69 | 69 | $revision = $manifest === NULL ? NULL : self::resolveRevision($manifest, $path, $need, $config); |
70 | 70 | |
71 | 71 | // Is revision only version (query parameter) or full path to asset? |
72 | - $revisionIsVersion = $revision === NULL || ! Strings::match($revision, '/[.\/]/'); |
|
72 | + $revisionIsVersion = $revision === NULL || !Strings::match($revision, '/[.\/]/'); |
|
73 | 73 | |
74 | 74 | // Check if asset exists |
75 | 75 | $ds = DIRECTORY_SEPARATOR; |
76 | 76 | $filePath = $revisionIsVersion ? |
77 | - ($wwwDir . $ds . $path) : |
|
78 | - ($wwwDir . $ds . Utils::normalizePath($revision)); |
|
79 | - if ( ! file_exists($filePath)) { |
|
77 | + ($wwwDir . $ds . $path) : ($wwwDir . $ds . Utils::normalizePath($revision)); |
|
78 | + if (!file_exists($filePath)) { |
|
80 | 79 | Utils::throwError( |
81 | 80 | new AssetNotFoundException(sprintf("Asset '%s' not found.", $filePath)), |
82 | 81 | $config['missingAsset'], |
@@ -105,7 +104,7 @@ discard block |
||
105 | 104 | |
106 | 105 | return Strings::replace($format, |
107 | 106 | '/%([^%]+)%/', |
108 | - function ($matches) use ($basePath, $format, $path, $revision, $revisionIsVersion) { |
|
107 | + function($matches) use ($basePath, $format, $path, $revision, $revisionIsVersion) { |
|
109 | 108 | switch ($matches[1]) { |
110 | 109 | case 'raw': |
111 | 110 | return $revision; |
@@ -115,8 +114,7 @@ discard block |
||
115 | 114 | return $path; |
116 | 115 | case 'url': |
117 | 116 | return $revisionIsVersion ? |
118 | - sprintf("%s/%s?v=%s", $basePath, $path, $revision) : |
|
119 | - sprintf("%s/%s", $basePath, $path); |
|
117 | + sprintf("%s/%s?v=%s", $basePath, $path, $revision) : sprintf("%s/%s", $basePath, $path); |
|
120 | 118 | default: |
121 | 119 | $msg = sprintf( |
122 | 120 | "Asset macro: Invalid variable '%s' in format '%s'. " . |
@@ -168,7 +166,7 @@ discard block |
||
168 | 166 | |
169 | 167 | // Path to JSON manifest |
170 | 168 | if (is_string($manifest)) { |
171 | - if ( ! file_exists($manifest)) { |
|
169 | + if (!file_exists($manifest)) { |
|
172 | 170 | Utils::throwError( |
173 | 171 | new ManifestNotFoundException(sprintf("Manifest file not found: '%s'.", $manifest)), |
174 | 172 | $config['missingManifest'], |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | class TemplateRouter extends Routers\RouteList |
12 | 12 | { |
13 | - /** @var ILatteFactory */ |
|
14 | - private $latteFactory; |
|
13 | + /** @var ILatteFactory */ |
|
14 | + private $latteFactory; |
|
15 | 15 | |
16 | 16 | public function __construct($path, $cachePath, ILatteFactory $latteFactory) |
17 | 17 | { |
18 | - parent::__construct(); |
|
19 | - $this->latteFactory = $latteFactory; |
|
18 | + parent::__construct(); |
|
19 | + $this->latteFactory = $latteFactory; |
|
20 | 20 | |
21 | 21 | if (is_file($cacheFile = $cachePath . '/routes.php')) { |
22 | 22 | $routes = require $cacheFile; |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | { |
38 | 38 | $routes = []; |
39 | 39 | |
40 | - $latte = $this->createLatte(); |
|
41 | - $macroSet = new Latte\Macros\MacroSet($latte->getCompiler()); |
|
40 | + $latte = $this->createLatte(); |
|
41 | + $macroSet = new Latte\Macros\MacroSet($latte->getCompiler()); |
|
42 | 42 | $macroSet->addMacro('url', function ($node) use (&$routes, &$file) { |
43 | 43 | $routes[$node->args] = (string) $file; |
44 | 44 | }, null, null, $macroSet::ALLOWED_IN_HEAD); |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | public function createLatte() { |
54 | - $latte = $this->latteFactory->create(); |
|
55 | - $macroSet = new Latte\Macros\MacroSet($latte->getCompiler()); |
|
56 | - $macroSet->addMacro('url', function () {}, null, null, $macroSet::ALLOWED_IN_HEAD); // ignore |
|
57 | - return $latte; |
|
58 | - } |
|
54 | + $latte = $this->latteFactory->create(); |
|
55 | + $macroSet = new Latte\Macros\MacroSet($latte->getCompiler()); |
|
56 | + $macroSet->addMacro('url', function () {}, null, null, $macroSet::ALLOWED_IN_HEAD); // ignore |
|
57 | + return $latte; |
|
58 | + } |
|
59 | 59 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | use Nette\Application\Routers; |
5 | 5 | use \Nette\Bridges\ApplicationLatte\ILatteFactory; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | } |
27 | 27 | |
28 | 28 | foreach ($routes as $mask => $file) { |
29 | - $this[] = new Routers\Route($mask, function ($presenter) use ($file, $cachePath, $latteFactory) { |
|
29 | + $this[] = new Routers\Route($mask, function($presenter) use ($file, $cachePath, $latteFactory) { |
|
30 | 30 | return $presenter->createTemplate(null, [$this, 'createLatte'])->setFile($file); |
31 | 31 | }); |
32 | 32 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | $latte = $this->createLatte(); |
41 | 41 | $macroSet = new Latte\Macros\MacroSet($latte->getCompiler()); |
42 | - $macroSet->addMacro('url', function ($node) use (&$routes, &$file) { |
|
42 | + $macroSet->addMacro('url', function($node) use (&$routes, &$file) { |
|
43 | 43 | $routes[$node->args] = (string) $file; |
44 | 44 | }, null, null, $macroSet::ALLOWED_IN_HEAD); |
45 | 45 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | public function createLatte() { |
54 | 54 | $latte = $this->latteFactory->create(); |
55 | 55 | $macroSet = new Latte\Macros\MacroSet($latte->getCompiler()); |
56 | - $macroSet->addMacro('url', function () {}, null, null, $macroSet::ALLOWED_IN_HEAD); // ignore |
|
56 | + $macroSet->addMacro('url', function() {}, null, null, $macroSet::ALLOWED_IN_HEAD); // ignore |
|
57 | 57 | return $latte; |
58 | 58 | } |
59 | 59 | } |
@@ -23,8 +23,8 @@ |
||
23 | 23 | /** @var ILatteFactory $latteFactory */ |
24 | 24 | $latteFactory = $container->getService('latte.latteFactory'); |
25 | 25 | $container->addService( |
26 | - 'router', |
|
27 | - new TemplateRouter('data/templates', __DIR__ . '/data/temp', $latteFactory) |
|
26 | + 'router', |
|
27 | + new TemplateRouter('data/templates', __DIR__ . '/data/temp', $latteFactory) |
|
28 | 28 | ); |
29 | 29 | |
30 | 30 | // Run the application! |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | class TemplateRouter extends Routers\RouteList |
12 | 12 | { |
13 | - /** @var ILatteFactory */ |
|
14 | - private $latteFactory; |
|
13 | + /** @var ILatteFactory */ |
|
14 | + private $latteFactory; |
|
15 | 15 | |
16 | 16 | public function __construct($path, $cachePath, ILatteFactory $latteFactory) |
17 | 17 | { |
18 | - parent::__construct(); |
|
19 | - $this->latteFactory = $latteFactory; |
|
18 | + parent::__construct(); |
|
19 | + $this->latteFactory = $latteFactory; |
|
20 | 20 | |
21 | 21 | if (is_file($cacheFile = $cachePath . '/routes.php')) { |
22 | 22 | $routes = require $cacheFile; |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | { |
38 | 38 | $routes = []; |
39 | 39 | |
40 | - $latte = $this->createLatte(); |
|
41 | - $macroSet = new Latte\Macros\MacroSet($latte->getCompiler()); |
|
40 | + $latte = $this->createLatte(); |
|
41 | + $macroSet = new Latte\Macros\MacroSet($latte->getCompiler()); |
|
42 | 42 | $macroSet->addMacro('url', function ($node) use (&$routes, &$file) { |
43 | 43 | $routes[$node->args] = (string) $file; |
44 | 44 | }, null, null, $macroSet::ALLOWED_IN_HEAD); |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | public function createLatte() { |
54 | - $latte = $this->latteFactory->create(); |
|
55 | - $macroSet = new Latte\Macros\MacroSet($latte->getCompiler()); |
|
56 | - $macroSet->addMacro('url', function () {}, null, null, $macroSet::ALLOWED_IN_HEAD); // ignore |
|
57 | - return $latte; |
|
58 | - } |
|
54 | + $latte = $this->latteFactory->create(); |
|
55 | + $macroSet = new Latte\Macros\MacroSet($latte->getCompiler()); |
|
56 | + $macroSet->addMacro('url', function () {}, null, null, $macroSet::ALLOWED_IN_HEAD); // ignore |
|
57 | + return $latte; |
|
58 | + } |
|
59 | 59 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | use Nette\Application\Routers; |
5 | 5 | use \Nette\Bridges\ApplicationLatte\ILatteFactory; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | } |
27 | 27 | |
28 | 28 | foreach ($routes as $mask => $file) { |
29 | - $this[] = new Routers\Route($mask, function ($presenter) use ($file, $cachePath, $latteFactory) { |
|
29 | + $this[] = new Routers\Route($mask, function($presenter) use ($file, $cachePath, $latteFactory) { |
|
30 | 30 | return $presenter->createTemplate(null, [$this, 'createLatte'])->setFile($file); |
31 | 31 | }); |
32 | 32 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | $latte = $this->createLatte(); |
41 | 41 | $macroSet = new Latte\Macros\MacroSet($latte->getCompiler()); |
42 | - $macroSet->addMacro('url', function ($node) use (&$routes, &$file) { |
|
42 | + $macroSet->addMacro('url', function($node) use (&$routes, &$file) { |
|
43 | 43 | $routes[$node->args] = (string) $file; |
44 | 44 | }, null, null, $macroSet::ALLOWED_IN_HEAD); |
45 | 45 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | public function createLatte() { |
54 | 54 | $latte = $this->latteFactory->create(); |
55 | 55 | $macroSet = new Latte\Macros\MacroSet($latte->getCompiler()); |
56 | - $macroSet->addMacro('url', function () {}, null, null, $macroSet::ALLOWED_IN_HEAD); // ignore |
|
56 | + $macroSet->addMacro('url', function() {}, null, null, $macroSet::ALLOWED_IN_HEAD); // ignore |
|
57 | 57 | return $latte; |
58 | 58 | } |
59 | 59 | } |
@@ -23,8 +23,8 @@ |
||
23 | 23 | /** @var ILatteFactory $latteFactory */ |
24 | 24 | $latteFactory = $container->getService('latte.latteFactory'); |
25 | 25 | $container->addService( |
26 | - 'router', |
|
27 | - new TemplateRouter('data/templates', __DIR__ . '/data/temp', $latteFactory) |
|
26 | + 'router', |
|
27 | + new TemplateRouter('data/templates', __DIR__ . '/data/temp', $latteFactory) |
|
28 | 28 | ); |
29 | 29 | |
30 | 30 | // Run the application! |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | class TemplateRouter extends Routers\RouteList |
12 | 12 | { |
13 | - /** @var ILatteFactory */ |
|
14 | - private $latteFactory; |
|
13 | + /** @var ILatteFactory */ |
|
14 | + private $latteFactory; |
|
15 | 15 | |
16 | 16 | public function __construct($path, $cachePath, ILatteFactory $latteFactory) |
17 | 17 | { |
18 | - parent::__construct(); |
|
19 | - $this->latteFactory = $latteFactory; |
|
18 | + parent::__construct(); |
|
19 | + $this->latteFactory = $latteFactory; |
|
20 | 20 | |
21 | 21 | if (is_file($cacheFile = $cachePath . '/routes.php')) { |
22 | 22 | $routes = require $cacheFile; |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | { |
38 | 38 | $routes = []; |
39 | 39 | |
40 | - $latte = $this->createLatte(); |
|
41 | - $macroSet = new Latte\Macros\MacroSet($latte->getCompiler()); |
|
40 | + $latte = $this->createLatte(); |
|
41 | + $macroSet = new Latte\Macros\MacroSet($latte->getCompiler()); |
|
42 | 42 | $macroSet->addMacro('url', function ($node) use (&$routes, &$file) { |
43 | 43 | $routes[$node->args] = (string) $file; |
44 | 44 | }, null, null, $macroSet::ALLOWED_IN_HEAD); |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | public function createLatte() { |
54 | - $latte = $this->latteFactory->create(); |
|
55 | - $macroSet = new Latte\Macros\MacroSet($latte->getCompiler()); |
|
56 | - $macroSet->addMacro('url', function () {}, null, null, $macroSet::ALLOWED_IN_HEAD); // ignore |
|
57 | - return $latte; |
|
58 | - } |
|
54 | + $latte = $this->latteFactory->create(); |
|
55 | + $macroSet = new Latte\Macros\MacroSet($latte->getCompiler()); |
|
56 | + $macroSet->addMacro('url', function () {}, null, null, $macroSet::ALLOWED_IN_HEAD); // ignore |
|
57 | + return $latte; |
|
58 | + } |
|
59 | 59 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | use Nette\Application\Routers; |
5 | 5 | use \Nette\Bridges\ApplicationLatte\ILatteFactory; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | } |
27 | 27 | |
28 | 28 | foreach ($routes as $mask => $file) { |
29 | - $this[] = new Routers\Route($mask, function ($presenter) use ($file, $cachePath, $latteFactory) { |
|
29 | + $this[] = new Routers\Route($mask, function($presenter) use ($file, $cachePath, $latteFactory) { |
|
30 | 30 | return $presenter->createTemplate(null, [$this, 'createLatte'])->setFile($file); |
31 | 31 | }); |
32 | 32 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | $latte = $this->createLatte(); |
41 | 41 | $macroSet = new Latte\Macros\MacroSet($latte->getCompiler()); |
42 | - $macroSet->addMacro('url', function ($node) use (&$routes, &$file) { |
|
42 | + $macroSet->addMacro('url', function($node) use (&$routes, &$file) { |
|
43 | 43 | $routes[$node->args] = (string) $file; |
44 | 44 | }, null, null, $macroSet::ALLOWED_IN_HEAD); |
45 | 45 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | public function createLatte() { |
54 | 54 | $latte = $this->latteFactory->create(); |
55 | 55 | $macroSet = new Latte\Macros\MacroSet($latte->getCompiler()); |
56 | - $macroSet->addMacro('url', function () {}, null, null, $macroSet::ALLOWED_IN_HEAD); // ignore |
|
56 | + $macroSet->addMacro('url', function() {}, null, null, $macroSet::ALLOWED_IN_HEAD); // ignore |
|
57 | 57 | return $latte; |
58 | 58 | } |
59 | 59 | } |
@@ -23,8 +23,8 @@ |
||
23 | 23 | /** @var ILatteFactory $latteFactory */ |
24 | 24 | $latteFactory = $container->getService('latte.latteFactory'); |
25 | 25 | $container->addService( |
26 | - 'router', |
|
27 | - new TemplateRouter('data/templates', __DIR__ . '/data/temp', $latteFactory) |
|
26 | + 'router', |
|
27 | + new TemplateRouter('data/templates', __DIR__ . '/data/temp', $latteFactory) |
|
28 | 28 | ); |
29 | 29 | |
30 | 30 | // Run the application! |