@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | $this->spaces[$id] = new Space($this->mapper, $id, $space); |
| 30 | 30 | |
| 31 | - if($properties) { |
|
| 31 | + if ($properties) { |
|
| 32 | 32 | $this->spaces[$id]->addProperties($properties); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | public function formatValue($type, $value) |
| 39 | 39 | { |
| 40 | - switch($type) { |
|
| 40 | + switch ($type) { |
|
| 41 | 41 | case 'str': return (string) $value; |
| 42 | 42 | case 'unsigned': return (int) $value; |
| 43 | 43 | default: return $value; |
@@ -46,15 +46,15 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | public function getSpace($id) |
| 48 | 48 | { |
| 49 | - if(is_string($id)) { |
|
| 49 | + if (is_string($id)) { |
|
| 50 | 50 | return $this->getSpace($this->getSpaceId($id)); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - if(!$id) { |
|
| 53 | + if (!$id) { |
|
| 54 | 54 | throw new Exception("Space id or name not defined"); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - if(!array_key_exists($id, $this->spaces)) { |
|
| 57 | + if (!array_key_exists($id, $this->spaces)) { |
|
| 58 | 58 | $this->spaces[$id] = new Space($this->mapper, $id, array_search($id, $this->names)); |
| 59 | 59 | } |
| 60 | 60 | return $this->spaces[$id]; |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | public function getSpaceId($name) |
| 64 | 64 | { |
| 65 | - if(!$this->hasSpace($name)) { |
|
| 65 | + if (!$this->hasSpace($name)) { |
|
| 66 | 66 | throw new Exception("No space $id"); |
| 67 | 67 | } |
| 68 | 68 | return $this->names[$name]; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | public function getSpaces() |
| 72 | 72 | { |
| 73 | - foreach($this->names as $id) { |
|
| 73 | + foreach ($this->names as $id) { |
|
| 74 | 74 | $this->getSpace($id); |
| 75 | 75 | } |
| 76 | 76 | return $this->spaces; |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | public function once($name, $callback) |
| 85 | 85 | { |
| 86 | - $key = 'once' . $name; |
|
| 86 | + $key = 'once'.$name; |
|
| 87 | 87 | |
| 88 | 88 | $rows = $this->mapper->find('_schema', ['key' => $key]); |
| 89 | - if(!count($rows)) { |
|
| 89 | + if (!count($rows)) { |
|
| 90 | 90 | $this->mapper->create('_schema', ['key' => $key]); |
| 91 | 91 | return $callback($this->mapper); |
| 92 | 92 | } |