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