Completed
Branch development (ef4cc3)
by Blake
02:52
created

Table::addCreated()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 12
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 12
loc 12
rs 9.4285
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
/**
3
 * Potatobase (https://github.com/PotatoPowered/potatobase)
4
 *
5
 * Licensed under The MIT License
6
 * For full copyright and license information, please see the LICENSE
7
 * Redistributions of files must retain the above copyright notice.
8
 *
9
 * @author      Blake Sutton <[email protected]>
10
 * @copyright   Copyright (c) Potato Powered Software
11
 * @link        http://potatopowered.net
12
 * @since       0.0.1
13
 * @version     0.0.1
14
 * @license     http://www.opensource.org/licenses/mit-license.php MIT License
15
 */
16
namespace Potatobase\DB;
17
18
use Phinx\Db\Table as BaseTable;
19
20
/**
21
 * Class Table
22
 *
23
 * This class is an extension to the default migration tools Table object. The goal of this object is to extend the base
24
 * table so that we can provide some default column builders and other tools.
25
 *
26
 * @package Potatobase\DB
27
 */
28
class Table extends BaseTable
29
{
30
    /**
31
     * Add a Created Timestamp Column
32
     *
33
     * This function is a simple accessor to allow a universal design for the created timestamp.
34
     *
35
     * @return BaseTable The table object with a created column added.
36
     */
37 View Code Duplication
    public function addCreated()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
38
    {
39
        return $this->addColumn(
40
            'created',
41
            'datetime',
42
            [
43
                'default' => null,
44
                'limit' => null,
45
                'null' => true,
46
            ]
47
        );
48
    }
49
50
    /**
51
     * Add a Modified Timestamp Column
52
     *
53
     * This function is a simple accessor to allow a universal design for the modified timestamp.
54
     *
55
     * @return BaseTable The table object with a modified column added.
56
     */
57 View Code Duplication
    public function addModified()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
58
    {
59
        return $this->addColumn(
60
            'modified',
61
            'datetime',
62
            [
63
                'default' => null,
64
                'limit' => null,
65
                'null' => true,
66
            ]
67
        );
68
    }
69
}
70