| @@ 83-103 (lines=21) @@ | ||
| 80 | * |
|
| 81 | * Include every composition public data into result. |
|
| 82 | */ |
|
| 83 | public function publicFields(): array |
|
| 84 | { |
|
| 85 | $result = []; |
|
| 86 | ||
| 87 | foreach ($this->getKeys() as $field => $value) { |
|
| 88 | if (in_array($field, $this->hidden)) { |
|
| 89 | //We might need to use isset in future, for performance |
|
| 90 | continue; |
|
| 91 | } |
|
| 92 | ||
| 93 | $value = $this->getField($field); |
|
| 94 | ||
| 95 | if ($value instanceof PublishableInterface) { |
|
| 96 | $result[$field] = $value->publicFields(); |
|
| 97 | } else { |
|
| 98 | $result[$field] = $value; |
|
| 99 | } |
|
| 100 | } |
|
| 101 | ||
| 102 | return $result; |
|
| 103 | } |
|
| 104 | ||
| 105 | /** |
|
| 106 | * Check if field can be set using setFields() method. |
|
| @@ 49-67 (lines=19) @@ | ||
| 46 | * |
|
| 47 | * Include every composition public data into result. |
|
| 48 | */ |
|
| 49 | public function publicFields(): array |
|
| 50 | { |
|
| 51 | $result = []; |
|
| 52 | ||
| 53 | foreach ($this->getKeys() as $field => $value) { |
|
| 54 | if (in_array($field, $this->schema[self::SH_HIDDEN])) { |
|
| 55 | //We might need to use isset in future, for performance |
|
| 56 | continue; |
|
| 57 | } |
|
| 58 | ||
| 59 | if ($value instanceof PublishableInterface) { |
|
| 60 | $result[$field] = $value->publicFields(); |
|
| 61 | } else { |
|
| 62 | $result[$field] = $value; |
|
| 63 | } |
|
| 64 | } |
|
| 65 | ||
| 66 | return $result; |
|
| 67 | } |
|
| 68 | ||
| 69 | /** |
|
| 70 | * {@inheritdoc} |
|
| @@ 79-99 (lines=21) @@ | ||
| 76 | * |
|
| 77 | * Include every composition public data into result. |
|
| 78 | */ |
|
| 79 | public function publicFields(): array |
|
| 80 | { |
|
| 81 | $result = []; |
|
| 82 | ||
| 83 | foreach ($this->getKeys() as $field => $value) { |
|
| 84 | if (in_array($field, static::HIDDEN)) { |
|
| 85 | //We might need to use isset in future, for performance |
|
| 86 | continue; |
|
| 87 | } |
|
| 88 | ||
| 89 | $value = $this->getField($field); |
|
| 90 | ||
| 91 | if ($value instanceof PublishableInterface) { |
|
| 92 | $result[$field] = $value->publicFields(); |
|
| 93 | } else { |
|
| 94 | $result[$field] = $value; |
|
| 95 | } |
|
| 96 | } |
|
| 97 | ||
| 98 | return $result; |
|
| 99 | } |
|
| 100 | ||
| 101 | /** |
|
| 102 | * Check if field can be set using setFields() method. |
|