Completed
Pull Request — master (#37)
by Raí
06:17
created
Bludata/Doctrine/Common/Contracts/RepositoryContract.php 1 patch
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,13 +15,13 @@
 block discarded – undo
15 15
 
16 16
     public function findAll(): QueryWorkerContract;
17 17
 
18
-    public function findOneBy(array $criteria, bool $abort = true): ?EntityContract;
18
+    public function findOneBy(array $criteria, bool $abort = TRUE): ?EntityContract;
19 19
 
20
-    public function find($id, bool $abort = true): ?EntityContract;
20
+    public function find($id, bool $abort = TRUE): ?EntityContract;
21 21
 
22 22
     public function findAllRemoved(): QueryWorkerContract;
23 23
 
24
-    public function findRemoved($id, bool $abort = true): ?EntityContract;
24
+    public function findRemoved($id, bool $abort = TRUE): ?EntityContract;
25 25
 
26 26
     public function createEntity(): EntityContract;
27 27
 
Please login to merge, or discard this patch.
Bludata/Doctrine/ORM/Repositories/QueryWorker.php 1 patch
Upper-Lower-Casing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      *
65 65
      * @return QueryWorker
66 66
      */
67
-    public function withFilters(array $filters = null)
67
+    public function withFilters(array $filters = NULL)
68 68
     {
69 69
         if ($filters) {
70 70
             foreach ($filters as $filter) {
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      *
138 138
      * @return $this
139 139
      */
140
-    public function andWhere($field, $operation, $value = null, $alias = self::DEFAULT_TABLE_ALIAS)
140
+    public function andWhere($field, $operation, $value = NULL, $alias = self::DEFAULT_TABLE_ALIAS)
141 141
     {
142 142
         if (strpos($field, '.') > 0) {
143 143
             //monta os joins
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
      *
164 164
      * @return $this
165 165
      */
166
-    public function orWhere($field, $operation, $value = null, $alias = self::DEFAULT_TABLE_ALIAS)
166
+    public function orWhere($field, $operation, $value = NULL, $alias = self::DEFAULT_TABLE_ALIAS)
167 167
     {
168 168
         if (strpos($field, '.') > 0) {
169 169
             //monta os joins
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
      *
240 240
      * @return $this
241 241
      */
242
-    public function andHaving($field, $operation, $value = null)
242
+    public function andHaving($field, $operation, $value = NULL)
243 243
     {
244 244
         throw new \Exception('Not implemented');
245 245
     }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      *
250 250
      * @param string $field
251 251
      */
252
-    public function orHaving($field, $operation, $value = null)
252
+    public function orHaving($field, $operation, $value = NULL)
253 253
     {
254 254
         throw new \Exception('Not implemented');
255 255
     }
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
      * @param string $parentAlias
498 498
      * @param bool   $withWhere
499 499
      */
500
-    private function setLeftJoin($table, $field, $parentField, $alias, $parentAlias, $withWhere = false)
500
+    private function setLeftJoin($table, $field, $parentField, $alias, $parentAlias, $withWhere = FALSE)
501 501
     {
502 502
         if (!in_array($alias, $this->tables)) {
503 503
             $condition = $this->getFullFieldName($field, $alias).' = '.$this->getFullFieldName($parentField, $parentAlias);
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
     private function setManyToManyValuedCondition($association, $alias, $arr)
522 522
     {
523 523
         if (empty($this->fieldValue['value']) || $this->position < count($arr) - 2) {
524
-            return null;
524
+            return NULL;
525 525
         }
526 526
         $targetField = $this->position == count($arr) - 1 ? $association['joinTable']['joinColumns'][0]['referencedColumnName'] : end($arr);
527 527
 
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
      * @param string $alias
536 536
      * @param mix    $condition
537 537
      */
538
-    private function setManyToManyJoin($table, $alias, $condition = null)
538
+    private function setManyToManyJoin($table, $alias, $condition = NULL)
539 539
     {
540 540
         if (!in_array($alias, $this->tables)) {
541 541
             if ($condition) {
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
             foreach ($parentMeta->parentClasses as $classe) {
610 610
                 $associationsByTargetClass = $meta->getAssociationsByTargetClass($classe);
611 611
                 if (count($associationsByTargetClass) > 0) {
612
-                    $parentTable = lcfirst(substr($classe, strrpos($classe, strpos($classe, '\\') !== false ? '\\' : '/') + 1));
612
+                    $parentTable = lcfirst(substr($classe, strrpos($classe, strpos($classe, '\\') !== FALSE ? '\\' : '/') + 1));
613 613
                     $field = $this->searchAssociationField($associationsByTargetClass, $parentTable, $value);
614 614
                     if ($field) {
615 615
                         return $field;
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
     {
654 654
         $validExpressions = ['SUM', 'MIN', 'MAX', 'AVG', 'COUNT'];
655 655
         if (in_array(trim(strtoupper($expression)), $validExpressions)) {
656
-            if (strpos($field, '.') === false) {
656
+            if (strpos($field, '.') === FALSE) {
657 657
                 $field = getFullFieldName($field, $fieldAlias);
658 658
             }
659 659
             $this->queryFields[] = sprintf('%s(%s) AS %s', $expression, $field, $alias);
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
      * @param null   $value
678 678
      * @param string $alias
679 679
      */
680
-    protected function makeExpression($field, $operation, $value = null, $alias = self::DEFAULT_TABLE_ALIAS)
680
+    protected function makeExpression($field, $operation, $value = NULL, $alias = self::DEFAULT_TABLE_ALIAS)
681 681
     {
682 682
         $originalValue = $value;
683 683
 
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
         if ($field) {
688 688
             $field = $this->getFullFieldName($field, $alias);
689 689
         }
690
-        $expression = null;
690
+        $expression = NULL;
691 691
         switch (strtolower($operation)) {
692 692
             case '>':
693 693
                 $expression = $this->queryBuilder->expr()->gt($field, $value);
Please login to merge, or discard this patch.
Bludata/Doctrine/ORM/Repositories/BaseRepository.php 1 patch
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         return $this->createQueryWorker();
32 32
     }
33 33
 
34
-    public function findOneBy(array $criteria, bool $abort = true): ?EntityContract
34
+    public function findOneBy(array $criteria, bool $abort = TRUE): ?EntityContract
35 35
     {
36 36
         $findAll = $this->findAll();
37 37
 
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
             abort(404, 'Registro não encontrado');
50 50
         }
51 51
 
52
-        return null;
52
+        return NULL;
53 53
     }
54 54
 
55
-    public function find($id, bool $abort = true): ?EntityContract
55
+    public function find($id, bool $abort = TRUE): ?EntityContract
56 56
     {
57 57
         return $this->findOneBy(['id' => $id], $abort);
58 58
     }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
                     ->andWhere('deletedAt', 'isnotnull');
66 66
     }
67 67
 
68
-    public function findRemoved($id, bool $abort = true): ?EntityContract
68
+    public function findRemoved($id, bool $abort = TRUE): ?EntityContract
69 69
     {
70 70
         $entity = $this->findAllRemoved()
71 71
                        ->andWhere('id', '=', $id)
Please login to merge, or discard this patch.
Bludata/Doctrine/ORM/Traits/ToArrayTrait.php 1 patch
Upper-Lower-Casing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,18 +14,18 @@  discard block
 block discarded – undo
14 14
     private function isOnly(ReflectionProperty $property, array $optionsToArray): bool
15 15
     {
16 16
         if (!isset($optionsToArray['only']) && !isset($optionsToArray['except'])) {
17
-            return true;
17
+            return TRUE;
18 18
         }
19 19
 
20 20
         if (isset($optionsToArray['only'])) {
21 21
             if (in_array($property->getName(), $optionsToArray['only'])) {
22
-                return true;
22
+                return TRUE;
23 23
             }
24 24
         } else if (isset($optionsToArray['except']) && !in_array($property->getName(), $optionsToArray['except'])) {
25
-            return true;
25
+            return TRUE;
26 26
         }
27 27
 
28
-        return false;
28
+        return FALSE;
29 29
     }
30 30
 
31 31
     private function getPropertiesFillable(): array
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         foreach ($propertiesFillable as $property) {
57 57
             if ($this->isOnly($property, $options)) {
58 58
                 $key         = $property->getName();
59
-                $metaDataKey = $classMetadata->hasField($key) ? $classMetadata->getFieldMapping($key) : null;
59
+                $metaDataKey = $classMetadata->hasField($key) ? $classMetadata->getFieldMapping($key) : NULL;
60 60
 
61 61
                 if (is_object($this->$key)) {
62 62
                     if ($this->$key instanceof DateTime) {
Please login to merge, or discard this patch.
Bludata/Doctrine/ORM/Entities/BaseEntity.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@
 block discarded – undo
150 150
 
151 151
     public function undelete(): BdContracts\EntityContract
152 152
     {
153
-        $this->deletedAt = null;
153
+        $this->deletedAt = NULL;
154 154
 
155 155
         $this->persist();
156 156
 
Please login to merge, or discard this patch.