| @@ 25-37 (lines=13) @@ | ||
| 22 | return array_key_exists($key, $this->values); |
|
| 23 | } |
|
| 24 | ||
| 25 | public function withValues(array $values) |
|
| 26 | { |
|
| 27 | if ($this->values === $values) { |
|
| 28 | return $this; |
|
| 29 | } |
|
| 30 | ||
| 31 | $this->assertValid($values); |
|
| 32 | ||
| 33 | $copy = clone $this; |
|
| 34 | $copy->values = $values; |
|
| 35 | ||
| 36 | return $copy; |
|
| 37 | } |
|
| 38 | ||
| 39 | public function withValue($key, $value) |
|
| 40 | { |
|
| @@ 16-29 (lines=14) @@ | ||
| 13 | return in_array($value, $this->values, true); |
|
| 14 | } |
|
| 15 | ||
| 16 | public function withValues(array $values) |
|
| 17 | { |
|
| 18 | if ($this->values === $values) { |
|
| 19 | return $this; |
|
| 20 | } |
|
| 21 | ||
| 22 | $this->assertValid($values); |
|
| 23 | ||
| 24 | $copy = clone $this; |
|
| 25 | $copy->values = $values; |
|
| 26 | $copy->sortValues(); |
|
| 27 | ||
| 28 | return $copy; |
|
| 29 | } |
|
| 30 | ||
| 31 | public function withValue($value) |
|
| 32 | { |
|
| @@ 16-28 (lines=13) @@ | ||
| 13 | return in_array($value, $this->values, true); |
|
| 14 | } |
|
| 15 | ||
| 16 | public function withValues(array $values) |
|
| 17 | { |
|
| 18 | $this->assertValid($values); |
|
| 19 | ||
| 20 | if ($this->values === $values) { |
|
| 21 | return $this; |
|
| 22 | } |
|
| 23 | ||
| 24 | $copy = clone $this; |
|
| 25 | $copy->values = $values; |
|
| 26 | ||
| 27 | return $copy; |
|
| 28 | } |
|
| 29 | ||
| 30 | public function withValue($value) |
|
| 31 | { |
|