@@ -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,11 +66,11 @@ 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 | - if(!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'Event.php')){
|
|
| 73 | + if (!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'Event.php')) {
|
|
| 74 | 74 | $this->touch['model/event'] = $this->directory['helper'].''.DIRECTORY_SEPARATOR.'Event.php'; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | $entityDir = $this->directory['modelDir'].''.DIRECTORY_SEPARATOR.'Entity'; |
| 80 | 80 | |
| 81 | - if(!file_exists($entityDir)){
|
|
| 81 | + if (!file_exists($entityDir)) {
|
|
| 82 | 82 | files()->makeDirectory($entityDir); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -87,9 +87,9 @@ discard block |
||
| 87 | 87 | $entityClass = $entityDir.''.DIRECTORY_SEPARATOR.''.$entityTableName.''.DIRECTORY_SEPARATOR.''.$entityTableName; |
| 88 | 88 | |
| 89 | 89 | |
| 90 | - $generator = new Generator($entityDir,'EntityMap'); |
|
| 90 | + $generator = new Generator($entityDir, 'EntityMap'); |
|
| 91 | 91 | |
| 92 | - if(!file_exists($entityDir.''.DIRECTORY_SEPARATOR.'EntityMap.php')){
|
|
| 92 | + if (!file_exists($entityDir.''.DIRECTORY_SEPARATOR.'EntityMap.php')) {
|
|
| 93 | 93 | |
| 94 | 94 | //$this->setAnnotations(); |
| 95 | 95 | $generator->createClass(); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | $entityMapNamespaceResolve = new $entityMapNamespace; |
| 101 | 101 | |
| 102 | - if(!method_exists($entityMapNamespaceResolve,strtolower($this->argument['table']))){
|
|
| 102 | + if (!method_exists($entityMapNamespaceResolve, strtolower($this->argument['table']))) {
|
|
| 103 | 103 | |
| 104 | 104 | $generator->createClassUse([ |
| 105 | 105 | Utils::getNamespace($entityClass) |
@@ -129,15 +129,15 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | |
| 131 | 131 | //set builder map |
| 132 | - $generator = new Generator($this->directory['builderDir'],'BuilderMap'); |
|
| 132 | + $generator = new Generator($this->directory['builderDir'], 'BuilderMap'); |
|
| 133 | 133 | |
| 134 | - if(!file_exists($this->directory['builderDir'].''.DIRECTORY_SEPARATOR.'BuilderMap.php')){
|
|
| 134 | + if (!file_exists($this->directory['builderDir'].''.DIRECTORY_SEPARATOR.'BuilderMap.php')) {
|
|
| 135 | 135 | |
| 136 | 136 | $this->setAnnotations(); |
| 137 | 137 | $generator->createClass(); |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - if(!file_exists($this->touch['model/model'])){
|
|
| 140 | + if (!file_exists($this->touch['model/model'])) {
|
|
| 141 | 141 | |
| 142 | 142 | $generator->createMethod([ |
| 143 | 143 | strtolower($this->argument['file']) |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | //set project touch |
| 161 | - $this->file->touch($this,[ |
|
| 161 | + $this->file->touch($this, [ |
|
| 162 | 162 | 'stub'=>'Model_Create' |
| 163 | 163 | ]); |
| 164 | 164 | |
@@ -169,11 +169,11 @@ discard block |
||
| 169 | 169 | /** |
| 170 | 170 | * @return bool |
| 171 | 171 | */ |
| 172 | - private function setAnnotations(){
|
|
| 172 | + private function setAnnotations() {
|
|
| 173 | 173 | |
| 174 | 174 | $entityMap = app()->path()->model().''.DIRECTORY_SEPARATOR.'Entity'.DIRECTORY_SEPARATOR.'EntityMap.php'; |
| 175 | 175 | |
| 176 | - if(file_exists($entityMap)){
|
|
| 176 | + if (file_exists($entityMap)) {
|
|
| 177 | 177 | |
| 178 | 178 | Utils::changeClass(path()->serviceAnnotations().'.php', |
| 179 | 179 | [ |