| Total Complexity | 4 |
| Total Lines | 62 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | trait HasMeta |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * The "meta" member |
||
| 14 | * |
||
| 15 | * @var array |
||
| 16 | */ |
||
| 17 | protected $meta; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Set the "meta" member. |
||
| 21 | * |
||
| 22 | * @param array $meta |
||
| 23 | * |
||
| 24 | * @return static |
||
| 25 | */ |
||
| 26 | 84 | public function setMeta(array $meta) |
|
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Get the "meta" member. |
||
| 35 | * |
||
| 36 | * @return array|null |
||
| 37 | */ |
||
| 38 | 33 | public function getMeta(): ?array |
|
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Add a single value to the "meta" member |
||
| 45 | * |
||
| 46 | * @param string $name |
||
| 47 | * @param mixed $value |
||
| 48 | * |
||
| 49 | * @return static |
||
| 50 | */ |
||
| 51 | 15 | public function addToMeta(string $name, $value) |
|
| 52 | { |
||
| 53 | 15 | $this->addToObject('meta', $name, $value); |
|
|
|
|||
| 54 | |||
| 55 | 15 | return $this; |
|
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Fill the "meta" member with fake values. |
||
| 60 | * |
||
| 61 | * @param integer $count The number of values to generate. |
||
| 62 | * |
||
| 63 | * @return static |
||
| 64 | */ |
||
| 65 | 60 | public function fakeMeta(int $count = 5) |
|
| 72 | } |
||
| 73 | } |
||
| 74 |