Code Duplication    Length = 35-35 lines in 2 locations

src/Actions/Processors/AttributeCreateProcessor.php 1 location

@@ 34-68 (lines=35) @@
31
 * @link      https://github.com/techdivision/import-attribute
32
 * @link      http://www.techdivision.com
33
 */
34
class AttributeCreateProcessor extends AbstractCreateProcessor
35
{
36
37
    /**
38
     * Return's the array with the SQL statements that has to be prepared.
39
     *
40
     * @return array The SQL statements to be prepared
41
     * @see \TechDivision\Import\Actions\Processors\AbstractBaseProcessor::getStatements()
42
     */
43
    protected function getStatements()
44
    {
45
46
        // load the utility class name
47
        $utilityClassName = $this->getUtilityClassName();
48
49
        // return the array with the SQL statements that has to be prepared
50
        return array(
51
            $utilityClassName::CREATE_ATTRIBUTE => $utilityClassName::CREATE_ATTRIBUTE
52
        );
53
    }
54
55
    /**
56
     * Persist's the passed row.
57
     *
58
     * @param array       $row  The row to persist
59
     * @param string|null $name The name of the prepared statement that has to be executed
60
     *
61
     * @return string The last inserted ID
62
     */
63
    public function execute($row, $name = null)
64
    {
65
        parent::execute($row, $name);
66
        return $this->getConnection()->lastInsertId();
67
    }
68
}
69

src/Actions/Processors/AttributeOptionCreateProcessor.php 1 location

@@ 34-68 (lines=35) @@
31
 * @link      https://github.com/techdivision/import-attribute
32
 * @link      http://www.techdivision.com
33
 */
34
class AttributeOptionCreateProcessor extends AbstractCreateProcessor
35
{
36
37
    /**
38
     * Return's the array with the SQL statements that has to be prepared.
39
     *
40
     * @return array The SQL statements to be prepared
41
     * @see \TechDivision\Import\Actions\Processors\AbstractBaseProcessor::getStatements()
42
     */
43
    protected function getStatements()
44
    {
45
46
        // load the utility class name
47
        $utilityClassName = $this->getUtilityClassName();
48
49
        // return the array with the SQL statements that has to be prepared
50
        return array(
51
            $utilityClassName::CREATE_ATTRIBUTE_OPTION => $utilityClassName::CREATE_ATTRIBUTE_OPTION
52
        );
53
    }
54
55
    /**
56
     * Persist's the passed row.
57
     *
58
     * @param array       $row  The row to persist
59
     * @param string|null $name The name of the prepared statement that has to be executed
60
     *
61
     * @return string The last inserted ID
62
     */
63
    public function execute($row, $name = null)
64
    {
65
        parent::execute($row, $name);
66
        return $this->getConnection()->lastInsertId();
67
    }
68
}
69