| Conditions | 3 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | public function get($name, $parent = null) |
||
| 20 | { |
||
| 21 | $module = S::$n->getContextModule($name); |
||
| 22 | |||
| 23 | if (empty($module)) { |
||
| 24 | return null; |
||
| 25 | } |
||
| 26 | |||
| 27 | $class = U::className($module::getNamespace(), 'context', $name); |
||
| 28 | |||
| 29 | if (!class_exists($class)) { |
||
| 30 | return null; |
||
| 31 | } |
||
| 32 | |||
| 33 | return $this->newContext($class, $parent, $module); |
||
|
|
|||
| 34 | } |
||
| 35 | |||
| 48 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.