| @@ 28-36 (lines=9) @@ | ||
| 25 | $this->coerce = $coerce; |
|
| 26 | } |
|
| 27 | ||
| 28 | public function assertColor($value, $error = "expected color value") |
|
| 29 | { |
|
| 30 | $color = $this->coerce->coerceColor($value); |
|
| 31 | if ($color === null) { |
|
| 32 | throw new GeneralException($error); |
|
| 33 | } |
|
| 34 | ||
| 35 | return $color; |
|
| 36 | } |
|
| 37 | ||
| 38 | public function assertNumber($value, $error = "expecting number") |
|
| 39 | { |
|
| @@ 81-89 (lines=9) @@ | ||
| 78 | return ["number", $this->assertions->assertNumber($a) % $this->assertions->assertNumber($b), $args[2][0][2]]; |
|
| 79 | } |
|
| 80 | ||
| 81 | public function red($color) |
|
| 82 | { |
|
| 83 | $color = $this->coerce->coerceColor($color); |
|
| 84 | if ($color === null) { |
|
| 85 | throw new GeneralException('color expected for red()'); |
|
| 86 | } |
|
| 87 | ||
| 88 | return $color[1]; |
|
| 89 | } |
|
| 90 | ||
| 91 | public function green($color) |
|
| 92 | { |
|
| @@ 91-99 (lines=9) @@ | ||
| 88 | return $color[1]; |
|
| 89 | } |
|
| 90 | ||
| 91 | public function green($color) |
|
| 92 | { |
|
| 93 | $color = $this->coerce->coerceColor($color); |
|
| 94 | if ($color === null) { |
|
| 95 | throw new GeneralException('color expected for green()'); |
|
| 96 | } |
|
| 97 | ||
| 98 | return $color[2]; |
|
| 99 | } |
|
| 100 | ||
| 101 | public function blue($color) |
|
| 102 | { |
|
| @@ 101-109 (lines=9) @@ | ||
| 98 | return $color[2]; |
|
| 99 | } |
|
| 100 | ||
| 101 | public function blue($color) |
|
| 102 | { |
|
| 103 | $color = $this->coerce->coerceColor($color); |
|
| 104 | if ($color === null) { |
|
| 105 | throw new GeneralException('color expected for blue()'); |
|
| 106 | } |
|
| 107 | ||
| 108 | return $color[3]; |
|
| 109 | } |
|
| 110 | ||
| 111 | public function convert($args) |
|
| 112 | { |
|