Completed
Push — master ( 0490fd...bbe757 )
by Marcus
04:33
created

SqlStatementRepository   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 40
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
1
<?php
2
3
/**
4
 * TechDivision\Import\Product\Bundle\Ee\Repositories\SqlStatementRepository
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 2016 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-product-bundle-ee
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Product\Bundle\Ee\Repositories;
22
23
use TechDivision\Import\Product\Bundle\Ee\Utils\SqlStatementKeys;
24
25
/**
26
 * Repository class with the SQL statements to use.
27
 *
28
 * @author    Tim Wagner <[email protected]>
29
 * @copyright 2016 TechDivision GmbH <[email protected]>
30
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
31
 * @link      https://github.com/techdivision/import-product-bundle-ee
32
 * @link      http://www.techdivision.com
33
 */
34
class SqlStatementRepository extends \TechDivision\Import\Product\Bundle\Repositories\SqlStatementRepository
35
{
36
37
    /**
38
     * The SQL statements.
39
     *
40
     * @var array
41
     */
42
    private $statements = array(
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
43
        SqlStatementKeys::CREATE_SEQUENCE_PRODUCT_BUNDLE_OPTION =>
44
            'INSERT INTO ${table:sequence_product_bundle_option} VALUES ()',
45
        SqlStatementKeys::CREATE_SEQUENCE_PRODUCT_BUNDLE_SELECTION =>
46
            'INSERT INTO ${table:sequence_product_bundle_selection} VALUES ()',
47
        SqlStatementKeys::UPDATE_PRODUCT_BUNDLE_OPTION =>
48
            'UPDATE ${table:catalog_product_bundle_option}
49
                SET ${column-values:catalog_product_bundle_option}
50
              WHERE option_id = :option_id
51
                AND parent_id = :parent_id',
52
        SqlStatementKeys::UPDATE_PRODUCT_BUNDLE_SELECTION =>
53
            'UPDATE ${table:catalog_product_bundle_selection}
54
                SET ${column-values:catalog_product_bundle_selection}
55
              WHERE selection_id = :selection_id
56
                AND parent_product_id = :parent_product_id',
57
    );
58
59
    /**
60
     * Initializes the SQL statement repository with the primary key and table prefix utility.
61
     *
62
     * @param \IteratorAggregate<\TechDivision\Import\Utils\SqlCompilerInterface> $compilers The array with the compiler instances
0 ignored issues
show
Documentation introduced by
The doc-type \IteratorAggregate<\Tech...s\SqlCompilerInterface> could not be parsed: Expected "|" or "end of type", but got "<" at position 18. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
63
     */
64
    public function __construct(\IteratorAggregate $compilers)
65
    {
66
67
        // pass primary key + table prefix utility to parent instance
68
        parent::__construct($compilers);
0 ignored issues
show
Unused Code introduced by
The call to SqlStatementRepository::__construct() has too many arguments starting with $compilers.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
69
70
        // compile the SQL statements
71
        $this->compile($this->statements);
0 ignored issues
show
Bug introduced by
The method compile() does not seem to exist on object<TechDivision\Impo...SqlStatementRepository>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
72
    }
73
}
74