@@ -34,13 +34,13 @@ discard block |
||
| 34 | 34 | public function get() |
| 35 | 35 | {
|
| 36 | 36 | // The config process class should not be null. |
| 37 | - if(self::$configProcessInstance!==null){
|
|
| 37 | + if (self::$configProcessInstance!==null) {
|
|
| 38 | 38 | |
| 39 | 39 | //get config variables |
| 40 | 40 | $config = self::$config; |
| 41 | 41 | |
| 42 | 42 | // offset config variables to config process class |
| 43 | - self::$configProcessInstance->offsetSet('config',$config);
|
|
| 43 | + self::$configProcessInstance->offsetSet('config', $config);
|
|
| 44 | 44 | |
| 45 | 45 | //get config variable from config process class |
| 46 | 46 | return self::$configProcessInstance->get(); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @param null|string $config |
| 76 | 76 | * @return Config |
| 77 | 77 | */ |
| 78 | - public static function macro($config=null) |
|
| 78 | + public static function macro($config = null) |
|
| 79 | 79 | {
|
| 80 | 80 | /** @var Macro $macro */ |
| 81 | 81 | $macro = app()->get('macro');
|
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * @param null $config |
| 89 | 89 | * @return Config |
| 90 | 90 | */ |
| 91 | - public static function make($config=null) |
|
| 91 | + public static function make($config = null) |
|
| 92 | 92 | {
|
| 93 | 93 | self::$config = $config; |
| 94 | 94 | self::$configProcessInstance = app()->resolve(ConfigProcess::class); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * @param array $data |
| 102 | 102 | * @return bool|mixed |
| 103 | 103 | */ |
| 104 | - public function set($data=array()) |
|
| 104 | + public function set($data = array()) |
|
| 105 | 105 | {
|
| 106 | 106 | // receive the necessary config settings. |
| 107 | 107 | $configPath = path()->config(); |
@@ -109,12 +109,12 @@ discard block |
||
| 109 | 109 | $setConfigPath = $configPath.''.DIRECTORY_SEPARATOR.''.ucfirst($configArray).'.php'; |
| 110 | 110 | $getConfigWrap = Arr::wrap(config($configArray)); |
| 111 | 111 | |
| 112 | - foreach ($data as $value){
|
|
| 112 | + foreach ($data as $value) {
|
|
| 113 | 113 | |
| 114 | 114 | // we check the config value not to be rewritten. |
| 115 | - if(!in_array($value,$getConfigWrap)){
|
|
| 116 | - $setData = '<?php return '.var_export(array_merge($getConfigWrap,$data), true).';'; |
|
| 117 | - return app()->resolve(FileProcess::class)->dumpFile($setConfigPath,$setData); |
|
| 115 | + if (!in_array($value, $getConfigWrap)) {
|
|
| 116 | + $setData = '<?php return '.var_export(array_merge($getConfigWrap, $data), true).';'; |
|
| 117 | + return app()->resolve(FileProcess::class)->dumpFile($setConfigPath, $setData); |
|
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | } |
@@ -14,9 +14,9 @@ |
||
| 14 | 14 | * |
| 15 | 15 | * @param null|string $path |
| 16 | 16 | */ |
| 17 | - public static function setPath($path=null) |
|
| 17 | + public static function setPath($path = null) |
|
| 18 | 18 | {
|
| 19 | - if(!is_null($path)){
|
|
| 19 | + if (!is_null($path)) {
|
|
| 20 | 20 | self::$requestPath = $path; |
| 21 | 21 | } |
| 22 | 22 | } |
@@ -10,9 +10,9 @@ discard block |
||
| 10 | 10 | /** |
| 11 | 11 | * @param array $data |
| 12 | 12 | */ |
| 13 | - public function exception($data=array()) |
|
| 13 | + public function exception($data = array()) |
|
| 14 | 14 | {
|
| 15 | - if(!isset($data['project']) and !isset($data['version'])){
|
|
| 15 | + if (!isset($data['project']) and !isset($data['version'])) {
|
|
| 16 | 16 | exception()->notFoundException('No Project or Version');
|
| 17 | 17 | } |
| 18 | 18 | |
@@ -21,17 +21,17 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | //If there is no project on the url |
| 23 | 23 | //we throw an exception |
| 24 | - if($data['project']===null OR !file_exists($appPath)){
|
|
| 24 | + if ($data['project']===null OR !file_exists($appPath)) {
|
|
| 25 | 25 | exception()->notFoundException('No Project');
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - if(!in_array($data['version'],UrlVersionIdentifier::supportedVersions())){
|
|
| 28 | + if (!in_array($data['version'], UrlVersionIdentifier::supportedVersions())) {
|
|
| 29 | 29 | throw new DomainException('Version Number is not supported');
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | //If there is no endpoint on the url |
| 33 | 33 | //we throw an exception |
| 34 | - if($data['endpoint']===null){
|
|
| 34 | + if ($data['endpoint']===null) {
|
|
| 35 | 35 | exception()->notFoundException('No Endpoint');
|
| 36 | 36 | } |
| 37 | 37 | } |
@@ -99,8 +99,7 @@ discard block |
||
| 99 | 99 | // in the application directory class. |
| 100 | 100 | if(Utils::isNamespaceExists($nameNamespace)){
|
| 101 | 101 | $callNamespace = new $nameNamespace; |
| 102 | - } |
|
| 103 | - else{
|
|
| 102 | + } else{
|
|
| 104 | 103 | |
| 105 | 104 | // if you do not have an exception in the application directory, |
| 106 | 105 | // this time we are looking for an exception in the core directory. |
@@ -133,8 +132,7 @@ discard block |
||
| 133 | 132 | //throw exception |
| 134 | 133 | if($msg===null){
|
| 135 | 134 | throw new $callNamespace; |
| 136 | - } |
|
| 137 | - else{
|
|
| 135 | + } else{
|
|
| 138 | 136 | throw new $callNamespace($msg); |
| 139 | 137 | } |
| 140 | 138 | |
@@ -16,13 +16,13 @@ discard block |
||
| 16 | 16 | * @param null|string $name |
| 17 | 17 | * @param array $params |
| 18 | 18 | */ |
| 19 | - public function __construct($app,$name=null,$params=array()) |
|
| 19 | + public function __construct($app, $name = null, $params = array()) |
|
| 20 | 20 | {
|
| 21 | 21 | parent::__construct($app); |
| 22 | 22 | |
| 23 | 23 | // we help the user to pull a special message from |
| 24 | 24 | // the translate section to be specified by the user for the exception. |
| 25 | - $this->exceptionTranslate($name,$params); |
|
| 25 | + $this->exceptionTranslate($name, $params); |
|
| 26 | 26 | |
| 27 | 27 | // for real file path with |
| 28 | 28 | // debug backtrace method are doing follow. |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | * @param $name |
| 36 | 36 | * @param array $params |
| 37 | 37 | */ |
| 38 | - private function exceptionTranslate($name,$params=array()) |
|
| 38 | + private function exceptionTranslate($name, $params = array()) |
|
| 39 | 39 | {
|
| 40 | - if($name!==null){
|
|
| 41 | - if(count($params)){
|
|
| 42 | - $this->app->register('exceptionTranslateParams',$name,$params);
|
|
| 40 | + if ($name!==null) {
|
|
| 41 | + if (count($params)) {
|
|
| 42 | + $this->app->register('exceptionTranslateParams', $name, $params);
|
|
| 43 | 43 | } |
| 44 | - $this->app->register('exceptionTranslate',$name);
|
|
| 44 | + $this->app->register('exceptionTranslate', $name);
|
|
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | |
@@ -52,23 +52,23 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function debugBackTrace() |
| 54 | 54 | {
|
| 55 | - foreach (debug_backtrace() as $key=>$value){
|
|
| 55 | + foreach (debug_backtrace() as $key=>$value) {
|
|
| 56 | 56 | |
| 57 | - if(isset(debug_backtrace()[$key],debug_backtrace()[$key]['file'])) |
|
| 57 | + if (isset(debug_backtrace()[$key], debug_backtrace()[$key]['file'])) |
|
| 58 | 58 | {
|
| 59 | - $this->app->register('exceptionFile',debug_backtrace()[$key]['file']);
|
|
| 60 | - $this->app->register('exceptionLine',debug_backtrace()[$key]['line']);
|
|
| 59 | + $this->app->register('exceptionFile', debug_backtrace()[$key]['file']);
|
|
| 60 | + $this->app->register('exceptionLine', debug_backtrace()[$key]['line']);
|
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | Dependencies::loadBootstrapperNeedsForException(); |
| 64 | 64 | |
| 65 | - if(isset($value['file']) && isset(core()->urlComponent)){
|
|
| 66 | - if(preg_match('@'.core()->urlComponent['project'].'|boot|providers@',$value['file'])){
|
|
| 65 | + if (isset($value['file']) && isset(core()->urlComponent)) {
|
|
| 66 | + if (preg_match('@'.core()->urlComponent['project'].'|boot|providers@', $value['file'])) {
|
|
| 67 | 67 | |
| 68 | 68 | $this->app->terminate('exceptionFile');
|
| 69 | 69 | $this->app->terminate('exceptionLine');
|
| 70 | - $this->app->register('exceptionFile',$value['file']);
|
|
| 71 | - $this->app->register('exceptionLine',$value['line']);
|
|
| 70 | + $this->app->register('exceptionFile', $value['file']);
|
|
| 71 | + $this->app->register('exceptionLine', $value['line']);
|
|
| 72 | 72 | |
| 73 | 73 | break; |
| 74 | 74 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function __get($name) |
| 83 | 83 | {
|
| 84 | - $this->customException($name,null,debug_backtrace()); |
|
| 84 | + $this->customException($name, null, debug_backtrace()); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * @param null|string $msg |
| 92 | 92 | * @param array $trace |
| 93 | 93 | */ |
| 94 | - public function customException($name,$msg=null,$trace=array()) |
|
| 94 | + public function customException($name, $msg = null, $trace = array()) |
|
| 95 | 95 | {
|
| 96 | 96 | //We use the magic method for the exception and |
| 97 | 97 | //call the exception class in the application to get the instance. |
@@ -100,22 +100,22 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | // first, you are looking for an exception |
| 102 | 102 | // in the application directory class. |
| 103 | - if(Utils::isNamespaceExists($nameNamespace)){
|
|
| 103 | + if (Utils::isNamespaceExists($nameNamespace)) {
|
|
| 104 | 104 | $callNamespace = new $nameNamespace; |
| 105 | 105 | } |
| 106 | - else{
|
|
| 106 | + else {
|
|
| 107 | 107 | |
| 108 | 108 | // if you do not have an exception in the application directory, |
| 109 | 109 | // this time we are looking for an exception in the core directory. |
| 110 | 110 | $nameNamespace = __NAMESPACE__.'\\'.$nameException; |
| 111 | - if(Utils::isNamespaceExists($nameNamespace)){
|
|
| 111 | + if (Utils::isNamespaceExists($nameNamespace)) {
|
|
| 112 | 112 | $callNamespace = new $nameNamespace; |
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - if(isset($callNamespace)){
|
|
| 116 | + if (isset($callNamespace)) {
|
|
| 117 | 117 | |
| 118 | - $traceForCustom = Utils::removeTrace($trace,self::removeExceptionFileItems); |
|
| 118 | + $traceForCustom = Utils::removeTrace($trace, self::removeExceptionFileItems); |
|
| 119 | 119 | |
| 120 | 120 | // we will set the information about the exception trace, |
| 121 | 121 | // and then bind it specifically to the event method. |
@@ -127,19 +127,19 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | |
| 129 | 129 | // we register the custom exception trace value with the global kernel object. |
| 130 | - $this->app->register('exceptiontrace',$customExceptionTrace);
|
|
| 130 | + $this->app->register('exceptiontrace', $customExceptionTrace);
|
|
| 131 | 131 | |
| 132 | 132 | //If the developer wants to execute an event when calling a special exception, |
| 133 | 133 | //we process the event method. |
| 134 | - if(method_exists($callNamespace,'event')){
|
|
| 134 | + if (method_exists($callNamespace, 'event')) {
|
|
| 135 | 135 | $callNamespace->event($customExceptionTrace); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | //throw exception |
| 139 | - if($msg===null){
|
|
| 139 | + if ($msg===null) {
|
|
| 140 | 140 | throw new $callNamespace; |
| 141 | 141 | } |
| 142 | - else{
|
|
| 142 | + else {
|
|
| 143 | 143 | throw new $callNamespace($msg); |
| 144 | 144 | } |
| 145 | 145 | |
@@ -152,8 +152,8 @@ discard block |
||
| 152 | 152 | * @param $name |
| 153 | 153 | * @param array $arguments |
| 154 | 154 | */ |
| 155 | - public function __call($name, $arguments=array()) |
|
| 155 | + public function __call($name, $arguments = array()) |
|
| 156 | 156 | {
|
| 157 | - $this->customException($name,current($arguments),debug_backtrace()); |
|
| 157 | + $this->customException($name, current($arguments), debug_backtrace()); |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | \ No newline at end of file |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * @var $type |
| 16 | 16 | */ |
| 17 | - public $type='project'; |
|
| 17 | + public $type = 'project'; |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * @var array |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | /** |
| 32 | 32 | * @var $commandRule |
| 33 | 33 | */ |
| 34 | - public $commandRule=[]; |
|
| 34 | + public $commandRule = []; |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * @method create |
@@ -45,15 +45,15 @@ discard block |
||
| 45 | 45 | $this->directory['projectDir'] = $this->projectPath(); |
| 46 | 46 | $this->argument['exceptionNamespace'] = app()->namespace()->exception(); |
| 47 | 47 | |
| 48 | - $recursiveDefaultDirectory = explode("\\",$this->argument['project']);
|
|
| 48 | + $recursiveDefaultDirectory = explode("\\", $this->argument['project']);
|
|
| 49 | 49 | $this->argument['applicationName'] = pos($recursiveDefaultDirectory); |
| 50 | 50 | $recursiveDefaultDirectory[] = 'V1'; |
| 51 | 51 | $recursiveDefaultDirectoryList = []; |
| 52 | 52 | |
| 53 | - foreach (array_slice($recursiveDefaultDirectory,1) as $defaultDirectory){
|
|
| 53 | + foreach (array_slice($recursiveDefaultDirectory, 1) as $defaultDirectory) {
|
|
| 54 | 54 | |
| 55 | - $recursiveDefaultDirectoryList[]=$defaultDirectory; |
|
| 56 | - $this->directory[$defaultDirectory.'Path'] = $this->projectPath().''.implode("/",$recursiveDefaultDirectoryList);
|
|
| 55 | + $recursiveDefaultDirectoryList[] = $defaultDirectory; |
|
| 56 | + $this->directory[$defaultDirectory.'Path'] = $this->projectPath().''.implode("/", $recursiveDefaultDirectoryList);
|
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | //$this->directory['optionalDir'] = $this->optional(); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | //$this->directory['sourceDir'] = $this->sourceDir(); |
| 80 | 80 | //$this->directory['sourceSupportDir'] = $this->sourceSupportDir(); |
| 81 | 81 | //$this->directory['sourceSupportTraitDir'] = $this->sourceSupportDir().'/Traits'; |
| 82 | - $this->directory['exceptionDir'] = app()->path()->exception(); |
|
| 82 | + $this->directory['exceptionDir'] = app()->path()->exception(); |
|
| 83 | 83 | |
| 84 | 84 | //set project directory |
| 85 | 85 | $this->file->makeDirectory($this); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $this->touch['app/gitignore'] = $this->projectPath().'/.gitignore'; |
| 131 | 131 | $this->touch['app/composer'] = $this->projectPath().'/composer.json'; |
| 132 | 132 | $this->touch['test/index'] = $this->storage().'/index.html'; |
| 133 | - $this->touch['exception/authenticate'] = $this->directory['exceptionDir'] .'/AuthenticateException.php'; |
|
| 133 | + $this->touch['exception/authenticate'] = $this->directory['exceptionDir'].'/AuthenticateException.php'; |
|
| 134 | 134 | |
| 135 | 135 | //set project touch |
| 136 | 136 | $this->file->touch($this); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | public function getArguments() |
| 17 | 17 | {
|
| 18 | 18 | //if there is no arguments constant |
| 19 | - if(!defined('arguments')) define ('arguments',['api']);
|
|
| 19 | + if (!defined('arguments')) define('arguments', ['api']);
|
|
| 20 | 20 | |
| 21 | 21 | //get psr standard console arguments |
| 22 | 22 | return core()->consoleArguments = Utils::upperCase(arguments); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function getConsoleClassRealArguments() |
| 51 | 51 | {
|
| 52 | - return array_slice($this->getArguments(),2); |
|
| 52 | + return array_slice($this->getArguments(), 2); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -65,19 +65,19 @@ discard block |
||
| 65 | 65 | $listKey = []; |
| 66 | 66 | $listKey['project'] = null; |
| 67 | 67 | |
| 68 | - if(property_exists($this,'consoleClassNamespace')){
|
|
| 68 | + if (property_exists($this, 'consoleClassNamespace')) {
|
|
| 69 | 69 | $listKey['class'] = strtolower(class_basename($this->consoleClassNamespace)); |
| 70 | 70 | $listKey['classMethod'] = strtolower($this->getConsoleClassMethod()); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - foreach($getConsoleClassRealArguments as $key=>$value){
|
|
| 73 | + foreach ($getConsoleClassRealArguments as $key=>$value) {
|
|
| 74 | 74 | |
| 75 | - if($key=="0"){
|
|
| 75 | + if ($key=="0") {
|
|
| 76 | 76 | $listKey['project'] = $value; |
| 77 | 77 | } |
| 78 | - else{
|
|
| 78 | + else {
|
|
| 79 | 79 | |
| 80 | - $colonExplode = explode(":",$value);
|
|
| 80 | + $colonExplode = explode(":", $value);
|
|
| 81 | 81 | $listKey[strtolower($colonExplode[0])] = ucfirst($colonExplode[1]); |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -109,14 +109,14 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | $this->getConsoleArgumentsWithKey(); |
| 111 | 111 | |
| 112 | - if(isset($arguments[2])){
|
|
| 112 | + if (isset($arguments[2])) {
|
|
| 113 | 113 | $app = $arguments[2]; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - if(!defined('group')){
|
|
| 117 | - define('group',StaticPathList::$projectPrefixGroup);
|
|
| 116 | + if (!defined('group')) {
|
|
| 117 | + define('group', StaticPathList::$projectPrefixGroup);
|
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if(!defined('app') and isset($arguments[2])) define('app',isset($app) ? $app : null);
|
|
| 120 | + if (!defined('app') and isset($arguments[2])) define('app', isset($app) ? $app : null);
|
|
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | \ No newline at end of file |
@@ -16,7 +16,9 @@ discard block |
||
| 16 | 16 | public function getArguments() |
| 17 | 17 | {
|
| 18 | 18 | //if there is no arguments constant |
| 19 | - if(!defined('arguments')) define ('arguments',['api']);
|
|
| 19 | + if(!defined('arguments')) {
|
|
| 20 | + define ('arguments',['api']);
|
|
| 21 | + } |
|
| 20 | 22 | |
| 21 | 23 | //get psr standard console arguments |
| 22 | 24 | return core()->consoleArguments = Utils::upperCase(arguments); |
@@ -74,8 +76,7 @@ discard block |
||
| 74 | 76 | |
| 75 | 77 | if($key=="0"){
|
| 76 | 78 | $listKey['project'] = $value; |
| 77 | - } |
|
| 78 | - else{
|
|
| 79 | + } else{
|
|
| 79 | 80 | |
| 80 | 81 | $colonExplode = explode(":",$value);
|
| 81 | 82 | $listKey[strtolower($colonExplode[0])] = ucfirst($colonExplode[1]); |
@@ -117,6 +118,8 @@ discard block |
||
| 117 | 118 | define('group',StaticPathList::$projectPrefixGroup);
|
| 118 | 119 | } |
| 119 | 120 | |
| 120 | - if(!defined('app') and isset($arguments[2])) define('app',isset($app) ? $app : null);
|
|
| 121 | + if(!defined('app') and isset($arguments[2])) {
|
|
| 122 | + define('app',isset($app) ? $app : null);
|
|
| 123 | + } |
|
| 121 | 124 | } |
| 122 | 125 | } |
| 123 | 126 | \ No newline at end of file |
@@ -14,6 +14,6 @@ |
||
| 14 | 14 | * @param array $commander |
| 15 | 15 | * @return mixed |
| 16 | 16 | */ |
| 17 | - public function exception($commander=array()); |
|
| 17 | + public function exception($commander = array()); |
|
| 18 | 18 | |
| 19 | 19 | } |
| 20 | 20 | \ No newline at end of file |
@@ -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,10 +110,10 @@ 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 | //run console process |
| 116 | - if(count($this->getArguments())){
|
|
| 116 | + if (count($this->getArguments())) {
|
|
| 117 | 117 | return $this->consoleProcess(); |
| 118 | 118 | } |
| 119 | 119 | |
@@ -129,24 +129,24 @@ discard block |
||
| 129 | 129 | * @param callable $callback |
| 130 | 130 | * @return mixed |
| 131 | 131 | */ |
| 132 | - protected function prepareCommander(ConsoleOutputterContracts $commander,callable $callback) |
|
| 132 | + protected function prepareCommander(ConsoleOutputterContracts $commander, callable $callback) |
|
| 133 | 133 | {
|
| 134 | 134 | // closure binding custom command,move custom namespace as specific |
| 135 | 135 | // call prepare commander firstly for checking command builder |
| 136 | - $closureCommand = app()->resolve(ClosureDispatcher::class,['bind'=>$commander]); |
|
| 136 | + $closureCommand = app()->resolve(ClosureDispatcher::class, ['bind'=>$commander]); |
|
| 137 | 137 | |
| 138 | 138 | //assign commander method name |
| 139 | 139 | $closureCommand->prepareBind['methodName'] = $this->getConsoleClassMethod(); |
| 140 | 140 | |
| 141 | 141 | $prepareCommander = $commander->prepareCommander($closureCommand); |
| 142 | 142 | |
| 143 | - if(!$prepareCommander['status']){
|
|
| 143 | + if (!$prepareCommander['status']) {
|
|
| 144 | 144 | echo $commander->exception($prepareCommander); |
| 145 | 145 | die(); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | //callback custom console |
| 149 | - return call_user_func_array($callback,[$commander]); |
|
| 149 | + return call_user_func_array($callback, [$commander]); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
@@ -159,8 +159,8 @@ discard block |
||
| 159 | 159 | $commandList = $this->app->commandList(); |
| 160 | 160 | |
| 161 | 161 | //is runnable kernel command conditions |
| 162 | - return !array_key_exists($this->consoleClassNamespace,$commandList) OR |
|
| 163 | - (array_key_exists($this->consoleClassNamespace,$commandList) AND |
|
| 162 | + return !array_key_exists($this->consoleClassNamespace, $commandList) OR |
|
| 163 | + (array_key_exists($this->consoleClassNamespace, $commandList) AND |
|
| 164 | 164 | !$commandList[$this->consoleClassNamespace]['isRunnable']); |
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | \ No newline at end of file |
@@ -8,83 +8,83 @@ |
||
| 8 | 8 | * @param null|string $msg |
| 9 | 9 | * @return mixed |
| 10 | 10 | */ |
| 11 | - public function invalidArgument($msg=null); |
|
| 11 | + public function invalidArgument($msg = null); |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * @param null|string $msg |
| 15 | 15 | * @return mixed |
| 16 | 16 | */ |
| 17 | - public function badFunctionCall($msg=null); |
|
| 17 | + public function badFunctionCall($msg = null); |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * @param null|string $msg |
| 21 | 21 | * @return mixed |
| 22 | 22 | */ |
| 23 | - public function badMethodCall($msg=null); |
|
| 23 | + public function badMethodCall($msg = null); |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * @param null|string $msg |
| 27 | 27 | * @return mixed |
| 28 | 28 | */ |
| 29 | - public function domain($msg=null); |
|
| 29 | + public function domain($msg = null); |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * @param null|string $msg |
| 33 | 33 | * @return mixed |
| 34 | 34 | */ |
| 35 | - public function length($msg=null); |
|
| 35 | + public function length($msg = null); |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @param null|string $msg |
| 39 | 39 | * @return mixed |
| 40 | 40 | */ |
| 41 | - public function logic($msg=null); |
|
| 41 | + public function logic($msg = null); |
|
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * @param null|string $msg |
| 45 | 45 | * @return mixed |
| 46 | 46 | */ |
| 47 | - public function notFoundException($msg=null); |
|
| 47 | + public function notFoundException($msg = null); |
|
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * @param null|string $msg |
| 51 | 51 | * @return mixed |
| 52 | 52 | */ |
| 53 | - public function fileNotFoundException($msg=null); |
|
| 53 | + public function fileNotFoundException($msg = null); |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * @param null|string $msg |
| 57 | 57 | * @return mixed |
| 58 | 58 | */ |
| 59 | - public function outOfRange($msg=null); |
|
| 59 | + public function outOfRange($msg = null); |
|
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * @param null|string $msg |
| 63 | 63 | * @return mixed |
| 64 | 64 | */ |
| 65 | - public function overflow($msg=null); |
|
| 65 | + public function overflow($msg = null); |
|
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * @param null|string $msg |
| 69 | 69 | * @return mixed |
| 70 | 70 | */ |
| 71 | - public function range($msg=null); |
|
| 71 | + public function range($msg = null); |
|
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * @param null|string $msg |
| 75 | 75 | * @return mixed |
| 76 | 76 | */ |
| 77 | - public function runtime($msg=null); |
|
| 77 | + public function runtime($msg = null); |
|
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * @param null|string $msg |
| 81 | 81 | * @return mixed |
| 82 | 82 | */ |
| 83 | - public function underflow($msg=null); |
|
| 83 | + public function underflow($msg = null); |
|
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | 86 | * @param null|string $msg |
| 87 | 87 | * @return mixed |
| 88 | 88 | */ |
| 89 | - public function unexpectedValue($msg=null); |
|
| 89 | + public function unexpectedValue($msg = null); |
|
| 90 | 90 | } |
| 91 | 91 | \ No newline at end of file |