Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
AbstractMigrator
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getDb
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 db
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2declare(strict_types=1);
3/**
4 * Pop PHP Framework (https://www.popphp.org/)
5 *
6 * @link       https://github.com/popphp/popphp-framework
7 * @author     Nick Sagona, III <nick@popphp.org>
8 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
9 * @license    https://www.popphp.org/license     New BSD License
10 */
11
12/**
13 * @namespace
14 */
15namespace Pop\Db\Sql\Migration;
16
17use Pop\Db\Adapter\AbstractAdapter;
18
19/**
20 * Db SQL migrator abstract class
21 *
22 * @category   Pop
23 * @package    Pop\Db
24 * @author     Nick Sagona, III <nick@popphp.org>
25 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
26 * @license    https://www.popphp.org/license     New BSD License
27 * @version    7.0.0
28 */
29abstract class AbstractMigrator implements MigratorInterface
30{
31
32    /**
33     * Database adapter
34     * @var ?AbstractAdapter
35     */
36    protected ?AbstractAdapter $db = null;
37
38    /**
39     * Constructor
40     *
41     * Instantiate the migration object
42     *
43     * @param  AbstractAdapter $db
44     */
45    public function __construct(AbstractAdapter $db)
46    {
47        $this->db = $db;
48    }
49
50    /**
51     * Get the DB adapter
52     *
53     * @return AbstractAdapter
54     */
55    public function getDb(): AbstractAdapter
56    {
57        return $this->db;
58    }
59
60    /**
61     * Get the DB adapter (alias method)
62     *
63     * @return AbstractAdapter
64     */
65    public function db(): AbstractAdapter
66    {
67        return $this->db;
68    }
69
70}