| Total Complexity | 6 |
| Total Lines | 70 |
| Duplicated Lines | 0 % |
| Coverage | 80% |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | trait MetaAwareTrait |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * @var array |
||
| 22 | */ |
||
| 23 | protected $metas = []; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @return array |
||
| 27 | */ |
||
| 28 | 1 | public function getMetas(): array |
|
| 29 | { |
||
| 30 | 1 | return $this->metas; |
|
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @param string $key |
||
| 35 | * |
||
| 36 | * @return mixed |
||
| 37 | */ |
||
| 38 | 10 | public function getMeta(string $key) |
|
| 39 | { |
||
| 40 | 10 | return $this->metas[$key]; |
|
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @param string $key |
||
| 45 | * |
||
| 46 | * @return bool |
||
| 47 | */ |
||
| 48 | 10 | public function hasMeta(string $key): bool |
|
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @param array $metas |
||
| 55 | * |
||
| 56 | * @return MetaAwareInterface |
||
| 57 | */ |
||
| 58 | 1 | public function setMetas(array $metas): MetaAwareInterface |
|
| 59 | { |
||
| 60 | 1 | $this->metas = $metas; |
|
| 61 | |||
| 62 | 1 | return $this; |
|
|
|
|||
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * @param string $key |
||
| 67 | * @param mixed $value |
||
| 68 | * |
||
| 69 | * @return MetaAwareInterface |
||
| 70 | */ |
||
| 71 | 1 | public function setMeta(string $key, $value): MetaAwareInterface |
|
| 76 | } |
||
| 77 | |||
| 78 | /** |
||
| 79 | * @param string $key |
||
| 80 | * |
||
| 81 | * @return MetaAwareInterface |
||
| 82 | */ |
||
| 83 | public function removeMeta(string $key): MetaAwareInterface |
||
| 88 | } |
||
| 89 | } |
||
| 90 |