Completed
Push — 15.x ( b45baa...4ca9b4 )
by Tim
02:13
created

AbstractFinder   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 77
ccs 0
cts 19
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getKey() 0 4 1
A getPrimaryKeyName() 0 4 1
A getEntityName() 0 4 1
1
<?php
2
3
/**
4
 * TechDivision\Import\Repositories\Finders\AbstractFinder
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * This source file is subject to the Open Software License (OSL 3.0)
9
 * that is available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * PHP version 5
13
 *
14
 * @author    Tim Wagner <[email protected]>
15
 * @copyright 2019 TechDivision GmbH <[email protected]>
16
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
 * @link      https://github.com/techdivision/import
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Repositories\Finders;
22
23
/**
24
 * An abstract finder implementation.
25
 *
26
 * @author    Tim Wagner <[email protected]>
27
 * @copyright 2019 TechDivision GmbH <[email protected]>
28
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
29
 * @link      https://github.com/techdivision/import
30
 * @link      http://www.techdivision.com
31
 */
32
abstract class AbstractFinder implements FinderInterface
33
{
34
35
    /**
36
     * The unique key of the prepared statement that has to be executed.
37
     *
38
     * @var string
39
     */
40
    protected $key;
41
42
    /**
43
     * The entity's primary key name.
44
     *
45
     * @var string
46
     */
47
    protected $primaryKeyName;
48
49
    /**
50
     * The finder's entity name.
51
     *
52
     * @var string
53
     */
54
    protected $entityName;
55
56
    /**
57
     * The prepared statement.
58
     *
59
     * @var \PDOStatement
60
     */
61
    protected $preparedStatement;
62
63
    /**
64
     * Initialize the repository with the passed connection and utility class name.
65
     * .
66
     * @param \PDOStatement $preparedStatement The prepared statement
67
     * @param string        $key               The unqiue key of the prepared statement that has to be executed.
68
     * @param string        $primaryKeyName    The entity's primary key
69
     * @param string        $entityName        The finder's entity name
70
     */
71
    public function __construct(\PDOStatement $preparedStatement, $key, $primaryKeyName, $entityName)
72
    {
73
        $this->preparedStatement = $preparedStatement;
74
        $this->primaryKeyName = $primaryKeyName;
75
        $this->entityName = $entityName;
76
        $this->key = $key;
77
    }
78
79
    /**
80
     * Return's the finder's unique key.
81
     *
82
     * @return string The unique key
83
     */
84
    public function getKey()
85
    {
86
        return $this->key;
87
    }
88
89
    /**
90
     * Return's the entity's primary key name.
91
     *
92
     * @return string The entity's primary key name
93
     */
94
    public function getPrimaryKeyName()
95
    {
96
        return $this->primaryKeyName;
97
    }
98
99
    /**
100
     * Return's the finder's entity name.
101
     *
102
     * @return string The finder's entity name
103
     */
104
    public function getEntityName()
105
    {
106
        return $this->entityName;
107
    }
108
}
109