| Conditions | 4 |
| Paths | 4 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public static function validate($entity) |
||
| 22 | { |
||
| 23 | if (Kernel::VERSION_ID >= 40000) { |
||
| 24 | $classFound = class_exists($entity, true); |
||
| 25 | |||
| 26 | if (!$classFound) { |
||
| 27 | throw new \InvalidArgumentException(sprintf('Entity "%s" was not found', $entity)); |
||
| 28 | } |
||
| 29 | |||
| 30 | return $entity; |
||
| 31 | } |
||
| 32 | |||
| 33 | if (!preg_match('{^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*:[a-zA-Z0-9_\x7f-\xff\\\/]+$}', $entity)) { |
||
| 34 | throw new \InvalidArgumentException(sprintf('The entity name isn\'t valid ("%s" given, expecting something like AcmeBlogBundle:Blog/Post)', $entity)); |
||
| 35 | } |
||
| 36 | |||
| 37 | return $entity; |
||
| 38 | } |
||
| 39 | } |
||
| 40 |