| Total Complexity | 6 | 
| Total Lines | 32 | 
| Duplicated Lines | 0 % | 
| Coverage | 0% | 
| Changes | 0 | ||
| 1 | <?php | ||
| 16 | class ActiveRecord | ||
| 17 | { | ||
| 18 | private static $dbh; | ||
| 19 | private static $sth; | ||
| 20 | |||
| 21 | public static function conn(string $dsn, string $user, string $pass): void | ||
| 22 |     { | ||
| 23 | ActiveRecord::$dbh = new PDO($dsn, $user, $pass); | ||
| 24 | ActiveRecord::$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | ||
| 25 | } | ||
| 26 | |||
| 27 | private static function getConn(): PDO | ||
| 28 |     { | ||
| 29 | return ActiveRecord::$dbh; | ||
| 30 | } | ||
| 31 | |||
| 32 | private static function prepare(string $query): PDOStatement | ||
| 35 | } | ||
| 36 | |||
| 37 | protected static function execute(string $query, array $parameters = []): ?PDOStatement | ||
| 38 |     { | ||
| 39 |         if (ActiveRecord::prepare($query)->execute($parameters)) { | ||
| 40 | return ActiveRecord::$sth; | ||
| 41 | } | ||
| 42 | return null; | ||
| 43 | } | ||
| 44 | |||
| 45 | protected static function exec(string $sql): int | ||
| 48 | } | ||
| 49 | } | ||
| 50 |