Passed
Push — master ( 2a3444...165fe3 )
by Fran
06:57
created
src/base/types/traits/Api/ApiTrait.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -95,15 +95,15 @@  discard block
 block discarded – undo
95 95
      */
96 96
     protected function hydrateBulkRequest() {
97 97
         $class = new \ReflectionClass($this->getModelNamespace());
98
-        foreach($this->data as $item) {
99
-            if(is_array($item)) {
100
-                if(count($this->list) < Config::getParam('api.block.limit', 1000)) {
98
+        foreach ($this->data as $item) {
99
+            if (is_array($item)) {
100
+                if (count($this->list) < Config::getParam('api.block.limit', 1000)) {
101 101
                     /** @var ActiveRecordInterface $model */
102 102
                     $model = $class->newInstance();
103 103
                     $this->hydrateModelFromRequest($model, $item);
104 104
                     $this->list[] = $model;
105
-                } else {
106
-                    Logger::log(_('Max items per bulk insert raised'), LOG_WARNING, count($this->data) . _('items'));
105
+                }else {
106
+                    Logger::log(_('Max items per bulk insert raised'), LOG_WARNING, count($this->data)._('items'));
107 107
                 }
108 108
             }
109 109
         }
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
      */
115 115
     protected function saveBulk() {
116 116
         $tablemap = $this->getTableMap();
117
-        foreach($this->list as &$model) {
117
+        foreach ($this->list as &$model) {
118 118
             $con = Propel::getWriteConnection($tablemap::DATABASE_NAME);
119 119
             try {
120 120
                 $model->save($con);
121 121
                 $con->commit();
122
-            } catch(\Exception $e) {
122
+            }catch (\Exception $e) {
123 123
                 Logger::log($e->getMessage(), LOG_ERR, $model->toArray());
124 124
                 $con->rollBack();
125 125
             }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
     protected function exportList() {
133 133
         $list = [];
134 134
         /** @var ActiveRecordInterface $item */
135
-        foreach($this->list as $item) {
135
+        foreach ($this->list as $item) {
136 136
             $list[] = $item->toArray();
137 137
         }
138 138
         return $list;
@@ -156,16 +156,16 @@  discard block
 block discarded – undo
156 156
      */
157 157
     protected function findPk(ModelCriteria $query, $pk) {
158 158
         $pks = explode(Api::API_PK_SEPARATOR, urldecode($pk));
159
-        if(count($pks) == 1 && !empty($pks[0])) {
159
+        if (count($pks) == 1 && !empty($pks[0])) {
160 160
             $model = $query->findPk($pks[0], $this->con);
161
-        } else {
161
+        }else {
162 162
             $i = 0;
163
-            foreach($this->getPkDbName() as $key => $phpName) {
163
+            foreach ($this->getPkDbName() as $key => $phpName) {
164 164
                 try {
165 165
                     $query->filterBy($phpName, $pks[$i]);
166 166
                     $i++;
167
-                    if($i >= count($pks)) break;
168
-                } catch(\Exception $e) {
167
+                    if ($i >= count($pks)) break;
168
+                }catch (\Exception $e) {
169 169
                     Logger::log($e->getMessage(), LOG_DEBUG);
170 170
                 }
171 171
             }
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
         try {
196 196
             $query = $this->prepareQuery();
197 197
             $this->model = $this->findPk($query, $pk);
198
-        } catch (\Exception $e) {
199
-            Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR);
198
+        }catch (\Exception $e) {
199
+            Logger::log(get_class($this).': '.$e->getMessage(), LOG_ERR);
200 200
         }
201 201
     }
202 202
 
Please login to merge, or discard this patch.