@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace Darya\ORM\Relation; |
3 | 3 | |
4 | -use Exception; |
|
5 | 4 | use Darya\ORM\Record; |
6 | 5 | use Darya\ORM\Relation; |
7 | 6 |
@@ -115,7 +115,7 @@ |
||
115 | 115 | * |
116 | 116 | * Returns true if the model was successfully dissociated. |
117 | 117 | * |
118 | - * @return int |
|
118 | + * @return boolean |
|
119 | 119 | */ |
120 | 120 | public function dissociate() { |
121 | 121 | $associated = $this->retrieve(); |
@@ -193,7 +193,7 @@ |
||
193 | 193 | |
194 | 194 | $container = $this; |
195 | 195 | |
196 | - return function () use ($callable, $container) { |
|
196 | + return function() use ($callable, $container) { |
|
197 | 197 | static $instance; |
198 | 198 | |
199 | 199 | if ($instance === null) { |
@@ -171,7 +171,7 @@ |
||
171 | 171 | $this->data[$resource] = $this->filterer->map( |
172 | 172 | $this->data[$resource], |
173 | 173 | $filter, |
174 | - function ($row) use ($data, &$affected) { |
|
174 | + function($row) use ($data, &$affected) { |
|
175 | 175 | foreach ($data as $key => $value) { |
176 | 176 | $row[$key] = $value; |
177 | 177 | } |
@@ -284,7 +284,7 @@ |
||
284 | 284 | * @param array|string $order [optional] |
285 | 285 | * @param int $limit [optional] |
286 | 286 | * @param int $offset [optional] |
287 | - * @return array |
|
287 | + * @return string |
|
288 | 288 | */ |
289 | 289 | public static function all($filter = array(), $order = array(), $limit = null, $offset = 0) { |
290 | 290 | return static::generate(static::load($filter, $order, $limit, $offset)); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function get($attribute) |
90 | 90 | { |
91 | - list($attribute, $subattribute) = array_pad(explode('.', $attribute, 2), 2, null); |
|
91 | + list($attribute, $subattribute) = array_pad(explode('.', $attribute, 2), 2, null); |
|
92 | 92 | |
93 | 93 | if ($this->hasRelation($attribute)) { |
94 | 94 | $related = $this->related($attribute); |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | $split = explode('\\', get_class($this)); |
139 | 139 | $class = end($split); |
140 | 140 | |
141 | - return preg_replace_callback('/([A-Z])/', function ($matches) { |
|
142 | - return '_' . strtolower($matches[1]); |
|
143 | - }, lcfirst($class)) . 's'; |
|
141 | + return preg_replace_callback('/([A-Z])/', function($matches) { |
|
142 | + return '_'.strtolower($matches[1]); |
|
143 | + }, lcfirst($class)).'s'; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $storage = $instance->storage(); |
380 | 380 | |
381 | 381 | if (!$storage instanceof Searchable) { |
382 | - throw new Exception(get_class($instance) . ' storage is not searchable'); |
|
382 | + throw new Exception(get_class($instance).' storage is not searchable'); |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | $attributes = $attributes ?: $instance->defaultSearchAttributes(); |
@@ -443,13 +443,13 @@ discard block |
||
443 | 443 | $storage = $instance->storage(); |
444 | 444 | |
445 | 445 | if (!$storage instanceof Queryable) { |
446 | - throw new Exception(get_class($instance) . ' storage is not queryable'); |
|
446 | + throw new Exception(get_class($instance).' storage is not queryable'); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | $query = new Query($instance->table()); |
450 | 450 | $builder = new Builder($query, $storage); |
451 | 451 | |
452 | - $builder->callback(function ($result) use ($instance) { |
|
452 | + $builder->callback(function($result) use ($instance) { |
|
453 | 453 | return $instance::hydrate($result->data); |
454 | 454 | }); |
455 | 455 | |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | $class = get_class($this); |
472 | 472 | |
473 | 473 | if (!$storage instanceof Modifiable) { |
474 | - throw new Exception($class . ' storage is not modifiable'); |
|
474 | + throw new Exception($class.' storage is not modifiable'); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | $data = $this->prepareData(); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | /** |
216 | 216 | * Execute the given storage query. |
217 | 217 | * |
218 | - * @param Query $storageQuery |
|
218 | + * @param StorageQuery $storageQuery |
|
219 | 219 | * @return DatabaseStorageResult |
220 | 220 | */ |
221 | 221 | public function execute(StorageQuery $storageQuery) { |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * |
234 | 234 | * @param string $resource |
235 | 235 | * @param array|string $columns [optional] |
236 | - * @return Builder |
|
236 | + * @return QueryBuilder |
|
237 | 237 | */ |
238 | 238 | public function query($resource, $columns = array()) { |
239 | 239 | $query = new StorageQuery($resource, (array) $columns); |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * |
281 | 281 | * Returns false if there was no error. |
282 | 282 | * |
283 | - * @return string|bool |
|
283 | + * @return string|false |
|
284 | 284 | */ |
285 | 285 | public function error() { |
286 | 286 | if ($error = $this->connection->error()) { |
@@ -17,7 +17,7 @@ |
||
17 | 17 | * Retrieves the related models without matching them to their parents. |
18 | 18 | * |
19 | 19 | * @param array $instances |
20 | - * @return array |
|
20 | + * @return Record[] |
|
21 | 21 | */ |
22 | 22 | public function eagerLoad(array $instances) |
23 | 23 | { |
@@ -19,7 +19,7 @@ |
||
19 | 19 | public function register(Container $container) |
20 | 20 | { |
21 | 21 | $container->register(array( |
22 | - 'Darya\Database\Storage' => function ($container) { |
|
22 | + 'Darya\Database\Storage' => function($container) { |
|
23 | 23 | return new Storage($container->resolve('Darya\Database\Connection')); |
24 | 24 | }, |
25 | 25 | 'Darya\Storage\Readable' => 'Darya\Database\Storage', |
@@ -16,7 +16,7 @@ |
||
16 | 16 | public function register(Container $container) |
17 | 17 | { |
18 | 18 | $container->register(array( |
19 | - 'Darya\Http\Request' => function ($container) { |
|
19 | + 'Darya\Http\Request' => function($container) { |
|
20 | 20 | return Request::createFromGlobals($container->resolve('Darya\Http\Session')); |
21 | 21 | }, |
22 | 22 | 'Darya\Http\Session' => new PhpSession |
@@ -15,7 +15,7 @@ |
||
15 | 15 | public function register(Container $container) |
16 | 16 | { |
17 | 17 | $container->register(array( |
18 | - 'Darya\Smarty\ViewResolver' => function ($container) { |
|
18 | + 'Darya\Smarty\ViewResolver' => function($container) { |
|
19 | 19 | $config = $container->config; |
20 | 20 | $basePath = $config['project.base_path']; |
21 | 21 | $realBasePath = realpath("{$basePath}/views/smarty"); |