Code Duplication    Length = 35-35 lines in 2 locations

src/Actions/Processors/ProductMediaGalleryCreateProcessor.php 1 location

@@ 34-68 (lines=35) @@
31
 * @link      https://github.com/techdivision/import-product-media
32
 * @link      http://www.techdivision.com
33
 */
34
class ProductMediaGalleryCreateProcessor 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_PRODUCT_MEDIA_GALLERY => $utilityClassName::CREATE_PRODUCT_MEDIA_GALLERY
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/ProductMediaGalleryUpdateProcessor.php 1 location

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