@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | /** |
101 | 101 | * Run the application based on the Sapi Name. |
102 | 102 | * |
103 | - * @return luya\web\Application|luya\cli\Application Application objected based on the sapi name. |
|
103 | + * @return null|integer Application objected based on the sapi name. |
|
104 | 104 | */ |
105 | 105 | public function run() |
106 | 106 | { |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | /** |
134 | 134 | * Run Web-Application based on the provided config file. |
135 | 135 | * |
136 | - * @return string|void Returns the Yii Application run() method if mock is disabled. Otherwise returns void |
|
136 | + * @return integer|null Returns the Yii Application run() method if mock is disabled. Otherwise returns void |
|
137 | 137 | */ |
138 | 138 | public function applicationWeb() |
139 | 139 | { |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function setConfigArray(array $config) |
93 | 93 | { |
94 | - $this->_configArray = $config; |
|
94 | + $this->_configArray = $config; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -103,24 +103,24 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function getConfigArray() |
105 | 105 | { |
106 | - if ($this->_configArray === null) { |
|
107 | - if (!file_exists($this->configFile)) { |
|
108 | - throw new Exception("Unable to load the config file '".$this->configFile."'."); |
|
109 | - } |
|
106 | + if ($this->_configArray === null) { |
|
107 | + if (!file_exists($this->configFile)) { |
|
108 | + throw new Exception("Unable to load the config file '".$this->configFile."'."); |
|
109 | + } |
|
110 | 110 | |
111 | - $config = require $this->configFile; |
|
111 | + $config = require $this->configFile; |
|
112 | 112 | |
113 | - if (!is_array($config)) { |
|
114 | - throw new Exception("config file '".$this->configFile."' found but no array returning."); |
|
115 | - } |
|
113 | + if (!is_array($config)) { |
|
114 | + throw new Exception("config file '".$this->configFile."' found but no array returning."); |
|
115 | + } |
|
116 | 116 | |
117 | - // adding default configuration timezone if not set |
|
118 | - if (!array_key_exists('timezone', $config)) { |
|
119 | - $config['timezone'] = 'Europe/Berlin'; |
|
120 | - } |
|
117 | + // adding default configuration timezone if not set |
|
118 | + if (!array_key_exists('timezone', $config)) { |
|
119 | + $config['timezone'] = 'Europe/Berlin'; |
|
120 | + } |
|
121 | 121 | |
122 | - $this->_configArray = $config; |
|
123 | - } |
|
122 | + $this->_configArray = $config; |
|
123 | + } |
|
124 | 124 | |
125 | 125 | return $this->_configArray; |
126 | 126 | } |
@@ -56,6 +56,11 @@ discard block |
||
56 | 56 | ]; |
57 | 57 | } |
58 | 58 | |
59 | + /** |
|
60 | + * @param string $type |
|
61 | + * @param string $varName |
|
62 | + * @param string $func |
|
63 | + */ |
|
59 | 64 | private function getExtraVarDef($type, $varName, $func) |
60 | 65 | { |
61 | 66 | $info = [ |
@@ -72,6 +77,9 @@ discard block |
||
72 | 77 | return false; |
73 | 78 | } |
74 | 79 | |
80 | + /** |
|
81 | + * @param string $type |
|
82 | + */ |
|
75 | 83 | private function getVariableTypeOption($type) |
76 | 84 | { |
77 | 85 | $types = $this->getVariableTypesOptions(); |
@@ -79,6 +87,9 @@ discard block |
||
79 | 87 | return $types[$type]; |
80 | 88 | } |
81 | 89 | |
90 | + /** |
|
91 | + * @param string $type |
|
92 | + */ |
|
82 | 93 | private function hasVariableTypeOption($type) |
83 | 94 | { |
84 | 95 | return array_key_exists($type, $this->getVariableTypesOptions()); |
@@ -292,6 +303,9 @@ discard block |
||
292 | 303 | return $this->outputError("Error while creating file '$file'"); |
293 | 304 | } |
294 | 305 | |
306 | + /** |
|
307 | + * @param string $prefix |
|
308 | + */ |
|
295 | 309 | private function placeholderCreator($prefix) |
296 | 310 | { |
297 | 311 | $this->output(PHP_EOL.'-> Create new '.$prefix, Console::FG_YELLOW); |
@@ -310,8 +324,8 @@ discard block |
||
310 | 324 | |
311 | 325 | /** |
312 | 326 | * |
313 | - * @param unknown $prefix |
|
314 | - * @param string $type 'var', 'cfg' |
|
327 | + * @param string $prefix |
|
328 | + * @param string $typeCast |
|
315 | 329 | * @return multitype:string Ambigous <string, array> |
316 | 330 | */ |
317 | 331 | private function varCreator($prefix, $typeCast) |
@@ -64,19 +64,19 @@ discard block |
||
64 | 64 | private function getExtraVarDef($type, $varName, $func) |
65 | 65 | { |
66 | 66 | $info = [ |
67 | - 'image-upload' => function ($varName) use ($func) { |
|
67 | + 'image-upload' => function($varName) use ($func) { |
|
68 | 68 | return '$this->zaaImageUpload($this->'.$func.'(\''.$varName.'\'), false, true),'; |
69 | 69 | }, |
70 | - 'image-array-upload' => function ($varName) use ($func) { |
|
70 | + 'image-array-upload' => function($varName) use ($func) { |
|
71 | 71 | return '$this->zaaImageArrayUpload($this->'.$func.'(\''.$varName.'\'), false, true),'; |
72 | 72 | }, |
73 | - 'file-upload' => function ($varName) use ($func) { |
|
73 | + 'file-upload' => function($varName) use ($func) { |
|
74 | 74 | return '$this->zaaFileUpload($this->'.$func.'(\''.$varName.'\'), true),'; |
75 | 75 | }, |
76 | - 'file-array-upload' => function ($varName) use ($func) { |
|
76 | + 'file-array-upload' => function($varName) use ($func) { |
|
77 | 77 | return '$this->zaaFileArrayUpload($this->'.$func.'(\''.$varName.'\'), true),'; |
78 | 78 | }, |
79 | - 'cms-page' => function ($varName) use ($func) { |
|
79 | + 'cms-page' => function($varName) use ($func) { |
|
80 | 80 | return 'Yii::$app->menu->findOne([\'nav_id\' => $this->'.$func.'(\''.$varName.'\', 0)]),'; |
81 | 81 | }, |
82 | 82 | ]; |
@@ -196,15 +196,15 @@ discard block |
||
196 | 196 | $content .= ' * @var bool Choose whether block is a layout/container/segmnet/section block or not, Container elements will be optically displayed'.PHP_EOL; |
197 | 197 | $content .= ' * in a different way for a better user experience. Container block will not display isDirty colorizing.'.PHP_EOL; |
198 | 198 | $content .= ' */'.PHP_EOL; |
199 | - $content .= ' public $isContainer = false;'.PHP_EOL . PHP_EOL; |
|
199 | + $content .= ' public $isContainer = false;'.PHP_EOL.PHP_EOL; |
|
200 | 200 | $content .= ' /**'.PHP_EOL; |
201 | 201 | $content .= ' * @var bool Choose whether a block can be cached trough the caching component. Be carefull with caching container blocks.'.PHP_EOL; |
202 | 202 | $content .= ' */'.PHP_EOL; |
203 | - $content .= ' public $cacheEnabled = false;'.PHP_EOL . PHP_EOL; |
|
203 | + $content .= ' public $cacheEnabled = false;'.PHP_EOL.PHP_EOL; |
|
204 | 204 | $content .= ' /**'.PHP_EOL; |
205 | 205 | $content .= ' * @var int The cache lifetime for this block in seconds (3600 = 1 hour), only affects when cacheEnabled is true'.PHP_EOL; |
206 | 206 | $content .= ' */'.PHP_EOL; |
207 | - $content .= ' public $cacheExpiration = 3600;'.PHP_EOL . PHP_EOL; |
|
207 | + $content .= ' public $cacheExpiration = 3600;'.PHP_EOL.PHP_EOL; |
|
208 | 208 | |
209 | 209 | // method name |
210 | 210 | $content .= ' public function name()'.PHP_EOL; |
@@ -42,6 +42,11 @@ |
||
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | + /** |
|
46 | + * @param string|boolean $module |
|
47 | + * |
|
48 | + * @return string |
|
49 | + */ |
|
45 | 50 | private function getModuleMigrationDirectorie($module) |
46 | 51 | { |
47 | 52 | if (!array_key_exists($module, $this->moduleMigrationDirectories)) { |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | protected function createMigration($class) |
55 | 55 | { |
56 | - $orig = $this->migrationPath . DIRECTORY_SEPARATOR . $class . '.php'; |
|
56 | + $orig = $this->migrationPath.DIRECTORY_SEPARATOR.$class.'.php'; |
|
57 | 57 | |
58 | 58 | if (file_exists($orig)) { |
59 | 59 | require_once $file; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | $module = $this->prompt("Could not find migration class. Please enter the module name who belongs to '$class.':"); |
73 | 73 | $dir = $this->getModuleMigrationDirectorie($module); |
74 | - $file = $dir . DIRECTORY_SEPARATOR . $class . '.php'; |
|
74 | + $file = $dir.DIRECTORY_SEPARATOR.$class.'.php'; |
|
75 | 75 | if (file_exists($file)) { |
76 | 76 | require_once $file; |
77 | 77 | return new $class(); |
@@ -37,7 +37,7 @@ |
||
37 | 37 | * |
38 | 38 | * @param string $route |
39 | 39 | * @param array $params |
40 | - * @param boolean $sheme Whether to return static url or not |
|
40 | + * @param boolean $scheme Whether to return static url or not |
|
41 | 41 | * @todo we have to remove this method as it provides no additinal functions to the yii\helpers\url to method |
42 | 42 | */ |
43 | 43 | public static function toManager($route, array $params = [], $scheme = false) |
@@ -104,7 +104,7 @@ |
||
104 | 104 | public static function ensureHttp($url, $https = false) |
105 | 105 | { |
106 | 106 | if (!preg_match("~^(?:f|ht)tps?://~i", $url)) { |
107 | - $url = ($https ? "https://" : "http://") . $url; |
|
107 | + $url = ($https ? "https://" : "http://").$url; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | return $url; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | if ($route === $composition) { |
49 | 49 | $parsedRequest[0] = false; |
50 | 50 | // now see if the composition (+1 as we add add trailing slash at the end) matches the cutted route request part, if so its composition prefix, remove it. |
51 | - } elseif (substr($route, 0, $length+1) == $composition.'/') { |
|
51 | + } elseif (substr($route, 0, $length + 1) == $composition.'/') { |
|
52 | 52 | $parsedRequest[0] = substr($parsedRequest[0], $length); |
53 | 53 | } |
54 | 54 | // fix broken request urls |
@@ -211,10 +211,10 @@ discard block |
||
211 | 211 | $params = (array) $params; |
212 | 212 | $url = $this->internalCreateUrl($params); |
213 | 213 | if (strpos($url, '://') === false) { |
214 | - $url = $this->getHostInfo() . $url; |
|
214 | + $url = $this->getHostInfo().$url; |
|
215 | 215 | } |
216 | 216 | if (is_string($scheme) && ($pos = strpos($url, '://')) !== false) { |
217 | - $url = $scheme . substr($url, $pos); |
|
217 | + $url = $scheme.substr($url, $pos); |
|
218 | 218 | } |
219 | 219 | return $url; |
220 | 220 | } |
@@ -37,6 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * {@inheritDoc} |
39 | 39 | * @see \yii\web\UrlManager::parseRequest() |
40 | + * @param Request $request |
|
40 | 41 | */ |
41 | 42 | public function parseRequest($request) |
42 | 43 | { |
@@ -141,7 +142,7 @@ discard block |
||
141 | 142 | * Remove the base url from a route |
142 | 143 | * |
143 | 144 | * @param string $route The route where the baseUrl should be removed from. |
144 | - * @return mixed |
|
145 | + * @return string |
|
145 | 146 | */ |
146 | 147 | public function removeBaseUrl($route) |
147 | 148 | { |
@@ -189,7 +190,7 @@ discard block |
||
189 | 190 | * Yii2 createUrl base implementation extends the prepand of the comosition |
190 | 191 | * |
191 | 192 | * @param string|array $params An array with params or not (e.g. `['module/controller/action', 'param1' => 'value1']`) |
192 | - * @param null|object $composition Composition instance to change the route behavior |
|
193 | + * @param Composition $composition Composition instance to change the route behavior |
|
193 | 194 | * @return string |
194 | 195 | */ |
195 | 196 | public function internalCreateUrl($params, $composition = null) |
@@ -241,7 +242,7 @@ discard block |
||
241 | 242 | * |
242 | 243 | * The module to test must be an instance of `luya\base\Module`. |
243 | 244 | * |
244 | - * @param unknown $route |
|
245 | + * @param string $route |
|
245 | 246 | * @return boolean|string |
246 | 247 | */ |
247 | 248 | private function findModuleInRoute($route) |
@@ -255,6 +256,9 @@ discard block |
||
255 | 256 | return false; |
256 | 257 | } |
257 | 258 | |
259 | + /** |
|
260 | + * @param string $url |
|
261 | + */ |
|
258 | 262 | private function urlReplaceModule($url, $navItemId, Composition $composition) |
259 | 263 | { |
260 | 264 | $route = $composition->removeFrom($this->removeBaseUrl($url)); |
@@ -30,38 +30,38 @@ discard block |
||
30 | 30 | public function getFunctions() |
31 | 31 | { |
32 | 32 | return [ |
33 | - 'menuFindAll' => function ($container, $parentNavId) { |
|
33 | + 'menuFindAll' => function($container, $parentNavId) { |
|
34 | 34 | return Yii::$app->menu->findAll(['container' => $container, 'parent_nav_id' => $parentNavId]); |
35 | 35 | }, |
36 | - 'menuFindOne' => function ($id) { |
|
36 | + 'menuFindOne' => function($id) { |
|
37 | 37 | return Yii::$app->menu->findOne(['id' => $id]); |
38 | 38 | }, |
39 | - 'menuCurrent' => function () { |
|
39 | + 'menuCurrent' => function() { |
|
40 | 40 | return Yii::$app->menu->current; |
41 | 41 | }, |
42 | - 'menuCurrentLevel' => function ($level) { |
|
42 | + 'menuCurrentLevel' => function($level) { |
|
43 | 43 | return Yii::$app->menu->getLevelCurrent($level); |
44 | 44 | }, |
45 | - 'menuLevelContainer' => function ($level) { |
|
45 | + 'menuLevelContainer' => function($level) { |
|
46 | 46 | return Yii::$app->menu->getLevelContainer($level); |
47 | 47 | }, |
48 | - 'asset' => function ($name) { |
|
48 | + 'asset' => function($name) { |
|
49 | 49 | return Yii::$app->getAssetManager()->getBundle($name); |
50 | 50 | }, |
51 | - 'filterApply' => function ($imageId, $filterIdentifier) { |
|
51 | + 'filterApply' => function($imageId, $filterIdentifier) { |
|
52 | 52 | return Yii::$app->storage->getImage($imageId)->applyFilter($filterIdentifier); |
53 | 53 | }, |
54 | - 'image' => function ($imageId) { |
|
54 | + 'image' => function($imageId) { |
|
55 | 55 | return Yii::$app->storage->getImage($imageId); |
56 | 56 | }, |
57 | - 'element' => function () { |
|
57 | + 'element' => function() { |
|
58 | 58 | $args = func_get_args(); |
59 | 59 | $method = $args[0]; |
60 | 60 | unset($args[0]); |
61 | 61 | |
62 | 62 | return Yii::$app->element->run($method, $args); |
63 | 63 | }, |
64 | - 't' => function () { |
|
64 | + 't' => function() { |
|
65 | 65 | $args = func_get_args(); |
66 | 66 | |
67 | 67 | return call_user_func_array(['Yii', 't'], $args); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $twig->addFunction(new Twig_SimpleFunction($name, $lambda)); |
80 | 80 | } |
81 | 81 | |
82 | - $twig->addFilter(new Twig_SimpleFilter('strftime', function ($timestamp, $format) { |
|
82 | + $twig->addFilter(new Twig_SimpleFilter('strftime', function($timestamp, $format) { |
|
83 | 83 | if (is_numeric($timestamp)) { |
84 | 84 | return strftime($format, $timestamp); |
85 | 85 | } |
@@ -36,7 +36,7 @@ |
||
36 | 36 | |
37 | 37 | @chdir(Yii::getAlias('@app')); |
38 | 38 | |
39 | - $this->output('The directory the health commands is applying to: ' . Yii::getAlias('@app')); |
|
39 | + $this->output('The directory the health commands is applying to: '.Yii::getAlias('@app')); |
|
40 | 40 | |
41 | 41 | foreach ($this->folders as $folder => $writable) { |
42 | 42 | if (!file_exists($folder)) { |
@@ -31,13 +31,13 @@ |
||
31 | 31 | |
32 | 32 | $module = Yii::$app->getModule($moduleId); |
33 | 33 | |
34 | - $folder = $module->basePath . DIRECTORY_SEPARATOR . 'aws'; |
|
34 | + $folder = $module->basePath.DIRECTORY_SEPARATOR.'aws'; |
|
35 | 35 | |
36 | - $file = $folder . DIRECTORY_SEPARATOR . $className . '.php'; |
|
36 | + $file = $folder.DIRECTORY_SEPARATOR.$className.'.php'; |
|
37 | 37 | |
38 | 38 | $content = $this->view->render('@luya/console/commands/views/aw/create.php', [ |
39 | 39 | 'className' => $className, |
40 | - 'namespace' => $module->getNamespace() . '\\aws', |
|
40 | + 'namespace' => $module->getNamespace().'\\aws', |
|
41 | 41 | 'luya' => $this->getLuyaVersion(), |
42 | 42 | 'moduleId' => $moduleId, |
43 | 43 | 'alias' => Inflector::humanize(Inflector::camel2words($className)), |
@@ -168,7 +168,7 @@ |
||
168 | 168 | return true; |
169 | 169 | } else { |
170 | 170 | $data = [$this->host, $this->port, $this->smtpSecure, $this->username]; |
171 | - throw new Exception('Authentication failed ('.implode(',', $data).'): '.$smtp->getLastReply() . PHP_EOL . print_r($smtp->getError(), true)); |
|
171 | + throw new Exception('Authentication failed ('.implode(',', $data).'): '.$smtp->getLastReply().PHP_EOL.print_r($smtp->getError(), true)); |
|
172 | 172 | } |
173 | 173 | } else { |
174 | 174 | throw new Exception('HELO failed: '.$smtp->getLastReply()); |