@@ -76,7 +76,7 @@ |
||
76 | 76 | { |
77 | 77 | // id must be there anyway |
78 | 78 | $this->data = $data; |
79 | - if(in_array(ModelsInterface::ID, $this->data) === false) |
|
79 | + if (in_array(ModelsInterface::ID, $this->data) === false) |
|
80 | 80 | { |
81 | 81 | $this->data[] = ModelsInterface::ID; |
82 | 82 | } |
@@ -13,10 +13,10 @@ |
||
13 | 13 | $table = ''; |
14 | 14 | // make entity lc + underscore |
15 | 15 | $words = preg_split(self::PATTERN_SPLIT_UC, lcfirst($objectName)); |
16 | - foreach($words as $key => $word) |
|
16 | + foreach ($words as $key => $word) |
|
17 | 17 | { |
18 | 18 | $table .= $word; |
19 | - if(empty($words[$key + 1]) === false) |
|
19 | + if (empty($words[$key + 1]) === false) |
|
20 | 20 | { |
21 | 21 | $table .= PhpInterface::UNDERSCORE; |
22 | 22 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | { |
16 | 16 | $ref = new \ReflectionClass($class); |
17 | 17 | |
18 | - return (string) $ref->getShortName(); |
|
18 | + return (string)$ref->getShortName(); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | $ref = new \ReflectionClass($object); |
29 | 29 | |
30 | - return (string) $ref->getShortName(); |
|
30 | + return (string)$ref->getShortName(); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -73,7 +73,7 @@ |
||
73 | 73 | foreach ($relations as $v) { |
74 | 74 | $attrs = $v->getAttributes(); |
75 | 75 | $jsonArr[] = [ApiInterface::RAML_TYPE => $entity, |
76 | - ApiInterface::RAML_ID => $attrs[ApiInterface::RAML_ID]]; |
|
76 | + ApiInterface::RAML_ID => $attrs[ApiInterface::RAML_ID]]; |
|
77 | 77 | } |
78 | 78 | } else { |
79 | 79 | foreach ($relations as $v) { |
@@ -12,8 +12,8 @@ |
||
12 | 12 | public const PREFIX_KEY = 'prefix'; |
13 | 13 | |
14 | 14 | // console colors |
15 | - public const ANSI_COLOR_RED = "\x1b[31m"; |
|
16 | - public const ANSI_COLOR_GREEN = "\x1b[32m"; |
|
15 | + public const ANSI_COLOR_RED = "\x1b[31m"; |
|
16 | + public const ANSI_COLOR_GREEN = "\x1b[32m"; |
|
17 | 17 | public const ANSI_COLOR_YELLOW = "\x1b[33m"; |
18 | 18 | public const ANSI_COLOR_RESET = "\x1b[0m"; |
19 | 19 |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | foreach ($files as $file) { |
288 | 288 | if (($pos = strpos($file, ApiInterface::OPEN_API_KEY)) !== false) { |
289 | 289 | $lastFiles[] = $file; |
290 | - $content = Yaml::parse(file_get_contents($this->formatGenPathByDir() .$file)); |
|
290 | + $content = Yaml::parse(file_get_contents($this->formatGenPathByDir() . $file)); |
|
291 | 291 | if (empty($content[ApiInterface::RAML_KEY_USES]) === false) { |
292 | 292 | foreach ($content[ApiInterface::RAML_KEY_USES] as $subFile) { |
293 | 293 | $lastFiles[] = substr($file, 0, $pos) . basename($subFile); |
@@ -327,10 +327,10 @@ discard block |
||
327 | 327 | $this->historyTypes = $dataHistory[ApiInterface::API_COMPONENTS][ApiInterface::API_SCHEMAS]; |
328 | 328 | $this->types += array_merge_recursive($this->historyTypes, $this->currentTypes); |
329 | 329 | |
330 | - $attrsCurrent += array_filter($this->currentTypes, function ($k) { |
|
330 | + $attrsCurrent += array_filter($this->currentTypes, function($k) { |
|
331 | 331 | return strpos($k, CustomsInterface::CUSTOM_TYPES_ATTRIBUTES) !== false; |
332 | 332 | }, ARRAY_FILTER_USE_KEY); |
333 | - $attrsHistory += array_filter($this->historyTypes, function ($k) { |
|
333 | + $attrsHistory += array_filter($this->historyTypes, function($k) { |
|
334 | 334 | return strpos($k, CustomsInterface::CUSTOM_TYPES_ATTRIBUTES) !== false; |
335 | 335 | }, ARRAY_FILTER_USE_KEY); |
336 | 336 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | if (empty($this->data[ApiInterface::RAML_KEY_USES]) === false) { |
302 | 302 | if ($this->isRollback) { |
303 | 303 | foreach ($this->files as $file) { |
304 | - $fileData = Yaml::parse(file_get_contents($this->formatGenPathByDir() . $file)); |
|
304 | + $fileData = Yaml::parse(file_get_contents($this->formatGenPathByDir() . $file)); |
|
305 | 305 | $this->types += $fileData[ApiInterface::API_COMPONENTS][ApiInterface::API_SCHEMAS]; |
306 | 306 | } |
307 | 307 | } else { |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | foreach ($files as $file) { |
310 | 310 | $this->files[] = $file; |
311 | 311 | $fileData = Yaml::parse(file_get_contents($file)); |
312 | - $this->types += $fileData[ApiInterface::API_COMPONENTS][ApiInterface::API_SCHEMAS]; |
|
312 | + $this->types += $fileData[ApiInterface::API_COMPONENTS][ApiInterface::API_SCHEMAS]; |
|
313 | 313 | } |
314 | 314 | } |
315 | 315 | } |
@@ -77,15 +77,13 @@ discard block |
||
77 | 77 | protected function startMethod(MethodOptions $methodOptions) : void |
78 | 78 | { |
79 | 79 | // get params |
80 | - $params = $this->getMethodParams($methodOptions->getParams()); |
|
80 | + $params = $this->getMethodParams($methodOptions->getParams()); |
|
81 | 81 | $this->sourceCode .= PhpInterface::TAB_PSR4 . $methodOptions->getModifier() . PhpInterface::SPACE . |
82 | - (($methodOptions->isStatic() !== false) ? PhpInterface::PHP_STATIC . PhpInterface::SPACE : |
|
83 | - '') . |
|
82 | + (($methodOptions->isStatic() !== false) ? PhpInterface::PHP_STATIC . PhpInterface::SPACE : '') . |
|
84 | 83 | PhpInterface::PHP_FUNCTION . PhpInterface::SPACE . |
85 | 84 | $methodOptions->getName() |
86 | 85 | . PhpInterface::OPEN_PARENTHESES . $params . PhpInterface::CLOSE_PARENTHESES . |
87 | - ((empty($methodOptions->getReturnType())) ? '' : |
|
88 | - PhpInterface::COLON . PhpInterface::SPACE . $methodOptions->getReturnType()) . |
|
86 | + ((empty($methodOptions->getReturnType())) ? '' : PhpInterface::COLON . PhpInterface::SPACE . $methodOptions->getReturnType()) . |
|
89 | 87 | PhpInterface::SPACE . PHP_EOL . PhpInterface::TAB_PSR4 |
90 | 88 | . PhpInterface::OPEN_BRACE . PHP_EOL; |
91 | 89 | } |
@@ -97,8 +95,7 @@ discard block |
||
97 | 95 | protected function setMethodReturn(string $value, $isString = false) : void |
98 | 96 | { |
99 | 97 | $this->setTabs(2); |
100 | - $this->sourceCode .= PhpInterface::PHP_RETURN . PhpInterface::SPACE . (($isString === false) ? $value : |
|
101 | - PhpInterface::DOUBLE_QUOTES . $value . PhpInterface::DOUBLE_QUOTES) . PhpInterface::SEMICOLON . PHP_EOL; |
|
98 | + $this->sourceCode .= PhpInterface::PHP_RETURN . PhpInterface::SPACE . (($isString === false) ? $value : PhpInterface::DOUBLE_QUOTES . $value . PhpInterface::DOUBLE_QUOTES) . PhpInterface::SEMICOLON . PHP_EOL; |
|
102 | 99 | } |
103 | 100 | |
104 | 101 | protected function endMethod(int $eolCnt = 2) : void |
@@ -130,7 +127,7 @@ discard block |
||
130 | 127 | */ |
131 | 128 | private function setArrayProperty($key, array $value) : void |
132 | 129 | { |
133 | - $val = $this->setArrayToString($value); |
|
130 | + $val = $this->setArrayToString($value); |
|
134 | 131 | $this->sourceCode .= $this->quoteParam($key) |
135 | 132 | . PhpInterface::SPACE . PhpInterface::DOUBLE_ARROW |
136 | 133 | . PhpInterface::SPACE . $val . PhpInterface::COMMA . PHP_EOL; |
@@ -161,7 +158,7 @@ discard block |
||
161 | 158 | */ |
162 | 159 | protected function createPropertyArray(string $prop, string $modifier, array $value) : void |
163 | 160 | { |
164 | - $val = $this->setArrayToString($value); |
|
161 | + $val = $this->setArrayToString($value); |
|
165 | 162 | $this->sourceCode .= PhpInterface::TAB_PSR4 . $modifier . PhpInterface::SPACE . PhpInterface::DOLLAR_SIGN . |
166 | 163 | $prop . PhpInterface::SPACE . PhpInterface::EQUALS . PhpInterface::SPACE . $val . PhpInterface::SEMICOLON . PHP_EOL; |
167 | 164 | } |
@@ -391,7 +388,7 @@ discard block |
||
391 | 388 | if ($till === null) { |
392 | 389 | $this->sourceCode .= mb_substr($this->resourceCode, $start, null, PhpInterface::ENCODING_UTF8); |
393 | 390 | } else { |
394 | - $end = mb_strpos($this->resourceCode, $till, null, PhpInterface::ENCODING_UTF8) - 3; |
|
391 | + $end = mb_strpos($this->resourceCode, $till, null, PhpInterface::ENCODING_UTF8) - 3; |
|
395 | 392 | $this->sourceCode .= mb_substr($this->resourceCode, $start, $end - $start, PhpInterface::ENCODING_UTF8); |
396 | 393 | } |
397 | 394 | } |
@@ -401,7 +398,7 @@ discard block |
||
401 | 398 | */ |
402 | 399 | private function setAfterMethods() : void |
403 | 400 | { |
404 | - $start = mb_strpos($this->resourceCode, DefaultInterface::METHOD_END, null, PhpInterface::ENCODING_UTF8) - 3; |
|
401 | + $start = mb_strpos($this->resourceCode, DefaultInterface::METHOD_END, null, PhpInterface::ENCODING_UTF8) - 3; |
|
405 | 402 | $this->sourceCode .= $this->setTabs() . mb_substr($this->resourceCode, $start, null, PhpInterface::ENCODING_UTF8); |
406 | 403 | } |
407 | 404 |
@@ -105,6 +105,6 @@ |
||
105 | 105 | $this->setRoute(RoutesInterface::METHOD_PATCH, $this->composeRelationsUri(), $this->composeEndPoint(JSONApiInterface::URI_METHOD_UPDATE |
106 | 106 | . ucfirst(JSONApiInterface::URI_METHOD_RELATIONS))); |
107 | 107 | $this->setRoute(RoutesInterface::METHOD_DELETE, $this->composeRelationsUri(), $this->composeEndPoint(JSONApiInterface::URI_METHOD_DELETE |
108 | - . ucfirst (JSONApiInterface::URI_METHOD_RELATIONS))); |
|
108 | + . ucfirst(JSONApiInterface::URI_METHOD_RELATIONS))); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | \ No newline at end of file |