| @@ 43-60 (lines=18) @@ | ||
| 40 | * @param $value |
|
| 41 | * @return boolean |
|
| 42 | */ |
|
| 43 | public function match($value) |
|
| 44 | { |
|
| 45 | if (!is_string($value)) { |
|
| 46 | $this->error = sprintf("EndsWith expander require \"string\", got \"%s\".", new StringConverter($value)); |
|
| 47 | return false; |
|
| 48 | } |
|
| 49 | ||
| 50 | if (empty($this->stringEnding)) { |
|
| 51 | return true; |
|
| 52 | } |
|
| 53 | ||
| 54 | if (!$this->matchValue($value)) { |
|
| 55 | $this->error = sprintf("string \"%s\" doesn't ends with string \"%s\".", $value, $this->stringEnding); |
|
| 56 | return false; |
|
| 57 | } |
|
| 58 | ||
| 59 | return true; |
|
| 60 | } |
|
| 61 | ||
| 62 | /** |
|
| 63 | * @return string|null |
|
| @@ 43-60 (lines=18) @@ | ||
| 40 | * @param $value |
|
| 41 | * @return boolean |
|
| 42 | */ |
|
| 43 | public function match($value) |
|
| 44 | { |
|
| 45 | if (!is_string($value)) { |
|
| 46 | $this->error = sprintf("StartsWith expander require \"string\", got \"%s\".", new StringConverter($value)); |
|
| 47 | return false; |
|
| 48 | } |
|
| 49 | ||
| 50 | if (empty($this->stringBeginning)) { |
|
| 51 | return true; |
|
| 52 | } |
|
| 53 | ||
| 54 | if ($this->matchValue($value)) { |
|
| 55 | $this->error = sprintf("string \"%s\" doesn't starts with string \"%s\".", $value, $this->stringBeginning); |
|
| 56 | return false; |
|
| 57 | } |
|
| 58 | ||
| 59 | return true; |
|
| 60 | } |
|
| 61 | ||
| 62 | /** |
|
| 63 | * @return string|null |
|