Code Duplication    Length = 90-90 lines in 2 locations

src/Actions/Processors/AbstractProcessor.php 1 location

@@ 35-124 (lines=90) @@
32
 * @link      https://github.com/techdivision/import
33
 * @link      http://www.techdivision.com
34
 */
35
abstract class AbstractProcessor implements ProcessorInterface
36
{
37
38
    /**
39
     * The connection instance.
40
     * .
41
     * @var \TechDivision\Import\Connection\ConnectionInterface;
42
     */
43
    protected $connection;
44
45
    /**
46
     * The utility class instance with the SQL statements to use.
47
     *
48
     * @var \TechDivision\Import\Utils\SqlStatementsInterface
49
     */
50
    protected $utilityClass;
51
52
    /**
53
     * Initialize the processor with the passed connection and utility class name.
54
     * .
55
     * @param \TechDivision\Import\Connection\ConnectionInterface $connection   The connection instance
56
     * @param \TechDivision\Import\Utils\SqlStatementsInterface   $utilityClass The utility class instance
57
     */
58
    public function __construct(
59
        ConnectionInterface $connection,
60
        SqlStatementsInterface $utilityClass
61
    ) {
62
63
        // set the passed instances
64
        $this->setConnection($connection);
65
        $this->setUtilityClass($utilityClass);
66
67
        // initialize the instance
68
        $this->init();
69
    }
70
71
    /**
72
     * Set's the connection to use.
73
     * .
74
     * @param \TechDivision\Import\Connection\ConnectionInterface $connection The connection instance
75
     *
76
     * @return void
77
     */
78
    public function setConnection(ConnectionInterface $connection)
79
    {
80
        $this->connection = $connection;
81
    }
82
83
    /**
84
     * Return's the connection to use.
85
     *
86
     * @return \TechDivision\Import\Connection\ConnectionInterface The connection instance
87
     */
88
    public function getConnection()
89
    {
90
        return $this->connection;
91
    }
92
93
    /**
94
     * Set's the utility class instance with the SQL statements to use.
95
     *
96
     * @param \TechDivision\Import\Utils\SqlStatementsInterface $utilityClass The utility class instance
97
     *
98
     * @return void
99
     */
100
    public function setUtilityClass(SqlStatementsInterface $utilityClass)
101
    {
102
        $this->utilityClass = $utilityClass;
103
    }
104
105
    /**
106
     * Return's the utility class instance with the SQL statements to use.
107
     *
108
     * @return \TechDivision\Import\Utils\SqlStatementsInterface The utility class instance
109
     */
110
    public function getUtilityClass()
111
    {
112
        return $this->utilityClass;
113
    }
114
115
    /**
116
     * Return's the utility class with the SQL statements to use.
117
     *
118
     * @return string The utility class name
119
     */
120
    public function getUtilityClassName()
121
    {
122
        return get_class($this->getUtilityClass());
123
    }
124
}
125

src/Repositories/AbstractRepository.php 1 location

@@ 35-124 (lines=90) @@
32
 * @link      https://github.com/techdivision/import
33
 * @link      http://www.techdivision.com
34
 */
35
abstract class AbstractRepository
36
{
37
38
    /**
39
     * The connection instance.
40
     * .
41
     * @var \TechDivision\Import\Connection\ConnectionInterface;
42
     */
43
    protected $connection;
44
45
    /**
46
     * The utility class instance with the SQL statements to use.
47
     *
48
     * @var \TechDivision\Import\Utils\SqlStatementsInterface
49
     */
50
    protected $utilityClass;
51
52
    /**
53
     * Initialize the repository with the passed connection and utility class name.
54
     * .
55
     * @param \TechDivision\Import\Connection\ConnectionInterface $connection   The connection instance
56
     * @param \TechDivision\Import\Utils\SqlStatementsInterface   $utilityClass The utility class instance
57
     */
58
    public function __construct(
59
        ConnectionInterface $connection,
60
        SqlStatementsInterface $utilityClass
61
    ) {
62
63
        // set the passed instances
64
        $this->setConnection($connection);
65
        $this->setUtilityClass($utilityClass);
66
67
        // initialize the instance
68
        $this->init();
69
    }
70
71
    /**
72
     * Set's the connection to use.
73
     * .
74
     * @param \TechDivision\Import\Connection\ConnectionInterface $connection The connection instance
75
     *
76
     * @return void
77
     */
78
    public function setConnection(ConnectionInterface $connection)
79
    {
80
        $this->connection = $connection;
81
    }
82
83
    /**
84
     * Return's the connection to use.
85
     *
86
     * @return \TechDivision\Import\Connection\ConnectionInterface The connection instance
87
     */
88
    public function getConnection()
89
    {
90
        return $this->connection;
91
    }
92
93
    /**
94
     * Set's the utility class instance with the SQL statements to use.
95
     *
96
     * @param \TechDivision\Import\Utils\SqlStatementsInterface $utilityClass The utility class instance
97
     *
98
     * @return void
99
     */
100
    public function setUtilityClass(SqlStatementsInterface $utilityClass)
101
    {
102
        $this->utilityClass = $utilityClass;
103
    }
104
105
    /**
106
     * Return's the utility class instance with the SQL statements to use.
107
     *
108
     * @return \TechDivision\Import\Utils\SqlStatementsInterface The utility class instance
109
     */
110
    public function getUtilityClass()
111
    {
112
        return $this->utilityClass;
113
    }
114
115
    /**
116
     * Return's the utility class with the SQL statements to use.
117
     *
118
     * @return string The utility class name
119
     */
120
    public function getUtilityClassName()
121
    {
122
        return get_class($this->getUtilityClass());
123
    }
124
}
125