Completed
Push — master ( caa057...6bc7cf )
by James Ekow Abaka
02:35
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/relationships/HasManyRelationship.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -42,10 +42,10 @@
 block discarded – undo
42 42
 
43 43
     public function runSetup()
44 44
     {
45
-        if($this->options['foreign_key'] == null) {
46
-            $this->options['foreign_key'] = Text::singularize($this->setupTable) . '_id';
45
+        if ($this->options['foreign_key'] == null) {
46
+            $this->options['foreign_key'] = Text::singularize($this->setupTable).'_id';
47 47
         }
48
-        if($this->options['local_key'] == null) {
48
+        if ($this->options['local_key'] == null) {
49 49
             $this->options['local_key'] = $this->setupPrimaryKey[0];
50 50
         }
51 51
     }
Please login to merge, or discard this patch.
src/validations/UniqueValidation.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -45,19 +45,19 @@  discard block
 block discarded – undo
45 45
     public function run($field, $data)
46 46
     {
47 47
         $test = [];
48
-        foreach($field['name'] as $name) {
48
+        foreach ($field['name'] as $name) {
49 49
             $test[$name] = isset($data[$name]) ? $data[$name] : null;
50 50
         }
51 51
         
52
-        if($this->mode == \ntentan\nibii\DataOperations::MODE_UPDATE) {
52
+        if ($this->mode == \ntentan\nibii\DataOperations::MODE_UPDATE) {
53 53
             $primaryKeyFields = $this->model->getDescription()->getPrimaryKey();
54 54
             $keys = [];
55
-            foreach($primaryKeyFields as $name) {
55
+            foreach ($primaryKeyFields as $name) {
56 56
                 $keys[$name] = $data[$name];
57 57
             }
58 58
             $testItem = $this->model->createNew()->fetchFirst($test);
59 59
             $intersection = array_intersect($testItem->toArray(), $keys);
60
-            if(!empty($intersection)) {
60
+            if (!empty($intersection)) {
61 61
                 return true;
62 62
             }                   
63 63
         } else {
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         return $this->evaluateResult(
68 68
             $field, 
69 69
             $testItem->count() === 0,
70
-            "The value of " . implode(', ', $field['name']) . " must be unique"
70
+            "The value of ".implode(', ', $field['name'])." must be unique"
71 71
         );        
72 72
     }
73 73
 }
Please login to merge, or discard this patch.
src/Resolver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         }
41 41
         $classes = [$classA['class'], $classB['class']];
42 42
         sort($classes);
43
-        return "{$classA['namespace']}\\" . implode('', $classes);
43
+        return "{$classA['namespace']}\\".implode('', $classes);
44 44
     }
45 45
 
46 46
     public function getTableName($instance) {
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     public static function getDriverAdapterClassName() {
53 53
         $driver = Config::get('ntentan:db.driver', false);
54 54
         if ($driver) {
55
-            return __NAMESPACE__ . '\adapters\\' . Text::ucamelize(Config::get('ntentan:db.driver')) . 'Adapter';
55
+            return __NAMESPACE__.'\adapters\\'.Text::ucamelize(Config::get('ntentan:db.driver')).'Adapter';
56 56
         }
57 57
         throw new NibiiException("Please specify a driver");
58 58
     }
Please login to merge, or discard this patch.
src/QueryEngine.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
         }
35 35
 
36 36
         return $this->filter(
37
-            "INSERT INTO " . $table .
38
-            " (" . implode(", ", $quotedFields) . ") VALUES (" . implode(', ', $valueFields) . ")"
37
+            "INSERT INTO ".$table.
38
+            " (".implode(", ", $quotedFields).") VALUES (".implode(', ', $valueFields).")"
39 39
         );
40 40
     }
41 41
 
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
             }
78 78
         }
79 79
 
80
-        return $this->filter("UPDATE " .
81
-            $model->getDBStoreInformation()['quoted_table'] .
82
-            " SET " . implode(', ', $valueFields) .
83
-            " WHERE " . implode(' AND ', $conditions)
80
+        return $this->filter("UPDATE ".
81
+            $model->getDBStoreInformation()['quoted_table'].
82
+            " SET ".implode(', ', $valueFields).
83
+            " WHERE ".implode(' AND ', $conditions)
84 84
         );
85 85
     }
86 86
 
Please login to merge, or discard this patch.
src/RecordWrapper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
     public function __construct(DriverAdapter $adapter) {
58 58
         $table = Nibii::getModelTable($this);
59 59
         $driver = Db::getDriver();
60
-        if(is_string($table)) {
60
+        if (is_string($table)) {
61 61
             $this->quotedTable = $driver->quoteIdentifier($table);
62 62
             $this->table = $this->unquotedTable = $table;
63 63
         } else {
64
-            $this->quotedTable = (isset($table['schema']) ? "{$driver->quoteIdentifier($table["schema"])}." : ""). $driver->quoteIdentifier($table["table"]);
65
-            $this->unquotedTable = (isset($table['schema']) ? "{$table['schema']}." : "") . $table['table'];
64
+            $this->quotedTable = (isset($table['schema']) ? "{$driver->quoteIdentifier($table["schema"])}." : "").$driver->quoteIdentifier($table["table"]);
65
+            $this->unquotedTable = (isset($table['schema']) ? "{$table['schema']}." : "").$table['table'];
66 66
             $this->table = $table['table'];
67 67
             $this->schema = $table['schema'];
68 68
         }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function getDescription() {
82 82
         return Cache::read(
83
-            (new \ReflectionClass($this))->getName() . '::desc', function() {
83
+            (new \ReflectionClass($this))->getName().'::desc', function() {
84 84
                 return new ModelDescription($this);
85 85
             }
86 86
         );
Please login to merge, or discard this patch.