@@ -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 | |
@@ -14,13 +14,13 @@ |
||
| 14 | 14 | |
| 15 | 15 | [$class, $method] = $array; |
| 16 | 16 | |
| 17 | - if (! class_exists($class)){ |
|
| 17 | + if (!class_exists($class)) { |
|
| 18 | 18 | throw new Exception("Class {$class} doesn't exist."); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $method = $method ?: 'handle'; |
| 22 | 22 | |
| 23 | - if (! method_exists($class, $method)){ |
|
| 23 | + if (!method_exists($class, $method)) { |
|
| 24 | 24 | throw new Exception("Method {$method} doesn't exist on {$class} class."); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -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 = [ |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | $str .= $inputObject->setKey($key)->setAction($this->inputName)->render(); |
| 271 | 271 | |
| 272 | 272 | $this->texts[$inputObject->getTitle()] = $inputObject->getTitle(); |
| 273 | - if ($placeholder = $inputObject->getPlaceholder()){ |
|
| 273 | + if ($placeholder = $inputObject->getPlaceholder()) { |
|
| 274 | 274 | $this->texts[$placeholder] = $placeholder; |
| 275 | 275 | } |
| 276 | 276 | } |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | /** |
| 282 | 282 | * Tab Maker (Each tabs mean 4 space) |
| 283 | 283 | */ |
| 284 | - public function makeTab($count, $newLine = true){ |
|
| 284 | + public function makeTab($count, $newLine = true) { |
|
| 285 | 285 | $count = $count * 4; |
| 286 | 286 | $tabs = str_repeat(' ', $count); |
| 287 | 287 | |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | |
| 298 | 298 | public function normalizeField($field) |
| 299 | 299 | { |
| 300 | - if($field instanceof Field){ |
|
| 300 | + if ($field instanceof Field) { |
|
| 301 | 301 | return $field; |
| 302 | 302 | } |
| 303 | 303 | |
@@ -306,8 +306,8 @@ discard block |
||
| 306 | 306 | return Field::title($title); |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | - public function normalizeInput($key, $input){ |
|
| 310 | - if ($input instanceof BaseInput){ |
|
| 309 | + public function normalizeInput($key, $input) { |
|
| 310 | + if ($input instanceof BaseInput) { |
|
| 311 | 311 | return $input; |
| 312 | 312 | } |
| 313 | 313 | |