@@ -26,12 +26,12 @@ |
||
| 26 | 26 | public static function read($sConfigFile) |
| 27 | 27 | { |
| 28 | 28 | $sConfigFile = realpath($sConfigFile); |
| 29 | - if(!is_readable($sConfigFile)) |
|
| 29 | + if (!is_readable($sConfigFile)) |
|
| 30 | 30 | { |
| 31 | 31 | throw new \Jaxon\Config\Exception\File(jaxon_trans('config.errors.file.access', array('path' => $sConfigFile))); |
| 32 | 32 | } |
| 33 | 33 | $aConfigOptions = include($sConfigFile); |
| 34 | - if(!is_array($aConfigOptions)) |
|
| 34 | + if (!is_array($aConfigOptions)) |
|
| 35 | 35 | { |
| 36 | 36 | throw new \Jaxon\Config\Exception\File(jaxon_trans('config.errors.file.content', array('path' => $sConfigFile))); |
| 37 | 37 | } |
@@ -45,14 +45,14 @@ discard block |
||
| 45 | 45 | $sPrefix = trim((string)$sPrefix); |
| 46 | 46 | $nDepth = intval($nDepth); |
| 47 | 47 | // Check the max depth |
| 48 | - if($nDepth < 0 || $nDepth > 9) |
|
| 48 | + if ($nDepth < 0 || $nDepth > 9) |
|
| 49 | 49 | { |
| 50 | 50 | throw new \Jaxon\Config\Exception\Data(jaxon_trans('config.errors.data.depth', |
| 51 | 51 | array('key' => $sPrefix, 'depth' => $nDepth))); |
| 52 | 52 | } |
| 53 | - foreach($aOptions as $sName => $xOption) |
|
| 53 | + foreach ($aOptions as $sName => $xOption) |
|
| 54 | 54 | { |
| 55 | - if(is_int($sName)) |
|
| 55 | + if (is_int($sName)) |
|
| 56 | 56 | { |
| 57 | 57 | continue; |
| 58 | 58 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | // Save the value of this option |
| 63 | 63 | $this->aOptions[$sFullName] = $xOption; |
| 64 | 64 | // Save the values of its sub-options |
| 65 | - if(is_array($xOption)) |
|
| 65 | + if (is_array($xOption)) |
|
| 66 | 66 | { |
| 67 | 67 | // Recursively read the options in the array |
| 68 | 68 | $this->_setOptions($xOption, $sFullName, $nDepth + 1); |
@@ -84,9 +84,9 @@ discard block |
||
| 84 | 84 | $aKeys = explode('.', (string)$sKeys); |
| 85 | 85 | foreach ($aKeys as $sKey) |
| 86 | 86 | { |
| 87 | - if(($sKey)) |
|
| 87 | + if (($sKey)) |
|
| 88 | 88 | { |
| 89 | - if(!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey])) |
|
| 89 | + if (!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey])) |
|
| 90 | 90 | { |
| 91 | 91 | return; |
| 92 | 92 | } |
@@ -134,13 +134,12 @@ discard block |
||
| 134 | 134 | $sPrefix = rtrim($sPrefix, '.') . '.'; |
| 135 | 135 | $sPrefixLen = strlen($sPrefix); |
| 136 | 136 | $aOptions = []; |
| 137 | - foreach($this->aOptions as $sName => $xValue) |
|
| 137 | + foreach ($this->aOptions as $sName => $xValue) |
|
| 138 | 138 | { |
| 139 | - if(substr($sName, 0, $sPrefixLen) == $sPrefix) |
|
| 139 | + if (substr($sName, 0, $sPrefixLen) == $sPrefix) |
|
| 140 | 140 | { |
| 141 | 141 | $iNextDotPos = strpos($sName, '.', $sPrefixLen); |
| 142 | - $sOptionName = $iNextDotPos === false ? substr($sName, $sPrefixLen) : |
|
| 143 | - substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen); |
|
| 142 | + $sOptionName = $iNextDotPos === false ? substr($sName, $sPrefixLen) : substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen); |
|
| 144 | 143 | $aOptions[$sOptionName] = $sPrefix . $sOptionName; |
| 145 | 144 | } |
| 146 | 145 | } |
@@ -26,16 +26,16 @@ |
||
| 26 | 26 | public static function read($sConfigFile) |
| 27 | 27 | { |
| 28 | 28 | $sConfigFile = realpath($sConfigFile); |
| 29 | - if(!extension_loaded('yaml')) |
|
| 29 | + if (!extension_loaded('yaml')) |
|
| 30 | 30 | { |
| 31 | 31 | throw new \Jaxon\Config\Exception\Yaml(jaxon_trans('config.errors.yaml.install')); |
| 32 | 32 | } |
| 33 | - if(!is_readable($sConfigFile)) |
|
| 33 | + if (!is_readable($sConfigFile)) |
|
| 34 | 34 | { |
| 35 | 35 | throw new \Jaxon\Config\Exception\File(jaxon_trans('config.errors.file.access', array('path' => $sConfigFile))); |
| 36 | 36 | } |
| 37 | 37 | $aConfigOptions = yaml_parse_file($sConfigFile); |
| 38 | - if(!is_array($aConfigOptions)) |
|
| 38 | + if (!is_array($aConfigOptions)) |
|
| 39 | 39 | { |
| 40 | 40 | throw new \Jaxon\Config\Exception\File(jaxon_trans('config.errors.file.content', array('path' => $sConfigFile))); |
| 41 | 41 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | public function read($sConfigFile) |
| 25 | 25 | { |
| 26 | 26 | $sExt = pathinfo($sConfigFile, PATHINFO_EXTENSION); |
| 27 | - switch($sExt) |
|
| 27 | + switch ($sExt) |
|
| 28 | 28 | { |
| 29 | 29 | case 'php': |
| 30 | 30 | $aConfigOptions = Php::read($sConfigFile); |
@@ -26,13 +26,13 @@ |
||
| 26 | 26 | public static function read($sConfigFile) |
| 27 | 27 | { |
| 28 | 28 | $sConfigFile = realpath($sConfigFile); |
| 29 | - if(!is_readable($sConfigFile)) |
|
| 29 | + if (!is_readable($sConfigFile)) |
|
| 30 | 30 | { |
| 31 | 31 | throw new \Jaxon\Config\Exception\File(jaxon_trans('config.errors.file.access', array('path' => $sConfigFile))); |
| 32 | 32 | } |
| 33 | 33 | $sFileContent = file_get_contents($sConfigFile); |
| 34 | 34 | $aConfigOptions = json_decode($sFileContent, true); |
| 35 | - if(!is_array($aConfigOptions)) |
|
| 35 | + if (!is_array($aConfigOptions)) |
|
| 36 | 36 | { |
| 37 | 37 | throw new \Jaxon\Config\Exception\File(jaxon_trans('config.errors.file.content', array('path' => $sConfigFile))); |
| 38 | 38 | } |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | /** |
| 62 | 62 | * The constructor |
| 63 | 63 | * |
| 64 | - * @param Jaxon\Plugin\Manager $xPluginManager |
|
| 64 | + * @param Manager $xPluginManager |
|
| 65 | 65 | */ |
| 66 | 66 | public function __construct(Manager $xPluginManager) |
| 67 | 67 | { |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | private function getJsLibUri() |
| 77 | 77 | { |
| 78 | - if(!$this->hasOption('js.lib.uri')) |
|
| 78 | + if (!$this->hasOption('js.lib.uri')) |
|
| 79 | 79 | { |
| 80 | 80 | // return 'https://cdn.jsdelivr.net/jaxon/1.2.0/'; |
| 81 | 81 | return 'https://cdn.jsdelivr.net/gh/jaxon-php/[email protected]/dist/'; |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | // The jsDelivr CDN only hosts minified files |
| 99 | 99 | // if(($this->getOption('js.app.minify')) || substr($this->getJsLibUri(), 0, $nLen) == $jsDelivrUri) |
| 100 | 100 | // Starting from version 2.0.0 of the js lib, the jsDelivr CDN also hosts non minified files. |
| 101 | - if(($this->getOption('js.app.minify'))) |
|
| 101 | + if (($this->getOption('js.app.minify'))) |
|
| 102 | 102 | { |
| 103 | 103 | return '.min.js'; |
| 104 | 104 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | // Check config options |
| 116 | 116 | // - The js.app.extern option must be set to true |
| 117 | 117 | // - The js.app.uri and js.app.dir options must be set to non null values |
| 118 | - if(!$this->getOption('js.app.extern') || |
|
| 118 | + if (!$this->getOption('js.app.extern') || |
|
| 119 | 119 | !$this->getOption('js.app.uri') || |
| 120 | 120 | !$this->getOption('js.app.dir')) |
| 121 | 121 | { |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | // Check dir access |
| 125 | 125 | // - The js.app.dir must be writable |
| 126 | 126 | $sJsAppDir = $this->getOption('js.app.dir'); |
| 127 | - if(!is_dir($sJsAppDir) || !is_writable($sJsAppDir)) |
|
| 127 | + if (!is_dir($sJsAppDir) || !is_writable($sJsAppDir)) |
|
| 128 | 128 | { |
| 129 | 129 | return false; |
| 130 | 130 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | private function setTemplateCacheDir() |
| 140 | 140 | { |
| 141 | - if($this->hasOption('core.template.cache_dir')) |
|
| 141 | + if ($this->hasOption('core.template.cache_dir')) |
|
| 142 | 142 | { |
| 143 | 143 | $this->setCacheDir($this->getOption('core.template.cache_dir')); |
| 144 | 144 | } |
@@ -152,11 +152,11 @@ discard block |
||
| 152 | 152 | private function generateHash() |
| 153 | 153 | { |
| 154 | 154 | $sHash = jaxon()->getVersion(); |
| 155 | - foreach($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
| 155 | + foreach ($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
| 156 | 156 | { |
| 157 | 157 | $sHash .= $xPlugin->generateHash(); |
| 158 | 158 | } |
| 159 | - foreach($this->xPluginManager->getResponsePlugins() as $xPlugin) |
|
| 159 | + foreach ($this->xPluginManager->getResponsePlugins() as $xPlugin) |
|
| 160 | 160 | { |
| 161 | 161 | $sHash .= $xPlugin->generateHash(); |
| 162 | 162 | } |
@@ -170,49 +170,49 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | private function makePluginsCode() |
| 172 | 172 | { |
| 173 | - if($this->sCssCode === null || $this->sJsCode === null || $this->sJsReady === null) |
|
| 173 | + if ($this->sCssCode === null || $this->sJsCode === null || $this->sJsReady === null) |
|
| 174 | 174 | { |
| 175 | 175 | $this->sCssCode = ''; |
| 176 | 176 | $this->sJsCode = ''; |
| 177 | 177 | $this->sJsReady = ''; |
| 178 | - foreach($this->xPluginManager->getResponsePlugins() as $xPlugin) |
|
| 178 | + foreach ($this->xPluginManager->getResponsePlugins() as $xPlugin) |
|
| 179 | 179 | { |
| 180 | - if(($str = trim($xPlugin->getCss()))) |
|
| 180 | + if (($str = trim($xPlugin->getCss()))) |
|
| 181 | 181 | { |
| 182 | 182 | $this->sCssCode .= rtrim($str, " \n") . "\n"; |
| 183 | 183 | } |
| 184 | - if(($str = trim($xPlugin->getJs()))) |
|
| 184 | + if (($str = trim($xPlugin->getJs()))) |
|
| 185 | 185 | { |
| 186 | 186 | $this->sJsCode .= rtrim($str, " \n") . "\n"; |
| 187 | 187 | } |
| 188 | - if(($str = trim($xPlugin->getScript()))) |
|
| 188 | + if (($str = trim($xPlugin->getScript()))) |
|
| 189 | 189 | { |
| 190 | 190 | $this->sJsReady .= "\n" . trim($str, " \n"); |
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | $this->sJsReady = $this->render('jaxon::plugins/ready.js', ['sPluginScript' => $this->sJsReady]); |
| 195 | - foreach($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
| 195 | + foreach ($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
| 196 | 196 | { |
| 197 | - if(($str = trim($xPlugin->getScript()))) |
|
| 197 | + if (($str = trim($xPlugin->getScript()))) |
|
| 198 | 198 | { |
| 199 | 199 | $this->sJsReady .= "\n" . trim($str, " \n"); |
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - foreach($this->xPluginManager->getPackages() as $sClass) |
|
| 203 | + foreach ($this->xPluginManager->getPackages() as $sClass) |
|
| 204 | 204 | { |
| 205 | 205 | $xPackage = jaxon()->di()->get($sClass); |
| 206 | - if(($str = trim($xPackage->css()))) |
|
| 206 | + if (($str = trim($xPackage->css()))) |
|
| 207 | 207 | { |
| 208 | 208 | $this->sCssCode .= rtrim($str, " \n") . "\n"; |
| 209 | 209 | } |
| 210 | - if(($str = trim($xPackage->js()))) |
|
| 210 | + if (($str = trim($xPackage->js()))) |
|
| 211 | 211 | { |
| 212 | 212 | $this->sJsCode .= rtrim($str, " \n") . "\n"; |
| 213 | 213 | } |
| 214 | 214 | $xPackage = jaxon()->di()->get($sClass); |
| 215 | - if(($str = trim($xPackage->ready()))) |
|
| 215 | + if (($str = trim($xPackage->ready()))) |
|
| 216 | 216 | { |
| 217 | 217 | $this->sJsReady .= "\n" . trim($str, " \n"); |
| 218 | 218 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | // Add component files to the javascript file array; |
| 238 | 238 | $aJsFiles = array($sJsCoreUrl); |
| 239 | - if($this->getOption('core.debug.on')) |
|
| 239 | + if ($this->getOption('core.debug.on')) |
|
| 240 | 240 | { |
| 241 | 241 | $aJsFiles[] = $sJsDebugUrl; |
| 242 | 242 | $aJsFiles[] = $sJsLanguageUrl; |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | $this->setTemplateCacheDir(); |
| 332 | 332 | $this->makePluginsCode(); |
| 333 | 333 | |
| 334 | - if($this->canExportJavascript()) |
|
| 334 | + if ($this->canExportJavascript()) |
|
| 335 | 335 | { |
| 336 | 336 | $sJsAppURI = rtrim($this->getOption('js.app.uri'), '/') . '/'; |
| 337 | 337 | $sJsAppDir = rtrim($this->getOption('js.app.dir'), '/') . '/'; |
@@ -340,13 +340,13 @@ discard block |
||
| 340 | 340 | $sHash = $this->generateHash(); |
| 341 | 341 | $sOutFile = $sHash . '.js'; |
| 342 | 342 | $sMinFile = $sHash . '.min.js'; |
| 343 | - if(!is_file($sJsAppDir . $sOutFile)) |
|
| 343 | + if (!is_file($sJsAppDir . $sOutFile)) |
|
| 344 | 344 | { |
| 345 | 345 | file_put_contents($sJsAppDir . $sOutFile, $this->_getScript()); |
| 346 | 346 | } |
| 347 | - if(($this->getOption('js.app.minify')) && !is_file($sJsAppDir . $sMinFile)) |
|
| 347 | + if (($this->getOption('js.app.minify')) && !is_file($sJsAppDir . $sMinFile)) |
|
| 348 | 348 | { |
| 349 | - if(($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile))) |
|
| 349 | + if (($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile))) |
|
| 350 | 350 | { |
| 351 | 351 | $sOutFile = $sMinFile; |
| 352 | 352 | } |
@@ -357,8 +357,7 @@ |
||
| 357 | 357 | 'sJsOptions' => $this->getOption('js.app.options'), |
| 358 | 358 | 'sUrl' => $sJsAppURI . $sOutFile, |
| 359 | 359 | )); |
| 360 | - } |
|
| 361 | - else |
|
| 360 | + } else |
|
| 362 | 361 | { |
| 363 | 362 | // The plugins scripts are wrapped with javascript tags |
| 364 | 363 | $sScript = $this->render('jaxon::plugins/wrapper.js', array( |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | /** |
| 304 | 304 | * Create a new the config manager |
| 305 | 305 | * |
| 306 | - * @return Jaxon\Config\Config The config manager |
|
| 306 | + * @return Config The config manager |
|
| 307 | 307 | */ |
| 308 | 308 | public function newConfig() |
| 309 | 309 | { |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | /** |
| 374 | 374 | * Set the pagination renderer |
| 375 | 375 | * |
| 376 | - * @param Jaxon\Utils\Pagination\Renderer $xRenderer The pagination renderer |
|
| 376 | + * @param PaginationRenderer $xRenderer The pagination renderer |
|
| 377 | 377 | * |
| 378 | 378 | * @return void |
| 379 | 379 | */ |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | /** |
| 406 | 406 | * Create a new Jaxon response object |
| 407 | 407 | * |
| 408 | - * @return Jaxon\Response\Response |
|
| 408 | + * @return Response |
|
| 409 | 409 | */ |
| 410 | 410 | public function newResponse() |
| 411 | 411 | { |
@@ -16,7 +16,6 @@ |
||
| 16 | 16 | |
| 17 | 17 | use Lemon\Event\EventDispatcher; |
| 18 | 18 | use Jaxon\Sentry\View\Renderer; |
| 19 | - |
|
| 20 | 19 | use Jaxon\Jaxon; |
| 21 | 20 | use Jaxon\Response\Response; |
| 22 | 21 | use Jaxon\Config\Config; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | public static function getInstance() |
| 51 | 51 | { |
| 52 | - if(!self::$xInstance) |
|
| 52 | + if (!self::$xInstance) |
|
| 53 | 53 | { |
| 54 | 54 | self::$xInstance = new Container(); |
| 55 | 55 | } |
@@ -109,15 +109,15 @@ discard block |
||
| 109 | 109 | * Core library objects |
| 110 | 110 | */ |
| 111 | 111 | // Jaxon Core |
| 112 | - $this->coreContainer[Jaxon::class] = function ($c) { |
|
| 112 | + $this->coreContainer[Jaxon::class] = function($c) { |
|
| 113 | 113 | return new Jaxon(); |
| 114 | 114 | }; |
| 115 | 115 | // Global Response |
| 116 | - $this->coreContainer[Response::class] = function ($c) { |
|
| 116 | + $this->coreContainer[Response::class] = function($c) { |
|
| 117 | 117 | return new Response(); |
| 118 | 118 | }; |
| 119 | 119 | // Dialog |
| 120 | - $this->coreContainer[Dialog::class] = function ($c) { |
|
| 120 | + $this->coreContainer[Dialog::class] = function($c) { |
|
| 121 | 121 | return new Dialog(); |
| 122 | 122 | }; |
| 123 | 123 | |
@@ -125,41 +125,41 @@ discard block |
||
| 125 | 125 | * Managers |
| 126 | 126 | */ |
| 127 | 127 | // Callable objects repository |
| 128 | - $this->coreContainer[CallableRepository::class] = function ($c) { |
|
| 128 | + $this->coreContainer[CallableRepository::class] = function($c) { |
|
| 129 | 129 | return new CallableRepository(); |
| 130 | 130 | }; |
| 131 | 131 | // Plugin Manager |
| 132 | - $this->coreContainer[PluginManager::class] = function ($c) { |
|
| 132 | + $this->coreContainer[PluginManager::class] = function($c) { |
|
| 133 | 133 | return new PluginManager(); |
| 134 | 134 | }; |
| 135 | 135 | // Request Manager |
| 136 | - $this->coreContainer[RequestHandler::class] = function ($c) { |
|
| 136 | + $this->coreContainer[RequestHandler::class] = function($c) { |
|
| 137 | 137 | return new RequestHandler($c[PluginManager::class]); |
| 138 | 138 | }; |
| 139 | 139 | // Request Factory |
| 140 | - $this->coreContainer[RequestFactory::class] = function ($c) { |
|
| 140 | + $this->coreContainer[RequestFactory::class] = function($c) { |
|
| 141 | 141 | return new RequestFactory($c[CallableRepository::class]); |
| 142 | 142 | }; |
| 143 | 143 | // Parameter Factory |
| 144 | - $this->coreContainer[ParameterFactory::class] = function ($c) { |
|
| 144 | + $this->coreContainer[ParameterFactory::class] = function($c) { |
|
| 145 | 145 | return new ParameterFactory(); |
| 146 | 146 | }; |
| 147 | 147 | // Response Manager |
| 148 | - $this->coreContainer[ResponseManager::class] = function ($c) { |
|
| 148 | + $this->coreContainer[ResponseManager::class] = function($c) { |
|
| 149 | 149 | return new ResponseManager(); |
| 150 | 150 | }; |
| 151 | 151 | // Code Generator |
| 152 | - $this->coreContainer[CodeGenerator::class] = function ($c) { |
|
| 152 | + $this->coreContainer[CodeGenerator::class] = function($c) { |
|
| 153 | 153 | return new CodeGenerator($c[PluginManager::class]); |
| 154 | 154 | }; |
| 155 | 155 | |
| 156 | 156 | /* |
| 157 | 157 | * Config |
| 158 | 158 | */ |
| 159 | - $this->coreContainer[Config::class] = function ($c) { |
|
| 159 | + $this->coreContainer[Config::class] = function($c) { |
|
| 160 | 160 | return new Config(); |
| 161 | 161 | }; |
| 162 | - $this->coreContainer[ConfigReader::class] = function ($c) { |
|
| 162 | + $this->coreContainer[ConfigReader::class] = function($c) { |
|
| 163 | 163 | return new ConfigReader(); |
| 164 | 164 | }; |
| 165 | 165 | |
@@ -167,31 +167,31 @@ discard block |
||
| 167 | 167 | * Services |
| 168 | 168 | */ |
| 169 | 169 | // Minifier |
| 170 | - $this->coreContainer[Minifier::class] = function ($c) { |
|
| 170 | + $this->coreContainer[Minifier::class] = function($c) { |
|
| 171 | 171 | return new Minifier(); |
| 172 | 172 | }; |
| 173 | 173 | // Translator |
| 174 | - $this->coreContainer[Translator::class] = function ($c) { |
|
| 174 | + $this->coreContainer[Translator::class] = function($c) { |
|
| 175 | 175 | return new Translator($c['jaxon.core.translation_dir'], $c[Config::class]); |
| 176 | 176 | }; |
| 177 | 177 | // Template engine |
| 178 | - $this->coreContainer[Template::class] = function ($c) { |
|
| 178 | + $this->coreContainer[Template::class] = function($c) { |
|
| 179 | 179 | return new Template($c['jaxon.core.template_dir']); |
| 180 | 180 | }; |
| 181 | 181 | // Validator |
| 182 | - $this->coreContainer[Validator::class] = function ($c) { |
|
| 182 | + $this->coreContainer[Validator::class] = function($c) { |
|
| 183 | 183 | return new Validator($c[Translator::class], $c[Config::class]); |
| 184 | 184 | }; |
| 185 | 185 | // Pagination Renderer |
| 186 | - $this->coreContainer[PaginationRenderer::class] = function ($c) { |
|
| 186 | + $this->coreContainer[PaginationRenderer::class] = function($c) { |
|
| 187 | 187 | return new PaginationRenderer($c[Template::class]); |
| 188 | 188 | }; |
| 189 | 189 | // Pagination Paginator |
| 190 | - $this->coreContainer[Paginator::class] = function ($c) { |
|
| 190 | + $this->coreContainer[Paginator::class] = function($c) { |
|
| 191 | 191 | return new Paginator($c[PaginationRenderer::class]); |
| 192 | 192 | }; |
| 193 | 193 | // Event Dispatcher |
| 194 | - $this->coreContainer[EventDispatcher::class] = function ($c) { |
|
| 194 | + $this->coreContainer[EventDispatcher::class] = function($c) { |
|
| 195 | 195 | return new EventDispatcher(); |
| 196 | 196 | }; |
| 197 | 197 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | */ |
| 211 | 211 | public function get($sClass) |
| 212 | 212 | { |
| 213 | - if($this->sentryContainer != null && $this->sentryContainer->has($sClass)) |
|
| 213 | + if ($this->sentryContainer != null && $this->sentryContainer->has($sClass)) |
|
| 214 | 214 | { |
| 215 | 215 | return $this->sentryContainer->get($sClass); |
| 216 | 216 | } |
@@ -515,14 +515,14 @@ discard block |
||
| 515 | 515 | $this->coreContainer['jaxon.sentry.view.base.' . $sId] = $xClosure; |
| 516 | 516 | |
| 517 | 517 | // Return the initialized view renderer |
| 518 | - $this->coreContainer['jaxon.sentry.view.' . $sId] = function ($c) use ($sId) { |
|
| 518 | + $this->coreContainer['jaxon.sentry.view.' . $sId] = function($c) use ($sId) { |
|
| 519 | 519 | // Get the defined renderer |
| 520 | 520 | $renderer = $c['jaxon.sentry.view.base.' . $sId]; |
| 521 | 521 | // Init the renderer with the template namespaces |
| 522 | 522 | $aNamespaces = $this->coreContainer['jaxon.view.data.namespaces']; |
| 523 | - if(key_exists($sId, $aNamespaces)) |
|
| 523 | + if (key_exists($sId, $aNamespaces)) |
|
| 524 | 524 | { |
| 525 | - foreach($aNamespaces[$sId] as $ns) |
|
| 525 | + foreach ($aNamespaces[$sId] as $ns) |
|
| 526 | 526 | { |
| 527 | 527 | $renderer->addNamespace($ns['namespace'], $ns['directory'], $ns['extension']); |
| 528 | 528 | } |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | */ |
| 541 | 541 | public function getViewRenderer($sId = '') |
| 542 | 542 | { |
| 543 | - if(!$sId) |
|
| 543 | + if (!$sId) |
|
| 544 | 544 | { |
| 545 | 545 | // Return the view renderer facade |
| 546 | 546 | return $this->coreContainer[\Jaxon\Sentry\View\Facade::class]; |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | /** |
| 63 | 63 | * Set the javascript confirm function |
| 64 | 64 | * |
| 65 | - * @param Jaxon\Dialog\Interfaces\Confirm $xConfirm The javascript confirm function |
|
| 65 | + * @param Interfaces\Confirm $xConfirm The javascript confirm function |
|
| 66 | 66 | * |
| 67 | 67 | * @return void |
| 68 | 68 | */ |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | /** |
| 105 | 105 | * Set the javascript alert function |
| 106 | 106 | * |
| 107 | - * @param Jaxon\Dialog\Interfaces\Alert $xAlert The javascript alert function |
|
| 107 | + * @param Interfaces\Alert $xAlert The javascript alert function |
|
| 108 | 108 | * |
| 109 | 109 | * @return void |
| 110 | 110 | */ |
@@ -12,8 +12,6 @@ |
||
| 12 | 12 | namespace Jaxon\Dialog; |
| 13 | 13 | |
| 14 | 14 | use Jaxon\Jaxon; |
| 15 | -use Jaxon\Plugin\Package; |
|
| 16 | -use Jaxon\Config\Config; |
|
| 17 | 15 | |
| 18 | 16 | class Dialog |
| 19 | 17 | { |
@@ -22,9 +22,7 @@ |
||
| 22 | 22 | namespace Jaxon\Plugin; |
| 23 | 23 | |
| 24 | 24 | use Jaxon\Jaxon; |
| 25 | -use Jaxon\Plugin\Package; |
|
| 26 | 25 | use Jaxon\Config\Config; |
| 27 | - |
|
| 28 | 26 | use Closure; |
| 29 | 27 | |
| 30 | 28 | class Manager |
@@ -132,32 +132,32 @@ discard block |
||
| 132 | 132 | { |
| 133 | 133 | $bIsAlert = ($xPlugin instanceof Dialogs\Interfaces\Alert); |
| 134 | 134 | $bIsConfirm = ($xPlugin instanceof Dialogs\Interfaces\Confirm); |
| 135 | - if($xPlugin instanceof Request) |
|
| 135 | + if ($xPlugin instanceof Request) |
|
| 136 | 136 | { |
| 137 | 137 | // The name of a request plugin is used as key in the plugin table |
| 138 | 138 | $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin; |
| 139 | 139 | } |
| 140 | - elseif($xPlugin instanceof Response) |
|
| 140 | + elseif ($xPlugin instanceof Response) |
|
| 141 | 141 | { |
| 142 | 142 | // The name of a response plugin is used as key in the plugin table |
| 143 | 143 | $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin; |
| 144 | 144 | } |
| 145 | - elseif(!$bIsConfirm && !$bIsAlert) |
|
| 145 | + elseif (!$bIsConfirm && !$bIsAlert) |
|
| 146 | 146 | { |
| 147 | 147 | throw new \Jaxon\Exception\Error($this->trans('errors.register.invalid', array('name' => get_class($xPlugin)))); |
| 148 | 148 | } |
| 149 | 149 | // This plugin implements the Alert interface |
| 150 | - if($bIsAlert) |
|
| 150 | + if ($bIsAlert) |
|
| 151 | 151 | { |
| 152 | 152 | $this->setAlert($xPlugin); |
| 153 | 153 | } |
| 154 | 154 | // This plugin implements the Confirm interface |
| 155 | - if($bIsConfirm) |
|
| 155 | + if ($bIsConfirm) |
|
| 156 | 156 | { |
| 157 | 157 | $this->setConfirm($xPlugin); |
| 158 | 158 | } |
| 159 | 159 | // Register the plugin as an event listener |
| 160 | - if($xPlugin instanceof \Jaxon\Utils\Interfaces\EventListener) |
|
| 160 | + if ($xPlugin instanceof \Jaxon\Utils\Interfaces\EventListener) |
|
| 161 | 161 | { |
| 162 | 162 | $this->addEventListener($xPlugin); |
| 163 | 163 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | public function register($sType, $sCallable, $aOptions = []) |
| 194 | 194 | { |
| 195 | - if(!key_exists($sType, $this->aRequestPlugins)) |
|
| 195 | + if (!key_exists($sType, $this->aRequestPlugins)) |
|
| 196 | 196 | { |
| 197 | 197 | throw new \Jaxon\Exception\Error($this->trans('errors.register.plugin', ['name' => $sType])); |
| 198 | 198 | } |
@@ -220,15 +220,15 @@ discard block |
||
| 220 | 220 | { |
| 221 | 221 | // Register user functions |
| 222 | 222 | $aFunctionsConfig = $xAppConfig->getOption('functions', []); |
| 223 | - foreach($aFunctionsConfig as $xKey => $xValue) |
|
| 223 | + foreach ($aFunctionsConfig as $xKey => $xValue) |
|
| 224 | 224 | { |
| 225 | - if(is_integer($xKey) && is_string($xValue)) |
|
| 225 | + if (is_integer($xKey) && is_string($xValue)) |
|
| 226 | 226 | { |
| 227 | 227 | $sFunction = $xValue; |
| 228 | 228 | // Register a function without options |
| 229 | 229 | $this->register(Jaxon::USER_FUNCTION, $sFunction); |
| 230 | 230 | } |
| 231 | - elseif(is_string($xKey) && is_array($xValue)) |
|
| 231 | + elseif (is_string($xKey) && is_array($xValue)) |
|
| 232 | 232 | { |
| 233 | 233 | $sFunction = $xKey; |
| 234 | 234 | $aOptions = $xValue; |
@@ -244,25 +244,25 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | // Register classes and directories |
| 246 | 246 | $aClassesConfig = $xAppConfig->getOption('classes', []); |
| 247 | - foreach($aClassesConfig as $xKey => $xValue) |
|
| 247 | + foreach ($aClassesConfig as $xKey => $xValue) |
|
| 248 | 248 | { |
| 249 | - if(is_integer($xKey) && is_string($xValue)) |
|
| 249 | + if (is_integer($xKey) && is_string($xValue)) |
|
| 250 | 250 | { |
| 251 | 251 | $sClass = $xValue; |
| 252 | 252 | // Register a class without options |
| 253 | 253 | $this->register(Jaxon::CALLABLE_CLASS, $sClass); |
| 254 | 254 | } |
| 255 | - elseif(is_string($xKey) && is_array($xValue)) |
|
| 255 | + elseif (is_string($xKey) && is_array($xValue)) |
|
| 256 | 256 | { |
| 257 | 257 | $sClass = $xKey; |
| 258 | 258 | $aOptions = $xValue; |
| 259 | 259 | // Register a class with options |
| 260 | 260 | $this->register(Jaxon::CALLABLE_CLASS, $sClass, $aOptions); |
| 261 | 261 | } |
| 262 | - elseif(is_integer($xKey) && is_array($xValue)) |
|
| 262 | + elseif (is_integer($xKey) && is_array($xValue)) |
|
| 263 | 263 | { |
| 264 | 264 | // The directory path is required |
| 265 | - if(!key_exists('directory', $xValue)) |
|
| 265 | + if (!key_exists('directory', $xValue)) |
|
| 266 | 266 | { |
| 267 | 267 | continue; |
| 268 | 268 | // Todo: throw an exception |
@@ -270,17 +270,17 @@ discard block |
||
| 270 | 270 | // Registering a directory |
| 271 | 271 | $sDirectory = $xValue['directory']; |
| 272 | 272 | $aOptions = []; |
| 273 | - if(key_exists('options', $xValue) && |
|
| 273 | + if (key_exists('options', $xValue) && |
|
| 274 | 274 | is_array($xValue['options']) || is_string($xValue['options'])) |
| 275 | 275 | { |
| 276 | 276 | $aOptions = $xValue['options']; |
| 277 | 277 | } |
| 278 | 278 | // Setup directory options |
| 279 | - if(key_exists('namespace', $xValue)) |
|
| 279 | + if (key_exists('namespace', $xValue)) |
|
| 280 | 280 | { |
| 281 | 281 | $aOptions['namespace'] = $xValue['namespace']; |
| 282 | 282 | } |
| 283 | - if(key_exists('separator', $xValue)) |
|
| 283 | + if (key_exists('separator', $xValue)) |
|
| 284 | 284 | { |
| 285 | 285 | $aOptions['separator'] = $xValue['separator']; |
| 286 | 286 | } |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | */ |
| 306 | 306 | public function getResponsePlugin($sName) |
| 307 | 307 | { |
| 308 | - if(array_key_exists($sName, $this->aResponsePlugins)) |
|
| 308 | + if (array_key_exists($sName, $this->aResponsePlugins)) |
|
| 309 | 309 | { |
| 310 | 310 | return $this->aResponsePlugins[$sName]; |
| 311 | 311 | } |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | */ |
| 322 | 322 | public function getRequestPlugin($sName) |
| 323 | 323 | { |
| 324 | - if(array_key_exists($sName, $this->aRequestPlugins)) |
|
| 324 | + if (array_key_exists($sName, $this->aRequestPlugins)) |
|
| 325 | 325 | { |
| 326 | 326 | return $this->aRequestPlugins[$sName]; |
| 327 | 327 | } |
@@ -136,13 +136,11 @@ discard block |
||
| 136 | 136 | { |
| 137 | 137 | // The name of a request plugin is used as key in the plugin table |
| 138 | 138 | $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin; |
| 139 | - } |
|
| 140 | - elseif($xPlugin instanceof Response) |
|
| 139 | + } elseif($xPlugin instanceof Response) |
|
| 141 | 140 | { |
| 142 | 141 | // The name of a response plugin is used as key in the plugin table |
| 143 | 142 | $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin; |
| 144 | - } |
|
| 145 | - elseif(!$bIsConfirm && !$bIsAlert) |
|
| 143 | + } elseif(!$bIsConfirm && !$bIsAlert) |
|
| 146 | 144 | { |
| 147 | 145 | throw new \Jaxon\Exception\Error($this->trans('errors.register.invalid', array('name' => get_class($xPlugin)))); |
| 148 | 146 | } |
@@ -227,15 +225,13 @@ discard block |
||
| 227 | 225 | $sFunction = $xValue; |
| 228 | 226 | // Register a function without options |
| 229 | 227 | $this->register(Jaxon::USER_FUNCTION, $sFunction); |
| 230 | - } |
|
| 231 | - elseif(is_string($xKey) && is_array($xValue)) |
|
| 228 | + } elseif(is_string($xKey) && is_array($xValue)) |
|
| 232 | 229 | { |
| 233 | 230 | $sFunction = $xKey; |
| 234 | 231 | $aOptions = $xValue; |
| 235 | 232 | // Register a function with options |
| 236 | 233 | $this->register(Jaxon::USER_FUNCTION, $sFunction, $aOptions); |
| 237 | - } |
|
| 238 | - else |
|
| 234 | + } else |
|
| 239 | 235 | { |
| 240 | 236 | continue; |
| 241 | 237 | // Todo: throw an exception |
@@ -251,15 +247,13 @@ discard block |
||
| 251 | 247 | $sClass = $xValue; |
| 252 | 248 | // Register a class without options |
| 253 | 249 | $this->register(Jaxon::CALLABLE_CLASS, $sClass); |
| 254 | - } |
|
| 255 | - elseif(is_string($xKey) && is_array($xValue)) |
|
| 250 | + } elseif(is_string($xKey) && is_array($xValue)) |
|
| 256 | 251 | { |
| 257 | 252 | $sClass = $xKey; |
| 258 | 253 | $aOptions = $xValue; |
| 259 | 254 | // Register a class with options |
| 260 | 255 | $this->register(Jaxon::CALLABLE_CLASS, $sClass, $aOptions); |
| 261 | - } |
|
| 262 | - elseif(is_integer($xKey) && is_array($xValue)) |
|
| 256 | + } elseif(is_integer($xKey) && is_array($xValue)) |
|
| 263 | 257 | { |
| 264 | 258 | // The directory path is required |
| 265 | 259 | if(!key_exists('directory', $xValue)) |
@@ -286,8 +280,7 @@ discard block |
||
| 286 | 280 | } |
| 287 | 281 | // Register a class without options |
| 288 | 282 | $this->register(Jaxon::CALLABLE_DIR, $sDirectory, $aOptions); |
| 289 | - } |
|
| 290 | - else |
|
| 283 | + } else |
|
| 291 | 284 | { |
| 292 | 285 | continue; |
| 293 | 286 | // Todo: throw an exception |