@@ -58,7 +58,7 @@ |
||
58 | 58 | |
59 | 59 | private function convertDates($value) { |
60 | 60 | if ($value instanceof \DateTime) { |
61 | - if ($value->format('H:i:s') == '00:00:00') $value = $value->format('Y-m-d'); |
|
61 | + if ($value->format('H:i:s') == '00:00:00') $value = $value->format('Y-m-d'); |
|
62 | 62 | else $value = $value->format('Y-m-d H:i:s'); |
63 | 63 | } |
64 | 64 | return $value; |
@@ -7,17 +7,17 @@ discard block |
||
7 | 7 | |
8 | 8 | public function __construct($object) { |
9 | 9 | if ($object instanceof \stdclass) { |
10 | - $this->readClosure = function() use ($object) { return $object; }; |
|
11 | - $this->writeClosure = function ($field, $value) use ($object) { $object->$field = $value; }; |
|
10 | + $this->readClosure = function() use ($object) { return $object; }; |
|
11 | + $this->writeClosure = function($field, $value) use ($object) { $object->$field = $value; }; |
|
12 | 12 | } |
13 | 13 | else { |
14 | 14 | $visOverride = $this; |
15 | 15 | $this->readClosure = function() use ($visOverride) { |
16 | - return (object) array_filter(get_object_vars($this), [$visOverride, 'isReturnableDataType']); |
|
16 | + return (object)array_filter(get_object_vars($this), [$visOverride, 'isReturnableDataType']); |
|
17 | 17 | }; |
18 | 18 | $this->readClosure = $this->readClosure->bindTo($object, $object); |
19 | 19 | |
20 | - $this->writeClosure = function ($field, $value) { $this->$field = $value; }; |
|
20 | + $this->writeClosure = function($field, $value) { $this->$field = $value; }; |
|
21 | 21 | $this->writeClosure = $this->writeClosure->bindTo($object, $object); |
22 | 22 | } |
23 | 23 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | public function write($data) { |
35 | 35 | if ($data != null) { |
36 | 36 | foreach ($data as $key => $value) { |
37 | - ($this->writeClosure)($key, $this->processDates($value)); |
|
37 | + ($this->writeClosure)($key, $this->processDates($value)); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | } |
27 | 27 | |
28 | 28 | private function addRelationData($object, $name, $relation, $siblings) { |
29 | - if (isset($object->$name) && !($object->$name instanceof \Maphper\Relation) ) { |
|
29 | + if (isset($object->$name) && !($object->$name instanceof \Maphper\Relation)) { |
|
30 | 30 | //After overwriting the relation, does the parent object ($object) need overwriting as well? |
31 | 31 | if ($relation->overwrite($object, $object->$name)) $this->parent[] = $object; |
32 | 32 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | private function tableExists($name) { |
47 | - $result = $this->pdo->query('SELECT name FROM sqlite_master WHERE type="table" and name="'. $name.'"'); |
|
47 | + $result = $this->pdo->query('SELECT name FROM sqlite_master WHERE type="table" and name="' . $name . '"'); |
|
48 | 48 | return count($result->fetchAll()) == 1; |
49 | 49 | } |
50 | 50 | |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | $this->stmtCache->clearCache(); |
65 | 65 | |
66 | 66 | // Create temp table to create a new structure |
67 | - $affix = '_'.substr(md5($table), 0, 6); |
|
67 | + $affix = '_' . substr(md5($table), 0, 6); |
|
68 | 68 | $tempTable = $table . $affix; |
69 | 69 | $this->createTable($tempTable, $primaryKey, $data); |
70 | 70 | $this->alterColumns($tempTable, $primaryKey, $data); |
71 | 71 | $this->copyTableData($table, $tempTable); |
72 | 72 | |
73 | - $this->pdo->query('DROP TABLE IF EXISTS ' . $table ); |
|
74 | - $this->pdo->query('ALTER TABLE ' . $tempTable . ' RENAME TO '. $table ); |
|
73 | + $this->pdo->query('DROP TABLE IF EXISTS ' . $table); |
|
74 | + $this->pdo->query('ALTER TABLE ' . $tempTable . ' RENAME TO ' . $table); |
|
75 | 75 | |
76 | 76 | } |
77 | 77 |