@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | /** |
8 | 8 | * @param string $key |
9 | 9 | */ |
10 | - function env($key, $defaultValue = '') |
|
10 | + function env ($key, $defaultValue = '') |
|
11 | 11 | { |
12 | 12 | $env = getenv($key); |
13 | 13 | if (!$env) { |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * @param string $input |
24 | 24 | */ |
25 | - function onlyNumbers(string $input) |
|
25 | + function onlyNumbers (string $input) |
|
26 | 26 | { |
27 | 27 | return preg_replace('/\D/i', '', $input); |
28 | 28 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param string $from = 'Y-m-d' |
35 | 35 | * @param string $to = 'obj' |
36 | 36 | */ |
37 | - function parseDate($date, string $from = 'Y-m-d', string $to = 'obj') |
|
37 | + function parseDate ($date, string $from = 'Y-m-d', string $to = 'obj') |
|
38 | 38 | { |
39 | 39 | if ($date instanceof DateTime && $to === 'obj') { |
40 | 40 | return $date; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * Dump and die. |
70 | 70 | */ |
71 | 71 | if (!function_exists('dd')) { |
72 | - function dd() |
|
72 | + function dd () |
|
73 | 73 | { |
74 | 74 | $args = func_get_args(); |
75 | 75 | foreach ($args as $arg) { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * Print and die |
84 | 84 | */ |
85 | 85 | if (!function_exists('pd')) { |
86 | - function pd() |
|
86 | + function pd () |
|
87 | 87 | { |
88 | 88 | $args = func_get_args(); |
89 | 89 | foreach ($args as $arg) { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * Dump and return |
98 | 98 | */ |
99 | 99 | if (!function_exists('dr')) { |
100 | - function dr() |
|
100 | + function dr () |
|
101 | 101 | { |
102 | 102 | $args = func_get_args(); |
103 | 103 | $result = ''; |
@@ -110,7 +110,7 @@ |
||
110 | 110 | if ($type == 'boolean') { |
111 | 111 | $result = $arg ? 'true' : 'false'; |
112 | 112 | } else { |
113 | - $result = print_r($arg, true); |
|
113 | + $result = print_r($arg, TRUE); |
|
114 | 114 | } |
115 | 115 | $result = sprintf('(%s) %s', $type, $result); |
116 | 116 | } |
@@ -26,24 +26,24 @@ |
||
26 | 26 | */ |
27 | 27 | protected $alias; |
28 | 28 | |
29 | - public function getNome() |
|
29 | + public function getNome () |
|
30 | 30 | { |
31 | 31 | return $this->nome; |
32 | 32 | } |
33 | 33 | |
34 | - public function setNome($nome) |
|
34 | + public function setNome ($nome) |
|
35 | 35 | { |
36 | 36 | $this->nome = $nome; |
37 | 37 | |
38 | 38 | return $this; |
39 | 39 | } |
40 | 40 | |
41 | - public function getAlias() |
|
41 | + public function getAlias () |
|
42 | 42 | { |
43 | 43 | return $this->alias; |
44 | 44 | } |
45 | 45 | |
46 | - public function setAlias($alias) |
|
46 | + public function setAlias ($alias) |
|
47 | 47 | { |
48 | 48 | $this->alias = $alias; |
49 | 49 |
@@ -10,8 +10,7 @@ |
||
10 | 10 | * @ORM\Entity(repositoryClass="LaravelSeed\Repositories\RotaRepository") |
11 | 11 | * @ORM\Table(name="Rota") |
12 | 12 | */ |
13 | -class Rota extends BaseEntity |
|
14 | -{ |
|
13 | +class Rota extends BaseEntity { |
|
15 | 14 | /** |
16 | 15 | * @ORM\Column(type="string", name="nome") |
17 | 16 | * BdAnnotations\ToArray |
@@ -8,7 +8,7 @@ |
||
8 | 8 | */ |
9 | 9 | class RulePersist |
10 | 10 | { |
11 | - /** |
|
11 | + /** |
|
12 | 12 | * @Enum({"STORE", "UPDATE", "*"}) |
13 | 13 | */ |
14 | 14 | public $value = '*'; |
@@ -6,8 +6,7 @@ |
||
6 | 6 | * @Annotation |
7 | 7 | * @Target({"PROPERTY"}) |
8 | 8 | */ |
9 | -class RulePersist |
|
10 | -{ |
|
9 | +class RulePersist { |
|
11 | 10 | /** |
12 | 11 | * @Enum({"STORE", "UPDATE", "*"}) |
13 | 12 | */ |
@@ -6,7 +6,6 @@ |
||
6 | 6 | * @Annotation |
7 | 7 | * @Target({"PROPERTY"}) |
8 | 8 | */ |
9 | -class ToArray |
|
10 | -{ |
|
9 | +class ToArray { |
|
11 | 10 | |
12 | 11 | } |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -function disableSoftDeleteableFilter() |
|
3 | +function disableSoftDeleteableFilter () |
|
4 | 4 | { |
5 | 5 | if (\EntityManager::getFilters()->isEnabled('soft-deleteable')) { |
6 | 6 | \EntityManager::getFilters()->disable('soft-deleteable'); |
7 | 7 | } |
8 | 8 | } |
9 | -function enableSoftDeleteableFilter() |
|
9 | +function enableSoftDeleteableFilter () |
|
10 | 10 | { |
11 | 11 | if (!\EntityManager::getFilters()->isEnabled('soft-deleteable')) { |
12 | 12 | \EntityManager::getFilters()->enable('soft-deleteable'); |
@@ -6,14 +6,14 @@ |
||
6 | 6 | { |
7 | 7 | public function toArray(array $options = []): array |
8 | 8 | { |
9 | - $reflectionProperty = new ReflectionProperty(get_called_class(), $key); |
|
9 | + $reflectionProperty = new ReflectionProperty(get_called_class(), $key); |
|
10 | 10 | $annotationReader = new AnnotationReader(); |
11 | 11 | $propertyAnnotations = $annotationReader->getPropertyAnnotations($reflectionProperty); |
12 | 12 | |
13 | 13 | $array = []; |
14 | 14 | |
15 | 15 | $classMetadata = $this->getRepository() |
16 | - ->getClassMetadata(); |
|
16 | + ->getClassMetadata(); |
|
17 | 17 | |
18 | 18 | foreach ($this->getFillable() as $key) { |
19 | 19 | $metaDataKey = $classMetadata->hasField($key) ? $classMetadata->getFieldMapping($key) : null; |
@@ -4,13 +4,13 @@ discard block |
||
4 | 4 | |
5 | 5 | trait ToArrayTrait |
6 | 6 | { |
7 | - public function toArray(array $options = []): array |
|
7 | + public function toArray (array $options = [ ]): array |
|
8 | 8 | { |
9 | - $reflectionProperty = new ReflectionProperty(get_called_class(), $key); |
|
9 | + $reflectionProperty = new ReflectionProperty(get_called_class(), $key); |
|
10 | 10 | $annotationReader = new AnnotationReader(); |
11 | 11 | $propertyAnnotations = $annotationReader->getPropertyAnnotations($reflectionProperty); |
12 | 12 | |
13 | - $array = []; |
|
13 | + $array = [ ]; |
|
14 | 14 | |
15 | 15 | $classMetadata = $this->getRepository() |
16 | 16 | ->getClassMetadata(); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $dateFormat = 'Y-m-d'; |
26 | 26 | |
27 | 27 | if ($metaDataKey) { |
28 | - switch ($metaDataKey['type']) { |
|
28 | + switch ($metaDataKey[ 'type' ]) { |
|
29 | 29 | case 'datetime': |
30 | 30 | $dateFormat = 'Y-m-d H:i:s'; |
31 | 31 | break; |
@@ -37,28 +37,28 @@ discard block |
||
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | - $array[$key] = $this->$key->format($dateFormat); |
|
40 | + $array[ $key ] = $this->$key->format($dateFormat); |
|
41 | 41 | } |
42 | 42 | } elseif ($this->$key instanceof ArrayCollection || $this->$key instanceof PersistentCollection) { |
43 | - $ids = []; |
|
43 | + $ids = [ ]; |
|
44 | 44 | |
45 | 45 | foreach ($this->$key->getValues() as $item) { |
46 | - $ids[] = $item->getId(); |
|
46 | + $ids[ ] = $item->getId(); |
|
47 | 47 | } |
48 | 48 | |
49 | - $array[$key] = $ids; |
|
49 | + $array[ $key ] = $ids; |
|
50 | 50 | } else { |
51 | 51 | if (method_exists($this->$key, 'getId')) { |
52 | - $array[$key] = $this->$key->getId(); |
|
52 | + $array[ $key ] = $this->$key->getId(); |
|
53 | 53 | } else { |
54 | - $array[$key] = $this->$key; |
|
54 | + $array[ $key ] = $this->$key; |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | } else { |
58 | - if ($metaDataKey['type'] == 'decimal') { |
|
59 | - $array[$key] = (float) $this->$key; |
|
58 | + if ($metaDataKey[ 'type' ] == 'decimal') { |
|
59 | + $array[ $key ] = (float) $this->$key; |
|
60 | 60 | } else { |
61 | - $array[$key] = $this->$key; |
|
61 | + $array[ $key ] = $this->$key; |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | } |
@@ -2,8 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace Bludata\Doctrine\ORM\Traits; |
4 | 4 | |
5 | -trait ToArrayTrait |
|
6 | -{ |
|
5 | +trait ToArrayTrait { |
|
7 | 6 | public function toArray(array $options = []): array |
8 | 7 | { |
9 | 8 | $reflectionProperty = new ReflectionProperty(get_called_class(), $key); |
@@ -16,7 +16,7 @@ |
||
16 | 16 | ->getClassMetadata(); |
17 | 17 | |
18 | 18 | foreach ($this->getFillable() as $key) { |
19 | - $metaDataKey = $classMetadata->hasField($key) ? $classMetadata->getFieldMapping($key) : null; |
|
19 | + $metaDataKey = $classMetadata->hasField($key) ? $classMetadata->getFieldMapping($key) : NULL; |
|
20 | 20 | |
21 | 21 | if ($this->checkOnyExceptInArray($key, $options)) { |
22 | 22 | if (is_object($this->$key)) { |
@@ -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_contract_repository')) { |
7 | - function bind_contract_repository(string $repositoryInterface, string $repository, string $entity) |
|
7 | + function bind_contract_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 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | /** |
20 | 20 | * @param string $className |
21 | 21 | */ |
22 | - function bdEntityName(string $className) |
|
22 | + function bdEntityName (string $className) |
|
23 | 23 | { |
24 | 24 | return config('bludata.generator.rootNamespace').'Entities\\'.$className; |
25 | 25 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * @param string $className |
31 | 31 | */ |
32 | - function bdEntity(string $className) |
|
32 | + function bdEntity (string $className) |
|
33 | 33 | { |
34 | 34 | return app(bdEntityName($className)); |
35 | 35 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | /** |
40 | 40 | * @param string $className |
41 | 41 | */ |
42 | - function bdContractName(string $className) |
|
42 | + function bdContractName (string $className) |
|
43 | 43 | { |
44 | 44 | return config('bludata.generator.rootNamespace').'Contracts\Repositories\\'.$className.'RepositoryContract'; |
45 | 45 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | /** |
50 | 50 | * @param string $className |
51 | 51 | */ |
52 | - function bdRepositoryName(string $className) |
|
52 | + function bdRepositoryName (string $className) |
|
53 | 53 | { |
54 | 54 | return config('bludata.generator.rootNamespace').'Repositories\\'.$className.'Repository'; |
55 | 55 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | /** |
60 | 60 | * @param string $className |
61 | 61 | */ |
62 | - function bdRepository(string $className) |
|
62 | + function bdRepository (string $className) |
|
63 | 63 | { |
64 | 64 | return app(bdContractName($className)); |
65 | 65 | } |