Completed
Branch feature/pre-split (f8e7b8)
by Anton
04:02
created

AbstractElement::setName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * components
4
 *
5
 * @author    Wolfy-J
6
 */
7
namespace Spiral\Database\Schemas\Prototypes;
8
9
/**
10
 * Aggregates common functionality for columns, indexes and foreign key schemas.
11
 */
12
class AbstractElement
13
{
14
    /**
15
     * Element name.
16
     *
17
     * @var string
18
     */
19
    protected $name = '';
20
21
    /**
22
     * Parent table name.
23
     *
24
     * @var string
25
     */
26
    protected $table = '';
27
28
    /**
29
     * @param string $table
30
     * @param string $name
31
     */
32
    public function __construct(string $table, string $name)
33
    {
34
        $this->name = $name;
35
        $this->table = $table;
36
    }
37
38
    /**
39
     * Associated table name (full name).
40
     *
41
     * @return string
42
     */
43
    public function getTable(): string
44
    {
45
        return $this->table;
46
    }
47
48
    /**
49
     * Set element name.
50
     *
51
     * @param string $name
52
     *
53
     * @return $this
54
     */
55
    public function setName(string $name)
56
    {
57
        $this->name = $name;
58
59
        return $this;
60
    }
61
62
    /**
63
     * Get element name (unquoted).
64
     *
65
     * @return string
66
     */
67
    public function getName(): string
68
    {
69
        return $this->name;
70
    }
71
}