| Conditions | 4 |
| Paths | 4 |
| Total Lines | 56 |
| 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 |
||
| 47 | public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $mapping, |
||
| 48 | \Aimeos\Controller\Common\Product\Import\Csv\Processor\Iface $object = null ) |
||
| 49 | { |
||
| 50 | parent::__construct( $context, $mapping, $object ); |
||
| 51 | |||
| 52 | /** controller/common/product/import/csv/processor/attribute/listtypes |
||
| 53 | * Names of the product list types for attributes that are updated or removed |
||
| 54 | * |
||
| 55 | * If you want to associate attribute 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 attributes |
||
| 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 | * @category Developer |
||
| 63 | * @category User |
||
| 64 | * @see controller/common/product/import/csv/domains |
||
| 65 | * @see controller/common/product/import/csv/processor/catalog/listtypes |
||
| 66 | * @see controller/common/product/import/csv/processor/media/listtypes |
||
| 67 | * @see controller/common/product/import/csv/processor/product/listtypes |
||
| 68 | * @see controller/common/product/import/csv/processor/price/listtypes |
||
| 69 | * @see controller/common/product/import/csv/processor/text/listtypes |
||
| 70 | */ |
||
| 71 | $key = 'controller/common/product/import/csv/processor/attribute/listtypes'; |
||
| 72 | $this->listTypes = $context->getConfig()->get( $key ); |
||
| 73 | |||
| 74 | if( $this->listTypes === null ) |
||
| 75 | { |
||
| 76 | $this->listTypes = []; |
||
| 77 | $manager = \Aimeos\MShop::create( $context, 'product/lists/type' ); |
||
| 78 | |||
| 79 | $search = $manager->createSearch()->setSlice( 0, 0x7fffffff ); |
||
| 80 | $search->setConditions( $search->compare( '==', 'product.lists.type.domain', 'attribute' ) ); |
||
| 81 | |||
| 82 | foreach( $manager->searchItems( $search ) as $item ) { |
||
| 83 | $this->listTypes[$item->getCode()] = $item->getCode(); |
||
|
1 ignored issue
–
show
|
|||
| 84 | } |
||
| 85 | } |
||
| 86 | else |
||
| 87 | { |
||
| 88 | $this->listTypes = array_flip( $this->listTypes ); |
||
| 89 | } |
||
| 90 | |||
| 91 | |||
| 92 | $manager = \Aimeos\MShop::create( $context, 'attribute/type' ); |
||
| 93 | |||
| 94 | $search = $manager->createSearch()->setSlice( 0, 0x7fffffff ); |
||
| 95 | $search->setConditions( $search->compare( '==', 'attribute.type.domain', 'product' ) ); |
||
| 96 | |||
| 97 | foreach( $manager->searchItems( $search ) as $item ) { |
||
| 98 | $this->types[$item->getCode()] = $item->getCode(); |
||
| 99 | } |
||
| 100 | |||
| 101 | |||
| 102 | $this->cache = $this->getCache( 'attribute' ); |
||
| 103 | } |
||
| 224 |