Code Duplication    Length = 35-35 lines in 3 locations

src/Actions/Processors/Magic360ColumnsUpdateProcessor.php 1 location

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

src/Actions/Processors/Magic360GalleryCreateProcessor.php 1 location

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

src/Actions/Processors/Magic360GalleryUpdateProcessor.php 1 location

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