| Conditions | 2 |
| Paths | 2 |
| Total Lines | 24 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function resolveClass($contextClass) |
||
| 15 | { |
||
| 16 | if (strpos($contextClass, 'behatch:context:') === false) { |
||
| 17 | list(, $className) = explode(':', $contextClass); |
||
| 18 | |||
| 19 | $className = ucfirst($className); |
||
| 20 | |||
| 21 | @trigger_error( |
||
|
|
|||
| 22 | sprintf( |
||
| 23 | 'Deprecated context alias use behatch:context:%s instead', |
||
| 24 | strtolower($className) |
||
| 25 | ), |
||
| 26 | E_USER_DEPRECATED |
||
| 27 | ); |
||
| 28 | |||
| 29 | return "\\Sanpi\\Behatch\\Context\\{$className}Context"; |
||
| 30 | } else { |
||
| 31 | $className = preg_replace_callback('/(^\w|:\w)/', function ($matches) { |
||
| 32 | return str_replace(':', '\\', strtoupper($matches[0])); |
||
| 33 | }, $contextClass); |
||
| 34 | |||
| 35 | return $className . 'Context'; |
||
| 36 | } |
||
| 37 | } |
||
| 38 | } |
||
| 39 |
If you suppress an error, we recommend checking for the error condition explicitly: