@@ -23,7 +23,7 @@ |
||
| 23 | 23 | |
| 24 | 24 | public static function get($name) |
| 25 | 25 | { |
| 26 | - if (!key_exists($name, static::inputClassMap)){ |
|
| 26 | + if (!key_exists($name, static::inputClassMap)) { |
|
| 27 | 27 | throw new \Exception("The [$name] input type doesn't exist in input list!"); |
| 28 | 28 | } |
| 29 | 29 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | public function asImage() |
| 38 | 38 | { |
| 39 | - if($this->stub != 'linked-image.stub'){ |
|
| 39 | + if ($this->stub != 'linked-image.stub') { |
|
| 40 | 40 | $this->stub = 'image.stub'; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | private function getTitleStubContent() |
| 158 | 158 | { |
| 159 | - if ($this->isRelational()){ |
|
| 159 | + if ($this->isRelational()) { |
|
| 160 | 160 | return file_get_contents(__DIR__.'/stubs/titles/relational.stub'); |
| 161 | 161 | } |
| 162 | 162 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | return \Str::contains($this->key, '.'); |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - private function parseRelationalKey($key){ |
|
| 171 | + private function parseRelationalKey($key) { |
|
| 172 | 172 | return str_replace('.', '->', $key); |
| 173 | 173 | } |
| 174 | 174 | |
@@ -37,15 +37,15 @@ discard block |
||
| 37 | 37 | $this->store = $store; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function setAuthType(bool $hasAuth){ |
|
| 40 | + public function setAuthType(bool $hasAuth) { |
|
| 41 | 41 | $this->hasAuth = $hasAuth; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function setFields(array $fields){ |
|
| 44 | + public function setFields(array $fields) { |
|
| 45 | 45 | $this->fields = $fields; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public function setInputs(array $inputs){ |
|
| 48 | + public function setInputs(array $inputs) { |
|
| 49 | 49 | $this->inputs = $inputs; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $decodedFile = json_decode(File::get($file), 1); |
| 82 | 82 | $texts = $this->texts; |
| 83 | 83 | foreach ($texts as $key => $text) { |
| 84 | - if (array_key_exists($key, $decodedFile)){ |
|
| 84 | + if (array_key_exists($key, $decodedFile)) { |
|
| 85 | 85 | unset($texts[$text]); |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $fields = array_keys($this->inputs); |
| 109 | 109 | $str = ''; |
| 110 | 110 | |
| 111 | - if(in_array($this->inputName, $fields)){ |
|
| 111 | + if (in_array($this->inputName, $fields)) { |
|
| 112 | 112 | $this->error("Model name must not equal to column names, fix it and rerun command with -f flag"); |
| 113 | 113 | die; |
| 114 | 114 | } |
@@ -181,10 +181,10 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | foreach ($this->inputs as $key => $field) { |
| 183 | 183 | $newLine = ($field != end($this->inputs) or $this->hasAuth); |
| 184 | - $str .= "'$key' => " . '$this' . "->$key,".$this->makeTab(3, $newLine); |
|
| 184 | + $str .= "'$key' => ".'$this'."->$key,".$this->makeTab(3, $newLine); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - if($this->hasAuth){ |
|
| 187 | + if ($this->hasAuth) { |
|
| 188 | 188 | $str .= "'user_id' => auth()->id(),"; |
| 189 | 189 | } |
| 190 | 190 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | /** |
| 195 | 195 | * Create Blade from stub |
| 196 | 196 | */ |
| 197 | - public function parseBlade($stub){ |
|
| 197 | + public function parseBlade($stub) { |
|
| 198 | 198 | $modelName = $this->getModelName($this->parsedModel); |
| 199 | 199 | |
| 200 | 200 | $array = [ |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | $str .= $inputObject->setKey($key)->setAction($this->inputName)->render(); |
| 269 | 269 | |
| 270 | 270 | $this->texts[$inputObject->getTitle()] = $inputObject->getTitle(); |
| 271 | - if ($placeholder = $inputObject->getPlaceholder()){ |
|
| 271 | + if ($placeholder = $inputObject->getPlaceholder()) { |
|
| 272 | 272 | $this->texts[$placeholder] = $placeholder; |
| 273 | 273 | } |
| 274 | 274 | } |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | /** |
| 280 | 280 | * Tab Maker (Each tabs mean 4 space) |
| 281 | 281 | */ |
| 282 | - public function makeTab($count, $newLine = true){ |
|
| 282 | + public function makeTab($count, $newLine = true) { |
|
| 283 | 283 | $count = $count * 4; |
| 284 | 284 | $tabs = str_repeat(' ', $count); |
| 285 | 285 | |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | |
| 296 | 296 | private function normalizeField($field) |
| 297 | 297 | { |
| 298 | - if($field instanceof Field){ |
|
| 298 | + if ($field instanceof Field) { |
|
| 299 | 299 | return $field; |
| 300 | 300 | } |
| 301 | 301 | |
@@ -304,8 +304,8 @@ discard block |
||
| 304 | 304 | return Field::title($title); |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - private function normalizeInput($key, $input){ |
|
| 308 | - if ($input instanceof BaseInput){ |
|
| 307 | + private function normalizeInput($key, $input) { |
|
| 308 | + if ($input instanceof BaseInput) { |
|
| 309 | 309 | return $input; |
| 310 | 310 | } |
| 311 | 311 | |