@@ -14,30 +14,30 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | public function processHandler() |
| 16 | 16 | { |
| 17 | - return $this->errorHandler(function(){ |
|
| 17 | + return $this->errorHandler(function() { |
|
| 18 | 18 | |
| 19 | 19 | $results = []; |
| 20 | 20 | |
| 21 | - foreach ($this->list as $table =>$datas){ |
|
| 21 | + foreach ($this->list as $table =>$datas) { |
|
| 22 | 22 | |
| 23 | - foreach ($datas as $data){ |
|
| 23 | + foreach ($datas as $data) { |
|
| 24 | 24 | |
| 25 | - $query = $this->queryBuilder($table,$data); |
|
| 25 | + $query = $this->queryBuilder($table, $data); |
|
| 26 | 26 | |
| 27 | 27 | $query = $query->handle(); |
| 28 | 28 | |
| 29 | 29 | |
| 30 | - if($query===false){ |
|
| 30 | + if ($query===false) { |
|
| 31 | 31 | $results[] = []; |
| 32 | 32 | } |
| 33 | - else{ |
|
| 34 | - $status =($query['result']!==false) ? true : false; |
|
| 33 | + else { |
|
| 34 | + $status = ($query['result']!==false) ? true : false; |
|
| 35 | 35 | |
| 36 | - if($status){ |
|
| 36 | + if ($status) { |
|
| 37 | 37 | $this->schema->getConnection()->generateEntity($table); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - $results[]= [ |
|
| 40 | + $results[] = [ |
|
| 41 | 41 | 'success'=>$status, |
| 42 | 42 | 'file'=>$data->getFile(), |
| 43 | 43 | 'table'=>$table, |
@@ -67,11 +67,11 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | $alterBinds = $object->getAlterBinds(); |
| 69 | 69 | |
| 70 | - if(!is_null($alterBinds) && count($alterBinds)>1){ |
|
| 70 | + if (!is_null($alterBinds) && count($alterBinds)>1) { |
|
| 71 | 71 | exception()->runtime('Only one command can be applied to alter groups'); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if(count($object->getError())){ |
|
| 74 | + if (count($object->getError())) { |
|
| 75 | 75 | exception()->runtime(''.$object->getFile().' -> '.$object->getError()[0].''); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -29,8 +29,7 @@ |
||
| 29 | 29 | |
| 30 | 30 | if($query===false){ |
| 31 | 31 | $results[] = []; |
| 32 | - } |
|
| 33 | - else{ |
|
| 32 | + } else{ |
|
| 34 | 33 | $status =($query['result']!==false) ? true : false; |
| 35 | 34 | |
| 36 | 35 | if($status){ |
@@ -15,25 +15,24 @@ discard block |
||
| 15 | 15 | {
|
| 16 | 16 | $getCommandList = app()->commandList(); |
| 17 | 17 | |
| 18 | - $this->table->setHeaders(['command','project','params','description']); |
|
| 18 | + $this->table->setHeaders(['command', 'project', 'params', 'description']); |
|
| 19 | 19 | |
| 20 | 20 | $app = $this; |
| 21 | 21 | |
| 22 | - foreach ($getCommandList as $command=>$runnable){
|
|
| 22 | + foreach ($getCommandList as $command=>$runnable) {
|
|
| 23 | 23 | |
| 24 | - $commandInstance = app()->resolve($command,['argument'=>[]]); |
|
| 24 | + $commandInstance = app()->resolve($command, ['argument'=>[]]); |
|
| 25 | 25 | |
| 26 | 26 | $className = class_basename($commandInstance); |
| 27 | 27 | |
| 28 | - ClosureDispatcher::bind($commandInstance)->call(function() use($app,$className) |
|
| 28 | + ClosureDispatcher::bind($commandInstance)->call(function() use($app, $className) |
|
| 29 | 29 | {
|
| 30 | - if(isset($this->runnableMethods)){
|
|
| 30 | + if (isset($this->runnableMethods)) {
|
|
| 31 | 31 | |
| 32 | - foreach ($this->runnableMethods as $method=>$description){
|
|
| 32 | + foreach ($this->runnableMethods as $method=>$description) {
|
|
| 33 | 33 | |
| 34 | 34 | $commandRule = (isset($this->commandRule[$method])) ? |
| 35 | - $app->methodCommandRule($this->commandRule[$method]) : |
|
| 36 | - $app->methodCommandRule($this->commandRule); |
|
| 35 | + $app->methodCommandRule($this->commandRule[$method]) : $app->methodCommandRule($this->commandRule); |
|
| 37 | 36 | |
| 38 | 37 | $projectStatus = (isset($this->projectStatus)) ? 'YES' : 'NO'; |
| 39 | 38 | |
@@ -61,18 +60,18 @@ discard block |
||
| 61 | 60 | public function methodCommandRule($commandRule) |
| 62 | 61 | {
|
| 63 | 62 | |
| 64 | - if(is_array($commandRule)){
|
|
| 63 | + if (is_array($commandRule)) {
|
|
| 65 | 64 | |
| 66 | 65 | $list = []; |
| 67 | 66 | |
| 68 | - foreach ($commandRule as $rule){
|
|
| 69 | - if(!is_array($rule)){
|
|
| 67 | + foreach ($commandRule as $rule) {
|
|
| 68 | + if (!is_array($rule)) {
|
|
| 70 | 69 | $list[] = $rule.':['.$rule.']'; |
| 71 | 70 | } |
| 72 | 71 | |
| 73 | 72 | } |
| 74 | 73 | |
| 75 | - return implode(" ",$list);
|
|
| 74 | + return implode(" ", $list);
|
|
| 76 | 75 | } |
| 77 | 76 | |
| 78 | 77 | return '['.$commandRule.']'; |
@@ -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,25 +43,25 @@ 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 | 63 | $event = $listeners['console']['default']; |
| 64 | - return call_user_func_array($event,['args'=>$args,'app'=>$this->app]); |
|
| 64 | + return call_user_func_array($event, ['args'=>$args, 'app'=>$this->app]); |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | //If the console executor is a custom console application; in this case we look at the kernel directory inside the application. |
| 81 | 81 | //If the console class is not available on the kernel of resta, then the system will run the command class in the application. |
| 82 | - return $this->checkConsoleNamespace(function(){
|
|
| 82 | + return $this->checkConsoleNamespace(function() {
|
|
| 83 | 83 | |
| 84 | - if($this->isRunnableKernelCommandList()){
|
|
| 84 | + if ($this->isRunnableKernelCommandList()) {
|
|
| 85 | 85 | exception()->badMethodCall('this command is not runnable');
|
| 86 | 86 | } |
| 87 | 87 | |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | $consoleArguments = $this->getConsoleArgumentsWithKey(); |
| 90 | 90 | |
| 91 | 91 | // we get the instance data of the kernel command class of the system. |
| 92 | - $commander = (new $this->consoleClassNamespace($consoleArguments,$this)); |
|
| 92 | + $commander = (new $this->consoleClassNamespace($consoleArguments, $this)); |
|
| 93 | 93 | |
| 94 | 94 | // we check the command rules of each command class. |
| 95 | - $this->prepareCommander($commander,function($commander){
|
|
| 95 | + $this->prepareCommander($commander, function($commander) {
|
|
| 96 | 96 | return $commander->{$this->getConsoleClassMethod()}();
|
| 97 | 97 | }); |
| 98 | 98 | |
@@ -110,12 +110,12 @@ discard block |
||
| 110 | 110 | public function handle() |
| 111 | 111 | {
|
| 112 | 112 | //get is running console |
| 113 | - if($this->app->runningInConsole()){
|
|
| 113 | + if ($this->app->runningInConsole()) {
|
|
| 114 | 114 | |
| 115 | 115 | error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); |
| 116 | 116 | |
| 117 | 117 | //run console process |
| 118 | - if(count($this->getArguments())){
|
|
| 118 | + if (count($this->getArguments())) {
|
|
| 119 | 119 | return $this->consoleProcess(); |
| 120 | 120 | } |
| 121 | 121 | |
@@ -131,24 +131,24 @@ discard block |
||
| 131 | 131 | * @param callable $callback |
| 132 | 132 | * @return mixed |
| 133 | 133 | */ |
| 134 | - protected function prepareCommander(ConsoleOutputterContracts $commander,callable $callback) |
|
| 134 | + protected function prepareCommander(ConsoleOutputterContracts $commander, callable $callback) |
|
| 135 | 135 | {
|
| 136 | 136 | // closure binding custom command,move custom namespace as specific |
| 137 | 137 | // call prepare commander firstly for checking command builder |
| 138 | - $closureCommand = app()->resolve(ClosureDispatcher::class,['bind'=>$commander]); |
|
| 138 | + $closureCommand = app()->resolve(ClosureDispatcher::class, ['bind'=>$commander]); |
|
| 139 | 139 | |
| 140 | 140 | //assign commander method name |
| 141 | 141 | $closureCommand->prepareBind['methodName'] = $this->getConsoleClassMethod(); |
| 142 | 142 | |
| 143 | 143 | $prepareCommander = $commander->prepareCommander($closureCommand); |
| 144 | 144 | |
| 145 | - if(!$prepareCommander['status']){
|
|
| 145 | + if (!$prepareCommander['status']) {
|
|
| 146 | 146 | echo $commander->exception($prepareCommander); |
| 147 | 147 | die(); |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | //callback custom console |
| 151 | - return call_user_func_array($callback,[$commander]); |
|
| 151 | + return call_user_func_array($callback, [$commander]); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -161,8 +161,8 @@ discard block |
||
| 161 | 161 | $commandList = $this->app->commandList(); |
| 162 | 162 | |
| 163 | 163 | //is runnable kernel command conditions |
| 164 | - return !array_key_exists($this->consoleClassNamespace,$commandList) OR |
|
| 165 | - (array_key_exists($this->consoleClassNamespace,$commandList) AND |
|
| 164 | + return !array_key_exists($this->consoleClassNamespace, $commandList) OR |
|
| 165 | + (array_key_exists($this->consoleClassNamespace, $commandList) AND |
|
| 166 | 166 | !$commandList[$this->consoleClassNamespace]['isRunnable']); |
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | \ No newline at end of file |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * @var $type |
| 17 | 17 | */ |
| 18 | - public $type='model'; |
|
| 18 | + public $type = 'model'; |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * @var array |
@@ -32,17 +32,17 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * @var $commandRule |
| 34 | 34 | */ |
| 35 | - public $commandRule=['model','?table']; |
|
| 35 | + public $commandRule = ['model', '?table']; |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @method create |
| 39 | 39 | * @return mixed |
| 40 | 40 | */ |
| 41 | - public function create(){
|
|
| 41 | + public function create() {
|
|
| 42 | 42 | |
| 43 | 43 | $this->argument['file'] = $this->argument['model']; |
| 44 | 44 | |
| 45 | - if(!isset($this->argument['table'])){
|
|
| 45 | + if (!isset($this->argument['table'])) {
|
|
| 46 | 46 | $this->argument['table'] = $this->argument['file'].'s'; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -66,21 +66,21 @@ discard block |
||
| 66 | 66 | $this->touch['model/builder'] = $this->directory['builderDir'].''.DIRECTORY_SEPARATOR.''.$this->argument['file'].'Builder.php'; |
| 67 | 67 | $this->touch['model/contract'] = $this->directory['contract'].''.DIRECTORY_SEPARATOR.''.$this->argument['file'].'Contract.php'; |
| 68 | 68 | |
| 69 | - if(!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'Scope.php')){
|
|
| 69 | + if (!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'Scope.php')) {
|
|
| 70 | 70 | $this->touch['model/scope'] = $this->directory['helper'].''.DIRECTORY_SEPARATOR.'Scope.php'; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $tableMaps = $this->directory['modelDir'].''.DIRECTORY_SEPARATOR.'Map.php'; |
| 74 | 74 | |
| 75 | - $generator = new Generator($this->directory['builderDir'],'BuilderMap'); |
|
| 75 | + $generator = new Generator($this->directory['builderDir'], 'BuilderMap'); |
|
| 76 | 76 | |
| 77 | - if(!file_exists($this->directory['builderDir'].''.DIRECTORY_SEPARATOR.'BuilderMap.php')){
|
|
| 77 | + if (!file_exists($this->directory['builderDir'].''.DIRECTORY_SEPARATOR.'BuilderMap.php')) {
|
|
| 78 | 78 | |
| 79 | 79 | $this->setAnnotations(); |
| 80 | 80 | $generator->createClass(); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - if(!file_exists($this->touch['model/model'])){
|
|
| 83 | + if (!file_exists($this->touch['model/model'])) {
|
|
| 84 | 84 | |
| 85 | 85 | $generator->createMethod([ |
| 86 | 86 | strtolower($this->argument['file']) |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | //set project touch |
| 104 | - $this->file->touch($this,[ |
|
| 104 | + $this->file->touch($this, [ |
|
| 105 | 105 | 'stub'=>'Model_Create' |
| 106 | 106 | ]); |
| 107 | 107 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | /** |
| 113 | 113 | * @return bool |
| 114 | 114 | */ |
| 115 | - private function setAnnotations(){
|
|
| 115 | + private function setAnnotations() {
|
|
| 116 | 116 | |
| 117 | 117 | return Utils::changeClass(path()->serviceAnnotations().'.php', |
| 118 | 118 | ['Trait ServiceAnnotationsManager'=>'Trait ServiceAnnotationsManager'.PHP_EOL.' * @property \\'.app()->namespace()->builder().'\BuilderMap builder' |