@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $path = realpath($path) ?: $path; |
| 131 | 131 | $tempPath = tempnam(dirname($path), basename($path)); |
| 132 | 132 | // Fix permissions of tempPath because `tempnam()` creates it with permissions set to 0600... |
| 133 | - chmod($tempPath, 0777 - umask()); |
|
| 133 | + chmod($tempPath, 0777-umask()); |
|
| 134 | 134 | file_put_contents($tempPath, $content); |
| 135 | 135 | rename($tempPath, $path); |
| 136 | 136 | } |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | $success = true; |
| 190 | 190 | foreach ($paths as $path) { |
| 191 | 191 | try { |
| 192 | - if (! @unlink($path)) { |
|
| 192 | + if (!@unlink($path)) { |
|
| 193 | 193 | $success = false; |
| 194 | 194 | } |
| 195 | 195 | } catch (ErrorException $e) { |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | */ |
| 233 | 233 | public function link($target, $link) |
| 234 | 234 | { |
| 235 | - if (! windows_os()) { |
|
| 235 | + if (!windows_os()) { |
|
| 236 | 236 | return symlink($target, $link); |
| 237 | 237 | } |
| 238 | 238 | $mode = $this->isDirectory($target) ? 'J' : 'H'; |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | public function files($directory, $hidden = false) |
| 394 | 394 | { |
| 395 | 395 | return iterator_to_array( |
| 396 | - Finder::create()->files()->ignoreDotFiles(! $hidden)->in($directory)->depth(0)->sortByName(), |
|
| 396 | + Finder::create()->files()->ignoreDotFiles(!$hidden)->in($directory)->depth(0)->sortByName(), |
|
| 397 | 397 | false |
| 398 | 398 | ); |
| 399 | 399 | } |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | public function allFiles($directory, $hidden = false) |
| 409 | 409 | { |
| 410 | 410 | return iterator_to_array( |
| 411 | - Finder::create()->files()->ignoreDotFiles(! $hidden)->in($directory)->sortByName(), |
|
| 411 | + Finder::create()->files()->ignoreDotFiles(!$hidden)->in($directory)->sortByName(), |
|
| 412 | 412 | false |
| 413 | 413 | ); |
| 414 | 414 | } |
@@ -455,10 +455,10 @@ discard block |
||
| 455 | 455 | */ |
| 456 | 456 | public function moveDirectory($from, $to, $overwrite = false) |
| 457 | 457 | { |
| 458 | - if ($overwrite && $this->isDirectory($to) && ! $this->deleteDirectory($to)) { |
|
| 458 | + if ($overwrite && $this->isDirectory($to) && !$this->deleteDirectory($to)) { |
|
| 459 | 459 | return false; |
| 460 | 460 | } |
| 461 | - return @rename($from, $to) === true; |
|
| 461 | + return @rename($from, $to)===true; |
|
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | /** |
@@ -471,14 +471,14 @@ discard block |
||
| 471 | 471 | */ |
| 472 | 472 | public function copyDirectory($directory, $destination, $options = null) |
| 473 | 473 | { |
| 474 | - if (! $this->isDirectory($directory)) { |
|
| 474 | + if (!$this->isDirectory($directory)) { |
|
| 475 | 475 | return false; |
| 476 | 476 | } |
| 477 | 477 | $options = $options ?: FilesystemIterator::SKIP_DOTS; |
| 478 | 478 | // If the destination directory does not actually exist, we will go ahead and |
| 479 | 479 | // create it recursively, which just gets the destination prepared to copy |
| 480 | 480 | // the files over. Once we make the directory we'll proceed the copying. |
| 481 | - if (! $this->isDirectory($destination)) { |
|
| 481 | + if (!$this->isDirectory($destination)) { |
|
| 482 | 482 | $this->makeDirectory($destination, 0777, true); |
| 483 | 483 | } |
| 484 | 484 | $items = new FilesystemIterator($directory, $options); |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | $target = $destination.'/'.$item->getBasename(); |
| 490 | 490 | if ($item->isDir()) { |
| 491 | 491 | $path = $item->getPathname(); |
| 492 | - if (! $this->copyDirectory($path, $target, $options)) { |
|
| 492 | + if (!$this->copyDirectory($path, $target, $options)) { |
|
| 493 | 493 | return false; |
| 494 | 494 | } |
| 495 | 495 | } |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | // location and keep looping. If for some reason the copy fails we'll bail out |
| 498 | 498 | // and return false, so the developer is aware that the copy process failed. |
| 499 | 499 | else { |
| 500 | - if (! $this->copy($item->getPathname(), $target)) { |
|
| 500 | + if (!$this->copy($item->getPathname(), $target)) { |
|
| 501 | 501 | return false; |
| 502 | 502 | } |
| 503 | 503 | } |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | */ |
| 517 | 517 | public function deleteDirectory($directory, $preserve = false) |
| 518 | 518 | { |
| 519 | - if (! $this->isDirectory($directory)) { |
|
| 519 | + if (!$this->isDirectory($directory)) { |
|
| 520 | 520 | return false; |
| 521 | 521 | } |
| 522 | 522 | $items = new FilesystemIterator($directory); |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | // If the item is a directory, we can just recurse into the function and |
| 525 | 525 | // delete that sub-directory otherwise we'll just delete the file and |
| 526 | 526 | // keep iterating through each file until the directory is cleaned. |
| 527 | - if ($item->isDir() && ! $item->isLink()) { |
|
| 527 | + if ($item->isDir() && !$item->isLink()) { |
|
| 528 | 528 | $this->deleteDirectory($item->getPathname()); |
| 529 | 529 | } |
| 530 | 530 | // If the item is just a file, we can go ahead and delete it since we're |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | $this->delete($item->getPathname()); |
| 535 | 535 | } |
| 536 | 536 | } |
| 537 | - if (! $preserve) { |
|
| 537 | + if (!$preserve) { |
|
| 538 | 538 | @rmdir($directory); |
| 539 | 539 | } |
| 540 | 540 | return true; |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | public function deleteDirectories($directory) |
| 550 | 550 | { |
| 551 | 551 | $allDirectories = $this->directories($directory); |
| 552 | - if (! empty($allDirectories)) { |
|
| 552 | + if (!empty($allDirectories)) { |
|
| 553 | 553 | foreach ($allDirectories as $directoryName) { |
| 554 | 554 | $this->deleteDirectory($directoryName); |
| 555 | 555 | } |
@@ -580,17 +580,17 @@ discard block |
||
| 580 | 580 | */ |
| 581 | 581 | public function getAllFilesInDirectory($dir, $recursive = true, $basedir = '', $include_dirs = false) |
| 582 | 582 | { |
| 583 | - if ($dir == '') {return array();} else {$results = array(); $subresults = array();} |
|
| 584 | - if (!is_dir($dir)) {$dir = dirname($dir);} // so a files path can be sent |
|
| 585 | - if ($basedir == '') {$basedir = realpath($dir).DIRECTORY_SEPARATOR;} |
|
| 583 | + if ($dir=='') {return array(); } else {$results = array(); $subresults = array(); } |
|
| 584 | + if (!is_dir($dir)) {$dir = dirname($dir); } // so a files path can be sent |
|
| 585 | + if ($basedir=='') {$basedir = realpath($dir).DIRECTORY_SEPARATOR; } |
|
| 586 | 586 | |
| 587 | 587 | $files = scandir($dir); |
| 588 | - foreach ($files as $key => $value){ |
|
| 589 | - if ( ($value != '.') && ($value != '..') ) { |
|
| 588 | + foreach ($files as $key => $value) { |
|
| 589 | + if (($value!='.') && ($value!='..')) { |
|
| 590 | 590 | $path = realpath($dir.DIRECTORY_SEPARATOR.$value); |
| 591 | 591 | if (is_dir($path)) { |
| 592 | 592 | // optionally include directories in file list |
| 593 | - if ($include_dirs) {$subresults[] = str_replace($basedir, '', $path);} |
|
| 593 | + if ($include_dirs) {$subresults[] = str_replace($basedir, '', $path); } |
|
| 594 | 594 | // optionally get file list for all subdirectories |
| 595 | 595 | if ($recursive) { |
| 596 | 596 | $subdirresults = $this->getAllFilesInDirectory($path, $recursive, $basedir, $include_dirs); |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | } |
| 604 | 604 | } |
| 605 | 605 | // merge the subarray to give the list of files then subdirectory files |
| 606 | - if (count($subresults) > 0) {$results = array_merge($subresults, $results);} |
|
| 606 | + if (count($subresults)>0) {$results = array_merge($subresults, $results); } |
|
| 607 | 607 | return $results; |
| 608 | 608 | } |
| 609 | 609 | } |
| 610 | 610 | \ No newline at end of file |
@@ -22,14 +22,14 @@ discard block |
||
| 22 | 22 | * @param ApplicationContracts $app |
| 23 | 23 | * @param array $result |
| 24 | 24 | */ |
| 25 | - public function __construct(ApplicationContracts $app,$result=array()) |
|
| 25 | + public function __construct(ApplicationContracts $app, $result = array()) |
|
| 26 | 26 | { |
| 27 | 27 | parent::__construct($app); |
| 28 | 28 | |
| 29 | 29 | $this->result = $result; |
| 30 | 30 | |
| 31 | - foreach($this->extender as $item){ |
|
| 32 | - if(method_exists($this,$item)){ |
|
| 31 | + foreach ($this->extender as $item) { |
|
| 32 | + if (method_exists($this, $item)) { |
|
| 33 | 33 | $this->{$item}(); |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | // we will look at the requestExpected container value to show |
| 56 | 56 | // the expected values for the request object in the exception output. |
| 57 | - if($this->app->has('requestExpected') && config('app.requestWithError')===true){ |
|
| 58 | - if($requestExpected = $this->app->get('requestExpected')){ |
|
| 57 | + if ($this->app->has('requestExpected') && config('app.requestWithError')===true) { |
|
| 58 | + if ($requestExpected = $this->app->get('requestExpected')) { |
|
| 59 | 59 | $this->result['request']['expected'] = $requestExpected; |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -25,26 +25,26 @@ |
||
| 25 | 25 | * @param null|string $name |
| 26 | 26 | * @return array |
| 27 | 27 | */ |
| 28 | - public function container($name=null) |
|
| 28 | + public function container($name = null) |
|
| 29 | 29 | {
|
| 30 | 30 | //check container value for kernel |
| 31 | - if(isset($this->instances['container'])){
|
|
| 31 | + if (isset($this->instances['container'])) {
|
|
| 32 | 32 | |
| 33 | 33 | // if methoda is a null parameter, |
| 34 | 34 | // then we send direct container values. |
| 35 | - if(is_null($name)){
|
|
| 35 | + if (is_null($name)) {
|
|
| 36 | 36 | return (array)$this->instances['container']; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // if there is an existing value in the container as the method parameter, |
| 40 | 40 | // we send this value directly in the container. |
| 41 | - if(isset($this->container()[$name])){
|
|
| 41 | + if (isset($this->container()[$name])) {
|
|
| 42 | 42 | return $this->container()[$name]; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | // if there is no $name value in the container as the method parameter, |
| 46 | 46 | // we check this value directly in the core object. |
| 47 | - if(property_exists(core(),$name)){
|
|
| 47 | + if (property_exists(core(), $name)) {
|
|
| 48 | 48 | return core()->{$name};
|
| 49 | 49 | } |
| 50 | 50 | |
@@ -39,8 +39,7 @@ discard block |
||
| 39 | 39 | {
|
| 40 | 40 | if($this->app->has('exceptiontrace')) {
|
| 41 | 41 | $this->data['status'] = (int)$this->app['exceptiontrace']['callNamespace']->getCode(); |
| 42 | - } |
|
| 43 | - else {
|
|
| 42 | + } else {
|
|
| 44 | 43 | $this->data['status'] = (int)$this->exception::exceptionTypeCodes($this->data['errType']); |
| 45 | 44 | } |
| 46 | 45 | } |
@@ -82,8 +81,7 @@ discard block |
||
| 82 | 81 | |
| 83 | 82 | //set as the success object is false |
| 84 | 83 | $this->data['appExceptionSuccess'] = []; |
| 85 | - } |
|
| 86 | - else{
|
|
| 84 | + } else{
|
|
| 87 | 85 | |
| 88 | 86 | //set as the success object is false |
| 89 | 87 | $this->data['appExceptionSuccess'] = ['success'=>(bool)false,'status'=>$this->data['status']]; |
@@ -180,8 +178,7 @@ discard block |
||
| 180 | 178 | $this->app->register('responseStatus',500);
|
| 181 | 179 | |
| 182 | 180 | |
| 183 | - } |
|
| 184 | - else{
|
|
| 181 | + } else{
|
|
| 185 | 182 | |
| 186 | 183 | $this->result = $this->getAppException($environment,$this->data['errStrReal']); |
| 187 | 184 | |
@@ -216,8 +213,7 @@ discard block |
||
| 216 | 213 | |
| 217 | 214 | echo json_encode($this->app->get('out')->outputFormatter($this->result));
|
| 218 | 215 | exit(); |
| 219 | - } |
|
| 220 | - else{
|
|
| 216 | + } else{
|
|
| 221 | 217 | echo $restaOutHandle; |
| 222 | 218 | exit(); |
| 223 | 219 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | private function getStatusAccordingToExceptionTrace() |
| 39 | 39 | {
|
| 40 | - if($this->app->has('exceptiontrace')) {
|
|
| 40 | + if ($this->app->has('exceptiontrace')) {
|
|
| 41 | 41 | $this->data['status'] = (int)$this->app['exceptiontrace']['callNamespace']->getCode(); |
| 42 | 42 | } |
| 43 | 43 | else {
|
@@ -54,21 +54,21 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | $this->app->terminate('responseSuccess');
|
| 56 | 56 | $this->app->terminate('responseStatus');
|
| 57 | - $this->app->register('responseSuccess',(bool)false);
|
|
| 58 | - $this->app->register('responseStatus',$this->data['status']);
|
|
| 57 | + $this->app->register('responseSuccess', (bool)false);
|
|
| 58 | + $this->app->register('responseStatus', $this->data['status']);
|
|
| 59 | 59 | |
| 60 | 60 | |
| 61 | - $optionalException = str_replace("\\","\\\\",$this->app->namespace()->exception());
|
|
| 61 | + $optionalException = str_replace("\\", "\\\\", $this->app->namespace()->exception());
|
|
| 62 | 62 | |
| 63 | - if(preg_match('@'.$optionalException.'@is',$this->data['errType'])){
|
|
| 63 | + if (preg_match('@'.$optionalException.'@is', $this->data['errType'])) {
|
|
| 64 | 64 | |
| 65 | 65 | //trace pattern |
| 66 | 66 | $trace = $this->data['errContext']['trace']; |
| 67 | - if(preg_match('@Stack trace:\n#0(.*)\n#1@is',$trace,$traceArray)){
|
|
| 67 | + if (preg_match('@Stack trace:\n#0(.*)\n#1@is', $trace, $traceArray)) {
|
|
| 68 | 68 | |
| 69 | - $traceFile = str_replace(root,'',$traceArray[1]); |
|
| 69 | + $traceFile = str_replace(root, '', $traceArray[1]); |
|
| 70 | 70 | |
| 71 | - if(preg_match('@(.*)\((\d+)\)@is',$traceFile,$traceResolve)){
|
|
| 71 | + if (preg_match('@(.*)\((\d+)\)@is', $traceFile, $traceResolve)) {
|
|
| 72 | 72 | $this->data['errFile'] = $traceResolve[1]; |
| 73 | 73 | $this->data['errLine'] = (int)$traceResolve[2]; |
| 74 | 74 | } |
@@ -78,15 +78,15 @@ discard block |
||
| 78 | 78 | $this->data['errType'] = class_basename($this->data['errType']); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if(is_array($meta = config('response.meta'))){
|
|
| 81 | + if (is_array($meta = config('response.meta'))) {
|
|
| 82 | 82 | |
| 83 | 83 | //set as the success object is false |
| 84 | 84 | $this->data['appExceptionSuccess'] = []; |
| 85 | 85 | } |
| 86 | - else{
|
|
| 86 | + else {
|
|
| 87 | 87 | |
| 88 | 88 | //set as the success object is false |
| 89 | - $this->data['appExceptionSuccess'] = ['success'=>(bool)false,'status'=>$this->data['status']]; |
|
| 89 | + $this->data['appExceptionSuccess'] = ['success'=>(bool)false, 'status'=>$this->data['status']]; |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
@@ -108,13 +108,13 @@ discard block |
||
| 108 | 108 | //This function can be used for defining your own way of handling errors during runtime, |
| 109 | 109 | //for example in applications in which you need to do cleanup of data/files when a critical error happens, |
| 110 | 110 | //or when you need to trigger an error under certain conditions (using trigger_error()). |
| 111 | - set_error_handler([$this,'setErrorHandler']); |
|
| 111 | + set_error_handler([$this, 'setErrorHandler']); |
|
| 112 | 112 | |
| 113 | 113 | //Registers a callback to be executed after script execution finishes or exit() is called. |
| 114 | 114 | //Multiple calls to register_shutdown_function() can be made, and each will be called in the same order as |
| 115 | 115 | //they were registered. If you call exit() within one registered shutdown function, |
| 116 | 116 | //processing will stop completely and no other registered shutdown functions will be called. |
| 117 | - register_shutdown_function([$this,'fatalErrorShutdownHandler']); |
|
| 117 | + register_shutdown_function([$this, 'fatalErrorShutdownHandler']); |
|
| 118 | 118 | |
| 119 | 119 | } |
| 120 | 120 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * @param null|string $errLine |
| 128 | 128 | * @param null|string $errContext |
| 129 | 129 | */ |
| 130 | - public function setErrorHandler($errNo=null, $errStr=null, $errFile=null, $errLine=null, $errContext=null) |
|
| 130 | + public function setErrorHandler($errNo = null, $errStr = null, $errFile = null, $errLine = null, $errContext = null) |
|
| 131 | 131 | {
|
| 132 | 132 | // in case of a deficiency, |
| 133 | 133 | // we need to boot our general needs to be needed for the exception. |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | //get lang message for exception |
| 155 | 155 | $this->getLangMessageForException(); |
| 156 | 156 | |
| 157 | - if($this->app->has('exceptiontrace')){
|
|
| 157 | + if ($this->app->has('exceptiontrace')) {
|
|
| 158 | 158 | |
| 159 | 159 | $customExceptionTrace = $this->app['exceptiontrace']; |
| 160 | 160 | $this->data['errFile'] = $customExceptionTrace['file']; |
@@ -163,42 +163,41 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | $environment = $this->app->environment(); |
| 165 | 165 | |
| 166 | - $vendorDirectory = str_replace(root.''.DIRECTORY_SEPARATOR.'','',$this->data['errFile']); |
|
| 166 | + $vendorDirectory = str_replace(root.''.DIRECTORY_SEPARATOR.'', '', $this->data['errFile']); |
|
| 167 | 167 | |
| 168 | - if(preg_match('@vendor.*\.php@is',$vendorDirectory,$vd)){
|
|
| 168 | + if (preg_match('@vendor.*\.php@is', $vendorDirectory, $vd)) {
|
|
| 169 | 169 | $vendorDirectory = $vd[0]; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - if(Str::startsWith($vendorDirectory,'vendor') |
|
| 173 | - && Str::startsWith($vendorDirectory,'vendor/php-resta')===false) |
|
| 172 | + if (Str::startsWith($vendorDirectory, 'vendor') |
|
| 173 | + && Str::startsWith($vendorDirectory, 'vendor/php-resta')===false) |
|
| 174 | 174 | {
|
| 175 | 175 | |
| 176 | 176 | $externalMessage = ($environment==="production") ? |
| 177 | - 'An unexpected external error has occurred' : |
|
| 178 | - $this->data['errStrReal']; |
|
| 177 | + 'An unexpected external error has occurred' : $this->data['errStrReal']; |
|
| 179 | 178 | |
| 180 | - $this->result = $this->getAppException($environment,$externalMessage); |
|
| 179 | + $this->result = $this->getAppException($environment, $externalMessage); |
|
| 181 | 180 | |
| 182 | 181 | |
| 183 | 182 | //Get or Set the HTTP response code |
| 184 | 183 | http_response_code(500); |
| 185 | 184 | $this->app->terminate('responseStatus');
|
| 186 | - $this->app->register('responseStatus',500);
|
|
| 185 | + $this->app->register('responseStatus', 500);
|
|
| 187 | 186 | |
| 188 | 187 | |
| 189 | 188 | } |
| 190 | - else{
|
|
| 189 | + else {
|
|
| 191 | 190 | |
| 192 | - $this->result = $this->getAppException($environment,$this->data['errStrReal']); |
|
| 191 | + $this->result = $this->getAppException($environment, $this->data['errStrReal']); |
|
| 193 | 192 | |
| 194 | 193 | //Get or Set the HTTP response code |
| 195 | 194 | http_response_code($this->data['status']); |
| 196 | 195 | } |
| 197 | 196 | |
| 198 | - if($environment==="production"){
|
|
| 197 | + if ($environment==="production") {
|
|
| 199 | 198 | |
| 200 | - $productionLogMessage = $this->getAppException('local',$this->data['errStrReal']);
|
|
| 201 | - $this->app->register('productionLogMessage',$this->app->get('out')->outputFormatter($productionLogMessage));
|
|
| 199 | + $productionLogMessage = $this->getAppException('local', $this->data['errStrReal']);
|
|
| 200 | + $this->app->register('productionLogMessage', $this->app->get('out')->outputFormatter($productionLogMessage));
|
|
| 202 | 201 | } |
| 203 | 202 | |
| 204 | 203 | // exception extender The exception information |
@@ -207,17 +206,17 @@ discard block |
||
| 207 | 206 | |
| 208 | 207 | |
| 209 | 208 | //set json app exception |
| 210 | - $this->app->register('routerResult',$this->result);
|
|
| 209 | + $this->app->register('routerResult', $this->result);
|
|
| 211 | 210 | |
| 212 | 211 | $restaOutHandle = null; |
| 213 | 212 | |
| 214 | - if(!defined('responseApp')){
|
|
| 213 | + if (!defined('responseApp')) {
|
|
| 215 | 214 | $restaOutHandle = $this->app->get('out')->handle();
|
| 216 | 215 | } |
| 217 | 216 | |
| 218 | 217 | header("HTTP/1.1 ".$this->data['status']);
|
| 219 | 218 | |
| 220 | - if($restaOutHandle===null){
|
|
| 219 | + if ($restaOutHandle===null) {
|
|
| 221 | 220 | |
| 222 | 221 | //header set and symfony response call |
| 223 | 222 | header('Content-type:application/json;charset=utf-8');
|
@@ -225,7 +224,7 @@ discard block |
||
| 225 | 224 | echo json_encode($this->app->get('out')->outputFormatter($this->result));
|
| 226 | 225 | exit(); |
| 227 | 226 | } |
| 228 | - else{
|
|
| 227 | + else {
|
|
| 229 | 228 | echo $restaOutHandle; |
| 230 | 229 | exit(); |
| 231 | 230 | } |
@@ -235,7 +234,7 @@ discard block |
||
| 235 | 234 | * @param $environment |
| 236 | 235 | * @return mixed |
| 237 | 236 | */ |
| 238 | - private function getAppException($environment,$message) |
|
| 237 | + private function getAppException($environment, $message) |
|
| 239 | 238 | {
|
| 240 | 239 | return $this->data['appExceptionSuccess']+$this->data['exception']::$environment( |
| 241 | 240 | $this->data['errNo'], |
@@ -255,7 +254,7 @@ discard block |
||
| 255 | 254 | private function getExceptionExtender() |
| 256 | 255 | {
|
| 257 | 256 | return $this->app->resolve( |
| 258 | - $this->app->get('macro')->call('exceptionExtender',function(){
|
|
| 257 | + $this->app->get('macro')->call('exceptionExtender', function() {
|
|
| 259 | 258 | return ExceptionExtender::class; |
| 260 | 259 | }), |
| 261 | 260 | ['result'=>$this->result])->getResult(); |
@@ -273,13 +272,13 @@ discard block |
||
| 273 | 272 | |
| 274 | 273 | $this->inStackTrace($last_error); |
| 275 | 274 | |
| 276 | - if(!is_null($last_error)){
|
|
| 275 | + if (!is_null($last_error)) {
|
|
| 277 | 276 | |
| 278 | - if(!defined('methodName')){
|
|
| 279 | - define('methodName',null);
|
|
| 277 | + if (!defined('methodName')) {
|
|
| 278 | + define('methodName', null);
|
|
| 280 | 279 | } |
| 281 | 280 | |
| 282 | - if($this->app->has('exceptionFile')){
|
|
| 281 | + if ($this->app->has('exceptionFile')) {
|
|
| 283 | 282 | $last_error['file'] = $this->app['exceptionFile']; |
| 284 | 283 | $last_error['line'] = $this->app['exceptionLine']; |
| 285 | 284 | } |
@@ -299,13 +298,13 @@ discard block |
||
| 299 | 298 | */ |
| 300 | 299 | public function inStackTrace($error) |
| 301 | 300 | {
|
| 302 | - if($this->app->has('urlComponent')){
|
|
| 303 | - if(!preg_match('@'.$this->app['urlComponent']['project'].'@',$error['file'])
|
|
| 304 | - && !$this->app->has('exceptionFile')){
|
|
| 305 | - if(preg_match('@ in\s(.*?)\n@is',$error['message'],$result)){
|
|
| 306 | - $errorMessage = explode(":",$result[1]);
|
|
| 307 | - $this->app->register('exceptionFile',$errorMessage[0]);
|
|
| 308 | - $this->app->register('exceptionLine',$errorMessage[1]);
|
|
| 301 | + if ($this->app->has('urlComponent')) {
|
|
| 302 | + if (!preg_match('@'.$this->app['urlComponent']['project'].'@', $error['file'])
|
|
| 303 | + && !$this->app->has('exceptionFile')) {
|
|
| 304 | + if (preg_match('@ in\s(.*?)\n@is', $error['message'], $result)) {
|
|
| 305 | + $errorMessage = explode(":", $result[1]);
|
|
| 306 | + $this->app->register('exceptionFile', $errorMessage[0]);
|
|
| 307 | + $this->app->register('exceptionLine', $errorMessage[1]);
|
|
| 309 | 308 | } |
| 310 | 309 | } |
| 311 | 310 | } |
@@ -318,33 +317,33 @@ discard block |
||
| 318 | 317 | {
|
| 319 | 318 | $clone = clone $this; |
| 320 | 319 | |
| 321 | - if($this->app->has('exceptionTranslate')){
|
|
| 320 | + if ($this->app->has('exceptionTranslate')) {
|
|
| 322 | 321 | |
| 323 | 322 | $langMessage = trans('exception.'.$this->app->get('exceptionTranslate'));
|
| 324 | 323 | |
| 325 | - if(!is_null($langMessage) && $this->app->has('exceptionTranslateParams')){
|
|
| 324 | + if (!is_null($langMessage) && $this->app->has('exceptionTranslateParams')) {
|
|
| 326 | 325 | |
| 327 | - if(count($this->app['exceptionTranslateParams'][$this->app['exceptionTranslate']])){
|
|
| 328 | - foreach ($this->app['exceptionTranslateParams'][$this->app['exceptionTranslate']] as $key=>$value){
|
|
| 326 | + if (count($this->app['exceptionTranslateParams'][$this->app['exceptionTranslate']])) {
|
|
| 327 | + foreach ($this->app['exceptionTranslateParams'][$this->app['exceptionTranslate']] as $key=>$value) {
|
|
| 329 | 328 | |
| 330 | 329 | $valueLangName = !is_null(trans('default.'.$value)) ? trans('default.'.$value) : $value;
|
| 331 | - $langMessage = preg_replace('@\('.$key.'\)@is',$valueLangName,$langMessage);
|
|
| 330 | + $langMessage = preg_replace('@\('.$key.'\)@is', $valueLangName, $langMessage);
|
|
| 332 | 331 | } |
| 333 | 332 | } |
| 334 | 333 | } |
| 335 | 334 | |
| 336 | - if($langMessage!==null){
|
|
| 335 | + if ($langMessage!==null) {
|
|
| 337 | 336 | $this->data['errStrReal'] = $langMessage; |
| 338 | 337 | } |
| 339 | 338 | } |
| 340 | 339 | |
| 341 | - if(class_exists($this->data['errorClassNamespace']) |
|
| 340 | + if (class_exists($this->data['errorClassNamespace']) |
|
| 342 | 341 | && |
| 343 | - (Str::startsWith($this->data['errorClassNamespace'],'App') |
|
| 344 | - || Str::startsWith($this->data['errorClassNamespace'],__NAMESPACE__))){
|
|
| 342 | + (Str::startsWith($this->data['errorClassNamespace'], 'App') |
|
| 343 | + || Str::startsWith($this->data['errorClassNamespace'], __NAMESPACE__))) {
|
|
| 345 | 344 | |
| 346 | 345 | ClosureDispatcher::bind($this->data['errorClassNamespace'])->call(function() use ($clone) {
|
| 347 | - if(property_exists($this,'lang')){
|
|
| 346 | + if (property_exists($this, 'lang')) {
|
|
| 348 | 347 | $clone->setLang($this->lang); |
| 349 | 348 | } |
| 350 | 349 | }); |
@@ -354,7 +353,7 @@ discard block |
||
| 354 | 353 | |
| 355 | 354 | $langMessage = (!is_null($this->data['lang'])) ? trans('exception.'.$this->data['lang']) : null;
|
| 356 | 355 | |
| 357 | - if($langMessage!==null){
|
|
| 356 | + if ($langMessage!==null) {
|
|
| 358 | 357 | $this->data['errStrReal'] = $langMessage; |
| 359 | 358 | } |
| 360 | 359 | } |
@@ -368,14 +367,14 @@ discard block |
||
| 368 | 367 | {
|
| 369 | 368 | // catch exception via preg match |
| 370 | 369 | // and then clear the Uncaught statement from inside. |
| 371 | - if(preg_match('@(.*?):@is',$this->data['errStrReal'],$errArr)){
|
|
| 370 | + if (preg_match('@(.*?):@is', $this->data['errStrReal'], $errArr)) {
|
|
| 372 | 371 | |
| 373 | - $this->data['errType'] = trim(str_replace('Uncaught','',$errArr[1]));
|
|
| 372 | + $this->data['errType'] = trim(str_replace('Uncaught', '', $errArr[1]));
|
|
| 374 | 373 | $this->data['errorClassNamespace'] = $this->data['errType']; |
| 375 | 374 | } |
| 376 | 375 | |
| 377 | - if(preg_match('@Uncaught@is',$this->data['errStrReal'])
|
|
| 378 | - && preg_match('@(.*?):(.*?)\sin\s@is',$this->data['errStrReal'],$errStrRealArray)){
|
|
| 376 | + if (preg_match('@Uncaught@is', $this->data['errStrReal'])
|
|
| 377 | + && preg_match('@(.*?):(.*?)\sin\s@is', $this->data['errStrReal'], $errStrRealArray)) {
|
|
| 379 | 378 | $this->data['errStrReal'] = trim($errStrRealArray[2]); |
| 380 | 379 | } |
| 381 | 380 | |
@@ -395,7 +394,7 @@ discard block |
||
| 395 | 394 | /** |
| 396 | 395 | * @param null|string $lang |
| 397 | 396 | */ |
| 398 | - public function setLang($lang=null) |
|
| 397 | + public function setLang($lang = null) |
|
| 399 | 398 | {
|
| 400 | 399 | $this->lang = $lang; |
| 401 | 400 | } |
@@ -32,15 +32,15 @@ discard block |
||
| 32 | 32 | * @param callable $callback |
| 33 | 33 | * @return mixed|null |
| 34 | 34 | */ |
| 35 | - public function call($macro,callable $callback) |
|
| 35 | + public function call($macro, callable $callback) |
|
| 36 | 36 | {
|
| 37 | - if(!is_null($macro)){
|
|
| 37 | + if (!is_null($macro)) {
|
|
| 38 | 38 | |
| 39 | 39 | //get macro class from kernel macros |
| 40 | 40 | $macroCall = config('kernel.macros.'.$macro);
|
| 41 | 41 | |
| 42 | 42 | //if macroCall class is available and an object. |
| 43 | - if(!is_null($macroCall) && Utils::isNamespaceExists($macroCall)){
|
|
| 43 | + if (!is_null($macroCall) && Utils::isNamespaceExists($macroCall)) {
|
|
| 44 | 44 | return $macroCall; |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @param bool $static |
| 55 | 55 | * @return bool |
| 56 | 56 | */ |
| 57 | - protected function checkMacroConditions($static=false) |
|
| 57 | + protected function checkMacroConditions($static = false) |
|
| 58 | 58 | {
|
| 59 | 59 | return is_string($this->macro) && |
| 60 | 60 | Utils::isNamespaceExists($this->macro) && |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | * @param bool $static |
| 68 | 68 | * @return bool |
| 69 | 69 | */ |
| 70 | - protected function checkMacroInstanceOf($static=false) |
|
| 70 | + protected function checkMacroInstanceOf($static = false) |
|
| 71 | 71 | {
|
| 72 | - if($static){
|
|
| 72 | + if ($static) {
|
|
| 73 | 73 | return true; |
| 74 | 74 | } |
| 75 | 75 | return $this->app->resolve($this->macro) instanceof MacroAbleContracts; |
@@ -82,11 +82,11 @@ discard block |
||
| 82 | 82 | * @param callable $callback |
| 83 | 83 | * @return mixed |
| 84 | 84 | */ |
| 85 | - public function get($method,callable $callback) |
|
| 85 | + public function get($method, callable $callback) |
|
| 86 | 86 | {
|
| 87 | - if($this->isMacro){
|
|
| 87 | + if ($this->isMacro) {
|
|
| 88 | 88 | |
| 89 | - if(method_exists($resolve = $this->app->resolve($this->macro),$method)){
|
|
| 89 | + if (method_exists($resolve = $this->app->resolve($this->macro), $method)) {
|
|
| 90 | 90 | return $resolve->macro($this->class); |
| 91 | 91 | } |
| 92 | 92 | } |
@@ -110,11 +110,11 @@ discard block |
||
| 110 | 110 | * @param $class |
| 111 | 111 | * @return $this |
| 112 | 112 | */ |
| 113 | - public function isMacro($class,$static=false) |
|
| 113 | + public function isMacro($class, $static = false) |
|
| 114 | 114 | {
|
| 115 | 115 | // if the macro class is a valid object, |
| 116 | 116 | // then this macro will return a boolean value if it has the specified methode. |
| 117 | - if($this->checkMacroConditions($static)){
|
|
| 117 | + if ($this->checkMacroConditions($static)) {
|
|
| 118 | 118 | |
| 119 | 119 | $this->isMacro = true; |
| 120 | 120 | $this->class = $class; |
@@ -142,10 +142,10 @@ discard block |
||
| 142 | 142 | * @param $method |
| 143 | 143 | * @return mixed |
| 144 | 144 | */ |
| 145 | - public function with($macro,$concrete,$method=null) |
|
| 145 | + public function with($macro, $concrete, $method = null) |
|
| 146 | 146 | {
|
| 147 | - if($this->macro === null){
|
|
| 148 | - return $this($macro)->isMacro($concrete)->get($method,function() use($concrete){
|
|
| 147 | + if ($this->macro===null) {
|
|
| 148 | + return $this($macro)->isMacro($concrete)->get($method, function() use($concrete){
|
|
| 149 | 149 | return $concrete; |
| 150 | 150 | }); |
| 151 | 151 | } |
@@ -159,9 +159,9 @@ discard block |
||
| 159 | 159 | * @param $method |
| 160 | 160 | * @return mixed |
| 161 | 161 | */ |
| 162 | - public function withStatic($macro,$concrete) |
|
| 162 | + public function withStatic($macro, $concrete) |
|
| 163 | 163 | {
|
| 164 | - return $this($macro)->isMacro($concrete,true)->get(null,is_callable($concrete) ? |
|
| 164 | + return $this($macro)->isMacro($concrete, true)->get(null, is_callable($concrete) ? |
|
| 165 | 165 | $concrete : function() use($concrete){
|
| 166 | 166 | return $concrete; |
| 167 | 167 | }); |
@@ -173,9 +173,9 @@ discard block |
||
| 173 | 173 | * @param null|string $macro |
| 174 | 174 | * @return $this |
| 175 | 175 | */ |
| 176 | - public function __invoke($macro=null) |
|
| 176 | + public function __invoke($macro = null) |
|
| 177 | 177 | {
|
| 178 | - if($macro!==null){
|
|
| 178 | + if ($macro!==null) {
|
|
| 179 | 179 | $this->macro = $macro; |
| 180 | 180 | } |
| 181 | 181 | return $this; |
@@ -12,9 +12,9 @@ discard block |
||
| 12 | 12 | * @param null $app |
| 13 | 13 | * @return string |
| 14 | 14 | */ |
| 15 | - public function app($app=null) |
|
| 15 | + public function app($app = null) |
|
| 16 | 16 | {
|
| 17 | - $app=($app===null) ? $this->appDetector() : $app; |
|
| 17 | + $app = ($app===null) ? $this->appDetector() : $app; |
|
| 18 | 18 | return StaticPathModel::appPath().''.DIRECTORY_SEPARATOR.''.Str::slashToBackSlash($app); |
| 19 | 19 | } |
| 20 | 20 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @param null $app |
| 39 | 39 | * @return string |
| 40 | 40 | */ |
| 41 | - public function appCall($app=null) |
|
| 41 | + public function appCall($app = null) |
|
| 42 | 42 | {
|
| 43 | 43 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$controller; |
| 44 | 44 | } |
@@ -56,9 +56,9 @@ discard block |
||
| 56 | 56 | * @param null $app |
| 57 | 57 | * @return string |
| 58 | 58 | */ |
| 59 | - public function appConfig($app=null) |
|
| 59 | + public function appConfig($app = null) |
|
| 60 | 60 | {
|
| 61 | - if(isset(core()->paths['config'])){
|
|
| 61 | + if (isset(core()->paths['config'])) {
|
|
| 62 | 62 | return core()->paths['config']; |
| 63 | 63 | } |
| 64 | 64 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$config; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @param null $app |
| 69 | 69 | * @return string |
| 70 | 70 | */ |
| 71 | - public function appHelpers($app=null) |
|
| 71 | + public function appHelpers($app = null) |
|
| 72 | 72 | {
|
| 73 | 73 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$helpers; |
| 74 | 74 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * @param null $app |
| 102 | 102 | * @return mixed |
| 103 | 103 | */ |
| 104 | - public function appFactory($app=null) |
|
| 104 | + public function appFactory($app = null) |
|
| 105 | 105 | {
|
| 106 | 106 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$factory; |
| 107 | 107 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function appKernel() |
| 113 | 113 | {
|
| 114 | - $kernel = $this->app().''.DIRECTORY_SEPARATOR.''.StaticPathList::$kernel; |
|
| 114 | + $kernel = $this->app().''.DIRECTORY_SEPARATOR.''.StaticPathList::$kernel; |
|
| 115 | 115 | |
| 116 | 116 | return $kernel; |
| 117 | 117 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | public function appProvider() |
| 123 | 123 | {
|
| 124 | - $kernel = $this->app().''.DIRECTORY_SEPARATOR.''.StaticPathList::$kernel.''.DIRECTORY_SEPARATOR.''.StaticPathList::$provider; |
|
| 124 | + $kernel = $this->app().''.DIRECTORY_SEPARATOR.''.StaticPathList::$kernel.''.DIRECTORY_SEPARATOR.''.StaticPathList::$provider; |
|
| 125 | 125 | |
| 126 | 126 | return $kernel; |
| 127 | 127 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * @param null $app |
| 147 | 147 | * @return mixed |
| 148 | 148 | */ |
| 149 | - public function appLogger($app=null) |
|
| 149 | + public function appLogger($app = null) |
|
| 150 | 150 | {
|
| 151 | 151 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.'ServiceLogManager'; |
| 152 | 152 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * @param null $app |
| 156 | 156 | * @return mixed |
| 157 | 157 | */ |
| 158 | - public function appMiddleware($app=null) |
|
| 158 | + public function appMiddleware($app = null) |
|
| 159 | 159 | {
|
| 160 | 160 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$middleware; |
| 161 | 161 | } |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | * @param null $app |
| 165 | 165 | * @return mixed |
| 166 | 166 | */ |
| 167 | - public function appMigration($app=null) |
|
| 167 | + public function appMigration($app = null) |
|
| 168 | 168 | {
|
| 169 | 169 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$migration; |
| 170 | 170 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | * @param null $app |
| 174 | 174 | * @return mixed |
| 175 | 175 | */ |
| 176 | - public function appModel($app=null) |
|
| 176 | + public function appModel($app = null) |
|
| 177 | 177 | {
|
| 178 | 178 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$model; |
| 179 | 179 | } |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * @param null $app |
| 183 | 183 | * @return mixed |
| 184 | 184 | */ |
| 185 | - public function appException($app=null) |
|
| 185 | + public function appException($app = null) |
|
| 186 | 186 | {
|
| 187 | 187 | return $this->appVersion().''.DIRECTORY_SEPARATOR.''.StaticPathList::$exception; |
| 188 | 188 | } |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * @param null $app |
| 192 | 192 | * @return mixed |
| 193 | 193 | */ |
| 194 | - public function appOptionalEvents($app=null) |
|
| 194 | + public function appOptionalEvents($app = null) |
|
| 195 | 195 | {
|
| 196 | 196 | return $this->appVersion().''.DIRECTORY_SEPARATOR.''.StaticPathList::$events; |
| 197 | 197 | } |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | * @param null $app |
| 201 | 201 | * @return mixed |
| 202 | 202 | */ |
| 203 | - public function appOptionalJob($app=null) |
|
| 203 | + public function appOptionalJob($app = null) |
|
| 204 | 204 | {
|
| 205 | 205 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$optional.''.DIRECTORY_SEPARATOR.''.StaticPathList::$job; |
| 206 | 206 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | * @param null $app |
| 210 | 210 | * @return mixed |
| 211 | 211 | */ |
| 212 | - public function appOptionalListeners($app=null) |
|
| 212 | + public function appOptionalListeners($app = null) |
|
| 213 | 213 | {
|
| 214 | 214 | return $this->appVersion().''.DIRECTORY_SEPARATOR.''.StaticPathList::$listeners; |
| 215 | 215 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * @param null $app |
| 219 | 219 | * @return mixed |
| 220 | 220 | */ |
| 221 | - public function appOptionalSubscribers($app=null) |
|
| 221 | + public function appOptionalSubscribers($app = null) |
|
| 222 | 222 | {
|
| 223 | 223 | return $this->appVersion().''.DIRECTORY_SEPARATOR.''.StaticPathList::$listeners.''.DIRECTORY_SEPARATOR.''.StaticPathList::$subscribers; |
| 224 | 224 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | */ |
| 237 | 237 | public function appRepository() |
| 238 | 238 | {
|
| 239 | - $repository = $this->app().''.DIRECTORY_SEPARATOR.''.StaticPathList::$repository; |
|
| 239 | + $repository = $this->app().''.DIRECTORY_SEPARATOR.''.StaticPathList::$repository; |
|
| 240 | 240 | |
| 241 | 241 | return $repository; |
| 242 | 242 | } |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | * @param null $app |
| 254 | 254 | * @return mixed |
| 255 | 255 | */ |
| 256 | - public function appOptionalSource($app=null) |
|
| 256 | + public function appOptionalSource($app = null) |
|
| 257 | 257 | {
|
| 258 | 258 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$optional.''.DIRECTORY_SEPARATOR.''.StaticPathList::$sourcePath; |
| 259 | 259 | } |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | * @param null $app |
| 263 | 263 | * @return mixed |
| 264 | 264 | */ |
| 265 | - public function appOptionalWebservice($app=null) |
|
| 265 | + public function appOptionalWebservice($app = null) |
|
| 266 | 266 | {
|
| 267 | 267 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$optional.''.DIRECTORY_SEPARATOR.''.StaticPathList::$webservice; |
| 268 | 268 | } |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | * @param null $app |
| 280 | 280 | * @return mixed |
| 281 | 281 | */ |
| 282 | - public function appServiceAnnotations($app=null) |
|
| 282 | + public function appServiceAnnotations($app = null) |
|
| 283 | 283 | {
|
| 284 | 284 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$serviceAnnotations; |
| 285 | 285 | } |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | * @param null $app |
| 289 | 289 | * @return mixed |
| 290 | 290 | */ |
| 291 | - public function appServiceContainer($app=null) |
|
| 291 | + public function appServiceContainer($app = null) |
|
| 292 | 292 | {
|
| 293 | 293 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.'ServiceContainerController'; |
| 294 | 294 | } |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | * @param null $app |
| 298 | 298 | * @return mixed |
| 299 | 299 | */ |
| 300 | - public function appServiceEventDispatcher($app=null) |
|
| 300 | + public function appServiceEventDispatcher($app = null) |
|
| 301 | 301 | {
|
| 302 | 302 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.'ServiceEventDispatcherManager'; |
| 303 | 303 | } |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | * @param null $app |
| 307 | 307 | * @return mixed |
| 308 | 308 | */ |
| 309 | - public function appServiceMiddleware($app=null) |
|
| 309 | + public function appServiceMiddleware($app = null) |
|
| 310 | 310 | {
|
| 311 | 311 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$serviceMiddleware; |
| 312 | 312 | } |
@@ -333,9 +333,9 @@ discard block |
||
| 333 | 333 | * @param null $app |
| 334 | 334 | * @return mixed |
| 335 | 335 | */ |
| 336 | - public function appVersion($app=null) |
|
| 336 | + public function appVersion($app = null) |
|
| 337 | 337 | {
|
| 338 | - if(defined('app')){
|
|
| 338 | + if (defined('app')) {
|
|
| 339 | 339 | |
| 340 | 340 | $prefixGroup = Str::slashToBackSlash(StaticPathList::$projectPrefixGroup); |
| 341 | 341 | |
@@ -379,19 +379,19 @@ discard block |
||
| 379 | 379 | * @param bool $bool |
| 380 | 380 | * @return mixed |
| 381 | 381 | */ |
| 382 | - public function controller($controller=null,$bool=false) |
|
| 382 | + public function controller($controller = null, $bool = false) |
|
| 383 | 383 | {
|
| 384 | 384 | $namespaceController = ($controller===null) ? app()->namespace()->controller() |
| 385 | - : app()->namespace()->controller($controller,true); |
|
| 385 | + : app()->namespace()->controller($controller, true); |
|
| 386 | 386 | |
| 387 | - if($bool){
|
|
| 388 | - $namespaceControllerExplode = explode("\\",$namespaceController);
|
|
| 387 | + if ($bool) {
|
|
| 388 | + $namespaceControllerExplode = explode("\\", $namespaceController);
|
|
| 389 | 389 | array_pop($namespaceControllerExplode); |
| 390 | 390 | |
| 391 | - $namespaceController = implode("\\",$namespaceControllerExplode);
|
|
| 391 | + $namespaceController = implode("\\", $namespaceControllerExplode);
|
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | - return Utils::getPathFromNamespace($namespaceController,false); |
|
| 394 | + return Utils::getPathFromNamespace($namespaceController, false); |
|
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | /** |
@@ -415,9 +415,9 @@ discard block |
||
| 415 | 415 | * @param $arg |
| 416 | 416 | * @return mixed |
| 417 | 417 | */ |
| 418 | - public function __call($name,$arg) |
|
| 418 | + public function __call($name, $arg) |
|
| 419 | 419 | {
|
| 420 | - $appCall='app'.ucfirst($name); |
|
| 420 | + $appCall = 'app'.ucfirst($name); |
|
| 421 | 421 | return $this->{$appCall}();
|
| 422 | 422 | } |
| 423 | 423 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | public function execute() |
| 22 | 22 | { |
| 23 | 23 | //we check the presence of worker on container. |
| 24 | - if($this->isWorkerAvailable()){ |
|
| 24 | + if ($this->isWorkerAvailable()) { |
|
| 25 | 25 | $this->{$this->getApply()}(); |
| 26 | 26 | } |
| 27 | 27 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | $this->isWorkerClosure(); |
| 37 | 37 | |
| 38 | - if($this->resolve instanceof \Closure){ |
|
| 38 | + if ($this->resolve instanceof \Closure) { |
|
| 39 | 39 | $resolve = $this->resolve; |
| 40 | 40 | echo $resolve($this->getData()).''.PHP_EOL; |
| 41 | 41 | $this->pause(); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | { |
| 52 | 52 | $this->isWorkerObject(); |
| 53 | 53 | |
| 54 | - if($this->resolve instanceof WorkerContracts){ |
|
| 54 | + if ($this->resolve instanceof WorkerContracts) { |
|
| 55 | 55 | $this->resolve->handle(); |
| 56 | 56 | echo $this->getWorker().' Worker : Ok'.PHP_EOL; |
| 57 | 57 | $this->pause($this->resolve->getSleep()); |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | public function isWorkerClosure() |
| 67 | 67 | { |
| 68 | 68 | //we check the presence of worker on container. |
| 69 | - if($this->isWorkerAvailable()){ |
|
| 69 | + if ($this->isWorkerAvailable()) { |
|
| 70 | 70 | |
| 71 | 71 | // if worker comes as an object, this object will be executed. |
| 72 | 72 | // worker can have a closure function. |
| 73 | - if(is_callable($worker = $this->worker[$this->getWorker()])) { |
|
| 73 | + if (is_callable($worker = $this->worker[$this->getWorker()])) { |
|
| 74 | 74 | $this->resolve = $worker; |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -84,12 +84,12 @@ discard block |
||
| 84 | 84 | public function isWorkerObject() |
| 85 | 85 | { |
| 86 | 86 | //we check the presence of worker on container. |
| 87 | - if($this->isWorkerAvailable()){ |
|
| 87 | + if ($this->isWorkerAvailable()) { |
|
| 88 | 88 | |
| 89 | 89 | // if worker comes as an object, this object will be executed. |
| 90 | 90 | // worker can have a closure function. |
| 91 | - if(!is_callable($worker = $this->worker[$this->getWorker()]) && Utils::isNamespaceExists($worker)) { |
|
| 92 | - $this->resolve = $this->app->resolve($worker,['data'=>$this->getData()]); |
|
| 91 | + if (!is_callable($worker = $this->worker[$this->getWorker()]) && Utils::isNamespaceExists($worker)) { |
|
| 92 | + $this->resolve = $this->app->resolve($worker, ['data'=>$this->getData()]); |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | * @param ApplicationContracts $app |
| 21 | 21 | * @param WorkerManagerContracts $worker |
| 22 | 22 | */ |
| 23 | - public function __construct(ApplicationContracts $app,WorkerManagerContracts $worker) |
|
| 23 | + public function __construct(ApplicationContracts $app, WorkerManagerContracts $worker) |
|
| 24 | 24 | { |
| 25 | 25 | parent::__construct($app); |
| 26 | 26 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function execute() |
| 34 | 34 | { |
| 35 | - while(1){ |
|
| 35 | + while (1) { |
|
| 36 | 36 | $this->worker->executeObject(); |
| 37 | 37 | $this->worker->executeClosure(); |
| 38 | 38 | } |
@@ -112,8 +112,7 @@ |
||
| 112 | 112 | { |
| 113 | 113 | if(is_null($pause)){ |
| 114 | 114 | sleep($this->getPauseValue()); |
| 115 | - } |
|
| 116 | - else{ |
|
| 115 | + } else{ |
|
| 117 | 116 | sleep($pause); |
| 118 | 117 | } |
| 119 | 118 | } |
@@ -25,15 +25,15 @@ discard block |
||
| 25 | 25 | * @param ApplicationContracts $app |
| 26 | 26 | * @param array $args |
| 27 | 27 | */ |
| 28 | - public function __construct(ApplicationContracts $app, $args=array()) |
|
| 28 | + public function __construct(ApplicationContracts $app, $args = array()) |
|
| 29 | 29 | { |
| 30 | 30 | parent::__construct($app); |
| 31 | 31 | |
| 32 | - if($this->app->runningInConsole()===false){ |
|
| 32 | + if ($this->app->runningInConsole()===false) { |
|
| 33 | 33 | exception()->runtime('The worker can only be run as cli..'); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - if($this->app->has('WORKER')===false){ |
|
| 36 | + if ($this->app->has('WORKER')===false) { |
|
| 37 | 37 | exception()->runtime('The worker console manipulation for WORKER container value'); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function getApply() |
| 51 | 51 | { |
| 52 | - if(isset($this->args['apply'])){ |
|
| 52 | + if (isset($this->args['apply'])) { |
|
| 53 | 53 | return $this->args['apply']; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function getData() |
| 65 | 65 | { |
| 66 | - if(isset($this->args['data'])){ |
|
| 66 | + if (isset($this->args['data'])) { |
|
| 67 | 67 | return $this->args['data']; |
| 68 | 68 | } |
| 69 | 69 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public function getPauseValue() |
| 79 | 79 | { |
| 80 | - if(isset($this->args['pause'])){ |
|
| 80 | + if (isset($this->args['pause'])) { |
|
| 81 | 81 | return $this->args['pause']; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function getWorker() |
| 93 | 93 | { |
| 94 | - if(isset($this->args['worker'],$this->worker[$worker = strtolower($this->args['worker'])])){ |
|
| 94 | + if (isset($this->args['worker'], $this->worker[$worker = strtolower($this->args['worker'])])) { |
|
| 95 | 95 | return $worker; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -113,12 +113,12 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @param null|\int $pause |
| 115 | 115 | */ |
| 116 | - public function pause($pause=null) |
|
| 116 | + public function pause($pause = null) |
|
| 117 | 117 | { |
| 118 | - if(is_null($pause)){ |
|
| 118 | + if (is_null($pause)) { |
|
| 119 | 119 | sleep($this->getPauseValue()); |
| 120 | 120 | } |
| 121 | - else{ |
|
| 121 | + else { |
|
| 122 | 122 | sleep($pause); |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -132,16 +132,16 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public function __call($name, $arguments) |
| 134 | 134 | { |
| 135 | - $job = $this->app->get('macro')->call(strtolower($this->getApply()).'Job',function() use($name){ |
|
| 135 | + $job = $this->app->get('macro')->call(strtolower($this->getApply()).'Job', function() use($name){ |
|
| 136 | 136 | return __NAMESPACE__.'\\'.ucfirst($name).'Job'; |
| 137 | 137 | }); |
| 138 | 138 | |
| 139 | - if(Utils::isNamespaceExists($job)){ |
|
| 139 | + if (Utils::isNamespaceExists($job)) { |
|
| 140 | 140 | |
| 141 | 141 | /** @var JobContracts $resolve */ |
| 142 | - $resolve = $this->app->resolve($job,['worker'=>$this]); |
|
| 142 | + $resolve = $this->app->resolve($job, ['worker'=>$this]); |
|
| 143 | 143 | |
| 144 | - if($resolve instanceof JobContracts){ |
|
| 144 | + if ($resolve instanceof JobContracts) { |
|
| 145 | 145 | return $resolve->execute(); |
| 146 | 146 | } |
| 147 | 147 | } |