Lines Matching defs:values
30 * Represents an entry attribute and any values.
59 protected $values = [];
68 * @param mixed|string ...$values
70 public function __construct(string $attribute, ...$values)
73 $this->values = $values;
77 * Add a value, or values, to the attribute.
79 * @param mixed|string ...$values
82 public function add(...$values): self
84 foreach ($values as $value) {
85 $this->values[] = $value;
99 return array_search($value, $this->values, true) !== false;
103 * Remove a specific value, or values, from an attribute.
105 * @param mixed|string ...$values
108 public function remove(...$values): self
110 foreach ($values as $value) {
111 if (($i = array_search($value, $this->values, true)) !== false) {
112 unset($this->values[$i]);
120 * Resets the values to any empty array.
126 $this->values = [];
132 * Set the values for the attribute.
134 * @param mixed|string ...$values
137 public function set(...$values): self
139 $this->values = $values;
167 * Gets any values associated with the attribute.
173 return $this->values;
183 return $this->values[0] ?? null;
193 $last = end($this->values);
194 reset($this->values);
222 return new ArrayIterator($this->values);
230 return count($this->values);
264 return implode(', ', $this->values);