| Total Complexity | 3 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class HankakuKatakana implements Rule |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var array |
||
| 11 | */ |
||
| 12 | protected $configs; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Create a new rule instance. |
||
| 16 | * |
||
| 17 | * @param array $configs |
||
| 18 | * @return void |
||
| 19 | */ |
||
| 20 | public function __construct(array $configs = []) |
||
| 21 | { |
||
| 22 | $default_configs = []; |
||
| 23 | |||
| 24 | $this->configs = array_merge($default_configs, $configs); |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Determine if the validation rule passes. |
||
| 29 | * |
||
| 30 | * @param string $attribute |
||
| 31 | * @param mixed $value |
||
| 32 | * @return bool |
||
| 33 | */ |
||
| 34 | public function passes($attribute, $value) |
||
| 35 | { |
||
| 36 | return (bool)preg_match('/^(\xef(\xbd[\xa1-\xbf]|\xbe[\x80-\x9f]))*$/', $value); |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Get the validation error message. |
||
| 41 | * |
||
| 42 | * @return string |
||
| 43 | */ |
||
| 44 | public function message() |
||
| 47 | } |
||
| 48 | } |
||
| 49 |