This commit is contained in:
Bastian Allgeier
2020-07-07 12:40:29 +02:00
parent 5f025ac2c2
commit f79d2e960c
176 changed files with 10531 additions and 5342 deletions
+5 -2
View File
@@ -29,7 +29,7 @@ class Collection
{
$this->api = $api;
$this->data = $data;
$this->model = $schema['model'];
$this->model = $schema['model'] ?? null;
$this->view = $schema['view'] ?? null;
if ($data === null) {
@@ -40,7 +40,10 @@ class Collection
$this->data = $schema['default']->call($this->api);
}
if (isset($schema['type']) === true && is_a($this->data, $schema['type']) === false) {
if (
isset($schema['type']) === true &&
is_a($this->data, $schema['type']) === false
) {
throw new Exception('Invalid collection type');
}
}