| Total Complexity | 4 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | trait TimezoneEnforcerTrait |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Change detector for $pdo property |
||
| 13 | * |
||
| 14 | * @var ChangeDetector |
||
| 15 | */ |
||
| 16 | protected $pdoChangeDetector; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Change detector for $readPdo property |
||
| 20 | * |
||
| 21 | * @var ChangeDetector |
||
| 22 | */ |
||
| 23 | protected $readPdoChangeDetector; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Get the current PDO connection. |
||
| 27 | * |
||
| 28 | * @return \PDO|null |
||
| 29 | */ |
||
| 30 | 2 | public function getPdo(): ?\PDO |
|
| 31 | { |
||
| 32 | 2 | if (!$this->pdoChangeDetector) { |
|
| 33 | 2 | $this->pdoChangeDetector = new ChangeDetector; |
|
| 34 | } |
||
| 35 | |||
| 36 | 2 | return $this->enforcePdoTimezone( |
|
|
|
|||
| 37 | 2 | parent::getPdo(), |
|
| 38 | 2 | $this->pdoChangeDetector |
|
| 39 | ); |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Get the current PDO connection used for reading. |
||
| 44 | * |
||
| 45 | * @return \PDO|null |
||
| 46 | */ |
||
| 47 | 2 | public function getReadPdo(): ?\PDO |
|
| 56 | ); |
||
| 57 | } |
||
| 59 |