| 1 | <?php |
||
| 10 | class FakePDO extends \PDO |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * Empty constructor. |
||
| 14 | */ |
||
| 15 | public function __construct() |
||
| 16 | { |
||
| 17 | } |
||
| 18 | |||
| 19 | /** |
||
| 20 | * A map of attributes to be passed back from getAttribute. |
||
| 21 | * |
||
| 22 | * @var mixed[] |
||
| 23 | */ |
||
| 24 | public $attributes = []; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Get the value of an attribute. Uses an element of the Attributes array if available, falling back to parent. |
||
| 28 | * |
||
| 29 | * @param mixed $attr The attribute whose value is to be fetched. |
||
| 30 | * @return mixed The value of the attribute. |
||
| 31 | */ |
||
| 32 | public function getAttribute($attr): mixed |
||
| 33 | { |
||
| 34 | return isset($this->attributes[$attr]) ? $this->attributes[$attr] : parent::getAttribute($attr); |
||
| 35 | } |
||
| 36 | } |
||
| 37 |