Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
31 | public function setTelephone($telephone) |
||
32 | { |
||
33 | /** |
||
34 | * Hack to support leading + sign |
||
35 | * @see ArrayHelper::typeCast in NavItemPageBlockItem::rules() |
||
36 | */ |
||
37 | $telephone = ltrim($telephone, '\\'); |
||
38 | |||
39 | $validator = new RegularExpressionValidator([ |
||
40 | 'pattern' => '#^(?:0|\+[0-9]{2})[\d- ]+$#' |
||
41 | ]); |
||
42 | if ($validator->validate($telephone, $error)) { |
||
43 | $this->_telephone = $telephone; |
||
44 | } |
||
45 | } |
||
46 | |||
73 |