Completed
Push — master ( 2228a4...a3bdbb )
by James Ekow Abaka
22:30
created
src/ModelValidator.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,17 +15,17 @@  discard block
 block discarded – undo
15 15
         $this->model = $model;
16 16
         $description = $model->getDescription();
17 17
 
18
-        if($description->getAutoPrimaryKey()) {
18
+        if ($description->getAutoPrimaryKey()) {
19 19
             $pk = $description->getPrimaryKey()[0];
20 20
         }
21 21
 
22 22
         $fields = $description->getFields();
23
-        foreach($fields as $field) {
23
+        foreach ($fields as $field) {
24 24
             $this->getFieldRules($rules, $field, $pk);
25 25
         }
26 26
         
27 27
         $unique = $description->getUniqueKeys();
28
-        foreach($unique as $constraints) {
28
+        foreach ($unique as $constraints) {
29 29
             $rules['unique'][] = [$constraints['fields']];
30 30
         }
31 31
         
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
 
40 40
     private function getFieldRules(&$rules, $field, $pk)
41 41
     {
42
-        if($field['required'] && $field['name'] != $pk && $field['default'] === null) {
42
+        if ($field['required'] && $field['name'] != $pk && $field['default'] === null) {
43 43
             $rules['required'][] = $field['name'];
44 44
         }
45
-        if($field['type'] === 'integer' || $field['type'] === 'double') {
45
+        if ($field['type'] === 'integer' || $field['type'] === 'double') {
46 46
             $rules['numeric'][] = $field['name'];
47 47
         }
48 48
     }
Please login to merge, or discard this patch.
src/adapters/MysqlAdapter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 {
6 6
     public function mapDataTypes($nativeType)
7 7
     {
8
-        switch($nativeType)
8
+        switch ($nativeType)
9 9
         {
10 10
             case 'int':
11 11
                 return 'integer';
Please login to merge, or discard this patch.
src/adapters/PostgresqlAdapter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
      */
13 13
     public function mapDataTypes($nativeType) 
14 14
     {
15
-        switch($nativeType)
15
+        switch ($nativeType)
16 16
         {
17 17
             case 'character varying':
18 18
                 return 'string';
Please login to merge, or discard this patch.
src/behaviours/TimestampableBehaviour.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     
17 17
     public function preSaveCallback($data)
18 18
     {
19
-        if(isset($this->model->getDescription()->getFields()['created']))
19
+        if (isset($this->model->getDescription()->getFields()['created']))
20 20
         {
21 21
             $data['created'] = date('Y-m-d H:i:s');
22 22
         }
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     
26 26
     public function preUpdateCallback($data)
27 27
     {
28
-        if(isset($this->model->getDescription()->getFields()['updated']))
28
+        if (isset($this->model->getDescription()->getFields()['updated']))
29 29
         {
30 30
             $data['updated'] = date('Y-m-d H:i:s');
31 31
         }
Please login to merge, or discard this patch.
src/ORMContext.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
     }
68 68
     
69 69
     public static function getInstance() {
70
-        if(self::$instance === null) throw new NibiiException("A context has not yet been initialized");
70
+        if (self::$instance === null) throw new NibiiException("A context has not yet been initialized");
71 71
         return self::$instance;
72 72
     }
73 73
     
Please login to merge, or discard this patch.
src/ModelDescription.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@
 block discarded – undo
87 87
             return null;
88 88
         }
89 89
         $relationshipDetails['local_table'] = $this->table;
90
-        if(isset($relationship['through'])) {
90
+        if (isset($relationship['through'])) {
91 91
             $relationshipDetails['through'] = $relationship['through'];
92 92
         }
93 93
         return $relationshipDetails;
Please login to merge, or discard this patch.
src/Relationship.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
     }
61 61
     
62 62
     public function getQuery() {
63
-        if(!$this->query) {
63
+        if (!$this->query) {
64 64
             $this->query = new QueryParameters();
65 65
         }
66 66
         return $this->query;
Please login to merge, or discard this patch.
src/QueryParameters.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
     }
68 68
 
69 69
     public function getWhereClause() {
70
-        if($this->whereClause) {
71
-            foreach($this->boundArrays as $boundArray) {
70
+        if ($this->whereClause) {
71
+            foreach ($this->boundArrays as $boundArray) {
72 72
                 $where = "";
73 73
                 $comma = "";
74
-                for($i = 0; $i < count($this->boundData[$boundArray]); $i++) {
74
+                for ($i = 0; $i < count($this->boundData[$boundArray]); $i++) {
75 75
                     $where .= "{$comma}:{$boundArray}_{$i}";
76 76
                     $comma = ', ';
77 77
                 }
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
     }
83 83
 
84 84
     public function getBoundData() {
85
-        if($this->preparedBoundData === false) {
85
+        if ($this->preparedBoundData === false) {
86 86
             $this->preparedBoundData = [];
87
-            foreach($this->boundData as $key => $value) {
88
-                if(in_array($key, $this->boundArrays)) {
89
-                    foreach($value as $i => $v) {
87
+            foreach ($this->boundData as $key => $value) {
88
+                if (in_array($key, $this->boundArrays)) {
89
+                    foreach ($value as $i => $v) {
90 90
                         $this->preparedBoundData["{$key}_{$i}"] = $v;
91 91
                     }
92 92
                 } else {
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
     }
99 99
 
100 100
     public function setBoundData($key, $value) {
101
-        if(isset($this->boundData[$key])){
101
+        if (isset($this->boundData[$key])) {
102 102
             $isArray = is_array($value);
103 103
             $boundArray = in_array($key, $this->boundArrays);
104
-            if($isArray && !$boundArray) {
104
+            if ($isArray && !$boundArray) {
105 105
                 throw new NibiiException("{$key} cannot be bound to an array");
106 106
             } else if (!$isArray && $boundArray) {
107 107
                 throw new NibiiException("{$key} must be bound to an array");
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     }
115 115
 
116 116
     public function getSorts() {
117
-        return count($this->sorts) ? " ORDER BY " . implode(", ", $this->sorts) : null;
117
+        return count($this->sorts) ? " ORDER BY ".implode(", ", $this->sorts) : null;
118 118
     }
119 119
 
120 120
     public function addFilter($field, $values = null) {
Please login to merge, or discard this patch.
src/relationships/BelongsToRelationship.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
     public function prepareQuery($data) {
42 42
         // @todo throw an exception when the data doesn't have the local key
43 43
         $query = $this->getQuery();
44
-        if($this->queryPrepared){
44
+        if ($this->queryPrepared) {
45 45
             $query->setBoundData($this->options['foreign_key'], $data[$this->options['local_key']]);
46 46
         } else {
47 47
             $query->setTable($this->getModelInstance()->getDBStoreInformation()['quoted_table'])
Please login to merge, or discard this patch.