Passed
Push — master ( 249ff3...d07642 )
by
unknown
02:16
created
src/NOSQL/Models/NOSQLQuery.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         $con = NOSQLParserTrait::initConnection($model, $con);
23 23
         $collection = $con->selectCollection($model->getSchema()->name);
24 24
         $result = $collection->findOne(['_id' => new ObjectId($pk)]);
25
-        if(null !== $result) {
25
+        if (null !== $result) {
26 26
             $model->feed($result->getArrayCopy());
27 27
         } else {
28 28
             throw new ApiException(t('Document not found'), 404);
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
         $filters = self::parseCriteria($criteria, $model);
49 49
         $resultSet->count = $collection->countDocuments($filters);
50 50
         $nosqlOptions = [
51
-            'limit' => (integer)(array_key_exists(Api::API_LIMIT_FIELD, $criteria) ? $criteria[Api::API_LIMIT_FIELD] : Config::getParam('pagination.limit', 50)),
51
+            'limit' => (integer) (array_key_exists(Api::API_LIMIT_FIELD, $criteria) ? $criteria[Api::API_LIMIT_FIELD] : Config::getParam('pagination.limit', 50)),
52 52
         ];
53 53
         $results = $collection->find($filters, $nosqlOptions);
54 54
         /** @var  $result */
55 55
         $items = $results->toArray();
56
-        foreach($items as $item) {
56
+        foreach ($items as $item) {
57 57
             $model->feed($item->getArrayCopy(), true);
58 58
             $resultSet->items[] = $model->getDtoCopy(true);
59 59
         }
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
                         break;
108 108
                 }
109 109
             } elseif (NOSQLBase::NOSQL_TYPE_INTEGER === $property->type) {
110
-                $filterValue = (integer)$filterValue;
110
+                $filterValue = (integer) $filterValue;
111 111
             } else {
112
-                $filterValue = (float)$filterValue;
112
+                $filterValue = (float) $filterValue;
113 113
             }
114 114
             $filterValue = [
115 115
                 '$eq' => $filterValue,
Please login to merge, or discard this patch.
src/NOSQL/Models/base/NOSQLModelTrait.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     public function __get($name)
25 25
     {
26 26
         $value = null;
27
-        if(null !== $this->dto && property_exists($this->dto, $name)) {
27
+        if (null !== $this->dto && property_exists($this->dto, $name)) {
28 28
             $value = $this->dto->$name;
29 29
         }
30 30
         return $value;
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      */
37 37
     public function __set($name, $value)
38 38
     {
39
-        if(null !== $this->dto && property_exists($this->dto, $name)) {
39
+        if (null !== $this->dto && property_exists($this->dto, $name)) {
40 40
             $this->dto->$name = $value;
41 41
             $this->addChanges($name);
42 42
         }
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 
46 46
     public function __call($name, $arguments)
47 47
     {
48
-        if(preg_match('/^(set|get)/', $name)) {
48
+        if (preg_match('/^(set|get)/', $name)) {
49 49
             $property = str_replace(['set', 'Set', 'get', 'Get'], '', $name);
50
-            if(false !== stripos($name, 'set')) {
50
+            if (false !== stripos($name, 'set')) {
51 51
                 $this->$property = $arguments[0];
52 52
             } else {
53 53
                 return $this->$property;
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
     public function feed(array $data, $withName = false) {
65 65
         $name = '';
66 66
         $sep = '';
67
-        foreach($data as $key => $value) {
68
-            if($value instanceof ObjectId) {
67
+        foreach ($data as $key => $value) {
68
+            if ($value instanceof ObjectId) {
69 69
                 $this->dto->setPk($value->jsonSerialize()['$oid']);
70
-            } elseif($key === '_last_update') {
70
+            } elseif ($key === '_last_update') {
71 71
                 $this->dto->setLastUpdate($value instanceof UTCDateTime ? $value : null);
72 72
             } else {
73 73
                 if (is_object($value)) {
@@ -78,13 +78,13 @@  discard block
 block discarded – undo
78 78
                     }
79 79
                 }
80 80
                 $this->$key = $value;
81
-                if(in_array(strtolower($key), ['name', 'label', 'title', 'method'])) {
81
+                if (in_array(strtolower($key), ['name', 'label', 'title', 'method'])) {
82 82
                     $name .= $sep . $value;
83 83
                     $sep = ' ';
84 84
                 }
85 85
             }
86 86
         }
87
-        if($withName) {
87
+        if ($withName) {
88 88
             $this->dto->setName($name);
89 89
         }
90 90
     }
Please login to merge, or discard this patch.