@@ -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 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | private function tableExists($name) { |
43 | - $result = $this->pdo->query('SELECT name FROM sqlite_master WHERE type="table" and name="'. $name.'"'); |
|
43 | + $result = $this->pdo->query('SELECT name FROM sqlite_master WHERE type="table" and name="' . $name . '"'); |
|
44 | 44 | return count($result->fetchAll()) == 1; |
45 | 45 | } |
46 | 46 | |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | $this->stmtCache->clearCache(); |
61 | 61 | |
62 | 62 | // Create temp table to create a new structure |
63 | - $affix = '_'.substr(md5($table), 0, 6); |
|
63 | + $affix = '_' . substr(md5($table), 0, 6); |
|
64 | 64 | $tempTable = $table . $affix; |
65 | 65 | $this->generalEditor->createTable($tempTable, $primaryKey, $data); |
66 | 66 | $this->alterColumns($tempTable, $primaryKey, $data); |
67 | 67 | $this->copyTableData($table, $tempTable); |
68 | 68 | |
69 | - $this->pdo->query('DROP TABLE IF EXISTS ' . $table ); |
|
70 | - $this->pdo->query('ALTER TABLE ' . $tempTable . ' RENAME TO '. $table ); |
|
69 | + $this->pdo->query('DROP TABLE IF EXISTS ' . $table); |
|
70 | + $this->pdo->query('ALTER TABLE ' . $tempTable . ' RENAME TO ' . $table); |
|
71 | 71 | |
72 | 72 | } |
73 | 73 |