@@ -164,7 +164,7 @@ |
||
| 164 | 164 | } |
| 165 | 165 | else |
| 166 | 166 | { |
| 167 | - // Use underscore as separator, so there's no need to deal with namespace |
|
| 167 | + // Use underscore as separator, so there's no need to deal with namespace |
|
| 168 | 168 | // when generating javascript code. |
| 169 | 169 | $aOptions['separator'] = '_'; |
| 170 | 170 | $aOptions['autoload'] = $this->bAutoloadEnabled; |
@@ -105,33 +105,33 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public function register($sType, $sDirectory, $aOptions) |
| 107 | 107 | { |
| 108 | - if($sType != $this->getName()) |
|
| 108 | + if ($sType != $this->getName()) |
|
| 109 | 109 | { |
| 110 | 110 | return false; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if(!is_string($sDirectory) || !is_dir($sDirectory)) |
|
| 113 | + if (!is_string($sDirectory) || !is_dir($sDirectory)) |
|
| 114 | 114 | { |
| 115 | 115 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration')); |
| 116 | 116 | } |
| 117 | - if(is_string($aOptions)) |
|
| 117 | + if (is_string($aOptions)) |
|
| 118 | 118 | { |
| 119 | 119 | $aOptions = ['namespace' => $aOptions]; |
| 120 | 120 | } |
| 121 | - if(!is_array($aOptions)) |
|
| 121 | + if (!is_array($aOptions)) |
|
| 122 | 122 | { |
| 123 | 123 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration')); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $sDirectory = rtrim(trim($sDirectory), DIRECTORY_SEPARATOR); |
| 127 | - if(!is_dir($sDirectory)) |
|
| 127 | + if (!is_dir($sDirectory)) |
|
| 128 | 128 | { |
| 129 | 129 | return false; |
| 130 | 130 | } |
| 131 | 131 | $aOptions['directory'] = $sDirectory; |
| 132 | 132 | |
| 133 | 133 | $sNamespace = key_exists('namespace', $aOptions) ? $aOptions['namespace'] : ''; |
| 134 | - if(!($sNamespace = trim($sNamespace, ' \\'))) |
|
| 134 | + if (!($sNamespace = trim($sNamespace, ' \\'))) |
|
| 135 | 135 | { |
| 136 | 136 | $sNamespace = ''; |
| 137 | 137 | } |
@@ -145,17 +145,17 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | // Change the keys in $aOptions to have "\" as separator |
| 147 | 147 | $_aOptions = []; |
| 148 | - foreach($aOptions as $sName => $aOption) |
|
| 148 | + foreach ($aOptions as $sName => $aOption) |
|
| 149 | 149 | { |
| 150 | 150 | $sName = trim(str_replace('.', '\\', $sName), ' \\'); |
| 151 | 151 | $_aOptions[$sName] = $aOption; |
| 152 | 152 | } |
| 153 | 153 | $aOptions = $_aOptions; |
| 154 | 154 | |
| 155 | - if(($sNamespace)) |
|
| 155 | + if (($sNamespace)) |
|
| 156 | 156 | { |
| 157 | 157 | // Register the dir with PSR4 autoloading |
| 158 | - if(($this->xAutoloader)) |
|
| 158 | + if (($this->xAutoloader)) |
|
| 159 | 159 | { |
| 160 | 160 | $this->xAutoloader->setPsr4($sNamespace . '\\', $sDirectory); |
| 161 | 161 | } |
@@ -161,8 +161,7 @@ |
||
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | $this->xRepository->addNamespace($sNamespace, $aOptions); |
| 164 | - } |
|
| 165 | - else |
|
| 164 | + } else |
|
| 166 | 165 | { |
| 167 | 166 | // Use underscore as separator, so there's no need to deal with namespace |
| 168 | 167 | // when generating javascript code. |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | /** |
| 56 | 56 | * The class constructor |
| 57 | 57 | * |
| 58 | - * @param CallableRepository $repository |
|
| 58 | + * @param CallableRepository $xRepository |
|
| 59 | 59 | */ |
| 60 | 60 | public function __construct(CallableRepository $xRepository) |
| 61 | 61 | { |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | /** |
| 43 | 43 | * The class constructor |
| 44 | 44 | * |
| 45 | - * @param CallableRepository $repository |
|
| 45 | + * @param CallableRepository $xRepository |
|
| 46 | 46 | */ |
| 47 | 47 | public function __construct(CallableRepository $xRepository) |
| 48 | 48 | { |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * |
| 55 | 55 | * @param string|null $sClass The callable class |
| 56 | 56 | * |
| 57 | - * @return Factory |
|
| 57 | + * @return Request |
|
| 58 | 58 | */ |
| 59 | 59 | public function setClassName($sClass) |
| 60 | 60 | { |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * |
| 83 | 83 | * @param CallableObject $xCallable The callable object |
| 84 | 84 | * |
| 85 | - * @return Factory |
|
| 85 | + * @return Request |
|
| 86 | 86 | */ |
| 87 | 87 | public function setCallable(CallableObject $xCallable) |
| 88 | 88 | { |
@@ -95,7 +95,6 @@ discard block |
||
| 95 | 95 | * Return the javascript call to a Jaxon function or object method |
| 96 | 96 | * |
| 97 | 97 | * @param string $sFunction The function or method (without class) name |
| 98 | - * @param ... $xParams The parameters of the function or method |
|
| 99 | 98 | * |
| 100 | 99 | * @return \Jaxon\Request\Request |
| 101 | 100 | */ |
@@ -124,7 +123,6 @@ discard block |
||
| 124 | 123 | * Return the javascript call to a generic function |
| 125 | 124 | * |
| 126 | 125 | * @param string $sFunction The function or method (with class) name |
| 127 | - * @param ... $xParams The parameters of the function or method |
|
| 128 | 126 | * |
| 129 | 127 | * @return \Jaxon\Request\Request |
| 130 | 128 | */ |
@@ -148,7 +146,6 @@ discard block |
||
| 148 | 146 | * @param integer $nItemsPerPage The number of items per page page |
| 149 | 147 | * @param integer $nCurrentPage The current page |
| 150 | 148 | * @param string $sMethod The name of function or a method prepended with its class name |
| 151 | - * @param ... $xParams The parameters of the function or method |
|
| 152 | 149 | * |
| 153 | 150 | * @return string the pagination links |
| 154 | 151 | */ |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | $this->sPrefix = $this->getOption('core.prefix.function'); |
| 62 | 62 | |
| 63 | 63 | $sClass = trim($sClass, '.\\ '); |
| 64 | - if(!$sClass) |
|
| 64 | + if (!$sClass) |
|
| 65 | 65 | { |
| 66 | 66 | return $this; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if(!($xCallable = $this->xRepository->getCallableObject($sClass))) |
|
| 69 | + if (!($xCallable = $this->xRepository->getCallableObject($sClass))) |
|
| 70 | 70 | { |
| 71 | 71 | // Todo: decide which of these values to return |
| 72 | 72 | // return null; |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | array_shift($aArguments); |
| 108 | 108 | |
| 109 | 109 | // Makes legacy code works |
| 110 | - if(strpos($sFunction, '.') !== false) |
|
| 110 | + if (strpos($sFunction, '.') !== false) |
|
| 111 | 111 | { |
| 112 | 112 | // If there is a dot in the name, then it is a call to a class |
| 113 | 113 | $this->sPrefix = $this->getOption('core.prefix.class'); |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | /** |
| 56 | 56 | * The class constructor |
| 57 | 57 | * |
| 58 | - * @param CallableRepository $repository |
|
| 58 | + * @param CallableRepository $xRepository |
|
| 59 | 59 | */ |
| 60 | 60 | public function __construct(CallableRepository $xRepository) |
| 61 | 61 | { |
@@ -61,19 +61,19 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | $this->xRepository = $xRepository; |
| 63 | 63 | |
| 64 | - if(!empty($_GET['jxncls'])) |
|
| 64 | + if (!empty($_GET['jxncls'])) |
|
| 65 | 65 | { |
| 66 | 66 | $this->sRequestedClass = $_GET['jxncls']; |
| 67 | 67 | } |
| 68 | - if(!empty($_GET['jxnmthd'])) |
|
| 68 | + if (!empty($_GET['jxnmthd'])) |
|
| 69 | 69 | { |
| 70 | 70 | $this->sRequestedMethod = $_GET['jxnmthd']; |
| 71 | 71 | } |
| 72 | - if(!empty($_POST['jxncls'])) |
|
| 72 | + if (!empty($_POST['jxncls'])) |
|
| 73 | 73 | { |
| 74 | 74 | $this->sRequestedClass = $_POST['jxncls']; |
| 75 | 75 | } |
| 76 | - if(!empty($_POST['jxnmthd'])) |
|
| 76 | + if (!empty($_POST['jxnmthd'])) |
|
| 77 | 77 | { |
| 78 | 78 | $this->sRequestedMethod = $_POST['jxnmthd']; |
| 79 | 79 | } |
@@ -100,20 +100,20 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function register($sType, $sClassName, $aOptions) |
| 102 | 102 | { |
| 103 | - if($sType != $this->getName()) |
|
| 103 | + if ($sType != $this->getName()) |
|
| 104 | 104 | { |
| 105 | 105 | return false; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - if(!is_string($sClassName)) |
|
| 108 | + if (!is_string($sClassName)) |
|
| 109 | 109 | { |
| 110 | 110 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration')); |
| 111 | 111 | } |
| 112 | - if(is_string($aOptions)) |
|
| 112 | + if (is_string($aOptions)) |
|
| 113 | 113 | { |
| 114 | 114 | $aOptions = ['include' => $aOptions]; |
| 115 | 115 | } |
| 116 | - if(!is_array($aOptions)) |
|
| 116 | + if (!is_array($aOptions)) |
|
| 117 | 117 | { |
| 118 | 118 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration')); |
| 119 | 119 | } |
@@ -151,13 +151,13 @@ discard block |
||
| 151 | 151 | public function canProcessRequest() |
| 152 | 152 | { |
| 153 | 153 | // Check the validity of the class name |
| 154 | - if($this->sRequestedClass !== null && !$this->validateClass($this->sRequestedClass)) |
|
| 154 | + if ($this->sRequestedClass !== null && !$this->validateClass($this->sRequestedClass)) |
|
| 155 | 155 | { |
| 156 | 156 | $this->sRequestedClass = null; |
| 157 | 157 | $this->sRequestedMethod = null; |
| 158 | 158 | } |
| 159 | 159 | // Check the validity of the method name |
| 160 | - if($this->sRequestedMethod !== null && !$this->validateMethod($this->sRequestedMethod)) |
|
| 160 | + if ($this->sRequestedMethod !== null && !$this->validateMethod($this->sRequestedMethod)) |
|
| 161 | 161 | { |
| 162 | 162 | $this->sRequestedClass = null; |
| 163 | 163 | $this->sRequestedMethod = null; |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | public function processRequest() |
| 174 | 174 | { |
| 175 | - if(!$this->canProcessRequest()) |
|
| 175 | + if (!$this->canProcessRequest()) |
|
| 176 | 176 | { |
| 177 | 177 | return false; |
| 178 | 178 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | // Find the requested method |
| 183 | 183 | $xCallableObject = $this->xRepository->getCallableObject($this->sRequestedClass); |
| 184 | - if(!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod)) |
|
| 184 | + if (!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod)) |
|
| 185 | 185 | { |
| 186 | 186 | // Unable to find the requested object or method |
| 187 | 187 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid', |