@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * @var array |
| 34 | 34 | */ |
| 35 | - public $commandRule=['name','client']; |
|
| 35 | + public $commandRule = ['name', 'client']; |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @method create |
@@ -54,23 +54,23 @@ discard block |
||
| 54 | 54 | //set project directory |
| 55 | 55 | $this->file->makeDirectory($this); |
| 56 | 56 | |
| 57 | - if(!file_exists($manager = $this->directory['clientNameDir'].'/'.$name.'Manager.php')){
|
|
| 57 | + if (!file_exists($manager = $this->directory['clientNameDir'].'/'.$name.'Manager.php')) {
|
|
| 58 | 58 | $this->touch['client/manager'] = $manager; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - if(!file_exists($this->directory['clientNameCreate'].'/Client.php')){
|
|
| 61 | + if (!file_exists($this->directory['clientNameCreate'].'/Client.php')) {
|
|
| 62 | 62 | $this->touch['client/client'] = $this->directory['clientNameCreate'].'/Client.php'; |
| 63 | 63 | $this->touch['client/clientGenerator'] = $this->directory['clientNameCreate'].'/ClientGenerator.php'; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | $clientSourceNamespace = Utils::getNamespace($this->directory['clientSource'].'/'.$client.'.php'); |
| 67 | 67 | |
| 68 | - if(!file_exists($clientSourceName = $this->directory['clientSource'].'/'.$client.'.php')){
|
|
| 68 | + if (!file_exists($clientSourceName = $this->directory['clientSource'].'/'.$client.'.php')) {
|
|
| 69 | 69 | $this->touch['client/source'] = $clientSourceName.''; |
| 70 | 70 | //$this->touch['client/sourcegenerator'] = $this->directory['clientSource'].'/'.$client.'Generator.php'; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if(!file_exists($this->directory['clientNameCreate'].'/ClientProvider.php')){
|
|
| 73 | + if (!file_exists($this->directory['clientNameCreate'].'/ClientProvider.php')) {
|
|
| 74 | 74 | $this->touch['client/clientProvider'] = $this->directory['clientNameCreate'].'/ClientProvider.php'; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -84,13 +84,13 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | $nameGeneratorNamespace = Utils::getNamespace($managerPath = $this->directory['clientNameDir'].''.DIRECTORY_SEPARATOR.''.$nameManager.'.php'); |
| 86 | 86 | |
| 87 | - $generator = new Generator(path()->version(),'ClientManager'); |
|
| 87 | + $generator = new Generator(path()->version(), 'ClientManager'); |
|
| 88 | 88 | |
| 89 | 89 | $clientManager = app()->namespace()->version().'\\ClientManager'; |
| 90 | 90 | |
| 91 | 91 | $clientManagerResolve = new $clientManager; |
| 92 | 92 | |
| 93 | - if(!method_exists($clientManagerResolve,strtolower($name))){
|
|
| 93 | + if (!method_exists($clientManagerResolve, strtolower($name))) {
|
|
| 94 | 94 | |
| 95 | 95 | $generator->createMethod([ |
| 96 | 96 | strtolower($name) |
@@ -121,11 +121,11 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - $nameGenerator = new Generator($this->directory['clientNameDir'],$name.'Manager'); |
|
| 124 | + $nameGenerator = new Generator($this->directory['clientNameDir'], $name.'Manager'); |
|
| 125 | 125 | |
| 126 | 126 | $nameGeneratorNamespaceResolve = new $nameGeneratorNamespace; |
| 127 | 127 | |
| 128 | - if(!method_exists($nameGeneratorNamespaceResolve,strtolower($client))){
|
|
| 128 | + if (!method_exists($nameGeneratorNamespaceResolve, strtolower($client))) {
|
|
| 129 | 129 | |
| 130 | 130 | $nameGenerator->createMethod([ |
| 131 | 131 | strtolower($client) |
@@ -27,13 +27,13 @@ discard block |
||
| 27 | 27 | //the auto service to be called. |
| 28 | 28 | return ClosureDispatcher::bind($controllerInstance)->call(function() use($controllerInstance){
|
| 29 | 29 | |
| 30 | - if(property_exists($controllerInstance,'response')){
|
|
| 30 | + if (property_exists($controllerInstance, 'response')) {
|
|
| 31 | 31 | return $controllerInstance->response; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // if the client wishes, |
| 35 | 35 | // data can be returned in the supported format. |
| 36 | - if(app()->has('clientResponseType')){
|
|
| 36 | + if (app()->has('clientResponseType')) {
|
|
| 37 | 37 | return app()->get('clientResponseType');
|
| 38 | 38 | } |
| 39 | 39 | |
@@ -73,8 +73,7 @@ discard block |
||
| 73 | 73 | {
|
| 74 | 74 | //we get the response type by checking the instanceController object from the router. |
| 75 | 75 | //Each type of response is in the base class in project directory. |
| 76 | - return ($this->getControllerInstance()===null) ? core()->responseType : |
|
| 77 | - $this->appResponseType(); |
|
| 76 | + return ($this->getControllerInstance()===null) ? core()->responseType : $this->appResponseType(); |
|
| 78 | 77 | } |
| 79 | 78 | |
| 80 | 79 | /** |
@@ -85,19 +84,19 @@ discard block |
||
| 85 | 84 | public function handle() |
| 86 | 85 | {
|
| 87 | 86 | //definition for singleton instance |
| 88 | - define ('responseApp',true);
|
|
| 87 | + define('responseApp', true);
|
|
| 89 | 88 | |
| 90 | 89 | //get out putter for response |
| 91 | 90 | $formatter = $this->formatter(); |
| 92 | 91 | |
| 93 | 92 | //if out putter is not null |
| 94 | - if(Utils::isNamespaceExists($formatter)){
|
|
| 93 | + if (Utils::isNamespaceExists($formatter)) {
|
|
| 95 | 94 | |
| 96 | 95 | //We resolve the response via the service container |
| 97 | 96 | //and run the handle method. |
| 98 | 97 | $result = app()->resolve($formatter)->{$this->getResponseKind()}($this->getOutPutter());
|
| 99 | 98 | |
| 100 | - $this->app->register('result',$result);
|
|
| 99 | + $this->app->register('result', $result);
|
|
| 101 | 100 | } |
| 102 | 101 | } |
| 103 | 102 | |
@@ -107,7 +106,7 @@ discard block |
||
| 107 | 106 | * @param array $data |
| 108 | 107 | * @return array |
| 109 | 108 | */ |
| 110 | - public function outputFormatter($data=array()) |
|
| 109 | + public function outputFormatter($data = array()) |
|
| 111 | 110 | {
|
| 112 | 111 | $dataCapsule = config('response.data');
|
| 113 | 112 | |