Passed
Push — master ( 5479d0...e244ce )
by Fran
05:48
created
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 = lcfirst(str_replace(['set', 'Set', 'get', 'Get'], '', $name));
50
-            if(false !== stripos($name, 'set')) {
50
+            if (false !== stripos($name, 'set')) {
51 51
                 $this->dto->$property = $arguments[0];
52 52
             } else {
53 53
                 return $this->dto->$property;
@@ -64,11 +64,11 @@  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 70
                 $name = $this->dto->getPk();
71
-            } elseif($key === '_last_update') {
71
+            } elseif ($key === '_last_update') {
72 72
                 $this->dto->setLastUpdate($value instanceof UTCDateTime ? $value : null);
73 73
             } else {
74 74
                 if (is_object($value)) {
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
                     }
80 80
                 }
81 81
                 $this->$key = $value;
82
-                if(in_array(strtolower($key), ['name', 'label', 'title', 'method'])) {
82
+                if (in_array(strtolower($key), ['name', 'label', 'title', 'method'])) {
83 83
                     $name .= $sep . $value;
84 84
                     $sep = ' ';
85 85
                 }
86 86
             }
87 87
         }
88
-        if($withName) {
88
+        if ($withName) {
89 89
             $this->dto->setName($name);
90 90
         }
91 91
     }
Please login to merge, or discard this patch.
src/NOSQL/Services/ParserService.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
         $dns .= '@' . Config::getParam('nosql.host', 'localhost', $lowerDomain);
29 29
 
30 30
         $database = Config::getParam('nosql.database', 'nosql', $lowerDomain);
31
-        if(null !== Config::getParam('nosql.replicaset')) {
31
+        if (null !== Config::getParam('nosql.replicaset')) {
32 32
             $dns .= '/' . $database . '?ssl=true&replicaSet=' . Config::getParam('nosql.replicaset', null, $lowerDomain);
33 33
             $dns .= '&authSource=admin&serverSelectionTryOnce=false&serverSelectionTimeoutMS=15000';
34 34
         } else {
35
-            if(strtolower($protocol) !== 'mongodb+srv') {
35
+            if (strtolower($protocol) !== 'mongodb+srv') {
36 36
                 $dns .= ':' . Config::getParam('nosql.port', '27017', $lowerDomain);
37 37
             }
38 38
             $dns .= '/' . $database . "?authSource=admin";
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function checkAndSave($domain, $collection, NOSQLModelDto $dto) {
54 54
         $errors = $dto->validate();
55
-        if(empty($errors)) {
55
+        if (empty($errors)) {
56 56
 
57 57
         } else {
58 58
             throw new ApiException(t('Dto not valid'), 400);
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     public function hydrateModelFromRequest(array $data, $className) {
70 70
         $model = null;
71 71
         $reflectionClass = new \ReflectionClass($className);
72
-        if($reflectionClass->isSubclassOf(NOSQLBase::class)) {
72
+        if ($reflectionClass->isSubclassOf(NOSQLBase::class)) {
73 73
             /** @var NOSQLActiveRecord $modelName */
74 74
             $modelName = $className::MODEL_CLASS;
75 75
             $model = $modelName::fromArray($data);
Please login to merge, or discard this patch.