Passed
Push — master ( caa7b5...0cbc1d )
by Fran
02:26
created
src/base/types/traits/Api/Crud/ApiListTrait.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     protected function hydrateOrders()
38 38
     {
39 39
         if (count($this->query)) {
40
-            Logger::log(static::class . ' gathering query string', LOG_DEBUG);
40
+            Logger::log(static::class.' gathering query string', LOG_DEBUG);
41 41
             foreach ($this->query as $key => $value) {
42 42
                 if ($key === self::API_ORDER_FIELD) {
43 43
                     $orders = json_decode($value, true);
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
      */
56 56
     protected function extractPagination()
57 57
     {
58
-        Logger::log(static::class . ' extract pagination start', LOG_DEBUG);
58
+        Logger::log(static::class.' extract pagination start', LOG_DEBUG);
59 59
         $page = array_key_exists(self::API_PAGE_FIELD, $this->query) ? $this->query[self::API_PAGE_FIELD] : 1;
60 60
         $limit = array_key_exists(self::API_LIMIT_FIELD, $this->query) ? $this->query[self::API_LIMIT_FIELD] : 100;
61
-        Logger::log(static::class . ' extract pagination end', LOG_DEBUG);
61
+        Logger::log(static::class.' extract pagination end', LOG_DEBUG);
62 62
         return array($page, (int)$limit);
63 63
     }
64 64
 
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
      * @param ModelCriteria $query
68 68
      * @throws \PSFS\base\exception\ApiException
69 69
      */
70
-    protected function addOrders(ModelCriteria &$query)
70
+    protected function addOrders(ModelCriteria & $query)
71 71
     {
72
-        Logger::log(static::class . ' extract orders start ', LOG_DEBUG);
72
+        Logger::log(static::class.' extract orders start ', LOG_DEBUG);
73 73
         $orderAdded = FALSE;
74 74
         $tableMap = $this->getTableMap();
75 75
         foreach ($this->order->getOrders() as $field => $direction) {
@@ -77,18 +77,18 @@  discard block
 block discarded – undo
77 77
                 $orderAdded = TRUE;
78 78
                 if ($direction === Order::ASC) {
79 79
                     $query->addAscendingOrderByColumn($column->getPhpName());
80
-                } else {
80
+                }else {
81 81
                     $query->addDescendingOrderByColumn($column->getPhpName());
82 82
                 }
83 83
             }
84 84
         }
85 85
         if (!$orderAdded) {
86 86
             $pks = $this->getPkDbName();
87
-            foreach(array_keys($pks) as $key) {
87
+            foreach (array_keys($pks) as $key) {
88 88
                 $query->addAscendingOrderByColumn($key);
89 89
             }
90 90
         }
91
-        Logger::log(static::class . ' extract orders end', LOG_DEBUG);
91
+        Logger::log(static::class.' extract orders end', LOG_DEBUG);
92 92
     }
93 93
 
94 94
     /**
@@ -96,14 +96,14 @@  discard block
 block discarded – undo
96 96
      *
97 97
      * @param ModelCriteria $query
98 98
      */
99
-    protected function addFilters(ModelCriteria &$query)
99
+    protected function addFilters(ModelCriteria & $query)
100 100
     {
101 101
         if (count($this->query) > 0) {
102 102
             $tableMap = $this->getTableMap();
103 103
             foreach ($this->query as $field => $value) {
104 104
                 if (self::API_COMBO_FIELD === $field) {
105 105
                     ApiHelper::composerComboField($tableMap, $query, $this->extraColumns, $value);
106
-                } elseif(!preg_match('/^__/', $field)) {
106
+                } elseif (!preg_match('/^__/', $field)) {
107 107
                     ApiHelper::addModelField($tableMap, $query, $field, $value);
108 108
                 }
109 109
             }
@@ -123,11 +123,11 @@  discard block
 block discarded – undo
123 123
             list($page, $limit) = $this->extractPagination();
124 124
             if ($limit === -1) {
125 125
                 $this->list = $query->find($this->con);
126
-            } else {
126
+            }else {
127 127
                 $this->list = $query->paginate($page, $limit, $this->con);
128 128
             }
129 129
             $this->checkReturnFields($this->list->getQuery());
130
-        } catch (\Exception $e) {
130
+        }catch (\Exception $e) {
131 131
             Logger::log($e->getMessage(), LOG_ERR);
132 132
         }
133 133
     }
Please login to merge, or discard this patch.