Conditions | 4 |
Paths | 4 |
Total Lines | 54 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
45 | public function __construct( \Aimeos\MShop\ContextIface $context, array $mapping, |
||
46 | \Aimeos\Controller\Jobs\Common\Product\Import\Csv\Processor\Iface $object = null ) |
||
47 | { |
||
48 | parent::__construct( $context, $mapping, $object ); |
||
49 | |||
50 | $config = $context->config(); |
||
51 | |||
52 | /** controller/jobs/product/import/csv/price/listtypes |
||
53 | * Names of the product list types for prices that are updated or removed |
||
54 | * |
||
55 | * If you want to associate price items manually via the administration |
||
56 | * interface to products and don't want these to be touched during the |
||
57 | * import, you can specify the product list types for these prices |
||
58 | * that shouldn't be updated or removed. |
||
59 | * |
||
60 | * @param array|null List of product list type names or null for all |
||
61 | * @since 2015.05 |
||
62 | * @see controller/jobs/product/import/csv/domains |
||
63 | * @see controller/jobs/product/import/csv/separator |
||
64 | * @see controller/jobs/product/import/csv/attribute/listtypes |
||
65 | * @see controller/jobs/product/import/csv/catalog/listtypes |
||
66 | * @see controller/jobs/product/import/csv/media/listtypes |
||
67 | * @see controller/jobs/product/import/csv/product/listtypes |
||
68 | * @see controller/jobs/product/import/csv/supplier/listtypes |
||
69 | * @see controller/jobs/product/import/csv/text/listtypes |
||
70 | */ |
||
71 | $default = $config->get( 'controller/jobs/product/import/csv/processor/price/listtypes' ); |
||
72 | $this->listTypes = $config->get( 'controller/jobs/product/import/csv/price/listtypes', $default ); |
||
73 | |||
74 | if( $this->listTypes === null ) |
||
75 | { |
||
76 | $this->listTypes = []; |
||
77 | $manager = \Aimeos\MShop::create( $context, 'product/lists/type' ); |
||
78 | |||
79 | $search = $manager->filter()->slice( 0, 0x7fffffff ); |
||
80 | $search->setConditions( $search->compare( '==', 'product.lists.type.domain', 'price' ) ); |
||
81 | |||
82 | foreach( $manager->search( $search ) as $item ) { |
||
83 | $this->listTypes[$item->getCode()] = $item->getCode(); |
||
84 | } |
||
85 | } |
||
86 | else |
||
87 | { |
||
88 | $this->listTypes = array_combine( $this->listTypes, $this->listTypes ); |
||
89 | } |
||
90 | |||
91 | |||
92 | $manager = \Aimeos\MShop::create( $context, 'price/type' ); |
||
93 | |||
94 | $search = $manager->filter()->slice( 0, 0x7fffffff ); |
||
95 | $search->setConditions( $search->compare( '==', 'price.type.domain', 'product' ) ); |
||
96 | |||
97 | foreach( $manager->search( $search ) as $item ) { |
||
98 | $this->types[$item->getCode()] = $item->getCode(); |
||
99 | } |
||
192 |
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.