@@ -96,7 +96,6 @@ discard block |
||
| 96 | 96 | * Return the javascript call to a Jaxon function or object method |
| 97 | 97 | * |
| 98 | 98 | * @param string $sFunction The function or method (without class) name |
| 99 | - * @param ... $xParams The parameters of the function or method |
|
| 100 | 99 | * |
| 101 | 100 | * @return Request |
| 102 | 101 | */ |
@@ -125,7 +124,6 @@ discard block |
||
| 125 | 124 | * Return the javascript call to a generic function |
| 126 | 125 | * |
| 127 | 126 | * @param string $sFunction The function or method (with class) name |
| 128 | - * @param ... $xParams The parameters of the function or method |
|
| 129 | 127 | * |
| 130 | 128 | * @return Request |
| 131 | 129 | */ |
@@ -20,7 +20,6 @@ |
||
| 20 | 20 | |
| 21 | 21 | namespace Jaxon\Request\Factory; |
| 22 | 22 | |
| 23 | -use JsonSerializable; |
|
| 24 | 23 | use Jaxon\Jaxon; |
| 25 | 24 | |
| 26 | 25 | class Request extends JsCall |
@@ -51,9 +51,9 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function hasPageNumber() |
| 53 | 53 | { |
| 54 | - foreach($this->aParameters as $xParameter) |
|
| 54 | + foreach ($this->aParameters as $xParameter) |
|
| 55 | 55 | { |
| 56 | - if($xParameter->getType() == Jaxon::PAGE_NUMBER) |
|
| 56 | + if ($xParameter->getType() == Jaxon::PAGE_NUMBER) |
|
| 57 | 57 | { |
| 58 | 58 | return true; |
| 59 | 59 | } |
@@ -71,9 +71,9 @@ discard block |
||
| 71 | 71 | public function setPageNumber($nPageNumber) |
| 72 | 72 | { |
| 73 | 73 | // Set the value of the Jaxon::PAGE_NUMBER parameter |
| 74 | - foreach($this->aParameters as $xParameter) |
|
| 74 | + foreach ($this->aParameters as $xParameter) |
|
| 75 | 75 | { |
| 76 | - if($xParameter->getType() == Jaxon::PAGE_NUMBER) |
|
| 76 | + if ($xParameter->getType() == Jaxon::PAGE_NUMBER) |
|
| 77 | 77 | { |
| 78 | 78 | $xParameter->setValue(intval($nPageNumber)); |
| 79 | 79 | break; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | private function setMessageArgs(array $aArgs) |
| 93 | 93 | { |
| 94 | - array_walk($aArgs, function (&$xParameter) { |
|
| 94 | + array_walk($aArgs, function(&$xParameter) { |
|
| 95 | 95 | $xParameter = Parameter::make($xParameter); |
| 96 | 96 | }); |
| 97 | 97 | $this->aMessageArgs = $aArgs; |
@@ -146,12 +146,12 @@ discard block |
||
| 146 | 146 | // This array will avoid declaring multiple variables with the same value. |
| 147 | 147 | // The array key is the variable value, while the array value is the variable name. |
| 148 | 148 | $aVariables = []; // Array of local variables. |
| 149 | - foreach($this->aParameters as &$xParameter) |
|
| 149 | + foreach ($this->aParameters as &$xParameter) |
|
| 150 | 150 | { |
| 151 | 151 | $sParameterStr = $xParameter->getScript(); |
| 152 | - if($xParameter instanceof \Jaxon\Response\Plugin\JQuery\Dom\Element) |
|
| 152 | + if ($xParameter instanceof \Jaxon\Response\Plugin\JQuery\Dom\Element) |
|
| 153 | 153 | { |
| 154 | - if(!array_key_exists($sParameterStr, $aVariables)) |
|
| 154 | + if (!array_key_exists($sParameterStr, $aVariables)) |
|
| 155 | 155 | { |
| 156 | 156 | // The value is not yet defined. A new variable is created. |
| 157 | 157 | $sVarName = "jxnVar$nVarId"; |
@@ -169,19 +169,19 @@ discard block |
||
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | $sPhrase = ''; |
| 172 | - if(count($this->aMessageArgs) > 0) |
|
| 172 | + if (count($this->aMessageArgs) > 0) |
|
| 173 | 173 | { |
| 174 | 174 | $sPhrase = array_shift($this->aMessageArgs); // The first array entry is the question. |
| 175 | 175 | // $sPhrase = "'" . addslashes($sPhrase) . "'"; // Wrap the phrase with single quotes |
| 176 | - if(count($this->aMessageArgs) > 0) |
|
| 176 | + if (count($this->aMessageArgs) > 0) |
|
| 177 | 177 | { |
| 178 | 178 | $nParamId = 1; |
| 179 | - foreach($this->aMessageArgs as &$xParameter) |
|
| 179 | + foreach ($this->aMessageArgs as &$xParameter) |
|
| 180 | 180 | { |
| 181 | 181 | $sParameterStr = $xParameter->getScript(); |
| 182 | - if($xParameter instanceof \Jaxon\Response\Plugin\JQuery\Dom\Element) |
|
| 182 | + if ($xParameter instanceof \Jaxon\Response\Plugin\JQuery\Dom\Element) |
|
| 183 | 183 | { |
| 184 | - if(!array_key_exists($sParameterStr, $aVariables)) |
|
| 184 | + if (!array_key_exists($sParameterStr, $aVariables)) |
|
| 185 | 185 | { |
| 186 | 186 | // The value is not yet defined. A new variable is created. |
| 187 | 187 | $sVarName = "jxnVar$nVarId"; |
@@ -205,14 +205,14 @@ discard block |
||
| 205 | 205 | |
| 206 | 206 | $sScript = parent::getScript(); |
| 207 | 207 | $xDialog = jaxon()->dialog(); |
| 208 | - if($this->sCondition == '__confirm__') |
|
| 208 | + if ($this->sCondition == '__confirm__') |
|
| 209 | 209 | { |
| 210 | 210 | $sScript = $xDialog->confirm($sPhrase, $sScript, ''); |
| 211 | 211 | } |
| 212 | - elseif($this->sCondition !== null) |
|
| 212 | + elseif ($this->sCondition !== null) |
|
| 213 | 213 | { |
| 214 | 214 | $sScript = 'if(' . $this->sCondition . '){' . $sScript . ';}'; |
| 215 | - if(($sPhrase)) |
|
| 215 | + if (($sPhrase)) |
|
| 216 | 216 | { |
| 217 | 217 | $xDialog->getAlert()->setReturn(true); |
| 218 | 218 | $sScript .= 'else{' . $xDialog->warning($sPhrase) . ';}'; |
@@ -60,19 +60,19 @@ discard block |
||
| 60 | 60 | { |
| 61 | 61 | $this->xRepository = $xRepository; |
| 62 | 62 | |
| 63 | - if(!empty($_GET['jxncls'])) |
|
| 63 | + if (!empty($_GET['jxncls'])) |
|
| 64 | 64 | { |
| 65 | 65 | $this->sRequestedClass = $_GET['jxncls']; |
| 66 | 66 | } |
| 67 | - if(!empty($_GET['jxnmthd'])) |
|
| 67 | + if (!empty($_GET['jxnmthd'])) |
|
| 68 | 68 | { |
| 69 | 69 | $this->sRequestedMethod = $_GET['jxnmthd']; |
| 70 | 70 | } |
| 71 | - if(!empty($_POST['jxncls'])) |
|
| 71 | + if (!empty($_POST['jxncls'])) |
|
| 72 | 72 | { |
| 73 | 73 | $this->sRequestedClass = $_POST['jxncls']; |
| 74 | 74 | } |
| 75 | - if(!empty($_POST['jxnmthd'])) |
|
| 75 | + if (!empty($_POST['jxnmthd'])) |
|
| 76 | 76 | { |
| 77 | 77 | $this->sRequestedMethod = $_POST['jxnmthd']; |
| 78 | 78 | } |
@@ -99,20 +99,20 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function register($sType, $sClassName, $aOptions) |
| 101 | 101 | { |
| 102 | - if($sType != $this->getName()) |
|
| 102 | + if ($sType != $this->getName()) |
|
| 103 | 103 | { |
| 104 | 104 | return false; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - if(!is_string($sClassName)) |
|
| 107 | + if (!is_string($sClassName)) |
|
| 108 | 108 | { |
| 109 | 109 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration')); |
| 110 | 110 | } |
| 111 | - if(is_string($aOptions)) |
|
| 111 | + if (is_string($aOptions)) |
|
| 112 | 112 | { |
| 113 | 113 | $aOptions = ['include' => $aOptions]; |
| 114 | 114 | } |
| 115 | - if(!is_array($aOptions)) |
|
| 115 | + if (!is_array($aOptions)) |
|
| 116 | 116 | { |
| 117 | 117 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration')); |
| 118 | 118 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | public function canProcessRequest() |
| 151 | 151 | { |
| 152 | 152 | // Check the validity of the class name |
| 153 | - if(($this->sRequestedClass !== null && !$this->validateClass($this->sRequestedClass)) || |
|
| 153 | + if (($this->sRequestedClass !== null && !$this->validateClass($this->sRequestedClass)) || |
|
| 154 | 154 | ($this->sRequestedMethod !== null && !$this->validateMethod($this->sRequestedMethod))) |
| 155 | 155 | { |
| 156 | 156 | $this->sRequestedClass = null; |
@@ -166,14 +166,14 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | public function processRequest() |
| 168 | 168 | { |
| 169 | - if(!$this->canProcessRequest()) |
|
| 169 | + if (!$this->canProcessRequest()) |
|
| 170 | 170 | { |
| 171 | 171 | return false; |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | // Find the requested method |
| 175 | 175 | $xCallableObject = $this->xRepository->getCallableObject($this->sRequestedClass); |
| 176 | - if(!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod)) |
|
| 176 | + if (!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod)) |
|
| 177 | 177 | { |
| 178 | 178 | // Unable to find the requested object or method |
| 179 | 179 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid', |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $jaxon = jaxon(); |
| 185 | 185 | $aArgs = $jaxon->getRequestHandler()->processArguments(); |
| 186 | 186 | $xResponse = $xCallableObject->call($this->sRequestedMethod, $aArgs); |
| 187 | - if(($xResponse)) |
|
| 187 | + if (($xResponse)) |
|
| 188 | 188 | { |
| 189 | 189 | $jaxon->getResponseManager()->append($xResponse); |
| 190 | 190 | } |
@@ -84,19 +84,19 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public static function make($xValue) |
| 86 | 86 | { |
| 87 | - if($xValue instanceof Interfaces\Parameter) |
|
| 87 | + if ($xValue instanceof Interfaces\Parameter) |
|
| 88 | 88 | { |
| 89 | 89 | return $xValue; |
| 90 | 90 | } |
| 91 | - elseif(is_numeric($xValue)) |
|
| 91 | + elseif (is_numeric($xValue)) |
|
| 92 | 92 | { |
| 93 | 93 | return new Parameter(Jaxon::NUMERIC_VALUE, $xValue); |
| 94 | 94 | } |
| 95 | - elseif(is_string($xValue)) |
|
| 95 | + elseif (is_string($xValue)) |
|
| 96 | 96 | { |
| 97 | 97 | return new Parameter(Jaxon::QUOTED_VALUE, $xValue); |
| 98 | 98 | } |
| 99 | - elseif(is_bool($xValue)) |
|
| 99 | + elseif (is_bool($xValue)) |
|
| 100 | 100 | { |
| 101 | 101 | return new Parameter(Jaxon::BOOL_VALUE, $xValue); |
| 102 | 102 | } |
@@ -115,16 +115,16 @@ discard block |
||
| 115 | 115 | { |
| 116 | 116 | $sJsCode = ''; |
| 117 | 117 | $sQuoteCharacter = "'"; |
| 118 | - switch($this->sType) |
|
| 118 | + switch ($this->sType) |
|
| 119 | 119 | { |
| 120 | 120 | case Jaxon::FORM_VALUES: |
| 121 | 121 | $sJsCode = "jaxon.getFormValues(" . $sQuoteCharacter . $this->xValue . $sQuoteCharacter . ")"; |
| 122 | 122 | break; |
| 123 | 123 | case Jaxon::INPUT_VALUE: |
| 124 | - $sJsCode = "jaxon.$(" . $sQuoteCharacter . $this->xValue . $sQuoteCharacter . ").value"; |
|
| 124 | + $sJsCode = "jaxon.$(" . $sQuoteCharacter . $this->xValue . $sQuoteCharacter . ").value"; |
|
| 125 | 125 | break; |
| 126 | 126 | case Jaxon::CHECKED_VALUE: |
| 127 | - $sJsCode = "jaxon.$(" . $sQuoteCharacter . $this->xValue . $sQuoteCharacter . ").checked"; |
|
| 127 | + $sJsCode = "jaxon.$(" . $sQuoteCharacter . $this->xValue . $sQuoteCharacter . ").checked"; |
|
| 128 | 128 | break; |
| 129 | 129 | case Jaxon::ELEMENT_INNERHTML: |
| 130 | 130 | $sJsCode = "jaxon.$(" . $sQuoteCharacter . $this->xValue . $sQuoteCharacter . ").innerHTML"; |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $sJsCode = (string)$this->xValue; |
| 143 | 143 | break; |
| 144 | 144 | case Jaxon::JS_VALUE: |
| 145 | - if(is_array($this->xValue) || is_object($this->xValue)) |
|
| 145 | + if (is_array($this->xValue) || is_object($this->xValue)) |
|
| 146 | 146 | { |
| 147 | 147 | // Unable to use double quotes here because they cannot be handled on client side. |
| 148 | 148 | // So we are using simple quotes even if the Json standard recommends double quotes. |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | private function getJsLibUri() |
| 75 | 75 | { |
| 76 | - if(!$this->hasOption('js.lib.uri')) |
|
| 76 | + if (!$this->hasOption('js.lib.uri')) |
|
| 77 | 77 | { |
| 78 | 78 | // return 'https://cdn.jsdelivr.net/jaxon/1.2.0/'; |
| 79 | 79 | return 'https://cdn.jsdelivr.net/gh/jaxon-php/[email protected]/dist/'; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | // The jsDelivr CDN only hosts minified files |
| 97 | 97 | // if(($this->getOption('js.app.minify')) || substr($this->getJsLibUri(), 0, $nLen) == $jsDelivrUri) |
| 98 | 98 | // Starting from version 2.0.0 of the js lib, the jsDelivr CDN also hosts non minified files. |
| 99 | - if(($this->getOption('js.app.minify'))) |
|
| 99 | + if (($this->getOption('js.app.minify'))) |
|
| 100 | 100 | { |
| 101 | 101 | return '.min.js'; |
| 102 | 102 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | // Check config options |
| 114 | 114 | // - The js.app.extern option must be set to true |
| 115 | 115 | // - The js.app.uri and js.app.dir options must be set to non null values |
| 116 | - if(!$this->getOption('js.app.extern') || |
|
| 116 | + if (!$this->getOption('js.app.extern') || |
|
| 117 | 117 | !$this->getOption('js.app.uri') || |
| 118 | 118 | !$this->getOption('js.app.dir')) |
| 119 | 119 | { |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | // Check dir access |
| 123 | 123 | // - The js.app.dir must be writable |
| 124 | 124 | $sJsAppDir = $this->getOption('js.app.dir'); |
| 125 | - if(!is_dir($sJsAppDir) || !is_writable($sJsAppDir)) |
|
| 125 | + if (!is_dir($sJsAppDir) || !is_writable($sJsAppDir)) |
|
| 126 | 126 | { |
| 127 | 127 | return false; |
| 128 | 128 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | private function setTemplateCacheDir() |
| 138 | 138 | { |
| 139 | - if($this->hasOption('core.template.cache_dir')) |
|
| 139 | + if ($this->hasOption('core.template.cache_dir')) |
|
| 140 | 140 | { |
| 141 | 141 | $this->setCacheDir($this->getOption('core.template.cache_dir')); |
| 142 | 142 | } |
@@ -150,11 +150,11 @@ discard block |
||
| 150 | 150 | private function generateHash() |
| 151 | 151 | { |
| 152 | 152 | $sHash = jaxon()->getVersion(); |
| 153 | - foreach($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
| 153 | + foreach ($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
| 154 | 154 | { |
| 155 | 155 | $sHash .= $xPlugin->generateHash(); |
| 156 | 156 | } |
| 157 | - foreach($this->xPluginManager->getResponsePlugins() as $xPlugin) |
|
| 157 | + foreach ($this->xPluginManager->getResponsePlugins() as $xPlugin) |
|
| 158 | 158 | { |
| 159 | 159 | $sHash .= $xPlugin->generateHash(); |
| 160 | 160 | } |
@@ -168,49 +168,49 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | private function makePluginsCode() |
| 170 | 170 | { |
| 171 | - if($this->sCssCode === null || $this->sJsCode === null || $this->sJsReady === null) |
|
| 171 | + if ($this->sCssCode === null || $this->sJsCode === null || $this->sJsReady === null) |
|
| 172 | 172 | { |
| 173 | 173 | $this->sCssCode = ''; |
| 174 | 174 | $this->sJsCode = ''; |
| 175 | 175 | $this->sJsReady = ''; |
| 176 | - foreach($this->xPluginManager->getResponsePlugins() as $xPlugin) |
|
| 176 | + foreach ($this->xPluginManager->getResponsePlugins() as $xPlugin) |
|
| 177 | 177 | { |
| 178 | - if(($sCssCode = trim($xPlugin->getCss()))) |
|
| 178 | + if (($sCssCode = trim($xPlugin->getCss()))) |
|
| 179 | 179 | { |
| 180 | 180 | $this->sCssCode .= rtrim($sCssCode, " \n") . "\n"; |
| 181 | 181 | } |
| 182 | - if(($sJsCode = trim($xPlugin->getJs()))) |
|
| 182 | + if (($sJsCode = trim($xPlugin->getJs()))) |
|
| 183 | 183 | { |
| 184 | 184 | $this->sJsCode .= rtrim($sJsCode, " \n") . "\n"; |
| 185 | 185 | } |
| 186 | - if(($sJsReady = trim($xPlugin->getScript()))) |
|
| 186 | + if (($sJsReady = trim($xPlugin->getScript()))) |
|
| 187 | 187 | { |
| 188 | 188 | $this->sJsReady .= trim($sJsReady, " \n") . "\n"; |
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | $this->sJsReady = $this->render('jaxon::plugins/ready.js', ['sPluginScript' => $this->sJsReady]); |
| 193 | - foreach($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
| 193 | + foreach ($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
| 194 | 194 | { |
| 195 | - if(($sJsReady = trim($xPlugin->getScript()))) |
|
| 195 | + if (($sJsReady = trim($xPlugin->getScript()))) |
|
| 196 | 196 | { |
| 197 | 197 | $this->sJsReady .= trim($sJsReady, " \n") . "\n"; |
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - foreach($this->xPluginManager->getPackages() as $sClass) |
|
| 201 | + foreach ($this->xPluginManager->getPackages() as $sClass) |
|
| 202 | 202 | { |
| 203 | 203 | $xPackage = jaxon()->di()->get($sClass); |
| 204 | - if(($sCssCode = trim($xPackage->css()))) |
|
| 204 | + if (($sCssCode = trim($xPackage->css()))) |
|
| 205 | 205 | { |
| 206 | 206 | $this->sCssCode .= rtrim($sCssCode, " \n") . "\n"; |
| 207 | 207 | } |
| 208 | - if(($sJsCode = trim($xPackage->js()))) |
|
| 208 | + if (($sJsCode = trim($xPackage->js()))) |
|
| 209 | 209 | { |
| 210 | 210 | $this->sJsCode .= rtrim($sJsCode, " \n") . "\n"; |
| 211 | 211 | } |
| 212 | 212 | $xPackage = jaxon()->di()->get($sClass); |
| 213 | - if(($sJsReady = trim($xPackage->ready()))) |
|
| 213 | + if (($sJsReady = trim($xPackage->ready()))) |
|
| 214 | 214 | { |
| 215 | 215 | $this->sJsReady .= trim($sJsReady, " \n") . "\n"; |
| 216 | 216 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | // Add component files to the javascript file array; |
| 236 | 236 | $aJsFiles = array($sJsCoreUrl); |
| 237 | - if($this->getOption('core.debug.on')) |
|
| 237 | + if ($this->getOption('core.debug.on')) |
|
| 238 | 238 | { |
| 239 | 239 | $aJsFiles[] = $sJsDebugUrl; |
| 240 | 240 | $aJsFiles[] = $sJsLanguageUrl; |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | $this->setTemplateCacheDir(); |
| 330 | 330 | $this->makePluginsCode(); |
| 331 | 331 | |
| 332 | - if($this->canExportJavascript()) |
|
| 332 | + if ($this->canExportJavascript()) |
|
| 333 | 333 | { |
| 334 | 334 | $sJsAppURI = rtrim($this->getOption('js.app.uri'), '/') . '/'; |
| 335 | 335 | $sJsAppDir = rtrim($this->getOption('js.app.dir'), '/') . '/'; |
@@ -338,13 +338,13 @@ discard block |
||
| 338 | 338 | $sHash = $this->generateHash(); |
| 339 | 339 | $sOutFile = $sHash . '.js'; |
| 340 | 340 | $sMinFile = $sHash . '.min.js'; |
| 341 | - if(!is_file($sJsAppDir . $sOutFile)) |
|
| 341 | + if (!is_file($sJsAppDir . $sOutFile)) |
|
| 342 | 342 | { |
| 343 | 343 | file_put_contents($sJsAppDir . $sOutFile, $this->_getScript()); |
| 344 | 344 | } |
| 345 | - if(($this->getOption('js.app.minify')) && !is_file($sJsAppDir . $sMinFile)) |
|
| 345 | + if (($this->getOption('js.app.minify')) && !is_file($sJsAppDir . $sMinFile)) |
|
| 346 | 346 | { |
| 347 | - if(($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile))) |
|
| 347 | + if (($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile))) |
|
| 348 | 348 | { |
| 349 | 349 | $sOutFile = $sMinFile; |
| 350 | 350 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | public static function getInstance() |
| 50 | 50 | { |
| 51 | - if(!self::$xInstance) |
|
| 51 | + if (!self::$xInstance) |
|
| 52 | 52 | { |
| 53 | 53 | self::$xInstance = new Container(); |
| 54 | 54 | } |
@@ -108,15 +108,15 @@ discard block |
||
| 108 | 108 | * Core library objects |
| 109 | 109 | */ |
| 110 | 110 | // Jaxon Core |
| 111 | - $this->coreContainer[Jaxon::class] = function () { |
|
| 111 | + $this->coreContainer[Jaxon::class] = function() { |
|
| 112 | 112 | return new Jaxon(); |
| 113 | 113 | }; |
| 114 | 114 | // Global Response |
| 115 | - $this->coreContainer[Response::class] = function () { |
|
| 115 | + $this->coreContainer[Response::class] = function() { |
|
| 116 | 116 | return new Response(); |
| 117 | 117 | }; |
| 118 | 118 | // Dialog |
| 119 | - $this->coreContainer[Dialog::class] = function () { |
|
| 119 | + $this->coreContainer[Dialog::class] = function() { |
|
| 120 | 120 | return new Dialog(); |
| 121 | 121 | }; |
| 122 | 122 | |
@@ -124,37 +124,37 @@ discard block |
||
| 124 | 124 | * Managers |
| 125 | 125 | */ |
| 126 | 126 | // Callable objects repository |
| 127 | - $this->coreContainer[CallableRepository::class] = function () { |
|
| 127 | + $this->coreContainer[CallableRepository::class] = function() { |
|
| 128 | 128 | return new CallableRepository(); |
| 129 | 129 | }; |
| 130 | 130 | // Plugin Manager |
| 131 | - $this->coreContainer[PluginManager::class] = function () { |
|
| 131 | + $this->coreContainer[PluginManager::class] = function() { |
|
| 132 | 132 | return new PluginManager(); |
| 133 | 133 | }; |
| 134 | 134 | // Request Handler |
| 135 | - $this->coreContainer[RequestHandler::class] = function ($c) { |
|
| 135 | + $this->coreContainer[RequestHandler::class] = function($c) { |
|
| 136 | 136 | return new RequestHandler($c[PluginManager::class]); |
| 137 | 137 | }; |
| 138 | 138 | // Request Factory |
| 139 | - $this->coreContainer[RequestFactory::class] = function ($c) { |
|
| 139 | + $this->coreContainer[RequestFactory::class] = function($c) { |
|
| 140 | 140 | return new RequestFactory($c[CallableRepository::class]); |
| 141 | 141 | }; |
| 142 | 142 | // Response Manager |
| 143 | - $this->coreContainer[ResponseManager::class] = function () { |
|
| 143 | + $this->coreContainer[ResponseManager::class] = function() { |
|
| 144 | 144 | return new ResponseManager(); |
| 145 | 145 | }; |
| 146 | 146 | // Code Generator |
| 147 | - $this->coreContainer[CodeGenerator::class] = function ($c) { |
|
| 147 | + $this->coreContainer[CodeGenerator::class] = function($c) { |
|
| 148 | 148 | return new CodeGenerator($c[PluginManager::class]); |
| 149 | 149 | }; |
| 150 | 150 | |
| 151 | 151 | /* |
| 152 | 152 | * Config |
| 153 | 153 | */ |
| 154 | - $this->coreContainer[Config::class] = function () { |
|
| 154 | + $this->coreContainer[Config::class] = function() { |
|
| 155 | 155 | return new Config(); |
| 156 | 156 | }; |
| 157 | - $this->coreContainer[ConfigReader::class] = function () { |
|
| 157 | + $this->coreContainer[ConfigReader::class] = function() { |
|
| 158 | 158 | return new ConfigReader(); |
| 159 | 159 | }; |
| 160 | 160 | |
@@ -162,31 +162,31 @@ discard block |
||
| 162 | 162 | * Services |
| 163 | 163 | */ |
| 164 | 164 | // Minifier |
| 165 | - $this->coreContainer[Minifier::class] = function () { |
|
| 165 | + $this->coreContainer[Minifier::class] = function() { |
|
| 166 | 166 | return new Minifier(); |
| 167 | 167 | }; |
| 168 | 168 | // Translator |
| 169 | - $this->coreContainer[Translator::class] = function ($c) { |
|
| 169 | + $this->coreContainer[Translator::class] = function($c) { |
|
| 170 | 170 | return new Translator($c['jaxon.core.translation_dir'], $c[Config::class]); |
| 171 | 171 | }; |
| 172 | 172 | // Template engine |
| 173 | - $this->coreContainer[Template::class] = function ($c) { |
|
| 173 | + $this->coreContainer[Template::class] = function($c) { |
|
| 174 | 174 | return new Template($c['jaxon.core.template_dir']); |
| 175 | 175 | }; |
| 176 | 176 | // Validator |
| 177 | - $this->coreContainer[Validator::class] = function ($c) { |
|
| 177 | + $this->coreContainer[Validator::class] = function($c) { |
|
| 178 | 178 | return new Validator($c[Translator::class], $c[Config::class]); |
| 179 | 179 | }; |
| 180 | 180 | // Pagination Renderer |
| 181 | - $this->coreContainer[PaginationRenderer::class] = function ($c) { |
|
| 181 | + $this->coreContainer[PaginationRenderer::class] = function($c) { |
|
| 182 | 182 | return new PaginationRenderer($c[Template::class]); |
| 183 | 183 | }; |
| 184 | 184 | // Pagination Paginator |
| 185 | - $this->coreContainer[Paginator::class] = function ($c) { |
|
| 185 | + $this->coreContainer[Paginator::class] = function($c) { |
|
| 186 | 186 | return new Paginator($c[PaginationRenderer::class]); |
| 187 | 187 | }; |
| 188 | 188 | // Event Dispatcher |
| 189 | - $this->coreContainer[EventDispatcher::class] = function () { |
|
| 189 | + $this->coreContainer[EventDispatcher::class] = function() { |
|
| 190 | 190 | return new EventDispatcher(); |
| 191 | 191 | }; |
| 192 | 192 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | public function get($sClass) |
| 207 | 207 | { |
| 208 | - if($this->sentryContainer != null && $this->sentryContainer->has($sClass)) |
|
| 208 | + if ($this->sentryContainer != null && $this->sentryContainer->has($sClass)) |
|
| 209 | 209 | { |
| 210 | 210 | return $this->sentryContainer->get($sClass); |
| 211 | 211 | } |
@@ -500,14 +500,14 @@ discard block |
||
| 500 | 500 | $this->coreContainer['jaxon.sentry.view.base.' . $sId] = $xClosure; |
| 501 | 501 | |
| 502 | 502 | // Return the initialized view renderer |
| 503 | - $this->coreContainer['jaxon.sentry.view.' . $sId] = function ($c) use ($sId) { |
|
| 503 | + $this->coreContainer['jaxon.sentry.view.' . $sId] = function($c) use ($sId) { |
|
| 504 | 504 | // Get the defined renderer |
| 505 | 505 | $renderer = $c['jaxon.sentry.view.base.' . $sId]; |
| 506 | 506 | // Init the renderer with the template namespaces |
| 507 | 507 | $aNamespaces = $this->coreContainer['jaxon.view.data.namespaces']; |
| 508 | - if(key_exists($sId, $aNamespaces)) |
|
| 508 | + if (key_exists($sId, $aNamespaces)) |
|
| 509 | 509 | { |
| 510 | - foreach($aNamespaces[$sId] as $ns) |
|
| 510 | + foreach ($aNamespaces[$sId] as $ns) |
|
| 511 | 511 | { |
| 512 | 512 | $renderer->addNamespace($ns['namespace'], $ns['directory'], $ns['extension']); |
| 513 | 513 | } |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | */ |
| 526 | 526 | public function getViewRenderer($sId = '') |
| 527 | 527 | { |
| 528 | - if(!$sId) |
|
| 528 | + if (!$sId) |
|
| 529 | 529 | { |
| 530 | 530 | // Return the view renderer facade |
| 531 | 531 | return $this->coreContainer[\Jaxon\Sentry\View\Facade::class]; |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | protected function alert($message) |
| 27 | 27 | { |
| 28 | - if($this->getReturn()) |
|
| 28 | + if ($this->getReturn()) |
|
| 29 | 29 | { |
| 30 | 30 | return 'alert(' . $message . ')'; |
| 31 | 31 | } |