| Conditions | 4 |
| Paths | 1 |
| Total Lines | 24 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 5.024 |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public function onBindProperty( |
||
| 30 | ReflectionProperty $reflProperty, |
||
| 31 | ReflectionClass $reflClass, |
||
| 32 | Descriptor $desc, |
||
| 33 | ContainerInterface $container |
||
| 34 | ) { |
||
| 35 | 2 | $desc->after(function ($instance) use ($reflProperty, $container) { |
|
| 36 | 2 | if (in_array($instance, static::$callStack)) { |
|
| 37 | 1 | return; // return when a circular call is detected. |
|
| 38 | } |
||
| 39 | 2 | array_push(static::$callStack, $instance); |
|
| 40 | try { |
||
| 41 | 2 | $reflProperty->setAccessible(true); |
|
| 42 | 2 | $reflProperty->setValue($instance, $container->get($this->name)); |
|
| 43 | } catch (Exception $e) { |
||
| 44 | array_pop(static::$callStack); |
||
| 45 | throw $e; |
||
| 46 | } catch (Throwable $e) { |
||
| 47 | array_pop(static::$callStack); |
||
| 48 | throw $e; |
||
| 49 | } |
||
| 50 | 2 | array_pop(static::$callStack); |
|
| 51 | 2 | }); |
|
| 52 | 2 | } |
|
| 53 | } |
||
| 54 |