@@ -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 |
@@ -46,17 +46,17 @@ discard block |
||
| 46 | 46 | $this->directory['projectDir'] = $this->projectPath(); |
| 47 | 47 | $this->argument['exceptionNamespace'] = app()->namespace()->exception(); |
| 48 | 48 | $this->argument['resourcePath'] = app()->path()->appResourche(); |
| 49 | - $this->argument['testNamespace'] = app()->namespace()->tests(); |
|
| 49 | + $this->argument['testNamespace'] = app()->namespace()->tests(); |
|
| 50 | 50 | |
| 51 | - $recursiveDefaultDirectory = explode("\\",$this->argument['project']);
|
|
| 51 | + $recursiveDefaultDirectory = explode("\\", $this->argument['project']);
|
|
| 52 | 52 | $this->argument['applicationName'] = pos($recursiveDefaultDirectory); |
| 53 | 53 | $recursiveDefaultDirectory[] = 'V1'; |
| 54 | 54 | $recursiveDefaultDirectoryList = []; |
| 55 | 55 | |
| 56 | - foreach (array_slice($recursiveDefaultDirectory,1) as $defaultDirectory){
|
|
| 56 | + foreach (array_slice($recursiveDefaultDirectory, 1) as $defaultDirectory) {
|
|
| 57 | 57 | |
| 58 | - $recursiveDefaultDirectoryList[]=$defaultDirectory; |
|
| 59 | - $this->directory[$defaultDirectory.'Path'] = $this->projectPath().''.implode("/",$recursiveDefaultDirectoryList);
|
|
| 58 | + $recursiveDefaultDirectoryList[] = $defaultDirectory; |
|
| 59 | + $this->directory[$defaultDirectory.'Path'] = $this->projectPath().''.implode("/", $recursiveDefaultDirectoryList);
|
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | //$this->directory['optionalDir'] = $this->optional(); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | //$this->directory['sourceDir'] = $this->sourceDir(); |
| 83 | 83 | //$this->directory['sourceSupportDir'] = $this->sourceSupportDir(); |
| 84 | 84 | //$this->directory['sourceSupportTraitDir'] = $this->sourceSupportDir().'/Traits'; |
| 85 | - $this->directory['exceptionDir'] = app()->path()->exception(); |
|
| 85 | + $this->directory['exceptionDir'] = app()->path()->exception(); |
|
| 86 | 86 | |
| 87 | 87 | //set project directory |
| 88 | 88 | $this->file->makeDirectory($this); |
@@ -95,11 +95,11 @@ discard block |
||
| 95 | 95 | $this->touch['kernel/version'] = $this->kernel().'/Version.php'; |
| 96 | 96 | $this->touch['kernel/app'] = $this->provider().'/AppServiceProvider.php'; |
| 97 | 97 | $this->touch['kernel/worker'] = $this->provider().'/WorkerServiceProvider.php'; |
| 98 | - $this->touch['kernel/cache'] = $this->provider().'/CacheServiceProvider.php'; |
|
| 98 | + $this->touch['kernel/cache'] = $this->provider().'/CacheServiceProvider.php'; |
|
| 99 | 99 | $this->touch['kernel/authenticate'] = $this->provider().'/AuthenticateServiceProvider.php'; |
| 100 | 100 | $this->touch['kernel/role'] = $this->provider().'/RoleServiceProvider.php'; |
| 101 | 101 | $this->touch['kernel/track'] = $this->provider().'/TrackServiceProvider.php'; |
| 102 | - $this->touch['test/testcase'] = $this->test().'/TestCase.php'; |
|
| 102 | + $this->touch['test/testcase'] = $this->test().'/TestCase.php'; |
|
| 103 | 103 | $this->touch['kernel/consoleevent'] = $this->provider().'/ConsoleEventServiceProvider.php'; |
| 104 | 104 | $this->touch['middleware/authenticate'] = $this->middleware().'/Authenticate.php'; |
| 105 | 105 | $this->touch['middleware/ratelimit'] = $this->middleware().'/RateLimit.php'; |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $this->touch['app/gitignore'] = $this->projectPath().'/.gitignore'; |
| 141 | 141 | $this->touch['app/composer'] = $this->projectPath().'/composer.json'; |
| 142 | 142 | $this->touch['test/index'] = $this->storage().'/index.html'; |
| 143 | - $this->touch['exception/authenticate'] = $this->directory['exceptionDir'] .'/AuthenticateException.php'; |
|
| 143 | + $this->touch['exception/authenticate'] = $this->directory['exceptionDir'].'/AuthenticateException.php'; |
|
| 144 | 144 | |
| 145 | 145 | //set project touch |
| 146 | 146 | $this->file->touch($this); |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | * @param $output |
| 24 | 24 | * @param $arguments |
| 25 | 25 | */ |
| 26 | - public function __construct(ApplicationContracts $app,$output,$arguments) |
|
| 26 | + public function __construct(ApplicationContracts $app, $output, $arguments) |
|
| 27 | 27 | { |
| 28 | 28 | parent::__construct($app); |
| 29 | 29 | |
| 30 | - if(!$this->app->runningInConsole()){ |
|
| 30 | + if (!$this->app->runningInConsole()) { |
|
| 31 | 31 | exception()->runtime('Console application is missing'); |
| 32 | 32 | } |
| 33 | 33 | |
@@ -42,31 +42,31 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function handle() |
| 44 | 44 | { |
| 45 | - if(isset($this->arguments['filter'])){ |
|
| 45 | + if (isset($this->arguments['filter'])) { |
|
| 46 | 46 | |
| 47 | 47 | $filterResult = []; |
| 48 | 48 | $filter = lcfirst($this->arguments['filter']); |
| 49 | 49 | |
| 50 | - foreach (explode('+',$filter) as $item){ |
|
| 51 | - $itemList = explode('=',$item); |
|
| 52 | - if(isset($this->output[$itemList[0]]) && $this->output[$itemList[0]]==$itemList[1]){ |
|
| 50 | + foreach (explode('+', $filter) as $item) { |
|
| 51 | + $itemList = explode('=', $item); |
|
| 52 | + if (isset($this->output[$itemList[0]]) && $this->output[$itemList[0]]==$itemList[1]) { |
|
| 53 | 53 | $filterResult[] = true; |
| 54 | 54 | } |
| 55 | - else{ |
|
| 55 | + else { |
|
| 56 | 56 | $filterResult[] = false; |
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - if(!isset($filterResult) || (isset($filterResult) && is_array($filterResult) && !in_array(false,$filterResult))){ |
|
| 61 | + if (!isset($filterResult) || (isset($filterResult) && is_array($filterResult) && !in_array(false, $filterResult))) { |
|
| 62 | 62 | |
| 63 | - if($this->output['meta']['success']) |
|
| 63 | + if ($this->output['meta']['success']) |
|
| 64 | 64 | { |
| 65 | 65 | echo ''.$this->output['trackNumber'].' - SUCCESS:'; |
| 66 | 66 | echo PHP_EOL; |
| 67 | 67 | echo 'Request Success : true'; |
| 68 | 68 | } |
| 69 | - else{ |
|
| 69 | + else { |
|
| 70 | 70 | |
| 71 | 71 | echo ''.$this->output['trackNumber'].' - ERROR:'; |
| 72 | 72 | echo PHP_EOL; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | echo PHP_EOL; |
| 86 | 86 | $requestClientIp = (isset($this->output['clientIp'])) ? $this->output['clientIp'] : null; |
| 87 | - echo 'Client Ip: '.$requestClientIp ; |
|
| 87 | + echo 'Client Ip: '.$requestClientIp; |
|
| 88 | 88 | |
| 89 | 89 | echo PHP_EOL; |
| 90 | 90 | $requestEndpoint = (isset($this->output['requestUrl'])) ? $this->output['requestUrl'] : null; |
@@ -51,8 +51,7 @@ discard block |
||
| 51 | 51 | $itemList = explode('=',$item); |
| 52 | 52 | if(isset($this->output[$itemList[0]]) && $this->output[$itemList[0]]==$itemList[1]){ |
| 53 | 53 | $filterResult[] = true; |
| 54 | - } |
|
| 55 | - else{ |
|
| 54 | + } else{ |
|
| 56 | 55 | $filterResult[] = false; |
| 57 | 56 | } |
| 58 | 57 | } |
@@ -65,8 +64,7 @@ discard block |
||
| 65 | 64 | echo ''.$this->output['trackNumber'].' - SUCCESS:'; |
| 66 | 65 | echo PHP_EOL; |
| 67 | 66 | echo 'Request Success : true'; |
| 68 | - } |
|
| 69 | - else{ |
|
| 67 | + } else{ |
|
| 70 | 68 | |
| 71 | 69 | echo ''.$this->output['trackNumber'].' - ERROR:'; |
| 72 | 70 | echo PHP_EOL; |
@@ -23,21 +23,21 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @throws \ReflectionException |
| 25 | 25 | */ |
| 26 | - public function call($class,$param,callable $callback) |
|
| 26 | + public function call($class, $param, callable $callback) |
|
| 27 | 27 | {
|
| 28 | 28 | // We use the reflection class to solve |
| 29 | 29 | // the parameters of the class's methods. |
| 30 | - $param = $this->reflectionMethodParameters($class,$param); |
|
| 30 | + $param = $this->reflectionMethodParameters($class, $param); |
|
| 31 | 31 | |
| 32 | 32 | // the results of a number of processes will be given |
| 33 | 33 | // before the container pipeline method is given. |
| 34 | 34 | return $this->app->resolve(ContainerPipelineResolve::class)->handle( |
| 35 | - function() use($class,$param,$callback) |
|
| 35 | + function() use($class, $param, $callback) |
|
| 36 | 36 | {
|
| 37 | 37 | // as a result |
| 38 | 38 | // we return the resolved class to the callback class |
| 39 | - $params = (object)['class'=>$class,'param'=>$param]; |
|
| 40 | - return call_user_func_array($callback,[$params]); |
|
| 39 | + $params = (object)['class'=>$class, 'param'=>$param]; |
|
| 40 | + return call_user_func_array($callback, [$params]); |
|
| 41 | 41 | }); |
| 42 | 42 | |
| 43 | 43 | } |
@@ -49,16 +49,16 @@ discard block |
||
| 49 | 49 | * @param $parameter |
| 50 | 50 | * @return array |
| 51 | 51 | */ |
| 52 | - private function checkParameterForContainer($containers,$parameter) |
|
| 52 | + private function checkParameterForContainer($containers, $parameter) |
|
| 53 | 53 | {
|
| 54 | 54 | $containerParameterNameValue = false; |
| 55 | 55 | |
| 56 | - if(isset($containers[$parameter->getType()->getName()])){
|
|
| 56 | + if (isset($containers[$parameter->getType()->getName()])) {
|
|
| 57 | 57 | $parameterNameResolve = $parameter->getType()->getName(); |
| 58 | 58 | $containerParameterNameValue = true; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - if(!$containerParameterNameValue && isset($containers[$parameter->getName()])){
|
|
| 61 | + if (!$containerParameterNameValue && isset($containers[$parameter->getName()])) {
|
|
| 62 | 62 | $parameterNameResolve = $parameter->getName(); |
| 63 | 63 | $containerParameterNameValue = true; |
| 64 | 64 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | // if the parameter is an object and |
| 67 | 67 | // this object is a service container object |
| 68 | 68 | // then the parameter will bind. |
| 69 | - if($parameter->getType()!==null && $containerParameterNameValue){
|
|
| 69 | + if ($parameter->getType()!==null && $containerParameterNameValue) {
|
|
| 70 | 70 | |
| 71 | 71 | // Unpack the container object and |
| 72 | 72 | // bind it to the param variable. |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | return [$parameterName=>$parameterResolve]; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - if($parameter->getType()!== NULL && Utils::isNamespaceExists($parameterNameResolve)){
|
|
| 88 | + if ($parameter->getType()!==NULL && Utils::isNamespaceExists($parameterNameResolve)) {
|
|
| 89 | 89 | |
| 90 | 90 | // Unpack the container object and |
| 91 | 91 | // bind it to the param variable. |
@@ -108,12 +108,12 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | private function getReflectionMethod($class) |
| 110 | 110 | {
|
| 111 | - if(!isset($class[0],$class[1])){
|
|
| 111 | + if (!isset($class[0], $class[1])) {
|
|
| 112 | 112 | exception('containerResolvingMissing')
|
| 113 | 113 | ->runtime('Container class resolving is missing');
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - [$class,$method] = [$class[0],$class[1]]; |
|
| 116 | + [$class, $method] = [$class[0], $class[1]]; |
|
| 117 | 117 | |
| 118 | 118 | return $this->instanceReflection($this->app['reflection']($class)) |
| 119 | 119 | ->reflectionMethodParams($method); |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | * @param $instance |
| 126 | 126 | * @return object|null |
| 127 | 127 | */ |
| 128 | - public function instanceReflection($instance=null) |
|
| 128 | + public function instanceReflection($instance = null) |
|
| 129 | 129 | {
|
| 130 | - if(is_object($instance) && is_null(static::$reflectionInstance)){
|
|
| 130 | + if (is_object($instance) && is_null(static::$reflectionInstance)) {
|
|
| 131 | 131 | static::$reflectionInstance = $instance; |
| 132 | 132 | } |
| 133 | 133 | |
@@ -143,12 +143,12 @@ discard block |
||
| 143 | 143 | * |
| 144 | 144 | * @throws \ReflectionException |
| 145 | 145 | */ |
| 146 | - private function reflectionMethodParameters($class,$param) |
|
| 146 | + private function reflectionMethodParameters($class, $param) |
|
| 147 | 147 | {
|
| 148 | 148 | $containers = []; |
| 149 | 149 | |
| 150 | 150 | //get service container objects. |
| 151 | - if(isset($this->app['serviceContainer'])){
|
|
| 151 | + if (isset($this->app['serviceContainer'])) {
|
|
| 152 | 152 | $containers = $this->app['serviceContainer']; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -161,23 +161,23 @@ discard block |
||
| 161 | 161 | // we provide the user with the container method document and take action. |
| 162 | 162 | // thus, we help the methods to have a cleaner code structure. |
| 163 | 163 | $this->app->resolve(ContainerMethodDocumentResolver::class, |
| 164 | - ['reflection'=>$this->instanceReflection(),'class'=>$class]); |
|
| 164 | + ['reflection'=>$this->instanceReflection(), 'class'=>$class]); |
|
| 165 | 165 | |
| 166 | 166 | // we group the parameters into type and |
| 167 | 167 | // name and bind them with the necessary logic. |
| 168 | - foreach ($parameters as $parameter){
|
|
| 168 | + foreach ($parameters as $parameter) {
|
|
| 169 | 169 | |
| 170 | 170 | // if the parameter is an object and |
| 171 | 171 | // this object is a service container object |
| 172 | 172 | // then the parameter will bind. |
| 173 | - $checkParameterForContainer = $this->checkParameterForContainer($containers,$parameter); |
|
| 173 | + $checkParameterForContainer = $this->checkParameterForContainer($containers, $parameter); |
|
| 174 | 174 | |
| 175 | - $paramMerge = array_merge($param,$checkParameterForContainer); |
|
| 175 | + $paramMerge = array_merge($param, $checkParameterForContainer); |
|
| 176 | 176 | |
| 177 | 177 | // we do some useful logic bind for user benefit. |
| 178 | - $param = app()->resolve(GraceContainer::class,[ |
|
| 178 | + $param = app()->resolve(GraceContainer::class, [ |
|
| 179 | 179 | 'reflection' => $reflection->reflection |
| 180 | - ])->graceContainerBuilder($parameter,$paramMerge); |
|
| 180 | + ])->graceContainerBuilder($parameter, $paramMerge); |
|
| 181 | 181 | |
| 182 | 182 | } |
| 183 | 183 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * |
| 52 | 52 | * @throws ReflectionExceptionAlias |
| 53 | 53 | */ |
| 54 | - public function __construct($clientData=null) |
|
| 54 | + public function __construct($clientData = null) |
|
| 55 | 55 | {
|
| 56 | 56 | //reflection process |
| 57 | 57 | $this->reflection = app()['reflection']($this); |
@@ -74,25 +74,25 @@ discard block |
||
| 74 | 74 | private function autoValidate($validate) |
| 75 | 75 | {
|
| 76 | 76 | //we get the values to auto-validate. |
| 77 | - foreach ($this->{$validate} as $object=>$datas){
|
|
| 77 | + foreach ($this->{$validate} as $object=>$datas) {
|
|
| 78 | 78 | |
| 79 | 79 | // the auto-validate value must necessarily represent a class. |
| 80 | 80 | // otherwise auto-validate is not used. |
| 81 | - if(Utils::isNamespaceExists($object)){
|
|
| 81 | + if (Utils::isNamespaceExists($object)) {
|
|
| 82 | 82 | $getObjectInstance = app()->resolve($object); |
| 83 | 83 | |
| 84 | 84 | // we get the index values, |
| 85 | 85 | // which are called methods of the auto-validate value that represents the class. |
| 86 | - foreach ($datas as $dataKey=>$data){
|
|
| 86 | + foreach ($datas as $dataKey=>$data) {
|
|
| 87 | 87 | |
| 88 | 88 | // if the methods of the auto-validate class resolved by the container resolve method apply, |
| 89 | 89 | // the process of auto-validate automatic implementation will be completed. |
| 90 | - if(is_numeric($dataKey) && method_exists($getObjectInstance,$data)){
|
|
| 91 | - if(isset($this->origin[$data])){
|
|
| 92 | - if(!is_array($this->origin[$data])){
|
|
| 90 | + if (is_numeric($dataKey) && method_exists($getObjectInstance, $data)) {
|
|
| 91 | + if (isset($this->origin[$data])) {
|
|
| 92 | + if (!is_array($this->origin[$data])) {
|
|
| 93 | 93 | $this->origin[$data] = array($this->origin[$data]); |
| 94 | 94 | } |
| 95 | - foreach ($this->origin[$data] as $originData){
|
|
| 95 | + foreach ($this->origin[$data] as $originData) {
|
|
| 96 | 96 | $getObjectInstance->{$data}($originData);
|
| 97 | 97 | } |
| 98 | 98 | } |
@@ -111,15 +111,15 @@ discard block |
||
| 111 | 111 | {
|
| 112 | 112 | // expected method is executed. |
| 113 | 113 | // this method is a must for http method values to be found in this property. |
| 114 | - if($this->checkProperties('capsule')){
|
|
| 114 | + if ($this->checkProperties('capsule')) {
|
|
| 115 | 115 | |
| 116 | 116 | $caret = $this->capsuleCaret(); |
| 117 | 117 | |
| 118 | - foreach($this->inputs as $input=>$value){
|
|
| 118 | + foreach ($this->inputs as $input=>$value) {
|
|
| 119 | 119 | |
| 120 | - if(isset($caret[$input]) || ( |
|
| 121 | - $this->checkProperties('capsule') && !in_array($input,$this->capsule)
|
|
| 122 | - )){
|
|
| 120 | + if (isset($caret[$input]) || ( |
|
| 121 | + $this->checkProperties('capsule') && !in_array($input, $this->capsule)
|
|
| 122 | + )) {
|
|
| 123 | 123 | exception('capsuleRequestException')
|
| 124 | 124 | ->overflow('The '.$input.' value cannot be sent.');
|
| 125 | 125 | } |
@@ -136,15 +136,15 @@ discard block |
||
| 136 | 136 | {
|
| 137 | 137 | $caret = []; |
| 138 | 138 | |
| 139 | - foreach($this->inputs as $input=>$item){
|
|
| 140 | - if(in_array('@'.$input,$this->capsule)){
|
|
| 139 | + foreach ($this->inputs as $input=>$item) {
|
|
| 140 | + if (in_array('@'.$input, $this->capsule)) {
|
|
| 141 | 141 | $caret[$input] = $item; |
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | foreach ($this->capsule as $item) {
|
| 146 | - if(preg_match('#@.*#is',$item)){
|
|
| 147 | - $this->capsule = array_diff($this->capsule,[$item]); |
|
| 146 | + if (preg_match('#@.*#is', $item)) {
|
|
| 147 | + $this->capsule = array_diff($this->capsule, [$item]); |
|
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | |
@@ -163,15 +163,15 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | // Determines which HTTP method |
| 165 | 165 | // the request object will be exposed to. |
| 166 | - if($this->checkProperties('http')){
|
|
| 166 | + if ($this->checkProperties('http')) {
|
|
| 167 | 167 | |
| 168 | 168 | // if the current http method does not exist |
| 169 | 169 | // in the http object, the exception will be thrown. |
| 170 | - if(!in_array($method,$this->http)){
|
|
| 170 | + if (!in_array($method, $this->http)) {
|
|
| 171 | 171 | |
| 172 | 172 | //exception batMethodCall |
| 173 | 173 | exception()->badMethodCall( |
| 174 | - 'Invalid http method process for '.class_basename($this).'.That is accepted http methods ['.implode(",",$this->http).'] ');
|
|
| 174 | + 'Invalid http method process for '.class_basename($this).'.That is accepted http methods ['.implode(",", $this->http).'] ');
|
|
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | {
|
| 187 | 187 | // from the properties of the object properties to |
| 188 | 188 | // the existing variables, control the array and at least one element. |
| 189 | - return (property_exists($this,$properties) |
|
| 189 | + return (property_exists($this, $properties) |
|
| 190 | 190 | && is_array($this->{$properties}) && count($this->{$properties})) ? true : false;
|
| 191 | 191 | } |
| 192 | 192 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | {
|
| 200 | 200 | // we are saving the expected values for the request in container. |
| 201 | 201 | // this record can be returned in exception information. |
| 202 | - app()->register('requestExpected',$this->expected);
|
|
| 202 | + app()->register('requestExpected', $this->expected);
|
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /** |
@@ -211,15 +211,15 @@ discard block |
||
| 211 | 211 | public function except($except) |
| 212 | 212 | {
|
| 213 | 213 | // the except parameter is a callable value. |
| 214 | - if(is_callable($except)){
|
|
| 215 | - $call = call_user_func_array($except,[$this]); |
|
| 214 | + if (is_callable($except)) {
|
|
| 215 | + $call = call_user_func_array($except, [$this]); |
|
| 216 | 216 | $except = $call; |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | // except with the except exceptions property |
| 220 | 220 | // and then assigning them to the inputs property. |
| 221 | - $this->except = array_merge($this->except,$except); |
|
| 222 | - $this->inputs = array_diff_key($this->inputs,array_flip($this->except)); |
|
| 221 | + $this->except = array_merge($this->except, $except); |
|
| 222 | + $this->inputs = array_diff_key($this->inputs, array_flip($this->except)); |
|
| 223 | 223 | |
| 224 | 224 | return $this; |
| 225 | 225 | } |
@@ -233,27 +233,27 @@ discard block |
||
| 233 | 233 | {
|
| 234 | 234 | // expected method is executed. |
| 235 | 235 | // this method is a must for http method values to be found in this property. |
| 236 | - if($this->checkProperties('expected')){
|
|
| 236 | + if ($this->checkProperties('expected')) {
|
|
| 237 | 237 | |
| 238 | 238 | // if the expected values are not found in the inputs array, |
| 239 | 239 | // the exception will be thrown. |
| 240 | - foreach ($this->expected as $expected){
|
|
| 240 | + foreach ($this->expected as $expected) {
|
|
| 241 | 241 | |
| 242 | 242 | $expectedValues = []; |
| 243 | 243 | |
| 244 | 244 | // mandatory expected data for each key can be separated by | operator. |
| 245 | 245 | // this is evaluated as "or". |
| 246 | - foreach($expectedData = explode("|",$expected) as $inputs){
|
|
| 247 | - if(!isset($this->inputs[$inputs])){
|
|
| 246 | + foreach ($expectedData = explode("|", $expected) as $inputs) {
|
|
| 247 | + if (!isset($this->inputs[$inputs])) {
|
|
| 248 | 248 | $expectedValues[] = $inputs; |
| 249 | 249 | } |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | // if the expectedData and expectedValues |
| 253 | 253 | // array are numerically equal to the expected key, the exception is thrown. |
| 254 | - if(count($expectedData)===count($expectedValues)){
|
|
| 254 | + if (count($expectedData)===count($expectedValues)) {
|
|
| 255 | 255 | exception($expected) |
| 256 | - ->unexpectedValue('You absolutely have to send the value '.implode(" or ",$expectedValues).' for request object');
|
|
| 256 | + ->unexpectedValue('You absolutely have to send the value '.implode(" or ", $expectedValues).' for request object');
|
|
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | } |
@@ -268,17 +268,17 @@ discard block |
||
| 268 | 268 | {
|
| 269 | 269 | // check the presence of the generator object |
| 270 | 270 | // and operate the generator over this object. |
| 271 | - if($this->checkProperties('auto_generators')){
|
|
| 271 | + if ($this->checkProperties('auto_generators')) {
|
|
| 272 | 272 | $generators = $this->getAutoGenerators(); |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | // check the presence of the generator object |
| 276 | 276 | // and operate the generator over this object. |
| 277 | - if($this->checkProperties('generators')){
|
|
| 278 | - $generators = array_merge(isset($generators) ? $generators: [],$this->getGenerators()); |
|
| 277 | + if ($this->checkProperties('generators')) {
|
|
| 278 | + $generators = array_merge(isset($generators) ? $generators : [], $this->getGenerators()); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - if(isset($generators)){
|
|
| 281 | + if (isset($generators)) {
|
|
| 282 | 282 | $this->generatorMethod($generators); |
| 283 | 283 | } |
| 284 | 284 | } |
@@ -293,21 +293,21 @@ discard block |
||
| 293 | 293 | private function generatorMethod($generators) |
| 294 | 294 | {
|
| 295 | 295 | //generator array object |
| 296 | - foreach ($generators as $generator){
|
|
| 296 | + foreach ($generators as $generator) {
|
|
| 297 | 297 | |
| 298 | 298 | //generator method name |
| 299 | 299 | $generatorMethodName = $generator.'Generator'; |
| 300 | 300 | |
| 301 | 301 | // if the generator method is present, |
| 302 | 302 | // the fake value is assigned. |
| 303 | - if(method_exists($this,$generatorMethodName)){
|
|
| 303 | + if (method_exists($this, $generatorMethodName)) {
|
|
| 304 | 304 | |
| 305 | 305 | //fake registration |
| 306 | - if(!isset($this->inputs[$generator])){
|
|
| 306 | + if (!isset($this->inputs[$generator])) {
|
|
| 307 | 307 | |
| 308 | 308 | $generatorMethodNameResult = $this->{$generatorMethodName}();
|
| 309 | 309 | |
| 310 | - if(!is_null($generatorMethodNameResult)){
|
|
| 310 | + if (!is_null($generatorMethodNameResult)) {
|
|
| 311 | 311 | $this->{$generator} = $this->{$generatorMethodName}();
|
| 312 | 312 | $this->inputs[$generator] = $this->{$generatorMethodName}();
|
| 313 | 313 | $this->requestData[$generator] = $this->inputs[$generator]; |
@@ -315,14 +315,14 @@ discard block |
||
| 315 | 315 | } |
| 316 | 316 | else {
|
| 317 | 317 | |
| 318 | - if($this->checkProperties('auto_generators_dont_overwrite')
|
|
| 319 | - && in_array($generator,$this->getAutoGeneratorsDontOverwrite())){
|
|
| 318 | + if ($this->checkProperties('auto_generators_dont_overwrite')
|
|
| 319 | + && in_array($generator, $this->getAutoGeneratorsDontOverwrite())) {
|
|
| 320 | 320 | $this->{$generator} = $this->{$generatorMethodName}();
|
| 321 | 321 | $this->inputs[$generator] = $this->{$generatorMethodName}();
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - if($this->checkProperties('generators_dont_overwrite')
|
|
| 325 | - && in_array($generator,$this->getGeneratorsDontOverwrite())){
|
|
| 324 | + if ($this->checkProperties('generators_dont_overwrite')
|
|
| 325 | + && in_array($generator, $this->getGeneratorsDontOverwrite())) {
|
|
| 326 | 326 | $this->{$generator} = $this->{$generatorMethodName}();
|
| 327 | 327 | $this->inputs[$generator] = $this->{$generatorMethodName}();
|
| 328 | 328 | } |
@@ -344,11 +344,11 @@ discard block |
||
| 344 | 344 | $list = []; |
| 345 | 345 | |
| 346 | 346 | foreach ($this->requestData as $key=>$item) {
|
| 347 | - if(property_exists($this,'requestExcept') && !in_array($key,$this->requestExcept)){
|
|
| 347 | + if (property_exists($this, 'requestExcept') && !in_array($key, $this->requestExcept)) {
|
|
| 348 | 348 | $list[$key] = $item; |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | - if(!property_exists($this,'requestExcept')){
|
|
| 351 | + if (!property_exists($this, 'requestExcept')) {
|
|
| 352 | 352 | $list[$key] = $item; |
| 353 | 353 | } |
| 354 | 354 | } |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | {
|
| 392 | 392 | // we use the http method to write |
| 393 | 393 | // the values to the inputs and origin properties. |
| 394 | - foreach($this->clientData as $key=>$value){
|
|
| 394 | + foreach ($this->clientData as $key=>$value) {
|
|
| 395 | 395 | |
| 396 | 396 | //inputs and origin properties |
| 397 | 397 | $this->inputs[$key] = $value; |
@@ -438,9 +438,9 @@ discard block |
||
| 438 | 438 | |
| 439 | 439 | // we update the input values after |
| 440 | 440 | // we receive and check the saved objects. |
| 441 | - foreach ($clientObjects as $key=>$value){
|
|
| 441 | + foreach ($clientObjects as $key=>$value) {
|
|
| 442 | 442 | |
| 443 | - if(isset($clientObjects['origin'][$key])){
|
|
| 443 | + if (isset($clientObjects['origin'][$key])) {
|
|
| 444 | 444 | |
| 445 | 445 | $this->{$key} = $clientObjects['origin'][$key];
|
| 446 | 446 | $this->inputs[$key] = $this->{$key};
|
@@ -467,11 +467,11 @@ discard block |
||
| 467 | 467 | |
| 468 | 468 | // the request update to be performed using |
| 469 | 469 | // the method name to be used with the http method. |
| 470 | - $this->setRequestInputs($requestMethod,$key); |
|
| 470 | + $this->setRequestInputs($requestMethod, $key); |
|
| 471 | 471 | |
| 472 | 472 | // the request update to be performed using |
| 473 | 473 | // the method name to be used without the http method. |
| 474 | - $this->setRequestInputs($key,$key); |
|
| 474 | + $this->setRequestInputs($key, $key); |
|
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | /** |
@@ -482,20 +482,20 @@ discard block |
||
| 482 | 482 | * |
| 483 | 483 | * @throws ReflectionExceptionAlias |
| 484 | 484 | */ |
| 485 | - private function setRequestInputs($method,$key) |
|
| 485 | + private function setRequestInputs($method, $key) |
|
| 486 | 486 | {
|
| 487 | - if(method_exists($this,$method) && $this->reflection->reflectionMethodParams($method)->isProtected){
|
|
| 487 | + if (method_exists($this, $method) && $this->reflection->reflectionMethodParams($method)->isProtected) {
|
|
| 488 | 488 | |
| 489 | 489 | //check annotations for method |
| 490 | - $annotation = app()->resolve(ClientAnnotationManager::class,['request'=>$this]); |
|
| 491 | - $annotation->annotation($method,$key); |
|
| 490 | + $annotation = app()->resolve(ClientAnnotationManager::class, ['request'=>$this]); |
|
| 491 | + $annotation->annotation($method, $key); |
|
| 492 | 492 | |
| 493 | - if(isset($this->inputs[$key]) && is_array($this->inputs[$key])){
|
|
| 493 | + if (isset($this->inputs[$key]) && is_array($this->inputs[$key])) {
|
|
| 494 | 494 | |
| 495 | 495 | $inputKeys = $this->inputs[$key]; |
| 496 | 496 | |
| 497 | 497 | $this->inputs[$key] = []; |
| 498 | - foreach ($inputKeys as $input){
|
|
| 498 | + foreach ($inputKeys as $input) {
|
|
| 499 | 499 | |
| 500 | 500 | $this->{$key} = $input;
|
| 501 | 501 | $keyMethod = $this->{$method}();
|
@@ -503,8 +503,8 @@ discard block |
||
| 503 | 503 | $this->requestData[$key][] = $keyMethod; |
| 504 | 504 | } |
| 505 | 505 | } |
| 506 | - else{
|
|
| 507 | - if(isset($this->inputs[$key])){
|
|
| 506 | + else {
|
|
| 507 | + if (isset($this->inputs[$key])) {
|
|
| 508 | 508 | $keyMethod = $this->{$method}();
|
| 509 | 509 | $this->inputs[$key] = $keyMethod; |
| 510 | 510 | $this->requestData[$key] = $keyMethod; |
@@ -523,8 +523,8 @@ discard block |
||
| 523 | 523 | {
|
| 524 | 524 | // the auto object validate property is the property |
| 525 | 525 | // where all of your request values are automatically validated. |
| 526 | - if(property_exists($this,'autoObjectValidate') |
|
| 527 | - && is_array($this->autoObjectValidate) && count($this->autoObjectValidate)){
|
|
| 526 | + if (property_exists($this, 'autoObjectValidate') |
|
| 527 | + && is_array($this->autoObjectValidate) && count($this->autoObjectValidate)) {
|
|
| 528 | 528 | $this->autoValidate('autoObjectValidate');
|
| 529 | 529 | } |
| 530 | 530 | } |
@@ -312,8 +312,7 @@ discard block |
||
| 312 | 312 | $this->inputs[$generator] = $this->{$generatorMethodName}();
|
| 313 | 313 | $this->requestData[$generator] = $this->inputs[$generator]; |
| 314 | 314 | } |
| 315 | - } |
|
| 316 | - else {
|
|
| 315 | + } else {
|
|
| 317 | 316 | |
| 318 | 317 | if($this->checkProperties('auto_generators_dont_overwrite')
|
| 319 | 318 | && in_array($generator,$this->getAutoGeneratorsDontOverwrite())){
|
@@ -502,8 +501,7 @@ discard block |
||
| 502 | 501 | $this->inputs[$key][] = $keyMethod; |
| 503 | 502 | $this->requestData[$key][] = $keyMethod; |
| 504 | 503 | } |
| 505 | - } |
|
| 506 | - else{
|
|
| 504 | + } else{
|
|
| 507 | 505 | if(isset($this->inputs[$key])){
|
| 508 | 506 | $keyMethod = $this->{$method}();
|
| 509 | 507 | $this->inputs[$key] = $keyMethod; |
@@ -7,11 +7,11 @@ |
||
| 7 | 7 | /** |
| 8 | 8 | * @return void |
| 9 | 9 | */ |
| 10 | - public function command() : void ; |
|
| 10 | + public function command() : void; |
|
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * @param ScheduleInterface $schedule |
| 14 | 14 | * @return void |
| 15 | 15 | */ |
| 16 | - public function when(ScheduleInterface $schedule) : void ; |
|
| 16 | + public function when(ScheduleInterface $schedule) : void; |
|
| 17 | 17 | } |
| 18 | 18 | \ No newline at end of file |
@@ -7,256 +7,256 @@ |
||
| 7 | 7 | /** |
| 8 | 8 | * @var string |
| 9 | 9 | */ |
| 10 | - public static $appDefine='src'; |
|
| 10 | + public static $appDefine = 'src'; |
|
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * @var string |
| 14 | 14 | */ |
| 15 | - public static $autoloadNamespace='App'; |
|
| 15 | + public static $autoloadNamespace = 'App'; |
|
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * @var string |
| 19 | 19 | */ |
| 20 | - public static $projectPrefixGroup='Api'; |
|
| 20 | + public static $projectPrefixGroup = 'Api'; |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * @var string |
| 24 | 24 | */ |
| 25 | - public static $methodPrefix='Action'; |
|
| 25 | + public static $methodPrefix = 'Action'; |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * @var string |
| 29 | 29 | */ |
| 30 | - public static $callClassPrefix='Controller'; |
|
| 30 | + public static $callClassPrefix = 'Controller'; |
|
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * @var string |
| 34 | 34 | */ |
| 35 | - public static $controllerBundleName=''; |
|
| 35 | + public static $controllerBundleName = ''; |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @var string |
| 39 | 39 | */ |
| 40 | - public static $resourceInController='Resource'; |
|
| 40 | + public static $resourceInController = 'Resource'; |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * @var string |
| 44 | 44 | */ |
| 45 | - public static $configurationInController='Config'; |
|
| 45 | + public static $configurationInController = 'Config'; |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * @var null |
| 49 | 49 | */ |
| 50 | - public static $appPath=null; |
|
| 50 | + public static $appPath = null; |
|
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * @var string |
| 54 | 54 | */ |
| 55 | - public static $kernel='Kernel'; |
|
| 55 | + public static $kernel = 'Kernel'; |
|
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * @var string |
| 59 | 59 | */ |
| 60 | - public static $repository='Repository'; |
|
| 60 | + public static $repository = 'Repository'; |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * @var string |
| 64 | 64 | */ |
| 65 | - public static $listener='Listener'; |
|
| 65 | + public static $listener = 'Listener'; |
|
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * @var string |
| 69 | 69 | */ |
| 70 | - public static $serviceAnnotations='ServiceAnnotationsManager'; |
|
| 70 | + public static $serviceAnnotations = 'ServiceAnnotationsManager'; |
|
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | 73 | * @var string |
| 74 | 74 | */ |
| 75 | - public static $serviceMiddleware='ServiceMiddlewareManager'; |
|
| 75 | + public static $serviceMiddleware = 'ServiceMiddlewareManager'; |
|
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | 78 | * @var string |
| 79 | 79 | */ |
| 80 | - public static $storage='Storage'; |
|
| 80 | + public static $storage = 'Storage'; |
|
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | 83 | * @var string |
| 84 | 84 | */ |
| 85 | - public static $controller='Controllers'; |
|
| 85 | + public static $controller = 'Controllers'; |
|
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | 88 | * @var string |
| 89 | 89 | */ |
| 90 | - public static $platform='__Platform'; |
|
| 90 | + public static $platform = '__Platform'; |
|
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | 93 | * @var string |
| 94 | 94 | */ |
| 95 | - public static $sourcePath='Source'; |
|
| 95 | + public static $sourcePath = 'Source'; |
|
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | 98 | * @var string |
| 99 | 99 | */ |
| 100 | - public static $sourceRequest='Client'; |
|
| 100 | + public static $sourceRequest = 'Client'; |
|
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | 103 | * @var string |
| 104 | 104 | */ |
| 105 | - public static $model='Model'; |
|
| 105 | + public static $model = 'Model'; |
|
| 106 | 106 | |
| 107 | 107 | /** |
| 108 | 108 | * @var string |
| 109 | 109 | */ |
| 110 | - public static $builder='Builder'; |
|
| 110 | + public static $builder = 'Builder'; |
|
| 111 | 111 | |
| 112 | 112 | /** |
| 113 | 113 | * @var string |
| 114 | 114 | */ |
| 115 | - public static $migration='Migrations'; |
|
| 115 | + public static $migration = 'Migrations'; |
|
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | 118 | * @var string |
| 119 | 119 | */ |
| 120 | - public static $config='Config'; |
|
| 120 | + public static $config = 'Config'; |
|
| 121 | 121 | |
| 122 | 122 | /** |
| 123 | 123 | * @var string |
| 124 | 124 | */ |
| 125 | - public static $helpers='Helpers'; |
|
| 125 | + public static $helpers = 'Helpers'; |
|
| 126 | 126 | |
| 127 | 127 | /** |
| 128 | 128 | * @var string |
| 129 | 129 | */ |
| 130 | - public static $test='Tests'; |
|
| 130 | + public static $test = 'Tests'; |
|
| 131 | 131 | |
| 132 | 132 | /** |
| 133 | 133 | * @var string |
| 134 | 134 | */ |
| 135 | - public static $workers='Workers'; |
|
| 135 | + public static $workers = 'Workers'; |
|
| 136 | 136 | |
| 137 | 137 | /** |
| 138 | 138 | * @var string |
| 139 | 139 | */ |
| 140 | - public static $schedule='Schedule'; |
|
| 140 | + public static $schedule = 'Schedule'; |
|
| 141 | 141 | |
| 142 | 142 | |
| 143 | 143 | /** |
| 144 | 144 | * @var string |
| 145 | 145 | */ |
| 146 | - public static $optional='Optional'; |
|
| 146 | + public static $optional = 'Optional'; |
|
| 147 | 147 | |
| 148 | 148 | /** |
| 149 | 149 | * @var string |
| 150 | 150 | */ |
| 151 | - public static $events='Events'; |
|
| 151 | + public static $events = 'Events'; |
|
| 152 | 152 | |
| 153 | 153 | /** |
| 154 | 154 | * @var string |
| 155 | 155 | */ |
| 156 | - public static $listeners='Listeners'; |
|
| 156 | + public static $listeners = 'Listeners'; |
|
| 157 | 157 | |
| 158 | 158 | /** |
| 159 | 159 | * @var string |
| 160 | 160 | */ |
| 161 | - public static $subscribers='Subscribers'; |
|
| 161 | + public static $subscribers = 'Subscribers'; |
|
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | 164 | * @var string |
| 165 | 165 | */ |
| 166 | - public static $exception='Exceptions'; |
|
| 166 | + public static $exception = 'Exceptions'; |
|
| 167 | 167 | |
| 168 | 168 | /** |
| 169 | 169 | * @var string |
| 170 | 170 | */ |
| 171 | - public static $job='Job'; |
|
| 171 | + public static $job = 'Job'; |
|
| 172 | 172 | |
| 173 | 173 | |
| 174 | 174 | /** |
| 175 | 175 | * @var string |
| 176 | 176 | */ |
| 177 | - public static $webservice='Webservice'; |
|
| 177 | + public static $webservice = 'Webservice'; |
|
| 178 | 178 | |
| 179 | 179 | /** |
| 180 | 180 | * @var string |
| 181 | 181 | */ |
| 182 | - public static $log='Log'; |
|
| 182 | + public static $log = 'Log'; |
|
| 183 | 183 | |
| 184 | 184 | /** |
| 185 | 185 | * @var string |
| 186 | 186 | */ |
| 187 | - public static $resource='Resource'; |
|
| 187 | + public static $resource = 'Resource'; |
|
| 188 | 188 | |
| 189 | 189 | /** |
| 190 | 190 | * @var string |
| 191 | 191 | */ |
| 192 | - public static $cache='Cache'; |
|
| 192 | + public static $cache = 'Cache'; |
|
| 193 | 193 | |
| 194 | 194 | /** |
| 195 | 195 | * @var string |
| 196 | 196 | */ |
| 197 | - public static $language='Language'; |
|
| 197 | + public static $language = 'Language'; |
|
| 198 | 198 | /** |
| 199 | 199 | * @var string |
| 200 | 200 | */ |
| 201 | - public static $session='Session'; |
|
| 201 | + public static $session = 'Session'; |
|
| 202 | 202 | |
| 203 | 203 | /** |
| 204 | 204 | * @var string |
| 205 | 205 | */ |
| 206 | - public static $middleware='Middleware'; |
|
| 206 | + public static $middleware = 'Middleware'; |
|
| 207 | 207 | |
| 208 | 208 | /** |
| 209 | 209 | * @var string |
| 210 | 210 | */ |
| 211 | - public static $route='Routes'; |
|
| 211 | + public static $route = 'Routes'; |
|
| 212 | 212 | |
| 213 | 213 | /** |
| 214 | 214 | * @var string |
| 215 | 215 | */ |
| 216 | - public static $request='Client'; |
|
| 216 | + public static $request = 'Client'; |
|
| 217 | 217 | |
| 218 | 218 | /** |
| 219 | 219 | * @var string |
| 220 | 220 | */ |
| 221 | - public static $factory='Factory'; |
|
| 221 | + public static $factory = 'Factory'; |
|
| 222 | 222 | |
| 223 | 223 | /** |
| 224 | 224 | * @var string |
| 225 | 225 | */ |
| 226 | - public static $node='Node'; |
|
| 226 | + public static $node = 'Node'; |
|
| 227 | 227 | |
| 228 | 228 | /** |
| 229 | 229 | * @var string |
| 230 | 230 | */ |
| 231 | - public static $provider='Providers'; |
|
| 231 | + public static $provider = 'Providers'; |
|
| 232 | 232 | |
| 233 | 233 | /** |
| 234 | 234 | * @var string |
| 235 | 235 | */ |
| 236 | - public static $once='Once'; |
|
| 236 | + public static $once = 'Once'; |
|
| 237 | 237 | |
| 238 | 238 | /** |
| 239 | 239 | * @var string |
| 240 | 240 | */ |
| 241 | - public static $command='Command'; |
|
| 241 | + public static $command = 'Command'; |
|
| 242 | 242 | |
| 243 | 243 | /** |
| 244 | 244 | * @var string |
| 245 | 245 | */ |
| 246 | - public static $stub='Stub'; |
|
| 246 | + public static $stub = 'Stub'; |
|
| 247 | 247 | |
| 248 | 248 | /** |
| 249 | 249 | * @var string |
| 250 | 250 | */ |
| 251 | - public static $store='Store'; |
|
| 251 | + public static $store = 'Store'; |
|
| 252 | 252 | |
| 253 | 253 | /** |
| 254 | 254 | * @var string |
| 255 | 255 | */ |
| 256 | - public static $boot='Boot'; |
|
| 256 | + public static $boot = 'Boot'; |
|
| 257 | 257 | |
| 258 | 258 | /** |
| 259 | 259 | * @var string |
| 260 | 260 | */ |
| 261 | - public static $autoService='Autoservice'; |
|
| 261 | + public static $autoService = 'Autoservice'; |
|
| 262 | 262 | } |
| 263 | 263 | \ No newline at end of file |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | /** |
| 8 | 8 | * @var array |
| 9 | 9 | */ |
| 10 | - protected static $cronScheduler = ['*','*','*','*','*']; |
|
| 10 | + protected static $cronScheduler = ['*', '*', '*', '*', '*']; |
|
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * set day for scheduler |
@@ -8,42 +8,42 @@ |
||
| 8 | 8 | * @param integer $day |
| 9 | 9 | * @return $this |
| 10 | 10 | */ |
| 11 | - public function day($day=1); |
|
| 11 | + public function day($day = 1); |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * @param integer $hour |
| 15 | 15 | * @return $this |
| 16 | 16 | */ |
| 17 | - public function everyHour($hour=1); |
|
| 17 | + public function everyHour($hour = 1); |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * @param int $minute |
| 21 | 21 | * @return $this |
| 22 | 22 | */ |
| 23 | - public function everyMinute($minute=1); |
|
| 23 | + public function everyMinute($minute = 1); |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * @param mixed $hour |
| 27 | 27 | * @return $this |
| 28 | 28 | */ |
| 29 | - public function hour($hour='*'); |
|
| 29 | + public function hour($hour = '*'); |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * @param int $minute |
| 33 | 33 | * @return $this |
| 34 | 34 | */ |
| 35 | - public function minute($minute=1); |
|
| 35 | + public function minute($minute = 1); |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @param mixed $month |
| 39 | 39 | * @return $this |
| 40 | 40 | */ |
| 41 | - public function month($month=1); |
|
| 41 | + public function month($month = 1); |
|
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * @param mixed $week$month |
| 45 | 45 | * @return $this |
| 46 | 46 | */ |
| 47 | - public function week($week=1); |
|
| 47 | + public function week($week = 1); |
|
| 48 | 48 | |
| 49 | 49 | } |
| 50 | 50 | \ No newline at end of file |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | /** |
| 35 | 35 | * @return void |
| 36 | 36 | */ |
| 37 | - public function create(){
|
|
| 37 | + public function create() {
|
|
| 38 | 38 | |
| 39 | 39 | $schedulePath = app()->path()->schedule(); |
| 40 | 40 | |
| 41 | - if(!file_exists($schedulePath)){
|
|
| 41 | + if (!file_exists($schedulePath)) {
|
|
| 42 | 42 | $this->directory['schedule'] = $schedulePath; |
| 43 | 43 | $this->file->makeDirectory($this); |
| 44 | 44 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $this->argument['scheduleClass'] = ucfirst($this->argument['schedule']).''; |
| 48 | 48 | $this->argument['projectName'] = strtolower($this->projectName()); |
| 49 | 49 | |
| 50 | - $this->touch['schedule/schedule']= $schedulePath.'/'.$this->argument['schedule'].'.php'; |
|
| 50 | + $this->touch['schedule/schedule'] = $schedulePath.'/'.$this->argument['schedule'].'.php'; |
|
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | $this->file->touch($this); |
@@ -57,30 +57,30 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | public function list() |
| 59 | 59 | {
|
| 60 | - exec('crontab -l',$list);
|
|
| 60 | + exec('crontab -l', $list);
|
|
| 61 | 61 | |
| 62 | - $this->table->setHeaders(['no','minute','hour','day','month','week','schedule','description']); |
|
| 62 | + $this->table->setHeaders(['no', 'minute', 'hour', 'day', 'month', 'week', 'schedule', 'description']); |
|
| 63 | 63 | |
| 64 | 64 | |
| 65 | - foreach ($list as $key=>$item){
|
|
| 65 | + foreach ($list as $key=>$item) {
|
|
| 66 | 66 | |
| 67 | - if(preg_match('@.*php api schedule run '.strtolower($this->projectName()).'.*@is',$item,$result)){
|
|
| 68 | - if(isset($result[0])){
|
|
| 67 | + if (preg_match('@.*php api schedule run '.strtolower($this->projectName()).'.*@is', $item, $result)) {
|
|
| 68 | + if (isset($result[0])) {
|
|
| 69 | 69 | |
| 70 | 70 | $cron = []; |
| 71 | 71 | |
| 72 | - if(preg_match('@(.*)\scd@',$result[0],$cron)){
|
|
| 73 | - $cron = (isset($cron[1])) ? explode(' ',$cron[1]) : '';
|
|
| 72 | + if (preg_match('@(.*)\scd@', $result[0], $cron)) {
|
|
| 73 | + $cron = (isset($cron[1])) ? explode(' ', $cron[1]) : '';
|
|
| 74 | 74 | |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $scheduleName = ''; |
| 78 | 78 | |
| 79 | - if(preg_match('@schedule\:(.*?)\s@',$result[0],$scheduler)){
|
|
| 79 | + if (preg_match('@schedule\:(.*?)\s@', $result[0], $scheduler)) {
|
|
| 80 | 80 | $scheduleName = (isset($scheduler[1])) ? $scheduler[1] : ''; |
| 81 | 81 | |
| 82 | 82 | $schedulerInstance = $this->scheduleInstance(ucfirst($scheduleName)); |
| 83 | - $description = ClosureDispatcher::bind($schedulerInstance)->call(function(){
|
|
| 83 | + $description = ClosureDispatcher::bind($schedulerInstance)->call(function() {
|
|
| 84 | 84 | return $this->description; |
| 85 | 85 | }); |
| 86 | 86 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $schedules = Utils::glob(app()->path()->schedule()); |
| 112 | 112 | |
| 113 | 113 | |
| 114 | - if(isset($schedules[$this->argument['schedule']])){
|
|
| 114 | + if (isset($schedules[$this->argument['schedule']])) {
|
|
| 115 | 115 | |
| 116 | 116 | $scheduleNamespace = Utils::getNamespace($schedules[$this->argument['schedule']]); |
| 117 | 117 | $scheduleInstance = app()->resolve($scheduleNamespace); |
@@ -119,11 +119,11 @@ discard block |
||
| 119 | 119 | $scheduleManager = new ScheduleManager(); |
| 120 | 120 | $scheduleInstance->when($scheduleManager); |
| 121 | 121 | |
| 122 | - $cronScheduler = implode(' ',$scheduleManager->getCronScheduler());
|
|
| 122 | + $cronScheduler = implode(' ', $scheduleManager->getCronScheduler());
|
|
| 123 | 123 | |
| 124 | 124 | $command = $cronScheduler.' cd '.root.' && php api schedule run munch schedule:'.lcfirst($this->argument['schedule']).' >> /dev/null 2>&1'; |
| 125 | 125 | |
| 126 | - if($this->cronjob_exists($command)===false){
|
|
| 126 | + if ($this->cronjob_exists($command)===false) {
|
|
| 127 | 127 | |
| 128 | 128 | $output = shell_exec('crontab -l');
|
| 129 | 129 | file_put_contents('/tmp/crontab.txt', $output.''.$command.''.PHP_EOL);
|
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | {
|
| 142 | 142 | $schedules = Utils::glob(app()->path()->schedule()); |
| 143 | 143 | |
| 144 | - if(isset($schedules[$this->argument['schedule']])){
|
|
| 144 | + if (isset($schedules[$this->argument['schedule']])) {
|
|
| 145 | 145 | $scheduleNamespace = Utils::getNamespace($schedules[$this->argument['schedule']]); |
| 146 | 146 | $scheduleInstance = app()->resolve($scheduleNamespace); |
| 147 | 147 | |
@@ -149,20 +149,20 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - private function cronjob_exists($command){
|
|
| 152 | + private function cronjob_exists($command) {
|
|
| 153 | 153 | |
| 154 | - $cronjob_exists=false; |
|
| 154 | + $cronjob_exists = false; |
|
| 155 | 155 | |
| 156 | 156 | exec('crontab -l', $crontab);
|
| 157 | 157 | |
| 158 | 158 | |
| 159 | - if(isset($crontab)&&is_array($crontab)){
|
|
| 159 | + if (isset($crontab) && is_array($crontab)) {
|
|
| 160 | 160 | |
| 161 | 161 | $crontab = array_flip($crontab); |
| 162 | 162 | |
| 163 | - if(isset($crontab[$command])){
|
|
| 163 | + if (isset($crontab[$command])) {
|
|
| 164 | 164 | |
| 165 | - $cronjob_exists=true; |
|
| 165 | + $cronjob_exists = true; |
|
| 166 | 166 | |
| 167 | 167 | } |
| 168 | 168 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | {
|
| 179 | 179 | $schedules = Utils::glob(app()->path()->schedule()); |
| 180 | 180 | |
| 181 | - if(isset($schedules[$schedule])){
|
|
| 181 | + if (isset($schedules[$schedule])) {
|
|
| 182 | 182 | $scheduleNamespace = Utils::getNamespace($schedules[$schedule]); |
| 183 | 183 | return $scheduleInstance = app()->resolve($scheduleNamespace); |
| 184 | 184 | } |