| @@ 41-49 (lines=9) @@ | ||
| 38 | * @param array $fields |
|
| 39 | * @return array |
|
| 40 | */ |
|
| 41 | public function getResourceAttributes(array $fields = []) |
|
| 42 | { |
|
| 43 | $attributes = []; |
|
| 44 | ||
| 45 | foreach ($this->resolveFields($this->fields(), $fields) as $name => $definition) { |
|
| 46 | $attributes[$name] = is_string($definition) ? $this->$definition : call_user_func($definition, $this, $name); |
|
| 47 | } |
|
| 48 | return $attributes; |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * @return array |
|
| @@ 54-62 (lines=9) @@ | ||
| 51 | /** |
|
| 52 | * @return array |
|
| 53 | */ |
|
| 54 | public function getResourceRelationships() |
|
| 55 | { |
|
| 56 | $relationships = []; |
|
| 57 | ||
| 58 | foreach ($this->resolveFields($this->extraFields()) as $name => $definition) { |
|
| 59 | $relationships[$name] = is_string($definition) ? $this->$definition : call_user_func($definition, $this, $name); |
|
| 60 | } |
|
| 61 | return $relationships; |
|
| 62 | } |
|
| 63 | ||
| 64 | /** |
|
| 65 | * @param string $name the case sensitive name of the relationship. |
|