Table::getDataBaseName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace Pumpkin\Database;
3
4
use Pumpkin\Test\Test;
5
6
/**
7
 * Class Table
8
 * @package Pumpkin
9
 * @author Raphaël Lefebvre <[email protected]>
10
 */
11
class Table
12
{
13
    /**
14
     * @var string
15
     */
16
    private $dataBaseName;
17
18
    /**
19
     * @var string
20
     */
21
    private $name;
22
23
    /**
24
     * @var Test
25
     */
26
    private $test;
27
28
    /**
29
     * Constructor.
30
     *
31
     * @param Test $test
32
     * @param string $dataBaseName
33
     * @param string $tableName
34
     */
35 11
    public function __construct(Test $test, $dataBaseName, $tableName)
36
    {
37 11
        $this->setTest($test);
38 11
        $this->setDataBaseName($dataBaseName);
39 11
        $this->setName($tableName);
40 11
    }
41
42
    /**
43
     * @return Test
44
     */
45 9
    public function getTest()
46
    {
47 9
        return $this->test;
48
    }
49
50
    /**
51
     * @return string
52
     */
53 6
    public function getFullName()
54
    {
55 6
        return $this->getDataBaseName() . '.' . $this->getName();
56
    }
57
58
    /**
59
     * @return string
60
     */
61 11
    public function getDataBaseName()
62
    {
63 11
        return $this->dataBaseName;
64
    }
65
66
    /**
67
     * @return string
68
     */
69 11
    public function getName()
70
    {
71 11
        return $this->name;
72
    }
73
74
    /**
75
     * @return \PHPUnit_Extensions_Database_DataSet_ITable
76
     */
77 3
    public function toPhpUnitTable()
78
    {
79 3
        $converterFactory = new TableConverterFactory();
80 3
        return $converterFactory->build($this)->toPhpUnitTable();
81
    }
82
83
    /**
84
     * @return string
85
     */
86 6
    public function getDataPath()
87
    {
88 6
        $pathFinder = new PathFinder($this);
89 6
        return $pathFinder->findDataPath(TableConverterFactory::getSupportedFileExtensions());
90
    }
91
92
    /**
93
     * @param string $name
94
     */
95 11
    private function setName($name)
96
    {
97 11
        $this->name = (string)$name;
98 11
    }
99
100
    /**
101
     * @param string $dataBaseName
102
     */
103 11
    private function setDataBaseName($dataBaseName)
104
    {
105 11
        $this->dataBaseName = (string)$dataBaseName;
106 11
    }
107
108
    /**
109
     * @param Test $test
110
     */
111 11
    private function setTest(Test $test)
112
    {
113 11
        $this->test = $test;
114 11
    }
115
}
116