@@ -115,7 +115,7 @@ |
||
| 115 | 115 | * |
| 116 | 116 | * @access public |
| 117 | 117 | * @param string $key |
| 118 | - * @param mixed $value |
|
| 118 | + * @param string $value |
|
| 119 | 119 | */ |
| 120 | 120 | public function setData($key, $value) |
| 121 | 121 | { |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | $target = $this->buildUrlWitOrigin($target); |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - header("Location: " . $target, true, $headerCode); |
|
| 233 | + header("Location: ".$target, true, $headerCode); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /** |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | return false; |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | - $message = $this->request->getProtocol() . ' ' . $code . ' ' . $codes[$code]; |
|
| 331 | + $message = $this->request->getProtocol().' '.$code.' '.$codes[$code]; |
|
| 332 | 332 | header($message, true, $code); |
| 333 | 333 | |
| 334 | 334 | if ($resetOutput) { |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | protected function buildUrlWithOrigin($target) |
| 360 | 360 | { |
| 361 | 361 | $origin = $this->request->getFullRoute(); |
| 362 | - $additionalQuery = '_origin=' . base64_encode($origin); |
|
| 362 | + $additionalQuery = '_origin='.base64_encode($origin); |
|
| 363 | 363 | |
| 364 | 364 | $parts = parse_url($target); |
| 365 | 365 | |
@@ -376,7 +376,7 @@ |
||
| 376 | 376 | * |
| 377 | 377 | * @access public |
| 378 | 378 | * @param string $className |
| 379 | - * @return mixed |
|
| 379 | + * @return Backend\ObjectBackendAbstract |
|
| 380 | 380 | * |
| 381 | 381 | * @throws \Zepi\Turbo\Exception Cannot find the module for the given class name. |
| 382 | 382 | * @throws \Zepi\Turbo\Exception Instance isn't an object! |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | public static function prepareClassName($className) |
| 304 | 304 | { |
| 305 | 305 | if (substr($className, 0, 1) !== '\\') { |
| 306 | - $className = '\\' . $className; |
|
| 306 | + $className = '\\'.$className; |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | return $className; |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | public static function prepareNamespace($namespace) |
| 322 | 322 | { |
| 323 | 323 | if (substr($namespace, 0, 1) !== '\\') { |
| 324 | - $namespace = '\\' . $namespace; |
|
| 324 | + $namespace = '\\'.$namespace; |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | if (substr($namespace, -1) !== '\\') { |
@@ -348,24 +348,24 @@ discard block |
||
| 348 | 348 | $className = self::prepareClassName($className); |
| 349 | 349 | |
| 350 | 350 | if (strpos($className, '\\Zepi\\Turbo\\') === 0) { |
| 351 | - $sourceDirectory = realpath(__DIR__ . '/../../'); |
|
| 351 | + $sourceDirectory = realpath(__DIR__.'/../../'); |
|
| 352 | 352 | |
| 353 | 353 | // The class is from the framework, so we load the class file from the framework directory |
| 354 | - $path = $sourceDirectory . str_replace('\\', '/', $className) . '.php'; |
|
| 354 | + $path = $sourceDirectory.str_replace('\\', '/', $className).'.php'; |
|
| 355 | 355 | } else { |
| 356 | 356 | // The class isn't from the framework, so we need the module for the given class name |
| 357 | 357 | $module = $this->moduleManager->getModuleByClassName($className); |
| 358 | 358 | |
| 359 | 359 | if ($module !== false) { |
| 360 | 360 | $fileName = substr($className, strlen($module->getNamespace())); |
| 361 | - $path = $module->getDirectory() . '/src/' . str_replace('\\', '/', $fileName) . '.php'; |
|
| 361 | + $path = $module->getDirectory().'/src/'.str_replace('\\', '/', $fileName).'.php'; |
|
| 362 | 362 | } |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | if ($path !== false && file_exists($path)) { |
| 366 | 366 | require_once($path); |
| 367 | 367 | } else if ($module !== false) { |
| 368 | - throw new Exception('Cannot find the class "' . $className . '"!'); |
|
| 368 | + throw new Exception('Cannot find the class "'.$className.'"!'); |
|
| 369 | 369 | } |
| 370 | 370 | } |
| 371 | 371 | |
@@ -391,14 +391,14 @@ discard block |
||
| 391 | 391 | $module = $this->moduleManager->getModuleByClassName($className); |
| 392 | 392 | |
| 393 | 393 | if ($module === false) { |
| 394 | - throw new Exception('Cannot find the module for the given class name "' . $className . '".'); |
|
| 394 | + throw new Exception('Cannot find the module for the given class name "'.$className.'".'); |
|
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | $instance = $module->getInstance($className); |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | if (!is_object($instance)) { |
| 401 | - throw new Exception('Instance for class name "' . $className . '" isn\'t an object!'); |
|
| 401 | + throw new Exception('Instance for class name "'.$className.'" isn\'t an object!'); |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | return $instance; |
@@ -419,26 +419,26 @@ discard block |
||
| 419 | 419 | |
| 420 | 420 | switch ($className) { |
| 421 | 421 | case '\\Zepi\\Turbo\\Backend\\VirtualModuleBackend': |
| 422 | - $path = $this->rootDirectory . '/data/modules.data'; |
|
| 422 | + $path = $this->rootDirectory.'/data/modules.data'; |
|
| 423 | 423 | return new \Zepi\Turbo\Backend\FileObjectBackend($path); |
| 424 | 424 | break; |
| 425 | 425 | case '\\Zepi\\Turbo\\Backend\\VirtualHandlerBackend': |
| 426 | - $path = $this->rootDirectory . '/data/handlers.data'; |
|
| 426 | + $path = $this->rootDirectory.'/data/handlers.data'; |
|
| 427 | 427 | return new \Zepi\Turbo\Backend\FileObjectBackend($path); |
| 428 | 428 | break; |
| 429 | 429 | case '\\Zepi\\Turbo\\Backend\\VirtualRouteBackend': |
| 430 | - $path = $this->rootDirectory . '/data/routes.data'; |
|
| 430 | + $path = $this->rootDirectory.'/data/routes.data'; |
|
| 431 | 431 | return new \Zepi\Turbo\Backend\FileObjectBackend($path); |
| 432 | 432 | break; |
| 433 | 433 | case '\\Zepi\\Turbo\\Backend\\VirtualDataSourceBackend': |
| 434 | - $path = $this->rootDirectory . '/data/data-sources.data'; |
|
| 434 | + $path = $this->rootDirectory.'/data/data-sources.data'; |
|
| 435 | 435 | return new \Zepi\Turbo\Backend\FileObjectBackend($path); |
| 436 | 436 | break; |
| 437 | 437 | default: |
| 438 | 438 | if (class_exists($className, true)) { |
| 439 | 439 | return new $className(); |
| 440 | 440 | } else { |
| 441 | - throw new Exception('Class "' . $className . '" is not defined.'); |
|
| 441 | + throw new Exception('Class "'.$className.'" is not defined.'); |
|
| 442 | 442 | } |
| 443 | 443 | break; |
| 444 | 444 | } |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | protected function saveSerializedObject($serializedObject) |
| 74 | 74 | { |
| 75 | 75 | if (file_exists($this->path) && !is_writable($this->path)) { |
| 76 | - throw new Exception('The file "' . $this->path . '" isn\'t writable!'); |
|
| 76 | + throw new Exception('The file "'.$this->path.'" isn\'t writable!'); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | return file_put_contents($this->path, $serializedObject); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | // If the file exists but isn't writeable we need to throw an exception |
| 82 | 82 | if (file_exists($path) && !is_writable($path)) { |
| 83 | - throw new Exception('The file "' . $path . '" isn\'t writable!'); |
|
| 83 | + throw new Exception('The file "'.$path.'" isn\'t writable!'); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | return file_put_contents($path, $content); |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | if (substr($additionalPath, 0, 1) === '/') { |
| 155 | 155 | $path = $additionalPath; |
| 156 | 156 | } else if ($additionalPath !== '') { |
| 157 | - $path = $this->path . $additionalPath; |
|
| 157 | + $path = $this->path.$additionalPath; |
|
| 158 | 158 | } else { |
| 159 | 159 | $path = $this->path; |
| 160 | 160 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | if (!is_readable($path) && !is_writeable($path)) { |
| 182 | - throw new Exception('The file path "' . $path . '" is not readable and not writeable!'); |
|
| 182 | + throw new Exception('The file path "'.$path.'" is not readable and not writeable!'); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | return $path; |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | $directory = dirname($path); |
| 199 | 199 | if (!file_exists($directory)) { |
| 200 | 200 | if (!is_writeable($this->getExistingPath($directory))) { |
| 201 | - throw new Exception('The directory "' . $directory . '" isn\'t writeable!'); |
|
| 201 | + throw new Exception('The directory "'.$directory.'" isn\'t writeable!'); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | mkdir($directory, 0755, true); |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | // Search the path for the module and initialize it |
| 186 | 186 | $path = $this->searchModulePath($namespace); |
| 187 | 187 | if ($path === false) { |
| 188 | - throw new Exception('Can not find the module "' . $namespace . '".'); |
|
| 188 | + throw new Exception('Can not find the module "'.$namespace.'".'); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | // Get the version |
@@ -308,11 +308,11 @@ discard block |
||
| 308 | 308 | */ |
| 309 | 309 | protected function parseModuleJson($path) |
| 310 | 310 | { |
| 311 | - if (!file_exists($path . '/Module.json')) { |
|
| 312 | - throw new Exception('Cannot find Module.json in the path "' . $path . '".'); |
|
| 311 | + if (!file_exists($path.'/Module.json')) { |
|
| 312 | + throw new Exception('Cannot find Module.json in the path "'.$path.'".'); |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | - $moduleProperties = json_decode(file_get_contents($path . '/Module.json')); |
|
| 315 | + $moduleProperties = json_decode(file_get_contents($path.'/Module.json')); |
|
| 316 | 316 | |
| 317 | 317 | return $moduleProperties; |
| 318 | 318 | } |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | $moduleProperties = $this->parseModuleJson($path); |
| 332 | 332 | |
| 333 | 333 | if (!isset($moduleProperties->module->namespace)) { |
| 334 | - throw new Exception('The namespace is not set in the module properties for the module in "' . $path . '".'); |
|
| 334 | + throw new Exception('The namespace is not set in the module properties for the module in "'.$path.'".'); |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | return Framework::prepareNamespace($moduleProperties->module->namespace); |
@@ -360,16 +360,16 @@ discard block |
||
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | // Try to find and load the module |
| 363 | - if (!file_exists($path . '/Module.php')) { |
|
| 364 | - throw new Exception('The module "' . $path . '" is not valid!'); |
|
| 363 | + if (!file_exists($path.'/Module.php')) { |
|
| 364 | + throw new Exception('The module "'.$path.'" is not valid!'); |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | // Look for dependencies and warn the user or activate the dependencies |
| 368 | 368 | $this->handleModuleDependencies($moduleNamespace, $path, $activateDependencies); |
| 369 | 369 | |
| 370 | 370 | // Load the module |
| 371 | - require_once($path . '/Module.php'); |
|
| 372 | - $moduleClassName = Framework::prepareClassName($moduleNamespace . 'Module'); |
|
| 371 | + require_once($path.'/Module.php'); |
|
| 372 | + $moduleClassName = Framework::prepareClassName($moduleNamespace.'Module'); |
|
| 373 | 373 | |
| 374 | 374 | // Initialize the module |
| 375 | 375 | $module = new $moduleClassName($this->framework, $moduleNamespace, $path); |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | if ($activateDependencies) { |
| 429 | 429 | $this->activateModule($dependencyModuleNamespace, $activateDependencies); |
| 430 | 430 | } else { |
| 431 | - throw new Exception('Can not activate the module "' . $moduleNamespace . '". The module requires the module "' . $dependencyModuleNamespace . '" which isn\'t activated.'); |
|
| 431 | + throw new Exception('Can not activate the module "'.$moduleNamespace.'". The module requires the module "'.$dependencyModuleNamespace.'" which isn\'t activated.'); |
|
| 432 | 432 | } |
| 433 | 433 | } |
| 434 | 434 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | // Generate the full url and extract the base |
| 169 | 169 | $scheme = $this->getScheme(); |
| 170 | - $fullUrl = $scheme . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
|
| 170 | + $fullUrl = $scheme.'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |
|
| 171 | 171 | |
| 172 | 172 | $isSsl = false; |
| 173 | 173 | if ($scheme == 'https') { |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | { |
| 248 | 248 | $scheme = $this->getScheme(); |
| 249 | 249 | |
| 250 | - return $scheme . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
|
| 250 | + return $scheme.'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /** |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | if ($locale == '') { |
| 303 | 303 | $locale = 'en_US'; |
| 304 | 304 | } else if (strpos($locale, '_') === false) { |
| 305 | - $locale = $locale . '_' . strtoupper($locale); |
|
| 305 | + $locale = $locale.'_'.strtoupper($locale); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | return $locale; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | // If the class does not implement the DataSourceInterface we cannot use |
| 164 | 164 | // this class as DataSource |
| 165 | 165 | if (!isset($implementedClasses[$frameworkDataSourceInterface])) { |
| 166 | - throw new Exception('Data Source "' . $className . '" does not implement the DataSourceInterface.'); |
|
| 166 | + throw new Exception('Data Source "'.$className.'" does not implement the DataSourceInterface.'); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | // Remove the framework interface |
@@ -227,14 +227,14 @@ discard block |
||
| 227 | 227 | |
| 228 | 228 | // If there is no driver for the given type class throw an exception |
| 229 | 229 | if ($driver === false) { |
| 230 | - throw new Exception('Cannot find a driver for the given type class "' . $typeClass . '".'); |
|
| 230 | + throw new Exception('Cannot find a driver for the given type class "'.$typeClass.'".'); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | $dataSourceClass = $this->searchDataSourceClass($typeClass, $driver); |
| 234 | 234 | |
| 235 | 235 | // If there is no data source class for the given type class throw an exception |
| 236 | 236 | if ($dataSourceClass === false) { |
| 237 | - throw new Exception('Cannot find a data source for the given type class "' . $typeClass . '" (selected driver: "' . $driver . '").'); |
|
| 237 | + throw new Exception('Cannot find a data source for the given type class "'.$typeClass.'" (selected driver: "'.$driver.'").'); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | return $this->framework->getInstance($dataSourceClass); |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | $this->routeParams[] = $param; |
| 194 | 194 | |
| 195 | 195 | if ($key != '') { |
| 196 | - $this->routeParams[$key]= $param; |
|
| 196 | + $this->routeParams[$key] = $param; |
|
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | $delimiter = $this->getRouteDelimiter(); |
| 257 | 257 | if (substr($routePart, 0, strlen($delimiter)) !== $delimiter) { |
| 258 | - $routePart = $delimiter . $routePart; |
|
| 258 | + $routePart = $delimiter.$routePart; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | $posPoint = strrpos($routePart, '.'); |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | $routePart .= $delimiter; |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | - return $this->base . $routePart; |
|
| 266 | + return $this->base.$routePart; |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /** |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | if ($parameterValue === null) { |
| 100 | - throw new Exception('Cannot find correct value for parameter "' . $parameter->name . '" in class "' . $className . '".'); |
|
| 100 | + throw new Exception('Cannot find correct value for parameter "'.$parameter->name.'" in class "'.$className.'".'); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | $parameters[] = $parameterValue; |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | break; |
| 190 | 190 | |
| 191 | 191 | default: |
| 192 | - throw new Exception('Cannot find framework manager "' . $className . '".'); |
|
| 192 | + throw new Exception('Cannot find framework manager "'.$className.'".'); |
|
| 193 | 193 | break; |
| 194 | 194 | } |
| 195 | 195 | } |