Conditions | 4 |
Paths | 4 |
Total Lines | 52 |
Code Lines | 17 |
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 |
||
46 | public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
||
47 | \Aimeos\Controller\Common\Catalog\Import\Csv\Processor\Iface $object = null ) |
||
48 | { |
||
49 | parent::__construct( $context, $mapping, $object ); |
||
50 | |||
51 | /** controller/common/catalog/import/csv/processor/text/listtypes |
||
52 | * Names of the catalog list types for texts that are updated or removed |
||
53 | * |
||
54 | * If you want to associate text items manually via the administration |
||
55 | * interface to catalogs and don't want these to be touched during the |
||
56 | * import, you can specify the catalog list types for these texts |
||
57 | * that shouldn't be updated or removed. |
||
58 | * |
||
59 | * @param array|null List of catalog list type names or null for all |
||
60 | * @since 2018.04 |
||
61 | * @category Developer |
||
62 | * @category User |
||
63 | * @see controller/common/catalog/import/csv/domains |
||
64 | * @see controller/common/catalog/import/csv/processor/attribute/listtypes |
||
65 | * @see controller/common/catalog/import/csv/processor/catalog/listtypes |
||
66 | * @see controller/common/catalog/import/csv/processor/media/listtypes |
||
67 | * @see controller/common/catalog/import/csv/processor/price/listtypes |
||
68 | * @see controller/common/catalog/import/csv/processor/catalog/listtypes |
||
69 | */ |
||
70 | $key = 'controller/common/catalog/import/csv/processor/text/listtypes'; |
||
71 | $this->listTypes = $context->getConfig()->get( $key ); |
||
72 | |||
73 | if( $this->listTypes === null ) |
||
74 | { |
||
75 | $this->listTypes = []; |
||
76 | $manager = \Aimeos\MShop::create( $context, 'catalog/lists/type' ); |
||
77 | |||
78 | $search = $manager->createSearch()->setSlice( 0, 0x7fffffff ); |
||
79 | $search->setConditions( $search->compare( '==', 'catalog.lists.type.domain', 'text' ) ); |
||
80 | |||
81 | foreach( $manager->searchItems( $search ) as $item ) { |
||
82 | $this->listTypes[$item->getCode()] = $item->getCode(); |
||
1 ignored issue
–
show
|
|||
83 | } |
||
84 | } |
||
85 | else |
||
86 | { |
||
87 | $this->listTypes = array_flip( $this->listTypes ); |
||
88 | } |
||
89 | |||
90 | |||
91 | $manager = \Aimeos\MShop::create( $context, 'text/type' ); |
||
92 | |||
93 | $search = $manager->createSearch()->setSlice( 0, 0x7fffffff ); |
||
94 | $search->setConditions( $search->compare( '==', 'text.type.domain', 'catalog' ) ); |
||
95 | |||
96 | foreach( $manager->searchItems( $search ) as $item ) { |
||
97 | $this->types[$item->getCode()] = $item->getCode(); |
||
98 | } |
||
188 |