| Conditions | 4 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | public function isTPropertyTypeValid($string) |
||
| 10 | { |
||
| 11 | //The below pattern represents the allowed identifiers in ECMA specification |
||
| 12 | // plus the '.' for namespace qualification |
||
| 13 | $regex = "/[\p{L}\p{Nl}][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}(\.[\p{L}\p{Nl}][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}){0,}/"; |
||
| 14 | |||
| 15 | if (!is_string($string)) { |
||
| 16 | $msg = "Input must be a string: ". get_class($this); |
||
| 17 | throw new \InvalidArgumentException($msg); |
||
| 18 | } |
||
| 19 | if ($this->isEDMSimpleTypeValid($string)) { |
||
| 20 | return true; |
||
| 21 | } |
||
| 22 | if ($this->isTQualifiedNameValid($string)) { |
||
| 23 | return true; |
||
| 24 | } |
||
| 25 | return $this->matchesRegexPattern($regex, $string); |
||
| 26 | } |
||
| 27 | } |
||
| 28 |