These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /** |
||
4 | * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
||
5 | * @copyright Aimeos (aimeos.org), 2015-2018 |
||
6 | * @package MShop |
||
7 | * @subpackage Customer |
||
8 | */ |
||
9 | |||
10 | |||
11 | namespace Aimeos\MShop\Customer\Manager\Lists\Type; |
||
12 | |||
13 | |||
14 | /** |
||
15 | * Laravel implementation of the customer list type class. |
||
16 | * |
||
17 | * @package MShop |
||
18 | * @subpackage Customer |
||
19 | */ |
||
20 | class Laravel |
||
21 | extends \Aimeos\MShop\Customer\Manager\Lists\Type\Standard |
||
22 | { |
||
23 | private $searchConfig = array( |
||
0 ignored issues
–
show
Comprehensibility
introduced
by
Loading history...
|
|||
24 | 'customer.lists.type.id' => array( |
||
25 | 'code'=>'customer.lists.type.id', |
||
26 | 'internalcode'=>'lvulity."id"', |
||
27 | 'label'=>'Customer list type ID', |
||
28 | 'type'=> 'integer', |
||
29 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
||
30 | 'public' => false, |
||
31 | ), |
||
32 | 'customer.lists.type.siteid' => array( |
||
33 | 'code'=>'customer.lists.type.siteid', |
||
34 | 'internalcode'=>'lvulity."siteid"', |
||
35 | 'label'=>'Customer list type site ID', |
||
36 | 'type'=> 'integer', |
||
37 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
||
38 | 'public' => false, |
||
39 | ), |
||
40 | 'customer.lists.type.code' => array( |
||
41 | 'code'=>'customer.lists.type.code', |
||
42 | 'internalcode'=>'lvulity."code"', |
||
43 | 'label'=>'Customer list type code', |
||
44 | 'type'=> 'string', |
||
45 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
46 | ), |
||
47 | 'customer.lists.type.domain' => array( |
||
48 | 'code'=>'customer.lists.type.domain', |
||
49 | 'internalcode'=>'lvulity."domain"', |
||
50 | 'label'=>'Customer list type domain', |
||
51 | 'type'=> 'string', |
||
52 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
53 | ), |
||
54 | 'customer.lists.type.label' => array( |
||
55 | 'code'=>'customer.lists.type.label', |
||
56 | 'internalcode'=>'lvulity."label"', |
||
57 | 'label'=>'Customer list type label', |
||
58 | 'type'=> 'string', |
||
59 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
60 | ), |
||
61 | 'customer.lists.type.status' => array( |
||
62 | 'code'=>'customer.lists.type.status', |
||
63 | 'internalcode'=>'lvulity."status"', |
||
64 | 'label'=>'Customer list type status', |
||
65 | 'type'=> 'integer', |
||
66 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
||
67 | ), |
||
68 | 'customer.lists.type.position' => array( |
||
69 | 'code'=>'customer.lists.type.position', |
||
70 | 'internalcode'=>'lvulity."pos"', |
||
71 | 'label'=>'Customer list type position', |
||
72 | 'type'=> 'integer', |
||
73 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
||
74 | ), |
||
75 | 'customer.lists.type.ctime'=> array( |
||
76 | 'code'=>'customer.lists.type.ctime', |
||
77 | 'internalcode'=>'lvulity."ctime"', |
||
78 | 'label'=>'Customer list type create date/time', |
||
79 | 'type'=> 'datetime', |
||
80 | 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
81 | ), |
||
82 | 'customer.lists.type.mtime'=> array( |
||
83 | 'code'=>'customer.lists.type.mtime', |
||
84 | 'internalcode'=>'lvulity."mtime"', |
||
85 | 'label'=>'Customer list type modification date/time', |
||
86 | 'type'=> 'datetime', |
||
87 | 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
88 | ), |
||
89 | 'customer.lists.type.editor'=> array( |
||
90 | 'code'=>'customer.lists.type.editor', |
||
91 | 'internalcode'=>'lvulity."editor"', |
||
92 | 'label'=>'Customer list type editor', |
||
93 | 'type'=> 'string', |
||
94 | 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
95 | ), |
||
96 | ); |
||
97 | |||
98 | |||
99 | /** |
||
100 | * Removes old entries from the storage. |
||
101 | * |
||
102 | * @param array $siteids List of IDs for sites whose entries should be deleted |
||
103 | */ |
||
104 | View Code Duplication | public function cleanup( array $siteids ) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
105 | { |
||
106 | $path = 'mshop/customer/manager/lists/type/submanagers'; |
||
107 | foreach( $this->getContext()->getConfig()->get( $path, [] ) as $domain ) { |
||
108 | $this->getObject()->getSubManager( $domain )->cleanup( $siteids ); |
||
109 | } |
||
110 | |||
111 | $this->cleanupBase( $siteids, 'mshop/customer/manager/lists/type/laravel/delete' ); |
||
112 | } |
||
113 | |||
114 | |||
115 | /** |
||
116 | * Returns the list attributes that can be used for searching. |
||
117 | * |
||
118 | * @param boolean $withsub Return also attributes of sub-managers if true |
||
119 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
||
120 | */ |
||
121 | public function getSearchAttributes( $withsub = true ) |
||
122 | { |
||
123 | $path = 'mshop/customer/manager/lists/type/submanagers'; |
||
124 | |||
125 | return $this->getSearchAttributesBase( $this->searchConfig, $path, [], $withsub ); |
||
126 | } |
||
127 | |||
128 | |||
129 | /** |
||
130 | * Returns a new manager for customer extensions |
||
131 | * |
||
132 | * @param string $manager Name of the sub manager type in lower case |
||
133 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
||
134 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
||
135 | */ |
||
136 | public function getSubManager( $manager, $name = null ) |
||
137 | { |
||
138 | return $this->getSubManagerBase( 'customer', 'lists/type/' . $manager, ( $name === null ? 'Laravel' : $name ) ); |
||
139 | } |
||
140 | |||
141 | |||
142 | /** |
||
143 | * Returns the config path for retrieving the configuration values. |
||
144 | * |
||
145 | * @return string Configuration path (mshop/customer/manager/lists/type/laravel/) |
||
146 | */ |
||
147 | protected function getConfigPath() |
||
148 | { |
||
149 | return 'mshop/customer/manager/lists/type/laravel/'; |
||
150 | } |
||
151 | |||
152 | |||
153 | /** |
||
154 | * Returns the search configuration for searching items. |
||
155 | * |
||
156 | * @return array Associative list of search keys and search definitions |
||
157 | */ |
||
158 | protected function getSearchConfig() |
||
159 | { |
||
160 | return $this->searchConfig; |
||
161 | } |
||
162 | } |
||
163 |