@@ -27,13 +27,13 @@ discard block |
||
| 27 | 27 | {
|
| 28 | 28 | // we check that they are in |
| 29 | 29 | // the console to run the console commands in the kernel. |
| 30 | - if(Utils::isNamespaceExists($this->consoleClassNamespace)){
|
|
| 30 | + if (Utils::isNamespaceExists($this->consoleClassNamespace)) {
|
|
| 31 | 31 | return call_user_func($callback); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // if the kernel console is not found |
| 35 | 35 | // then we check the existence of the specific application command and run it if it is. |
| 36 | - return (new CustomConsoleProcess($this->getConsoleArgumentsWithKey(),$this))->handle(); |
|
| 36 | + return (new CustomConsoleProcess($this->getConsoleArgumentsWithKey(), $this))->handle(); |
|
| 37 | 37 | |
| 38 | 38 | } |
| 39 | 39 | |
@@ -43,29 +43,29 @@ discard block |
||
| 43 | 43 | * @param array $args |
| 44 | 44 | * @return void|mixed |
| 45 | 45 | */ |
| 46 | - protected function consoleEventHandler($args=array()) |
|
| 46 | + protected function consoleEventHandler($args = array()) |
|
| 47 | 47 | {
|
| 48 | - if(isset($this->app['eventDispatcher'])){
|
|
| 48 | + if (isset($this->app['eventDispatcher'])) {
|
|
| 49 | 49 | |
| 50 | 50 | $listeners = event()->getListeners(); |
| 51 | 51 | |
| 52 | - if(isset($args['event']) && isset($listeners['console'])){
|
|
| 52 | + if (isset($args['event']) && isset($listeners['console'])) {
|
|
| 53 | 53 | |
| 54 | - if(strtolower($args['event'])!=='default' && isset($listeners['console'][strtolower($args['event'])])){
|
|
| 54 | + if (strtolower($args['event'])!=='default' && isset($listeners['console'][strtolower($args['event'])])) {
|
|
| 55 | 55 | |
| 56 | 56 | $event = $listeners['console'][strtolower($args['event'])]; |
| 57 | - return call_user_func_array($event,['app'=>$this->app,'args'=>$args,]); |
|
| 57 | + return call_user_func_array($event, ['app'=>$this->app, 'args'=>$args, ]); |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - if(isset($listeners['console']['default'])){
|
|
| 61 | + if (isset($listeners['console']['default'])) {
|
|
| 62 | 62 | |
| 63 | - if($this->app->has('arguments')){
|
|
| 64 | - $args = array_merge($args,$this->app->get('arguments'));
|
|
| 63 | + if ($this->app->has('arguments')) {
|
|
| 64 | + $args = array_merge($args, $this->app->get('arguments'));
|
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $event = $listeners['console']['default']; |
| 68 | - return call_user_func_array($event,['args'=>$args,'app'=>$this->app]); |
|
| 68 | + return call_user_func_array($event, ['args'=>$args, 'app'=>$this->app]); |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
@@ -83,9 +83,9 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | //If the console executor is a custom console application; in this case we look at the kernel directory inside the application. |
| 85 | 85 | //If the console class is not available on the kernel of resta, then the system will run the command class in the application. |
| 86 | - return $this->checkConsoleNamespace(function(){
|
|
| 86 | + return $this->checkConsoleNamespace(function() {
|
|
| 87 | 87 | |
| 88 | - if($this->isRunnableKernelCommandList()){
|
|
| 88 | + if ($this->isRunnableKernelCommandList()) {
|
|
| 89 | 89 | exception()->badMethodCall('this command is not runnable');
|
| 90 | 90 | } |
| 91 | 91 | |
@@ -93,10 +93,10 @@ discard block |
||
| 93 | 93 | $consoleArguments = $this->getConsoleArgumentsWithKey(); |
| 94 | 94 | |
| 95 | 95 | // we get the instance data of the kernel command class of the system. |
| 96 | - $commander = (new $this->consoleClassNamespace($consoleArguments,$this)); |
|
| 96 | + $commander = (new $this->consoleClassNamespace($consoleArguments, $this)); |
|
| 97 | 97 | |
| 98 | 98 | // we check the command rules of each command class. |
| 99 | - $this->prepareCommander($commander,function($commander){
|
|
| 99 | + $this->prepareCommander($commander, function($commander) {
|
|
| 100 | 100 | return $commander->{$this->getConsoleClassMethod()}();
|
| 101 | 101 | }); |
| 102 | 102 | |
@@ -114,12 +114,12 @@ discard block |
||
| 114 | 114 | public function handle() |
| 115 | 115 | {
|
| 116 | 116 | //get is running console |
| 117 | - if($this->app->runningInConsole()){
|
|
| 117 | + if ($this->app->runningInConsole()) {
|
|
| 118 | 118 | |
| 119 | 119 | error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); |
| 120 | 120 | |
| 121 | 121 | //run console process |
| 122 | - if(count($this->getArguments())){
|
|
| 122 | + if (count($this->getArguments())) {
|
|
| 123 | 123 | return $this->consoleProcess(); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -135,24 +135,24 @@ discard block |
||
| 135 | 135 | * @param callable $callback |
| 136 | 136 | * @return mixed |
| 137 | 137 | */ |
| 138 | - protected function prepareCommander(ConsoleOutputterContracts $commander,callable $callback) |
|
| 138 | + protected function prepareCommander(ConsoleOutputterContracts $commander, callable $callback) |
|
| 139 | 139 | {
|
| 140 | 140 | // closure binding custom command,move custom namespace as specific |
| 141 | 141 | // call prepare commander firstly for checking command builder |
| 142 | - $closureCommand = app()->resolve(ClosureDispatcher::class,['bind'=>$commander]); |
|
| 142 | + $closureCommand = app()->resolve(ClosureDispatcher::class, ['bind'=>$commander]); |
|
| 143 | 143 | |
| 144 | 144 | //assign commander method name |
| 145 | 145 | $closureCommand->prepareBind['methodName'] = $this->getConsoleClassMethod(); |
| 146 | 146 | |
| 147 | 147 | $prepareCommander = $commander->prepareCommander($closureCommand); |
| 148 | 148 | |
| 149 | - if(!$prepareCommander['status']){
|
|
| 149 | + if (!$prepareCommander['status']) {
|
|
| 150 | 150 | echo $commander->exception($prepareCommander); |
| 151 | 151 | die(); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | //callback custom console |
| 155 | - return call_user_func_array($callback,[$commander]); |
|
| 155 | + return call_user_func_array($callback, [$commander]); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -165,8 +165,8 @@ discard block |
||
| 165 | 165 | $commandList = $this->app->commandList(); |
| 166 | 166 | |
| 167 | 167 | //is runnable kernel command conditions |
| 168 | - return !array_key_exists($this->consoleClassNamespace,$commandList) OR |
|
| 169 | - (array_key_exists($this->consoleClassNamespace,$commandList) AND |
|
| 168 | + return !array_key_exists($this->consoleClassNamespace, $commandList) OR |
|
| 169 | + (array_key_exists($this->consoleClassNamespace, $commandList) AND |
|
| 170 | 170 | !$commandList[$this->consoleClassNamespace]['isRunnable']); |
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | \ No newline at end of file |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function handle() |
| 24 | 24 | { |
| 25 | - foreach ($this->tableFilters() as $table=>$files){ |
|
| 25 | + foreach ($this->tableFilters() as $table=>$files) { |
|
| 26 | 26 | |
| 27 | 27 | $table = strtolower($table); |
| 28 | 28 | |
@@ -30,28 +30,28 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | $checkMigrationMain = $this->schema->getConnection()->checkMigrationMain(); |
| 32 | 32 | |
| 33 | - if($checkMigrationMain===false && isset($this->tableFilters()['Migrations'][0])){ |
|
| 34 | - $this->apply($this->tableFilters()['Migrations'][0],'migrations'); |
|
| 33 | + if ($checkMigrationMain===false && isset($this->tableFilters()['Migrations'][0])) { |
|
| 34 | + $this->apply($this->tableFilters()['Migrations'][0], 'migrations'); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - $checkMigration = $this->schema->getConnection()->checkMigration($table,$file); |
|
| 37 | + $checkMigration = $this->schema->getConnection()->checkMigration($table, $file); |
|
| 38 | 38 | |
| 39 | - if(!$checkMigration){ |
|
| 39 | + if (!$checkMigration) { |
|
| 40 | 40 | |
| 41 | - $getClassName = preg_replace('@(\d+)_@is','',$file); |
|
| 41 | + $getClassName = preg_replace('@(\d+)_@is', '', $file); |
|
| 42 | 42 | $className = $this->getClassName($getClassName); |
| 43 | 43 | |
| 44 | 44 | require_once ($file); |
| 45 | 45 | |
| 46 | - $capsule = new SchemaCapsule($this->config,$file,$table); |
|
| 46 | + $capsule = new SchemaCapsule($this->config, $file, $table); |
|
| 47 | 47 | |
| 48 | 48 | $this->list[$table][] = (new $className)->up($capsule); |
| 49 | 49 | |
| 50 | - if(app()->has('arguments')){ |
|
| 50 | + if (app()->has('arguments')) { |
|
| 51 | 51 | app()->terminate('arguments'); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - app()->register('arguments','table',$table); |
|
| 54 | + app()->register('arguments', 'table', $table); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
@@ -66,14 +66,14 @@ discard block |
||
| 66 | 66 | * @param $table |
| 67 | 67 | * @return mixed|string |
| 68 | 68 | */ |
| 69 | - public function apply($file,$table) |
|
| 69 | + public function apply($file, $table) |
|
| 70 | 70 | { |
| 71 | - $getClassName = preg_replace('@(\d+)_@is','',$file); |
|
| 71 | + $getClassName = preg_replace('@(\d+)_@is', '', $file); |
|
| 72 | 72 | $className = $this->getClassName($getClassName); |
| 73 | 73 | |
| 74 | 74 | require_once ($file); |
| 75 | 75 | |
| 76 | - $capsule = new SchemaCapsule($this->config,$file,$table); |
|
| 76 | + $capsule = new SchemaCapsule($this->config, $file, $table); |
|
| 77 | 77 | |
| 78 | 78 | $this->list[$table][] = (new $className)->up($capsule); |
| 79 | 79 | |