| Total Complexity | 2 |
| Total Lines | 23 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | |||
| 13 | final readonly class AuraSqlMasterDbInterceptor implements MethodInterceptor |
||
|
|
|||
| 14 | { |
||
| 15 | public const string PROP = 'pdo'; |
||
| 16 | |||
| 17 | public function __construct(private ConnectionLocatorInterface $connectionLocator) |
||
| 18 | { |
||
| 19 | } |
||
| 20 | |||
| 21 | /** |
||
| 22 | * {@inheritDoc} |
||
| 23 | */ |
||
| 24 | #[Override] |
||
| 25 | 3 | public function invoke(MethodInvocation $invocation) |
|
| 26 | { |
||
| 27 | 3 | $object = $invocation->getThis(); |
|
| 28 | 3 | $ref = new ReflectionProperty($object, self::PROP); |
|
| 29 | $connection = $this->connectionLocator->getWrite(); |
||
| 30 | $ref->setValue($object, $connection); |
||
| 31 | |||
| 32 | return $invocation->proceed(); |
||
| 33 | 2 | } |
|
| 34 | } |
||
| 35 |