@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * |
12 | 12 | * @return void |
13 | 13 | */ |
14 | - public function boot() |
|
14 | + public function boot () |
|
15 | 15 | { |
16 | 16 | // |
17 | 17 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @return void |
23 | 23 | */ |
24 | - public function register() |
|
24 | + public function register () |
|
25 | 25 | { |
26 | 26 | } |
27 | 27 | } |
@@ -5,6 +5,5 @@ |
||
5 | 5 | use Bludata\Doctrine\ORM\Repositories\BaseRepository; |
6 | 6 | use LaravelSeed\Contracts\Repositories\RotaRepositoryContract; |
7 | 7 | |
8 | -class RotaRepository extends BaseRepository implements RotaRepositoryContract |
|
9 | -{ |
|
8 | +class RotaRepository extends BaseRepository implements RotaRepositoryContract { |
|
10 | 9 | } |
@@ -34,28 +34,28 @@ discard block |
||
34 | 34 | /** |
35 | 35 | * @var array |
36 | 36 | */ |
37 | - protected $entitys = []; |
|
37 | + protected $entitys = [ ]; |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * @var array |
41 | 41 | */ |
42 | - protected $tables = []; |
|
42 | + protected $tables = [ ]; |
|
43 | 43 | /** |
44 | 44 | * @var array |
45 | 45 | */ |
46 | - protected $queryFields = []; |
|
46 | + protected $queryFields = [ ]; |
|
47 | 47 | /** |
48 | 48 | * @var array |
49 | 49 | */ |
50 | - protected $expressions = []; |
|
50 | + protected $expressions = [ ]; |
|
51 | 51 | /** |
52 | 52 | * @var array |
53 | 53 | */ |
54 | - protected $groupFields = []; |
|
54 | + protected $groupFields = [ ]; |
|
55 | 55 | /** |
56 | 56 | * @var array |
57 | 57 | */ |
58 | - protected $field = []; |
|
58 | + protected $field = [ ]; |
|
59 | 59 | /** |
60 | 60 | * @var int |
61 | 61 | */ |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | /** |
64 | 64 | * @var array |
65 | 65 | */ |
66 | - protected $fieldValue = []; |
|
66 | + protected $fieldValue = [ ]; |
|
67 | 67 | |
68 | - public function __construct(RepositoryContract $repository) |
|
68 | + public function __construct (RepositoryContract $repository) |
|
69 | 69 | { |
70 | 70 | $this->repository = $repository; |
71 | 71 | $this->em = $this->repository->getEntityManager(); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @return string |
80 | 80 | */ |
81 | - public function getEntityName() |
|
81 | + public function getEntityName () |
|
82 | 82 | { |
83 | 83 | $this->repository->getEntityName(); |
84 | 84 | } |
@@ -88,15 +88,15 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return string |
90 | 90 | */ |
91 | - public function getPrimaryKeyEntity() |
|
91 | + public function getPrimaryKeyEntity () |
|
92 | 92 | { |
93 | - return $this->getClassMetaData()->identifier[0]; |
|
93 | + return $this->getClassMetaData()->identifier[ 0 ]; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
97 | 97 | * @return Doctrine\ORM\Query |
98 | 98 | */ |
99 | - public function getQuery() |
|
99 | + public function getQuery () |
|
100 | 100 | { |
101 | 101 | $query = $this->queryBuilder->getQuery(); |
102 | 102 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @return array |
114 | 114 | */ |
115 | - public function getResult() |
|
115 | + public function getResult () |
|
116 | 116 | { |
117 | 117 | $query = $this->getQuery(); |
118 | 118 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * |
129 | 129 | * @return Bludata\Doctrine\ORM\Entities\BaseEntity | null |
130 | 130 | */ |
131 | - public function getOneResult() |
|
131 | + public function getOneResult () |
|
132 | 132 | { |
133 | 133 | return $this->getQuery()->getOneOrNullResult(); |
134 | 134 | } |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | * |
139 | 139 | * @return array |
140 | 140 | */ |
141 | - public function toArray(array $options = null) |
|
141 | + public function toArray (array $options = null) |
|
142 | 142 | { |
143 | - $array = []; |
|
143 | + $array = [ ]; |
|
144 | 144 | |
145 | 145 | foreach ($this->getResult() as $item) { |
146 | 146 | if (method_exists($item, 'toArray')) { |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | /** |
157 | 157 | * @return Doctrine\ORM\Mapping\ClassMetadata |
158 | 158 | */ |
159 | - public function getClassMetaData() |
|
159 | + public function getClassMetaData () |
|
160 | 160 | { |
161 | 161 | return $this->classMetadata; |
162 | 162 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | /** |
165 | 165 | * @return Doctrine\ORM\QueryBuilder |
166 | 166 | */ |
167 | - public function getBuilder() |
|
167 | + public function getBuilder () |
|
168 | 168 | { |
169 | 169 | return $this->queryBuilder; |
170 | 170 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | /** |
173 | 173 | * @return QueryWorker |
174 | 174 | */ |
175 | - public function setBuilder($builder) |
|
175 | + public function setBuilder ($builder) |
|
176 | 176 | { |
177 | 177 | $this->queryBuilder = $builder; |
178 | 178 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * |
185 | 185 | * @return int |
186 | 186 | */ |
187 | - public function count() |
|
187 | + public function count () |
|
188 | 188 | { |
189 | 189 | return count($this->getResult()); |
190 | 190 | } |
@@ -196,40 +196,40 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @return QueryWorker |
198 | 198 | */ |
199 | - public function withFilters(array $filters = null) |
|
199 | + public function withFilters (array $filters = null) |
|
200 | 200 | { |
201 | 201 | if ($filters) { |
202 | 202 | foreach ($filters as $filter) { |
203 | - switch ($filter['type']) { |
|
203 | + switch ($filter[ 'type' ]) { |
|
204 | 204 | case 'select': |
205 | - $this->select($filter['fields']); |
|
205 | + $this->select($filter[ 'fields' ]); |
|
206 | 206 | break; |
207 | 207 | case 'andWhere': |
208 | - $this->andWhere($filter['field'], $filter['operation'], $filter['value']); |
|
208 | + $this->andWhere($filter[ 'field' ], $filter[ 'operation' ], $filter[ 'value' ]); |
|
209 | 209 | break; |
210 | 210 | case 'orWhere': |
211 | - $this->orWhere($filter['field'], $filter['operation'], $filter['value']); |
|
211 | + $this->orWhere($filter[ 'field' ], $filter[ 'operation' ], $filter[ 'value' ]); |
|
212 | 212 | break; |
213 | 213 | case 'andHaving': |
214 | - $this->andHaving($filter['field'], $filter['operation'], $filter['value']); |
|
214 | + $this->andHaving($filter[ 'field' ], $filter[ 'operation' ], $filter[ 'value' ]); |
|
215 | 215 | break; |
216 | 216 | case 'orHaving': |
217 | - $this->orHaving($filter['field'], $filter['operation'], $filter['value']); |
|
217 | + $this->orHaving($filter[ 'field' ], $filter[ 'operation' ], $filter[ 'value' ]); |
|
218 | 218 | break; |
219 | 219 | case 'addGroupBy': |
220 | - $this->addGroupBy($filter['field']); |
|
220 | + $this->addGroupBy($filter[ 'field' ]); |
|
221 | 221 | break; |
222 | 222 | case 'addOrderBy': |
223 | - $this->addOrderBy($filter['field'], $filter['order']); |
|
223 | + $this->addOrderBy($filter[ 'field' ], $filter[ 'order' ]); |
|
224 | 224 | break; |
225 | 225 | case 'fkAddOrderBy': |
226 | - $this->fkAddOrderBy($filter['field'], $filter['fkField'], $filter['order']); |
|
226 | + $this->fkAddOrderBy($filter[ 'field' ], $filter[ 'fkField' ], $filter[ 'order' ]); |
|
227 | 227 | break; |
228 | 228 | case 'paginate': |
229 | - if (isset($filter['page'])) { |
|
230 | - $this->paginate($filter['limit'], $filter['page']); |
|
229 | + if (isset($filter[ 'page' ])) { |
|
230 | + $this->paginate($filter[ 'limit' ], $filter[ 'page' ]); |
|
231 | 231 | } else { |
232 | - $this->paginate($filter['limit']); |
|
232 | + $this->paginate($filter[ 'limit' ]); |
|
233 | 233 | } |
234 | 234 | break; |
235 | 235 | } |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * |
248 | 248 | * @return $this |
249 | 249 | */ |
250 | - public function paginate($limit = 25, $page = 0) |
|
250 | + public function paginate ($limit = 25, $page = 0) |
|
251 | 251 | { |
252 | 252 | if ($limit > 0) { |
253 | 253 | $this->queryBuilder->setMaxResults($limit); |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return $this |
271 | 271 | */ |
272 | - public function andWhere($field, $operation, $value = null, $alias = self::DEFAULT_TABLE_ALIAS) |
|
272 | + public function andWhere ($field, $operation, $value = null, $alias = self::DEFAULT_TABLE_ALIAS) |
|
273 | 273 | { |
274 | 274 | if (strpos($field, '.') > 0) { |
275 | 275 | //monta os joins |
@@ -278,8 +278,8 @@ discard block |
||
278 | 278 | 'operation' => $operation, |
279 | 279 | ]; |
280 | 280 | $newAliasField = $this->associationQueryFields($field); |
281 | - $alias = $newAliasField['alias']; |
|
282 | - $field = $newAliasField['field']; |
|
281 | + $alias = $newAliasField[ 'alias' ]; |
|
282 | + $field = $newAliasField[ 'field' ]; |
|
283 | 283 | } |
284 | 284 | $this->queryBuilder->andWhere($this->makeExpression($field, $operation, $value, $alias)); |
285 | 285 | |
@@ -295,13 +295,13 @@ discard block |
||
295 | 295 | * |
296 | 296 | * @return $this |
297 | 297 | */ |
298 | - public function orWhere($field, $operation, $value = null, $alias = self::DEFAULT_TABLE_ALIAS) |
|
298 | + public function orWhere ($field, $operation, $value = null, $alias = self::DEFAULT_TABLE_ALIAS) |
|
299 | 299 | { |
300 | 300 | if (strpos($field, '.') > 0) { |
301 | 301 | //monta os joins |
302 | 302 | $newAliasField = $this->associationQueryFields($field); |
303 | - $alias = $newAliasField['alias']; |
|
304 | - $field = $newAliasField['field']; |
|
303 | + $alias = $newAliasField[ 'alias' ]; |
|
304 | + $field = $newAliasField[ 'field' ]; |
|
305 | 305 | } |
306 | 306 | $this->queryBuilder->orWhere($this->makeExpression($field, $operation, $value, $alias)); |
307 | 307 | |
@@ -315,18 +315,18 @@ discard block |
||
315 | 315 | * |
316 | 316 | * @return $this |
317 | 317 | */ |
318 | - private function makeExpressions($conditions, $alias = self::DEFAULT_TABLE_ALIAS) |
|
318 | + private function makeExpressions ($conditions, $alias = self::DEFAULT_TABLE_ALIAS) |
|
319 | 319 | { |
320 | - $expressions = []; |
|
320 | + $expressions = [ ]; |
|
321 | 321 | foreach ($conditions as $attr) { |
322 | - $field = $attr['field']; |
|
322 | + $field = $attr[ 'field' ]; |
|
323 | 323 | if (strpos($field, '.') > 0) { |
324 | 324 | //monta os joins |
325 | 325 | $newAliasField = $this->associationQueryFields($field); |
326 | - $alias = $newAliasField['alias']; |
|
327 | - $field = $newAliasField['field']; |
|
326 | + $alias = $newAliasField[ 'alias' ]; |
|
327 | + $field = $newAliasField[ 'field' ]; |
|
328 | 328 | } |
329 | - $expressions[] = $this->makeExpression($field, $attr['operation'], $attr['value'], $alias); |
|
329 | + $expressions[ ] = $this->makeExpression($field, $attr[ 'operation' ], $attr[ 'value' ], $alias); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | return $expressions; |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | * |
338 | 338 | * @param string $field |
339 | 339 | */ |
340 | - public function addGroupBy($field) |
|
340 | + public function addGroupBy ($field) |
|
341 | 341 | { |
342 | 342 | $alias = self::DEFAULT_TABLE_ALIAS; |
343 | 343 | if (strpos($field, '.') > 0) { |
@@ -346,15 +346,15 @@ discard block |
||
346 | 346 | } |
347 | 347 | if (count($this->queryFields) > 0) { |
348 | 348 | foreach ($this->queryFields as $item) { |
349 | - $parts = []; |
|
349 | + $parts = [ ]; |
|
350 | 350 | if (strpos($item, ' AS ')) { |
351 | 351 | $item = str_replace(')', '', str_replace('(', '', $item)); |
352 | 352 | $parts = explode('AS', $item); |
353 | - $item = trim($parts[0]); |
|
353 | + $item = trim($parts[ 0 ]); |
|
354 | 354 | } |
355 | 355 | if (!in_array($item, $this->groupFields)) { |
356 | 356 | $this->queryBuilder->addGroupBy($item); |
357 | - $this->groupFields[] = $item; |
|
357 | + $this->groupFields[ ] = $item; |
|
358 | 358 | } |
359 | 359 | } |
360 | 360 | } |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | * |
372 | 372 | * @return $this |
373 | 373 | */ |
374 | - public function andHaving($field, $operation, $value = null) |
|
374 | + public function andHaving ($field, $operation, $value = null) |
|
375 | 375 | { |
376 | 376 | throw new \Exception('Not implemented'); |
377 | 377 | } |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | * |
382 | 382 | * @param string $field |
383 | 383 | */ |
384 | - public function orHaving($field, $operation, $value = null) |
|
384 | + public function orHaving ($field, $operation, $value = null) |
|
385 | 385 | { |
386 | 386 | throw new \Exception('Not implemented'); |
387 | 387 | } |
@@ -392,14 +392,14 @@ discard block |
||
392 | 392 | * @param string $field |
393 | 393 | * @param string $order |
394 | 394 | */ |
395 | - public function addOrderBy($field, $order = 'ASC') |
|
395 | + public function addOrderBy ($field, $order = 'ASC') |
|
396 | 396 | { |
397 | 397 | $alias = self::DEFAULT_TABLE_ALIAS; |
398 | 398 | if (strpos($field, '.') > 0) { |
399 | 399 | //monta os joins |
400 | 400 | $newAliasField = $this->associationQueryFields($field); |
401 | - $alias = $newAliasField['alias']; |
|
402 | - $field = $newAliasField['field']; |
|
401 | + $alias = $newAliasField[ 'alias' ]; |
|
402 | + $field = $newAliasField[ 'field' ]; |
|
403 | 403 | } |
404 | 404 | $this->queryBuilder->addOrderBy($this->getFullFieldName($field, $alias), $order); |
405 | 405 | |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * @param string $field |
413 | 413 | * @param string $order |
414 | 414 | */ |
415 | - public function fkAddOrderBy($field, $fkField, $order = 'ASC') |
|
415 | + public function fkAddOrderBy ($field, $fkField, $order = 'ASC') |
|
416 | 416 | { |
417 | 417 | $alias = $this->tableAlias(); |
418 | 418 | $this->queryBuilder->join($this->getFullFieldName($field), $alias); |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | * @param associationField.fkField |
428 | 428 | * @param $field |
429 | 429 | */ |
430 | - public function select($fields) |
|
430 | + public function select ($fields) |
|
431 | 431 | { |
432 | 432 | foreach ($fields as $key => $value) { |
433 | 433 | if (is_int($key)) { |
@@ -436,10 +436,10 @@ discard block |
||
436 | 436 | $alias = $this->tableAlias(); |
437 | 437 | $this->queryBuilder->join($this->getFullFieldName($key, self::DEFAULT_TABLE_ALIAS), $alias); |
438 | 438 | foreach ($value as $valueField) { |
439 | - $this->queryFields[] = $this->getFullFieldName($valueField, $alias); |
|
439 | + $this->queryFields[ ] = $this->getFullFieldName($valueField, $alias); |
|
440 | 440 | } |
441 | 441 | } else { |
442 | - $this->queryFields[] = $value; |
|
442 | + $this->queryFields[ ] = $value; |
|
443 | 443 | } |
444 | 444 | } |
445 | 445 | $this->queryBuilder->select(implode(',', $this->queryFields)); |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | * @param associationField.fkField |
454 | 454 | * @param $field |
455 | 455 | */ |
456 | - public function associationQueryFields($campo) |
|
456 | + public function associationQueryFields ($campo) |
|
457 | 457 | { |
458 | 458 | $this->field = $campo; |
459 | 459 | $pos = strpos($campo, '.'); |
@@ -461,11 +461,11 @@ discard block |
||
461 | 461 | $arr = explode('.', $campo); |
462 | 462 | $lastField = end($arr); |
463 | 463 | |
464 | - if (count($arr) == 2 && $arr[0] == self::DEFAULT_TABLE_ALIAS) { |
|
464 | + if (count($arr) == 2 && $arr[ 0 ] == self::DEFAULT_TABLE_ALIAS) { |
|
465 | 465 | //não é um campo composto |
466 | 466 | return [ |
467 | 467 | 'field' => $lastField, |
468 | - 'alias' => $arr[0], |
|
468 | + 'alias' => $arr[ 0 ], |
|
469 | 469 | ]; |
470 | 470 | } |
471 | 471 | |
@@ -476,14 +476,14 @@ discard block |
||
476 | 476 | if ($this->position < count($arr) - 1) { |
477 | 477 | $dados = $this->getMetaAndAliases(); |
478 | 478 | |
479 | - $alias = $dados['alias']; |
|
480 | - $parentAlias = $dados['parentAlias']; |
|
479 | + $alias = $dados[ 'alias' ]; |
|
480 | + $parentAlias = $dados[ 'parentAlias' ]; |
|
481 | 481 | |
482 | 482 | if ($tempMeta) { |
483 | 483 | $meta = $tempMeta; |
484 | 484 | $tempMeta = ''; |
485 | 485 | } else { |
486 | - $meta = $dados['parentMeta']; |
|
486 | + $meta = $dados[ 'parentMeta' ]; |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | if ($meta->isAssociationWithSingleJoinColumn($value)) { |
@@ -491,22 +491,22 @@ discard block |
||
491 | 491 | $association = $meta->getAssociationMapping($value); |
492 | 492 | $this->setLeftJoin( |
493 | 493 | $meta->getAssociationTargetClass($value), |
494 | - $association['joinColumns'][0]['referencedColumnName'], |
|
495 | - $association['fieldName'], |
|
494 | + $association[ 'joinColumns' ][ 0 ][ 'referencedColumnName' ], |
|
495 | + $association[ 'fieldName' ], |
|
496 | 496 | $alias, |
497 | 497 | $parentAlias |
498 | 498 | ); |
499 | 499 | } elseif ($meta->isCollectionValuedAssociation($value)) { |
500 | 500 | $association = $meta->getAssociationMapping($value); |
501 | - if (empty($association['mappedBy']) && empty($association['joinTable'])) { |
|
501 | + if (empty($association[ 'mappedBy' ]) && empty($association[ 'joinTable' ])) { |
|
502 | 502 | //não tem como fazer o join |
503 | 503 | $this->critical(sprintf('"%s" não é uma associação válida', $campo)); |
504 | 504 | continue; |
505 | 505 | } |
506 | - if (!empty($association['joinTable'])) { |
|
506 | + if (!empty($association[ 'joinTable' ])) { |
|
507 | 507 | //manyToMany |
508 | 508 | $this->setManyToManyJoin( |
509 | - $this->getFullFieldName($association['fieldName'], $parentAlias), |
|
509 | + $this->getFullFieldName($association[ 'fieldName' ], $parentAlias), |
|
510 | 510 | $alias, |
511 | 511 | $this->setManyToManyValuedCondition($association, $alias, $arr) |
512 | 512 | ); |
@@ -514,8 +514,8 @@ discard block |
||
514 | 514 | //oneToMany |
515 | 515 | $this->setLeftJoin( |
516 | 516 | $meta->getAssociationTargetClass($value), |
517 | - $this->getTargetField($dados['meta'], $meta, $value), |
|
518 | - $meta->getIdentifierColumnNames()[0], |
|
517 | + $this->getTargetField($dados[ 'meta' ], $meta, $value), |
|
518 | + $meta->getIdentifierColumnNames()[ 0 ], |
|
519 | 519 | $alias, |
520 | 520 | $parentAlias |
521 | 521 | ); |
@@ -524,9 +524,9 @@ discard block |
||
524 | 524 | //subClass |
525 | 525 | if (count($meta->subClasses) > 0) { |
526 | 526 | $temp = $this->getSubClassFields($meta, $value); |
527 | - if (!empty($temp['meta'])) { |
|
528 | - $this->setLeftJoin($temp['table'], $temp['targetField'], $temp['parentField'], $alias, $parentAlias); |
|
529 | - $tempMeta = $temp['meta']; |
|
527 | + if (!empty($temp[ 'meta' ])) { |
|
528 | + $this->setLeftJoin($temp[ 'table' ], $temp[ 'targetField' ], $temp[ 'parentField' ], $alias, $parentAlias); |
|
529 | + $tempMeta = $temp[ 'meta' ]; |
|
530 | 530 | } |
531 | 531 | } |
532 | 532 | } |
@@ -553,23 +553,23 @@ discard block |
||
553 | 553 | * |
554 | 554 | * @return string |
555 | 555 | */ |
556 | - private function getMetaAndAliases() |
|
556 | + private function getMetaAndAliases () |
|
557 | 557 | { |
558 | 558 | $arr = explode('.', $this->field); |
559 | 559 | $meta = $this->getClassMetadata(); |
560 | - $metaAnterior = []; |
|
560 | + $metaAnterior = [ ]; |
|
561 | 561 | $parent = ''; |
562 | 562 | $alias = ''; |
563 | 563 | |
564 | 564 | for ($i = 0; $i <= $this->position; $i++) { |
565 | 565 | $metaAnterior = $meta; |
566 | 566 | |
567 | - if ($meta->hasAssociation($arr[$i])) { |
|
568 | - $class = $meta->getAssociationTargetClass($arr[$i]); |
|
567 | + if ($meta->hasAssociation($arr[ $i ])) { |
|
568 | + $class = $meta->getAssociationTargetClass($arr[ $i ]); |
|
569 | 569 | } elseif (count($meta->subClasses) > 0) { |
570 | - $temp = $this->getSubClassFields($meta, $arr[$i]); |
|
571 | - if (!empty($temp['meta'])) { |
|
572 | - $class = $temp['table']; |
|
570 | + $temp = $this->getSubClassFields($meta, $arr[ $i ]); |
|
571 | + if (!empty($temp[ 'meta' ])) { |
|
572 | + $class = $temp[ 'table' ]; |
|
573 | 573 | } |
574 | 574 | } |
575 | 575 | |
@@ -577,12 +577,12 @@ discard block |
||
577 | 577 | |
578 | 578 | if ($i < $this->position) { |
579 | 579 | $parent .= $parent != '' ? '_' : ''; |
580 | - $parent .= $arr[$i]; |
|
580 | + $parent .= $arr[ $i ]; |
|
581 | 581 | } |
582 | 582 | if ($i == $this->position) { |
583 | 583 | $alias .= $parent; |
584 | 584 | $alias .= $parent != '' ? '_' : ''; |
585 | - $alias .= $arr[$i]; |
|
585 | + $alias .= $arr[ $i ]; |
|
586 | 586 | } |
587 | 587 | } |
588 | 588 | |
@@ -610,12 +610,12 @@ discard block |
||
610 | 610 | * @param string $alias |
611 | 611 | * @param string $parentAlias |
612 | 612 | */ |
613 | - private function setJoin($table, $field, $parentField, $alias, $parentAlias) |
|
613 | + private function setJoin ($table, $field, $parentField, $alias, $parentAlias) |
|
614 | 614 | { |
615 | 615 | if (!in_array($alias, $this->tables)) { |
616 | 616 | $condition = $this->getFullFieldName($field, $alias).' = '.$this->getFullFieldName($parentField, $parentAlias); |
617 | 617 | $this->queryBuilder->join($table, $alias, 'WITH', $condition); |
618 | - $this->tables[] = $alias; |
|
618 | + $this->tables[ ] = $alias; |
|
619 | 619 | } |
620 | 620 | } |
621 | 621 | |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | * @param string $parentAlias |
630 | 630 | * @param bool $withWhere |
631 | 631 | */ |
632 | - private function setLeftJoin($table, $field, $parentField, $alias, $parentAlias, $withWhere = false) |
|
632 | + private function setLeftJoin ($table, $field, $parentField, $alias, $parentAlias, $withWhere = false) |
|
633 | 633 | { |
634 | 634 | if (!in_array($alias, $this->tables)) { |
635 | 635 | $condition = $this->getFullFieldName($field, $alias).' = '.$this->getFullFieldName($parentField, $parentAlias); |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | if ($withWhere) { |
638 | 638 | $this->queryBuilder->andWhere($condition); |
639 | 639 | } |
640 | - $this->tables[] = $alias; |
|
640 | + $this->tables[ ] = $alias; |
|
641 | 641 | } |
642 | 642 | } |
643 | 643 | |
@@ -650,14 +650,14 @@ discard block |
||
650 | 650 | * |
651 | 651 | * @return mix|null |
652 | 652 | */ |
653 | - private function setManyToManyValuedCondition($association, $alias, $arr) |
|
653 | + private function setManyToManyValuedCondition ($association, $alias, $arr) |
|
654 | 654 | { |
655 | - if (empty($this->fieldValue['value']) || $this->position < count($arr) - 2) { |
|
655 | + if (empty($this->fieldValue[ 'value' ]) || $this->position < count($arr) - 2) { |
|
656 | 656 | return null; |
657 | 657 | } |
658 | - $targetField = $this->position == count($arr) - 1 ? $association['joinTable']['joinColumns'][0]['referencedColumnName'] : end($arr); |
|
658 | + $targetField = $this->position == count($arr) - 1 ? $association[ 'joinTable' ][ 'joinColumns' ][ 0 ][ 'referencedColumnName' ] : end($arr); |
|
659 | 659 | |
660 | - return $this->makeExpression($targetField, $this->fieldValue['operation'], $this->fieldValue['value'], $alias); |
|
660 | + return $this->makeExpression($targetField, $this->fieldValue[ 'operation' ], $this->fieldValue[ 'value' ], $alias); |
|
661 | 661 | } |
662 | 662 | |
663 | 663 | /** |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | * @param string $alias |
668 | 668 | * @param mix $condition |
669 | 669 | */ |
670 | - private function setManyToManyJoin($table, $alias, $condition = null) |
|
670 | + private function setManyToManyJoin ($table, $alias, $condition = null) |
|
671 | 671 | { |
672 | 672 | if (!in_array($alias, $this->tables)) { |
673 | 673 | if ($condition) { |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | } else { |
676 | 676 | $this->queryBuilder->join($table, $alias); |
677 | 677 | } |
678 | - $this->tables[] = $alias; |
|
678 | + $this->tables[ ] = $alias; |
|
679 | 679 | } |
680 | 680 | } |
681 | 681 | |
@@ -686,19 +686,19 @@ discard block |
||
686 | 686 | * @param $value |
687 | 687 | * @param $alias |
688 | 688 | */ |
689 | - private function setQueryField($meta, $value, $alias) |
|
689 | + private function setQueryField ($meta, $value, $alias) |
|
690 | 690 | { |
691 | 691 | $campo = $this->getFullFieldName($value, $alias); |
692 | 692 | |
693 | 693 | if ($meta->isSingleValuedAssociation($value)) { |
694 | - $targetField = $meta->getAssociationMapping($value)['joinColumns'][0]['referencedColumnName']; |
|
694 | + $targetField = $meta->getAssociationMapping($value)[ 'joinColumns' ][ 0 ][ 'referencedColumnName' ]; |
|
695 | 695 | $alias = $alias == self::DEFAULT_TABLE_ALIAS ? substr($campo, strpos($campo, '.') + 1) : $alias.'_'.$targetField; |
696 | 696 | $campo = 'IDENTITY('.$campo.') '.$alias; |
697 | 697 | } elseif ($this->position > 0) { |
698 | 698 | $campo = '('.$campo.') AS '.$alias.'_'.$value; |
699 | 699 | } |
700 | 700 | // acrescenta o campo ao select |
701 | - $this->queryFields[] = $campo; |
|
701 | + $this->queryFields[ ] = $campo; |
|
702 | 702 | } |
703 | 703 | |
704 | 704 | /** |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | * |
710 | 710 | * @return string |
711 | 711 | */ |
712 | - private function getSubClassFields($meta, $value) |
|
712 | + private function getSubClassFields ($meta, $value) |
|
713 | 713 | { |
714 | 714 | foreach ($meta->subClasses as $subClass) { |
715 | 715 | $delimiter = strpos($subClass, '/') > 0 ? '/' : '\\'; |
@@ -718,8 +718,8 @@ discard block |
||
718 | 718 | if (end($temp) == $value) { |
719 | 719 | return [ |
720 | 720 | 'table' => $subClass, |
721 | - 'parentField' => $meta->getIdentifierColumnNames()[0], |
|
722 | - 'targetField' => $tempMeta->getIdentifierColumnNames()[0], |
|
721 | + 'parentField' => $meta->getIdentifierColumnNames()[ 0 ], |
|
722 | + 'targetField' => $tempMeta->getIdentifierColumnNames()[ 0 ], |
|
723 | 723 | 'meta' => $tempMeta, |
724 | 724 | ]; |
725 | 725 | } |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | * |
736 | 736 | * @return string |
737 | 737 | */ |
738 | - private function getTargetField($meta, $parentMeta, $value) |
|
738 | + private function getTargetField ($meta, $parentMeta, $value) |
|
739 | 739 | { |
740 | 740 | if (count($parentMeta->parentClasses) > 0) { |
741 | 741 | foreach ($parentMeta->parentClasses as $classe) { |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | return $field; |
756 | 756 | } |
757 | 757 | |
758 | - return $meta->getIdentifierColumnNames()[0]; |
|
758 | + return $meta->getIdentifierColumnNames()[ 0 ]; |
|
759 | 759 | } |
760 | 760 | |
761 | 761 | /** |
@@ -767,11 +767,11 @@ discard block |
||
767 | 767 | * |
768 | 768 | * @return string |
769 | 769 | */ |
770 | - private function searchAssociationField($associationsByTargetClass, $parentTable, $value) |
|
770 | + private function searchAssociationField ($associationsByTargetClass, $parentTable, $value) |
|
771 | 771 | { |
772 | 772 | foreach ($associationsByTargetClass as $table => $association) { |
773 | - if ($table == $parentTable && $association['inversedBy'] == $value) { |
|
774 | - return $association['fieldName']; |
|
773 | + if ($table == $parentTable && $association[ 'inversedBy' ] == $value) { |
|
774 | + return $association[ 'fieldName' ]; |
|
775 | 775 | } |
776 | 776 | } |
777 | 777 | } |
@@ -781,14 +781,14 @@ discard block |
||
781 | 781 | * @param string $expression |
782 | 782 | * @param string $alias |
783 | 783 | */ |
784 | - private function getSelectExpression($expression, $field, $alias, $fieldAlias = self::DEFAULT_TABLE_ALIAS) |
|
784 | + private function getSelectExpression ($expression, $field, $alias, $fieldAlias = self::DEFAULT_TABLE_ALIAS) |
|
785 | 785 | { |
786 | - $validExpressions = ['SUM', 'MIN', 'MAX', 'AVG', 'COUNT']; |
|
786 | + $validExpressions = [ 'SUM', 'MIN', 'MAX', 'AVG', 'COUNT' ]; |
|
787 | 787 | if (in_array(trim(strtoupper($expression)), $validExpressions)) { |
788 | 788 | if (strpos($field, '.') === false) { |
789 | 789 | $field = getFullFieldName($field, $fieldAlias); |
790 | 790 | } |
791 | - $this->queryFields[] = sprintf('%s(%s) AS %s', $expression, $field, $alias); |
|
791 | + $this->queryFields[ ] = sprintf('%s(%s) AS %s', $expression, $field, $alias); |
|
792 | 792 | } |
793 | 793 | } |
794 | 794 | |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | * |
799 | 799 | * @return string |
800 | 800 | */ |
801 | - protected function getFullFieldName($field, $alias = self::DEFAULT_TABLE_ALIAS, $separator = '.') |
|
801 | + protected function getFullFieldName ($field, $alias = self::DEFAULT_TABLE_ALIAS, $separator = '.') |
|
802 | 802 | { |
803 | 803 | return sprintf('%s%s%s', $alias, $separator, $field); |
804 | 804 | } |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | * @param null $value |
810 | 810 | * @param string $alias |
811 | 811 | */ |
812 | - protected function makeExpression($field, $operation, $value = null, $alias = self::DEFAULT_TABLE_ALIAS) |
|
812 | + protected function makeExpression ($field, $operation, $value = null, $alias = self::DEFAULT_TABLE_ALIAS) |
|
813 | 813 | { |
814 | 814 | $originalValue = $value; |
815 | 815 | |
@@ -871,10 +871,10 @@ discard block |
||
871 | 871 | $expression = $alias.' INSTANCE OF '.$value; |
872 | 872 | break; |
873 | 873 | case 'between': |
874 | - $expression = $this->queryBuilder->expr()->between($field, $this->queryBuilder->expr()->literal($value[0]), $this->queryBuilder->expr()->literal($value[1])); |
|
874 | + $expression = $this->queryBuilder->expr()->between($field, $this->queryBuilder->expr()->literal($value[ 0 ]), $this->queryBuilder->expr()->literal($value[ 1 ])); |
|
875 | 875 | break; |
876 | 876 | case 'dateparteq': |
877 | - $expression = $this->queryBuilder->expr()->eq("DATEPART('".$value['format']."', ".$field.')', $value['value']); |
|
877 | + $expression = $this->queryBuilder->expr()->eq("DATEPART('".$value[ 'format' ]."', ".$field.')', $value[ 'value' ]); |
|
878 | 878 | } |
879 | 879 | |
880 | 880 | return $expression; |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | /** |
884 | 884 | * @return string |
885 | 885 | */ |
886 | - protected function tableAlias() |
|
886 | + protected function tableAlias () |
|
887 | 887 | { |
888 | 888 | return self::DEFAULT_TABLE_ALIAS.count($this->queryBuilder->getAllAliases()); |
889 | 889 | } |
@@ -6,8 +6,7 @@ |
||
6 | 6 | use Bludata\Doctrine\Common\Contracts\RepositoryContract; |
7 | 7 | use Doctrine\ORM\Query; |
8 | 8 | |
9 | -class QueryWorker implements QueryWorkerContract |
|
10 | -{ |
|
9 | +class QueryWorker implements QueryWorkerContract { |
|
11 | 10 | const CUSTOM_FILTERS_KEY = 'custom'; |
12 | 11 | const DEFAULT_TABLE_ALIAS = 't'; |
13 | 12 |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $query = $this->queryBuilder->getQuery(); |
102 | 102 | |
103 | 103 | if (method_exists($query, 'setHint')) { |
104 | - $query->setHint(Query::HINT_INCLUDE_META_COLUMNS, true); |
|
104 | + $query->setHint(Query::HINT_INCLUDE_META_COLUMNS, TRUE); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | return $query; |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * |
139 | 139 | * @return array |
140 | 140 | */ |
141 | - public function toArray(array $options = null) |
|
141 | + public function toArray(array $options = NULL) |
|
142 | 142 | { |
143 | 143 | $array = []; |
144 | 144 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @return QueryWorker |
198 | 198 | */ |
199 | - public function withFilters(array $filters = null) |
|
199 | + public function withFilters(array $filters = NULL) |
|
200 | 200 | { |
201 | 201 | if ($filters) { |
202 | 202 | foreach ($filters as $filter) { |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return $this |
271 | 271 | */ |
272 | - public function andWhere($field, $operation, $value = null, $alias = self::DEFAULT_TABLE_ALIAS) |
|
272 | + public function andWhere($field, $operation, $value = NULL, $alias = self::DEFAULT_TABLE_ALIAS) |
|
273 | 273 | { |
274 | 274 | if (strpos($field, '.') > 0) { |
275 | 275 | //monta os joins |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | * |
296 | 296 | * @return $this |
297 | 297 | */ |
298 | - public function orWhere($field, $operation, $value = null, $alias = self::DEFAULT_TABLE_ALIAS) |
|
298 | + public function orWhere($field, $operation, $value = NULL, $alias = self::DEFAULT_TABLE_ALIAS) |
|
299 | 299 | { |
300 | 300 | if (strpos($field, '.') > 0) { |
301 | 301 | //monta os joins |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | * |
372 | 372 | * @return $this |
373 | 373 | */ |
374 | - public function andHaving($field, $operation, $value = null) |
|
374 | + public function andHaving($field, $operation, $value = NULL) |
|
375 | 375 | { |
376 | 376 | throw new \Exception('Not implemented'); |
377 | 377 | } |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | * |
382 | 382 | * @param string $field |
383 | 383 | */ |
384 | - public function orHaving($field, $operation, $value = null) |
|
384 | + public function orHaving($field, $operation, $value = NULL) |
|
385 | 385 | { |
386 | 386 | throw new \Exception('Not implemented'); |
387 | 387 | } |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | * @param string $parentAlias |
630 | 630 | * @param bool $withWhere |
631 | 631 | */ |
632 | - private function setLeftJoin($table, $field, $parentField, $alias, $parentAlias, $withWhere = false) |
|
632 | + private function setLeftJoin($table, $field, $parentField, $alias, $parentAlias, $withWhere = FALSE) |
|
633 | 633 | { |
634 | 634 | if (!in_array($alias, $this->tables)) { |
635 | 635 | $condition = $this->getFullFieldName($field, $alias).' = '.$this->getFullFieldName($parentField, $parentAlias); |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | private function setManyToManyValuedCondition($association, $alias, $arr) |
654 | 654 | { |
655 | 655 | if (empty($this->fieldValue['value']) || $this->position < count($arr) - 2) { |
656 | - return null; |
|
656 | + return NULL; |
|
657 | 657 | } |
658 | 658 | $targetField = $this->position == count($arr) - 1 ? $association['joinTable']['joinColumns'][0]['referencedColumnName'] : end($arr); |
659 | 659 | |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | * @param string $alias |
668 | 668 | * @param mix $condition |
669 | 669 | */ |
670 | - private function setManyToManyJoin($table, $alias, $condition = null) |
|
670 | + private function setManyToManyJoin($table, $alias, $condition = NULL) |
|
671 | 671 | { |
672 | 672 | if (!in_array($alias, $this->tables)) { |
673 | 673 | if ($condition) { |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | foreach ($parentMeta->parentClasses as $classe) { |
742 | 742 | $associationsByTargetClass = $meta->getAssociationsByTargetClass($classe); |
743 | 743 | if (count($associationsByTargetClass) > 0) { |
744 | - $parentTable = lcfirst(substr($classe, strrpos($classe, strpos($classe, '\\') !== false ? '\\' : '/') + 1)); |
|
744 | + $parentTable = lcfirst(substr($classe, strrpos($classe, strpos($classe, '\\') !== FALSE ? '\\' : '/') + 1)); |
|
745 | 745 | $field = $this->searchAssociationField($associationsByTargetClass, $parentTable, $value); |
746 | 746 | if ($field) { |
747 | 747 | return $field; |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | { |
786 | 786 | $validExpressions = ['SUM', 'MIN', 'MAX', 'AVG', 'COUNT']; |
787 | 787 | if (in_array(trim(strtoupper($expression)), $validExpressions)) { |
788 | - if (strpos($field, '.') === false) { |
|
788 | + if (strpos($field, '.') === FALSE) { |
|
789 | 789 | $field = getFullFieldName($field, $fieldAlias); |
790 | 790 | } |
791 | 791 | $this->queryFields[] = sprintf('%s(%s) AS %s', $expression, $field, $alias); |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | * @param null $value |
810 | 810 | * @param string $alias |
811 | 811 | */ |
812 | - protected function makeExpression($field, $operation, $value = null, $alias = self::DEFAULT_TABLE_ALIAS) |
|
812 | + protected function makeExpression($field, $operation, $value = NULL, $alias = self::DEFAULT_TABLE_ALIAS) |
|
813 | 813 | { |
814 | 814 | $originalValue = $value; |
815 | 815 | |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | if ($field) { |
820 | 820 | $field = $this->getFullFieldName($field, $alias); |
821 | 821 | } |
822 | - $expression = null; |
|
822 | + $expression = NULL; |
|
823 | 823 | switch (strtolower($operation)) { |
824 | 824 | case '>': |
825 | 825 | $expression = $this->queryBuilder->expr()->gt($field, $value); |
@@ -11,43 +11,43 @@ |
||
11 | 11 | |
12 | 12 | abstract class BaseRepository extends EntityRepository implements RepositoryContract |
13 | 13 | { |
14 | - public function getEntityManager(): EntityManager |
|
14 | + public function getEntityManager (): EntityManager |
|
15 | 15 | { |
16 | 16 | return parent::getEntityManager(); |
17 | 17 | } |
18 | 18 | |
19 | - public function getClassMetadata(): ClassMetadata |
|
19 | + public function getClassMetadata (): ClassMetadata |
|
20 | 20 | { |
21 | 21 | return parent::getClassMetadata(); |
22 | 22 | } |
23 | 23 | |
24 | - public function createQueryWorker(): QueryWorkerContract |
|
24 | + public function createQueryWorker (): QueryWorkerContract |
|
25 | 25 | { |
26 | 26 | return new QueryWorker($this); |
27 | 27 | } |
28 | 28 | |
29 | - public function findAll(): QueryWorkerContract |
|
29 | + public function findAll (): QueryWorkerContract |
|
30 | 30 | { |
31 | 31 | return $this->createQueryWorker(); |
32 | 32 | } |
33 | 33 | |
34 | - public function findOneBy(array $criteria): EntityContract |
|
34 | + public function findOneBy (array $criteria): EntityContract |
|
35 | 35 | { |
36 | 36 | } |
37 | 37 | |
38 | - public function find($id): EntityContract |
|
38 | + public function find ($id): EntityContract |
|
39 | 39 | { |
40 | 40 | } |
41 | 41 | |
42 | - public function findAllRemoved() |
|
42 | + public function findAllRemoved () |
|
43 | 43 | { |
44 | 44 | } |
45 | 45 | |
46 | - public function findRemoved($id, bool $abort = true): EntityContract |
|
46 | + public function findRemoved ($id, bool $abort = true): EntityContract |
|
47 | 47 | { |
48 | 48 | } |
49 | 49 | |
50 | - public function createEntity(): EntityContract |
|
50 | + public function createEntity (): EntityContract |
|
51 | 51 | { |
52 | 52 | $entityName = $this->getEntityName(); |
53 | 53 |
@@ -9,8 +9,7 @@ |
||
9 | 9 | use Doctrine\ORM\EntityRepository; |
10 | 10 | use Doctrine\ORM\Mapping\ClassMetadata; |
11 | 11 | |
12 | -abstract class BaseRepository extends EntityRepository implements RepositoryContract |
|
13 | -{ |
|
12 | +abstract class BaseRepository extends EntityRepository implements RepositoryContract { |
|
14 | 13 | public function getEntityManager(): EntityManager |
15 | 14 | { |
16 | 15 | return parent::getEntityManager(); |
@@ -43,7 +43,7 @@ |
||
43 | 43 | { |
44 | 44 | } |
45 | 45 | |
46 | - public function findRemoved($id, bool $abort = true): EntityContract |
|
46 | + public function findRemoved($id, bool $abort = TRUE): EntityContract |
|
47 | 47 | { |
48 | 48 | } |
49 | 49 |
@@ -4,12 +4,12 @@ discard block |
||
4 | 4 | * Default binding a repository interface to a concret class |
5 | 5 | */ |
6 | 6 | if (!function_exists('bind_repository')) { |
7 | - function bind_repository(string $repositoryInterface, string $repository, string $entity) |
|
7 | + function bind_repository (string $repositoryInterface, string $repository, string $entity) |
|
8 | 8 | { |
9 | 9 | app()->bind($repositoryInterface, function ($app) use ($repository, $entity) { |
10 | 10 | return new $repository( |
11 | - $app['em'], |
|
12 | - $app['em']->getClassMetaData($entity) |
|
11 | + $app[ 'em' ], |
|
12 | + $app[ 'em' ]->getClassMetaData($entity) |
|
13 | 13 | ); |
14 | 14 | }); |
15 | 15 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @param string $version = 'v1' |
28 | 28 | * @param bool $abort = true |
29 | 29 | */ |
30 | - function bdClassExists(string $folder, string $className, string $version = 'v1', bool $abort = true) |
|
30 | + function bdClassExists (string $folder, string $className, string $version = 'v1', bool $abort = true) |
|
31 | 31 | { |
32 | 32 | $entityClass = config('bludata.generator.rootNamespace').'\\'.$folder.'\\'.$version.'\\'.$className; |
33 | 33 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param string $version = 'v1' |
55 | 55 | * @param bool $abort = true |
56 | 56 | */ |
57 | - function bdInterfaceExists(string $folder, string $className, string $version = 'v1', bool $abort = true) |
|
57 | + function bdInterfaceExists (string $folder, string $className, string $version = 'v1', bool $abort = true) |
|
58 | 58 | { |
59 | 59 | $entityClass = config('bludata.generator.rootNamespace').'\\'.$folder.'\\'.$version.'\\'.$className; |
60 | 60 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param string $version = 'v1' |
77 | 77 | * @param bool $abort = true |
78 | 78 | */ |
79 | - function bdInterfaceClass(string $className, string $version = 'v1', bool $abort = true) |
|
79 | + function bdInterfaceClass (string $className, string $version = 'v1', bool $abort = true) |
|
80 | 80 | { |
81 | 81 | dd(config('bludata.generator.paths.interfaces')); |
82 | 82 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param string $version = 'v1' |
91 | 91 | * @param bool $abort = true |
92 | 92 | */ |
93 | - function bdContractClass(string $className, string $version = 'v1', bool $abort = true) |
|
93 | + function bdContractClass (string $className, string $version = 'v1', bool $abort = true) |
|
94 | 94 | { |
95 | 95 | return bdInterfaceExists(config('bludata.generator.paths.contracts'), $className.'Interface', $version, $abort); |
96 | 96 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @param string $version = 'v1' |
103 | 103 | * @param bool $abort = true |
104 | 104 | */ |
105 | - function bdContract(string $className, string $version = 'v1', bool $abort = true) |
|
105 | + function bdContract (string $className, string $version = 'v1', bool $abort = true) |
|
106 | 106 | { |
107 | 107 | return app(bdContractClass($className, $version, $abort)); |
108 | 108 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @param string $version = 'v1' |
115 | 115 | * @param bool $abort = true |
116 | 116 | */ |
117 | - function bdRepositoryInterfaceClass(string $className, string $version = 'v1', bool $abort = true) |
|
117 | + function bdRepositoryInterfaceClass (string $className, string $version = 'v1', bool $abort = true) |
|
118 | 118 | { |
119 | 119 | return bdInterfaceClass($className.'Repository', $version, $abort); |
120 | 120 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param string $version = 'v1' |
127 | 127 | * @param bool $abort = true |
128 | 128 | */ |
129 | - function bdRepositoryClass(string $className, string $version = 'v1', bool $abort = true) |
|
129 | + function bdRepositoryClass (string $className, string $version = 'v1', bool $abort = true) |
|
130 | 130 | { |
131 | 131 | return bdClassExists(config('bludata.generator.paths.repositories'), $className.'Repository', $version, $abort); |
132 | 132 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @param string $version = 'v1' |
139 | 139 | * @param bool $abort = true |
140 | 140 | */ |
141 | - function bdRepository(string $className, string $version = 'v1', bool $abort = true) |
|
141 | + function bdRepository (string $className, string $version = 'v1', bool $abort = true) |
|
142 | 142 | { |
143 | 143 | return app(bdRepositoryInterfaceClass($className, $version, $abort)); |
144 | 144 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @param string $version = 'v1' |
151 | 151 | * @param bool $abort = true |
152 | 152 | */ |
153 | - function bdServiceInterfaceClass(string $className, string $version = 'v1', bool $abort = true) |
|
153 | + function bdServiceInterfaceClass (string $className, string $version = 'v1', bool $abort = true) |
|
154 | 154 | { |
155 | 155 | return bdInterfaceClass($className.'Service', $version, $abort); |
156 | 156 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @param string $version = 'v1' |
163 | 163 | * @param bool $abort = true |
164 | 164 | */ |
165 | - function bdServiceClass(string $className, string $version = 'v1', bool $abort = true) |
|
165 | + function bdServiceClass (string $className, string $version = 'v1', bool $abort = true) |
|
166 | 166 | { |
167 | 167 | return bdClassExists(config('bludata.generator.paths.services'), $className.'Service', $version, $abort); |
168 | 168 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @param string $version = 'v1' |
175 | 175 | * @param bool $abort = true |
176 | 176 | */ |
177 | - function bdService(string $className, string $version = 'v1', bool $abort = true) |
|
177 | + function bdService (string $className, string $version = 'v1', bool $abort = true) |
|
178 | 178 | { |
179 | 179 | return app(bdServiceInterfaceClass($className, $version, $abort)); |
180 | 180 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @param string $version = 'v1' |
187 | 187 | * @param bool $abort = true |
188 | 188 | */ |
189 | - function bdEntityClass(string $className, string $version = 'v1', bool $abort = true) |
|
189 | + function bdEntityClass (string $className, string $version = 'v1', bool $abort = true) |
|
190 | 190 | { |
191 | 191 | return bdClassExists(config('bludata.generator.paths.entities'), $className, $version, $abort); |
192 | 192 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @param string $version = 'v1' |
199 | 199 | * @param bool $abort = true |
200 | 200 | */ |
201 | - function bdEntity(string $className, string $version = 'v1', bool $abort = true) |
|
201 | + function bdEntity (string $className, string $version = 'v1', bool $abort = true) |
|
202 | 202 | { |
203 | 203 | return app(bdEntityClass($className, $version, $abort)); |
204 | 204 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @param string $version = 'v1' |
28 | 28 | * @param bool $abort = true |
29 | 29 | */ |
30 | - function bdClassExists(string $folder, string $className, string $version = 'v1', bool $abort = true) |
|
30 | + function bdClassExists(string $folder, string $className, string $version = 'v1', bool $abort = TRUE) |
|
31 | 31 | { |
32 | 32 | $entityClass = config('bludata.generator.rootNamespace').'\\'.$folder.'\\'.$version.'\\'.$className; |
33 | 33 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | abort(500, 'Undefined \''.$className.'\''); |
40 | 40 | } |
41 | 41 | |
42 | - return null; |
|
42 | + return NULL; |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param string $version = 'v1' |
55 | 55 | * @param bool $abort = true |
56 | 56 | */ |
57 | - function bdInterfaceExists(string $folder, string $className, string $version = 'v1', bool $abort = true) |
|
57 | + function bdInterfaceExists(string $folder, string $className, string $version = 'v1', bool $abort = TRUE) |
|
58 | 58 | { |
59 | 59 | $entityClass = config('bludata.generator.rootNamespace').'\\'.$folder.'\\'.$version.'\\'.$className; |
60 | 60 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | abort(500, 'Undefined \''.$className.'\''); |
67 | 67 | } |
68 | 68 | |
69 | - return null; |
|
69 | + return NULL; |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param string $version = 'v1' |
77 | 77 | * @param bool $abort = true |
78 | 78 | */ |
79 | - function bdInterfaceClass(string $className, string $version = 'v1', bool $abort = true) |
|
79 | + function bdInterfaceClass(string $className, string $version = 'v1', bool $abort = TRUE) |
|
80 | 80 | { |
81 | 81 | dd(config('bludata.generator.paths.interfaces')); |
82 | 82 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @param string $version = 'v1' |
91 | 91 | * @param bool $abort = true |
92 | 92 | */ |
93 | - function bdContractClass(string $className, string $version = 'v1', bool $abort = true) |
|
93 | + function bdContractClass(string $className, string $version = 'v1', bool $abort = TRUE) |
|
94 | 94 | { |
95 | 95 | return bdInterfaceExists(config('bludata.generator.paths.contracts'), $className.'Interface', $version, $abort); |
96 | 96 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @param string $version = 'v1' |
103 | 103 | * @param bool $abort = true |
104 | 104 | */ |
105 | - function bdContract(string $className, string $version = 'v1', bool $abort = true) |
|
105 | + function bdContract(string $className, string $version = 'v1', bool $abort = TRUE) |
|
106 | 106 | { |
107 | 107 | return app(bdContractClass($className, $version, $abort)); |
108 | 108 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @param string $version = 'v1' |
115 | 115 | * @param bool $abort = true |
116 | 116 | */ |
117 | - function bdRepositoryInterfaceClass(string $className, string $version = 'v1', bool $abort = true) |
|
117 | + function bdRepositoryInterfaceClass(string $className, string $version = 'v1', bool $abort = TRUE) |
|
118 | 118 | { |
119 | 119 | return bdInterfaceClass($className.'Repository', $version, $abort); |
120 | 120 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param string $version = 'v1' |
127 | 127 | * @param bool $abort = true |
128 | 128 | */ |
129 | - function bdRepositoryClass(string $className, string $version = 'v1', bool $abort = true) |
|
129 | + function bdRepositoryClass(string $className, string $version = 'v1', bool $abort = TRUE) |
|
130 | 130 | { |
131 | 131 | return bdClassExists(config('bludata.generator.paths.repositories'), $className.'Repository', $version, $abort); |
132 | 132 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * @param string $version = 'v1' |
139 | 139 | * @param bool $abort = true |
140 | 140 | */ |
141 | - function bdRepository(string $className, string $version = 'v1', bool $abort = true) |
|
141 | + function bdRepository(string $className, string $version = 'v1', bool $abort = TRUE) |
|
142 | 142 | { |
143 | 143 | return app(bdRepositoryInterfaceClass($className, $version, $abort)); |
144 | 144 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @param string $version = 'v1' |
151 | 151 | * @param bool $abort = true |
152 | 152 | */ |
153 | - function bdServiceInterfaceClass(string $className, string $version = 'v1', bool $abort = true) |
|
153 | + function bdServiceInterfaceClass(string $className, string $version = 'v1', bool $abort = TRUE) |
|
154 | 154 | { |
155 | 155 | return bdInterfaceClass($className.'Service', $version, $abort); |
156 | 156 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @param string $version = 'v1' |
163 | 163 | * @param bool $abort = true |
164 | 164 | */ |
165 | - function bdServiceClass(string $className, string $version = 'v1', bool $abort = true) |
|
165 | + function bdServiceClass(string $className, string $version = 'v1', bool $abort = TRUE) |
|
166 | 166 | { |
167 | 167 | return bdClassExists(config('bludata.generator.paths.services'), $className.'Service', $version, $abort); |
168 | 168 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @param string $version = 'v1' |
175 | 175 | * @param bool $abort = true |
176 | 176 | */ |
177 | - function bdService(string $className, string $version = 'v1', bool $abort = true) |
|
177 | + function bdService(string $className, string $version = 'v1', bool $abort = TRUE) |
|
178 | 178 | { |
179 | 179 | return app(bdServiceInterfaceClass($className, $version, $abort)); |
180 | 180 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @param string $version = 'v1' |
187 | 187 | * @param bool $abort = true |
188 | 188 | */ |
189 | - function bdEntityClass(string $className, string $version = 'v1', bool $abort = true) |
|
189 | + function bdEntityClass(string $className, string $version = 'v1', bool $abort = TRUE) |
|
190 | 190 | { |
191 | 191 | return bdClassExists(config('bludata.generator.paths.entities'), $className, $version, $abort); |
192 | 192 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @param string $version = 'v1' |
199 | 199 | * @param bool $abort = true |
200 | 200 | */ |
201 | - function bdEntity(string $className, string $version = 'v1', bool $abort = true) |
|
201 | + function bdEntity(string $className, string $version = 'v1', bool $abort = TRUE) |
|
202 | 202 | { |
203 | 203 | return app(bdEntityClass($className, $version, $abort)); |
204 | 204 | } |