@@ -16,8 +16,6 @@ |
||
16 | 16 | |
17 | 17 | use Nette; |
18 | 18 | use Nette\DI; |
19 | -use Nette\PhpGenerator as Code; |
|
20 | - |
|
21 | 19 | use IPub\ConfirmationDialog; |
22 | 20 | |
23 | 21 | class ConfirmationDialogExtension extends DI\CompilerExtension |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public static function register(Nette\Configurator $config, $extensionName = 'confirmationDialog') |
81 | 81 | { |
82 | - $config->onCompile[] = function (Nette\Configurator $config, Nette\DI\Compiler $compiler) use ($extensionName) { |
|
82 | + $config->onCompile[] = function(Nette\Configurator $config, Nette\DI\Compiler $compiler) use ($extensionName) { |
|
83 | 83 | $compiler->addExtension($extensionName, new ConfirmationDialogExtension()); |
84 | 84 | }; |
85 | 85 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | function getTranslationResources() |
93 | 93 | { |
94 | 94 | return [ |
95 | - __DIR__ . '/../Translations' |
|
95 | + __DIR__.'/../Translations' |
|
96 | 96 | ]; |
97 | 97 | } |
98 | 98 | } |
@@ -16,9 +16,7 @@ |
||
16 | 16 | |
17 | 17 | use Nette; |
18 | 18 | use Nette\Application; |
19 | -use Nette\Localization; |
|
20 | 19 | use Nette\Utils; |
21 | - |
|
22 | 20 | use IPub; |
23 | 21 | use IPub\ConfirmationDialog\Exceptions; |
24 | 22 |
@@ -231,7 +231,7 @@ |
||
231 | 231 | */ |
232 | 232 | protected function generateToken() : string |
233 | 233 | { |
234 | - return base_convert(md5(uniqid('confirm' . $this->getName(), TRUE)), 16, 36); |
|
234 | + return base_convert(md5(uniqid('confirm'.$this->getName(), TRUE)), 16, 36); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -82,11 +82,11 @@ |
||
82 | 82 | $dir = dirname($this->getReflection()->getFileName()); |
83 | 83 | |
84 | 84 | // ...check if extension template is used |
85 | - if (is_file($dir . DIRECTORY_SEPARATOR . 'template' . DIRECTORY_SEPARATOR . $templateFile)) { |
|
86 | - $templateFile = $dir . DIRECTORY_SEPARATOR . 'template' . DIRECTORY_SEPARATOR . $templateFile; |
|
85 | + if (is_file($dir.DIRECTORY_SEPARATOR.'template'.DIRECTORY_SEPARATOR.$templateFile)) { |
|
86 | + $templateFile = $dir.DIRECTORY_SEPARATOR.'template'.DIRECTORY_SEPARATOR.$templateFile; |
|
87 | 87 | |
88 | - } elseif (is_file($dir . DIRECTORY_SEPARATOR . 'template' . DIRECTORY_SEPARATOR . $templateFile . '.latte')) { |
|
89 | - $templateFile = $dir . DIRECTORY_SEPARATOR . 'template' . DIRECTORY_SEPARATOR . $templateFile . '.latte'; |
|
88 | + } elseif (is_file($dir.DIRECTORY_SEPARATOR.'template'.DIRECTORY_SEPARATOR.$templateFile.'.latte')) { |
|
89 | + $templateFile = $dir.DIRECTORY_SEPARATOR.'template'.DIRECTORY_SEPARATOR.$templateFile.'.latte'; |
|
90 | 90 | |
91 | 91 | } else { |
92 | 92 | // ...if not throw exception |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | string $layoutFile = NULL, |
70 | 70 | string $templateFile = NULL |
71 | 71 | ) { |
72 | - list(, , $parent, $name) = func_get_args() + [NULL, NULL, NULL, NULL]; |
|
72 | + list(,, $parent, $name) = func_get_args() + [NULL, NULL, NULL, NULL]; |
|
73 | 73 | |
74 | 74 | parent::__construct($parent, $name); |
75 | 75 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | public function getTemplateFile() : string |
113 | 113 | { |
114 | 114 | // ...try to get default component layout file |
115 | - return $this->templateFile !== NULL ? $this->templateFile : __DIR__ . DIRECTORY_SEPARATOR . 'template' . DIRECTORY_SEPARATOR . 'default.latte'; |
|
115 | + return $this->templateFile !== NULL ? $this->templateFile : __DIR__.DIRECTORY_SEPARATOR.'template'.DIRECTORY_SEPARATOR.'default.latte'; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | } |
153 | 153 | |
154 | 154 | // Check confirmer |
155 | - if ((!$confirmer = $this->getComponent('confirmer-' . $name)) || !$confirmer instanceof Confirmer || $confirmer->isConfigured()) { |
|
155 | + if ((!$confirmer = $this->getComponent('confirmer-'.$name)) || !$confirmer instanceof Confirmer || $confirmer->isConfigured()) { |
|
156 | 156 | throw new Exceptions\InvalidArgumentException("Confirmation control '$name' could not be created."); |
157 | 157 | } |
158 | 158 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public function getConfirmer(string $name) : Confirmer |
175 | 175 | { |
176 | - if ((!$confirmer = $this->getComponent('confirmer-' . $name)) || !$confirmer instanceof Confirmer || !$confirmer->isConfigured()) { |
|
176 | + if ((!$confirmer = $this->getComponent('confirmer-'.$name)) || !$confirmer instanceof Confirmer || !$confirmer->isConfigured()) { |
|
177 | 177 | throw new Exceptions\InvalidArgumentException("Confirmation control '$name' does not exists."); |
178 | 178 | } |
179 | 179 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | protected function createComponentConfirmer() : Application\UI\Multiplier |
200 | 200 | { |
201 | - return new Application\UI\Multiplier((function () { |
|
201 | + return new Application\UI\Multiplier((function() { |
|
202 | 202 | // Check if confirmer factory is available |
203 | 203 | if (!$this->confirmerFactory) { |
204 | 204 | throw new Exceptions\InvalidStateException("Confirmation control factory does not exist."); |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | throw new Exceptions\InvalidArgumentException('$name must be string.'); |
235 | 235 | } |
236 | 236 | |
237 | - if ((!$this->confirmer = $this['confirmer-' . $name]) || !$this->confirmer->isConfigured()) { |
|
237 | + if ((!$this->confirmer = $this['confirmer-'.$name]) || !$this->confirmer->isConfigured()) { |
|
238 | 238 | throw new Exceptions\InvalidStateException("Confirmer '$name' do not exist."); |
239 | 239 | } |
240 | 240 | |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | $name = Utils\Strings::substring($signal, 7); |
262 | 262 | $name{0} = strtolower($name{0}); |
263 | 263 | |
264 | - if (!$this['confirmer-' . $name]->isConfigured()) { |
|
264 | + if (!$this['confirmer-'.$name]->isConfigured()) { |
|
265 | 265 | throw new Exceptions\InvalidArgumentException('Invalid confirmation control.'); |
266 | 266 | } |
267 | 267 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | // If template was not defined before... |
307 | 307 | if ($template->getFile() === NULL) { |
308 | 308 | // ...try to get base component template file |
309 | - $layoutFile = $this->layoutFile !== NULL ? $this->layoutFile : __DIR__ . DIRECTORY_SEPARATOR . 'template' . DIRECTORY_SEPARATOR . 'layout.latte'; |
|
309 | + $layoutFile = $this->layoutFile !== NULL ? $this->layoutFile : __DIR__.DIRECTORY_SEPARATOR.'template'.DIRECTORY_SEPARATOR.'layout.latte'; |
|
310 | 310 | $template->setFile($layoutFile); |
311 | 311 | } |
312 | 312 |