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