Completed
Push — master ( 55ea8c...269c8b )
by Aimeos
01:28
created
lib/custom/src/MShop/Customer/Manager/Group/Ezpublish.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @param integer[] $siteids List of IDs for sites whose entries should be deleted
74 74
 	 */
75
-	public function cleanup( array $siteids )
75
+	public function cleanup(array $siteids)
76 76
 	{
77 77
 	}
78 78
 
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 	 *
83 83
 	 * @param array $ids List of IDs
84 84
 	 */
85
-	public function deleteItems( array $ids )
85
+	public function deleteItems(array $ids)
86 86
 	{
87
-		throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Deleting groups is not supported, please use the eZ Publish backend' ) );
87
+		throw new \Aimeos\MShop\Customer\Exception(sprintf('Deleting groups is not supported, please use the eZ Publish backend'));
88 88
 	}
89 89
 
90 90
 
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
 	 * @param boolean $withsub Return also attributes of sub-managers if true
95 95
 	 * @return array Returns a list of attribtes implementing \Aimeos\MW\Criteria\Attribute\Iface
96 96
 	 */
97
-	public function getSearchAttributes( $withsub = true )
97
+	public function getSearchAttributes($withsub = true)
98 98
 	{
99 99
 		$path = 'mshop/customer/manager/group/submanagers';
100 100
 
101
-		return $this->getSearchAttributesBase( $this->searchConfig, $path, [], $withsub );
101
+		return $this->getSearchAttributesBase($this->searchConfig, $path, [], $withsub);
102 102
 	}
103 103
 
104 104
 
@@ -109,9 +109,9 @@  discard block
 block discarded – undo
109 109
 	 * @param string|null $name Name of the implementation, will be from configuration (or Default) if null
110 110
 	 * @return \Aimeos\MShop\Common\Manager\Iface Manager for different extensions
111 111
 	 */
112
-	public function getSubManager( $manager, $name = null )
112
+	public function getSubManager($manager, $name = null)
113 113
 	{
114
-		return $this->getSubManagerBase( 'customer/group', $manager, ( $name === null ? 'Ezpublish' : $name ) );
114
+		return $this->getSubManagerBase('customer/group', $manager, ($name === null ? 'Ezpublish' : $name));
115 115
 	}
116 116
 
117 117
 
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 	 * @param \Aimeos\MShop\Customer\Item\Group\Iface $item Customer group item
122 122
 	 * @param boolean $fetch True if the new ID should be returned in the item
123 123
 	 */
124
-	public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true )
124
+	public function saveItem(\Aimeos\MShop\Common\Item\Iface $item, $fetch = true)
125 125
 	{
126
-		throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Saving groups is not supported, please use the eZ Publish backend' ) );
126
+		throw new \Aimeos\MShop\Customer\Exception(sprintf('Saving groups is not supported, please use the eZ Publish backend'));
127 127
 	}
128 128
 
129 129
 
@@ -136,33 +136,33 @@  discard block
 block discarded – undo
136 136
 	 * @return array List of items implementing \Aimeos\MShop\Customer\Item\Group\Iface
137 137
 	 * @throws \Aimeos\MShop\Exception If retrieving items failed
138 138
 	 */
139
-	public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null )
139
+	public function searchItems(\Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null)
140 140
 	{
141 141
 		$map = [];
142 142
 		$context = $this->getContext();
143 143
 
144 144
 		$dbm = $context->getDatabaseManager();
145 145
 		$dbname = $this->getResourceName();
146
-		$conn = $dbm->acquire( $dbname );
146
+		$conn = $dbm->acquire($dbname);
147 147
 
148 148
 		try
149 149
 		{
150
-			$required = array( 'customer.group' );
150
+			$required = array('customer.group');
151 151
 			$level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL;
152 152
 			$cfgPathSearch = 'mshop/customer/manager/group/ezpublish/search';
153 153
 			$cfgPathCount = 'mshop/customer/manager/group/ezpublish/count';
154 154
 
155
-			$results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level );
155
+			$results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level);
156 156
 
157
-			while( ( $row = $results->fetch() ) !== false ) {
158
-				$map[$row['customer.group.id']] = $this->createItemBase( $row );
157
+			while (($row = $results->fetch()) !== false) {
158
+				$map[$row['customer.group.id']] = $this->createItemBase($row);
159 159
 			}
160 160
 
161
-			$dbm->release( $conn, $dbname );
161
+			$dbm->release($conn, $dbname);
162 162
 		}
163
-		catch( \Exception $e )
163
+		catch (\Exception $e)
164 164
 		{
165
-			$dbm->release( $conn, $dbname );
165
+			$dbm->release($conn, $dbname);
166 166
 			throw $e;
167 167
 		}
168 168
 
Please login to merge, or discard this patch.
lib/custom/src/MShop/Customer/Manager/Lists/Type/Ezpublish.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 		'customer.lists.type.id' => array(
26 26
 			'code'=>'customer.lists.type.id',
27 27
 			'internalcode'=>'ezulity."id"',
28
-			'internaldeps'=>array( 'LEFT JOIN "ezuser_list_type" AS ezulity ON ( ezuli."typeid" = ezulity."id" )' ),
28
+			'internaldeps'=>array('LEFT JOIN "ezuser_list_type" AS ezulity ON ( ezuli."typeid" = ezulity."id" )'),
29 29
 			'label'=>'Customer list type ID',
30 30
 			'type'=> 'integer',
31 31
 			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
@@ -96,14 +96,14 @@  discard block
 block discarded – undo
96 96
 	 *
97 97
 	 * @param array $siteids List of IDs for sites whose entries should be deleted
98 98
 	 */
99
-	public function cleanup( array $siteids )
99
+	public function cleanup(array $siteids)
100 100
 	{
101 101
 		$path = 'mshop/customer/manager/lists/type/submanagers';
102
-		foreach( $this->getContext()->getConfig()->get( $path, [] ) as $domain ) {
103
-			$this->getObject()->getSubManager( $domain )->cleanup( $siteids );
102
+		foreach ($this->getContext()->getConfig()->get($path, []) as $domain) {
103
+			$this->getObject()->getSubManager($domain)->cleanup($siteids);
104 104
 		}
105 105
 
106
-		$this->cleanupBase( $siteids, $this->getConfigPath() . 'delete' );
106
+		$this->cleanupBase($siteids, $this->getConfigPath().'delete');
107 107
 	}
108 108
 
109 109
 
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
 	 * @param boolean $withsub Return also attributes of sub-managers if true
114 114
 	 * @return array Returns a list of attribtes implementing \Aimeos\MW\Criteria\Attribute\Iface
115 115
 	 */
116
-	public function getSearchAttributes( $withsub = true )
116
+	public function getSearchAttributes($withsub = true)
117 117
 	{
118 118
 		$path = 'mshop/customer/manager/lists/type/submanagers';
119 119
 
120
-		return $this->getSearchAttributesBase( $this->getSearchConfig(), $path, [], $withsub );
120
+		return $this->getSearchAttributesBase($this->getSearchConfig(), $path, [], $withsub);
121 121
 	}
122 122
 
123 123
 
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 	 * @param string|null $name Name of the implementation, will be from configuration (or Default) if null
129 129
 	 * @return mixed Manager for different extensions, e.g stock, tags, locations, etc.
130 130
 	 */
131
-	public function getSubManager( $manager, $name = null )
131
+	public function getSubManager($manager, $name = null)
132 132
 	{
133
-		return $this->getSubManagerBase( 'customer', 'lists/type/' . $manager, ( $name === null ? 'Ezpublish' : $name ) );
133
+		return $this->getSubManagerBase('customer', 'lists/type/'.$manager, ($name === null ? 'Ezpublish' : $name));
134 134
 	}
135 135
 
136 136
 
Please login to merge, or discard this patch.
lib/custom/src/MShop/Customer/Manager/Address/Ezpublish.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 			'label' => 'Customer address ID',
27 27
 			'code' => 'customer.address.id',
28 28
 			'internalcode' => 'ezuad."id"',
29
-			'internaldeps' => array( 'LEFT JOIN "ezuser_address" AS ezuad ON ( ezu."contentobject_id" = ezuad."parentid" )' ),
29
+			'internaldeps' => array('LEFT JOIN "ezuser_address" AS ezuad ON ( ezu."contentobject_id" = ezuad."parentid" )'),
30 30
 			'type' => 'integer',
31 31
 			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
32 32
 			'public' => false,
@@ -209,14 +209,14 @@  discard block
 block discarded – undo
209 209
 	 *
210 210
 	 * @param array $siteids List of IDs for sites whose entries should be deleted
211 211
 	 */
212
-	public function cleanup( array $siteids )
212
+	public function cleanup(array $siteids)
213 213
 	{
214 214
 		$path = 'mshop/customer/manager/address/submanagers';
215
-		foreach( $this->getContext()->getConfig()->get( $path, [] ) as $domain ) {
216
-			$this->getObject()->getSubManager( $domain )->cleanup( $siteids );
215
+		foreach ($this->getContext()->getConfig()->get($path, []) as $domain) {
216
+			$this->getObject()->getSubManager($domain)->cleanup($siteids);
217 217
 		}
218 218
 
219
-		$this->cleanupBase( $siteids, 'mshop/customer/manager/lists/ezpublish/delete' );
219
+		$this->cleanupBase($siteids, 'mshop/customer/manager/lists/ezpublish/delete');
220 220
 	}
221 221
 
222 222
 
@@ -226,11 +226,11 @@  discard block
 block discarded – undo
226 226
 	 * @param boolean $withsub Return also attributes of sub-managers if true
227 227
 	 * @return array Returns a list of attribtes implementing \Aimeos\MW\Criteria\Attribute\Iface
228 228
 	 */
229
-	public function getSearchAttributes( $withsub = true )
229
+	public function getSearchAttributes($withsub = true)
230 230
 	{
231 231
 		$path = 'mshop/customer/manager/address/submanagers';
232 232
 
233
-		return $this->getSearchAttributesBase( $this->getSearchConfig(), $path, [], $withsub );
233
+		return $this->getSearchAttributesBase($this->getSearchConfig(), $path, [], $withsub);
234 234
 	}
235 235
 
236 236
 
@@ -241,9 +241,9 @@  discard block
 block discarded – undo
241 241
 	 * @param string|null $name Name of the implementation, will be from configuration (or Default) if null
242 242
 	 * @return mixed Manager for different extensions, e.g stock, tags, locations, etc.
243 243
 	 */
244
-	public function getSubManager( $manager, $name = null )
244
+	public function getSubManager($manager, $name = null)
245 245
 	{
246
-		return $this->getSubManagerBase( 'customer', 'address/' . $manager, ( $name === null ? 'Ezpublish' : $name ) );
246
+		return $this->getSubManagerBase('customer', 'address/'.$manager, ($name === null ? 'Ezpublish' : $name));
247 247
 	}
248 248
 
249 249
 
Please login to merge, or discard this patch.
lib/custom/src/MShop/Customer/Manager/Property/Ezpublish.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 		'customer.property.id' => array(
25 25
 			'code' => 'customer.property.id',
26 26
 			'internalcode' => 'ezppr."id"',
27
-			'internaldeps'=>array( 'LEFT JOIN "ezp_user_property" AS ezppr ON ( ezppr."parentid" = ezp."id" )' ),
27
+			'internaldeps'=>array('LEFT JOIN "ezp_user_property" AS ezppr ON ( ezppr."parentid" = ezp."id" )'),
28 28
 			'label' => 'Property ID',
29 29
 			'type' => 'integer',
30 30
 			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 * @param integer[] $siteids List of IDs for sites whose entries should be deleted
102 102
 	 */
103
-	public function cleanup( array $siteids )
103
+	public function cleanup(array $siteids)
104 104
 	{
105 105
 		$path = 'mshop/customer/manager/property/submanagers';
106
-		foreach( $this->getContext()->getConfig()->get( $path, [] ) as $domain ) {
107
-			$this->getObject()->getSubManager( $domain )->cleanup( $siteids );
106
+		foreach ($this->getContext()->getConfig()->get($path, []) as $domain) {
107
+			$this->getObject()->getSubManager($domain)->cleanup($siteids);
108 108
 		}
109 109
 
110
-		$this->cleanupBase( $siteids, 'mshop/customer/manager/property/ezpublish/delete' );
110
+		$this->cleanupBase($siteids, 'mshop/customer/manager/property/ezpublish/delete');
111 111
 	}
112 112
 
113 113
 
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
 	 * @param boolean $withsub Return also attributes of sub-managers if true
118 118
 	 * @return array Returns a list of attribtes implementing \Aimeos\MW\Criteria\Attribute\Iface
119 119
 	 */
120
-	public function getSearchAttributes( $withsub = true )
120
+	public function getSearchAttributes($withsub = true)
121 121
 	{
122 122
 		$path = 'mshop/customer/manager/property/submanagers';
123 123
 
124
-		return $this->getSearchAttributesBase( $this->searchConfig, $path, ['type'], $withsub );
124
+		return $this->getSearchAttributesBase($this->searchConfig, $path, ['type'], $withsub);
125 125
 	}
126 126
 
127 127
 
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
 	 * configuration (or Default) if null
134 134
 	 * @return \Aimeos\MShop\Common\Manager\Iface Manager for different extensions, e.g property types, property lists etc.
135 135
 	 */
136
-	public function getSubManager( $manager, $name = null )
136
+	public function getSubManager($manager, $name = null)
137 137
 	{
138
-		return $this->getSubManagerBase( 'customer', 'property/' . $manager, ( $name === null ? 'Ezpublish' : $name ) );
138
+		return $this->getSubManagerBase('customer', 'property/'.$manager, ($name === null ? 'Ezpublish' : $name));
139 139
 	}
140 140
 
141 141
 
Please login to merge, or discard this patch.
lib/custom/src/MShop/Customer/Manager/Property/Type/Ezpublish.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 		'customer.property.type.id' => array(
25 25
 			'code' => 'customer.property.type.id',
26 26
 			'internalcode' => 'ezpprty."id"',
27
-			'internaldeps' => array( 'LEFT JOIN "ezp_user_property_type" AS ezpprty ON ( ezppr."typeid" = ezpprty."id" )' ),
27
+			'internaldeps' => array('LEFT JOIN "ezp_user_property_type" AS ezpprty ON ( ezppr."typeid" = ezpprty."id" )'),
28 28
 			'label' => 'Property type ID',
29 29
 			'type' => 'integer',
30 30
 			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
 	 *
106 106
 	 * @param array $siteids List of IDs for sites whose entries should be deleted
107 107
 	 */
108
-	public function cleanup( array $siteids )
108
+	public function cleanup(array $siteids)
109 109
 	{
110 110
 		$path = 'mshop/customer/manager/property/type/submanagers';
111
-		foreach( $this->getContext()->getConfig()->get( $path, [] ) as $domain ) {
112
-			$this->getObject()->getSubManager( $domain )->cleanup( $siteids );
111
+		foreach ($this->getContext()->getConfig()->get($path, []) as $domain) {
112
+			$this->getObject()->getSubManager($domain)->cleanup($siteids);
113 113
 		}
114 114
 
115
-		$this->cleanupBase( $siteids, 'mshop/customer/manager/property/type/ezpublish/delete' );
115
+		$this->cleanupBase($siteids, 'mshop/customer/manager/property/type/ezpublish/delete');
116 116
 	}
117 117
 
118 118
 
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
 	 * @param boolean $withsub Return also attributes of sub-managers if true
123 123
 	 * @return array Returns a list of attribtes implementing \Aimeos\MW\Criteria\Attribute\Iface
124 124
 	 */
125
-	public function getSearchAttributes( $withsub = true )
125
+	public function getSearchAttributes($withsub = true)
126 126
 	{
127 127
 		$path = 'mshop/customer/manager/property/type/submanagers';
128 128
 
129
-		return $this->getSearchAttributesBase( $this->searchConfig, $path, [], $withsub );
129
+		return $this->getSearchAttributesBase($this->searchConfig, $path, [], $withsub);
130 130
 	}
131 131
 
132 132
 
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
 	 * @param string|null $name Name of the implementation, will be from configuration (or Default) if null
138 138
 	 * @return \Aimeos\MShop\Common\Manager\Iface Manager for different extensions, e.g types, lists etc.
139 139
 	 */
140
-	public function getSubManager( $manager, $name = null )
140
+	public function getSubManager($manager, $name = null)
141 141
 	{
142
-		return $this->getSubManagerBase( 'customer', 'property/type/' . $manager, ( $name === null ? 'Ezpublish' : $name ) );
142
+		return $this->getSubManagerBase('customer', 'property/type/'.$manager, ($name === null ? 'Ezpublish' : $name));
143 143
 	}
144 144
 
145 145
 
Please login to merge, or discard this patch.
lib/custom/tests/MShop/Customer/Manager/Lists/EzpublishTest.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -16,57 +16,57 @@
 block discarded – undo
16 16
 
17 17
 	protected function setUp()
18 18
 	{
19
-		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( \TestHelper::getContext(), 'Ezpublish' );
20
-		$this->object = $manager->getSubManager( 'lists', 'Ezpublish' );
19
+		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager(\TestHelper::getContext(), 'Ezpublish');
20
+		$this->object = $manager->getSubManager('lists', 'Ezpublish');
21 21
 	}
22 22
 
23 23
 
24 24
 	protected function tearDown()
25 25
 	{
26
-		unset( $this->object );
26
+		unset($this->object);
27 27
 	}
28 28
 
29 29
 
30 30
 	public function testCleanup()
31 31
 	{
32
-		$this->object->cleanup( array( -1 ) );
32
+		$this->object->cleanup(array( -1 ));
33 33
 	}
34 34
 
35 35
 
36 36
 	public function testGetSearchAttributes()
37 37
 	{
38 38
 		$attributes = $this->object->getSearchAttributes();
39
-		$this->assertGreaterThan( 0, count( $attributes ) );
39
+		$this->assertGreaterThan(0, count($attributes));
40 40
 
41
-		foreach( $attributes as $attribute ) {
42
-			$this->assertInstanceOf( '\Aimeos\MW\Criteria\Attribute\Iface', $attribute );
41
+		foreach ($attributes as $attribute) {
42
+			$this->assertInstanceOf('\Aimeos\MW\Criteria\Attribute\Iface', $attribute);
43 43
 		}
44 44
 	}
45 45
 
46 46
 
47 47
 	public function testGetSubManager()
48 48
 	{
49
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type') );
50
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard') );
49
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type'));
50
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard'));
51 51
 
52
-		$this->setExpectedException( '\\Aimeos\\MShop\\Exception' );
53
-		$this->object->getSubManager( 'unknown' );
52
+		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
53
+		$this->object->getSubManager('unknown');
54 54
 	}
55 55
 
56 56
 
57 57
 	public function testSaveItemInvalidItem()
58 58
 	{
59
-		$this->setExpectedException( '\Aimeos\MW\Common\Exception' );
60
-		$this->object->saveItem( new \Aimeos\MShop\Common\Item\Type\Standard( 'common.lists.type.' ) );
59
+		$this->setExpectedException('\Aimeos\MW\Common\Exception');
60
+		$this->object->saveItem(new \Aimeos\MShop\Common\Item\Type\Standard('common.lists.type.'));
61 61
 	}
62 62
 
63 63
 
64 64
 	public function testSaveItemInvalidDomain()
65 65
 	{
66 66
 		$item = $this->object->createItem();
67
-		$item->setDomain( 'customer/group' );
67
+		$item->setDomain('customer/group');
68 68
 
69
-		$this->setExpectedException( '\Aimeos\MShop\Customer\Exception' );
70
-		$this->object->saveItem( $item );
69
+		$this->setExpectedException('\Aimeos\MShop\Customer\Exception');
70
+		$this->object->saveItem($item);
71 71
 	}
72 72
 }
Please login to merge, or discard this patch.
lib/custom/tests/MShop/Customer/Manager/Property/EzpublishTest.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -16,47 +16,47 @@
 block discarded – undo
16 16
 
17 17
 	protected function setUp()
18 18
 	{
19
-		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( \TestHelper::getContext(), 'Ezpublish' );
20
-		$this->object = $manager->getSubManager( 'property', 'Ezpublish' );
19
+		$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager(\TestHelper::getContext(), 'Ezpublish');
20
+		$this->object = $manager->getSubManager('property', 'Ezpublish');
21 21
 	}
22 22
 
23 23
 
24 24
 	protected function tearDown()
25 25
 	{
26
-		unset( $this->object );
26
+		unset($this->object);
27 27
 	}
28 28
 
29 29
 
30 30
 	public function testCleanup()
31 31
 	{
32
-		$this->object->cleanup( array( -1 ) );
32
+		$this->object->cleanup(array( -1 ));
33 33
 	}
34 34
 
35 35
 
36 36
 	public function testGetSearchAttributes()
37 37
 	{
38 38
 		$attributes = $this->object->getSearchAttributes();
39
-		$this->assertGreaterThan( 0, count( $attributes ) );
39
+		$this->assertGreaterThan(0, count($attributes));
40 40
 
41
-		foreach( $attributes as $attribute ) {
42
-			$this->assertInstanceOf( '\Aimeos\MW\Criteria\Attribute\Iface', $attribute );
41
+		foreach ($attributes as $attribute) {
42
+			$this->assertInstanceOf('\Aimeos\MW\Criteria\Attribute\Iface', $attribute);
43 43
 		}
44 44
 	}
45 45
 
46 46
 
47 47
 	public function testGetSubManager()
48 48
 	{
49
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type') );
50
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard') );
49
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type'));
50
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard'));
51 51
 
52
-		$this->setExpectedException( '\\Aimeos\\MShop\\Exception' );
53
-		$this->object->getSubManager( 'unknown' );
52
+		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
53
+		$this->object->getSubManager('unknown');
54 54
 	}
55 55
 
56 56
 
57 57
 	public function testSaveItemInvalidItem()
58 58
 	{
59
-		$this->setExpectedException( '\Aimeos\MW\Common\Exception' );
60
-		$this->object->saveItem( new \Aimeos\MShop\Common\Item\Type\Standard( 'common.property.type.' ) );
59
+		$this->setExpectedException('\Aimeos\MW\Common\Exception');
60
+		$this->object->saveItem(new \Aimeos\MShop\Common\Item\Type\Standard('common.property.type.'));
61 61
 	}
62 62
 }
Please login to merge, or discard this patch.
lib/custom/src/MShop/Customer/Manager/Lists/Ezpublish.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 		'customer.lists.id'=> array(
26 26
 			'code'=>'customer.lists.id',
27 27
 			'internalcode'=>'ezuli."id"',
28
-			'internaldeps' => array( 'LEFT JOIN "ezuser_list" AS ezuli ON ( ezu."id" = ezuli."parentid" )' ),
28
+			'internaldeps' => array('LEFT JOIN "ezuser_list" AS ezuli ON ( ezu."id" = ezuli."parentid" )'),
29 29
 			'label'=>'Customer list ID',
30 30
 			'type'=> 'integer',
31 31
 			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_INT,
@@ -133,14 +133,14 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @param array $siteids List of IDs for sites whose entries should be deleted
135 135
 	 */
136
-	public function cleanup( array $siteids )
136
+	public function cleanup(array $siteids)
137 137
 	{
138 138
 		$path = 'mshop/customer/manager/lists/submanagers';
139
-		foreach( $this->getContext()->getConfig()->get( $path, array( 'type' ) ) as $domain ) {
140
-			$this->getObject()->getSubManager( $domain )->cleanup( $siteids );
139
+		foreach ($this->getContext()->getConfig()->get($path, array('type')) as $domain) {
140
+			$this->getObject()->getSubManager($domain)->cleanup($siteids);
141 141
 		}
142 142
 
143
-		$this->cleanupBase( $siteids, $this->getConfigPath() . 'delete' );
143
+		$this->cleanupBase($siteids, $this->getConfigPath().'delete');
144 144
 	}
145 145
 
146 146
 
@@ -150,11 +150,11 @@  discard block
 block discarded – undo
150 150
 	 * @param boolean $withsub Return also attributes of sub-managers if true
151 151
 	 * @return array Returns a list of attribtes implementing \Aimeos\MW\Criteria\Attribute\Iface
152 152
 	 */
153
-	public function getSearchAttributes( $withsub = true )
153
+	public function getSearchAttributes($withsub = true)
154 154
 	{
155 155
 		$path = 'mshop/customer/manager/lists/submanagers';
156 156
 
157
-		return $this->getSearchAttributesBase( $this->getSearchConfig(), $path, ['type'], $withsub );
157
+		return $this->getSearchAttributesBase($this->getSearchConfig(), $path, ['type'], $withsub);
158 158
 	}
159 159
 
160 160
 
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 	 * @param string|null $name Name of the implementation, will be from configuration (or Default) if null
166 166
 	 * @return mixed Manager for different extensions, e.g stock, tags, locations, etc.
167 167
 	 */
168
-	public function getSubManager( $manager, $name = null )
168
+	public function getSubManager($manager, $name = null)
169 169
 	{
170
-		return $this->getSubManagerBase( 'customer', 'lists/' . $manager, ( $name === null ? 'Ezpublish' : $name ) );
170
+		return $this->getSubManagerBase('customer', 'lists/'.$manager, ($name === null ? 'Ezpublish' : $name));
171 171
 	}
172 172
 
173 173
 
@@ -177,15 +177,15 @@  discard block
 block discarded – undo
177 177
 	 * @param \Aimeos\MShop\Common\Item\Lists\Iface $item List item object which should be saved
178 178
 	 * @param boolean $fetch True if the new ID should be returned in the item
179 179
 	 */
180
-	public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true )
180
+	public function saveItem(\Aimeos\MShop\Common\Item\Iface $item, $fetch = true)
181 181
 	{
182
-		self::checkClass( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $item );
182
+		self::checkClass('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $item);
183 183
 
184
-		if( $item->getDomain() === 'customer/group' ) {
185
-			throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Adding groups to customers is not supported, please use the eZ Publish backend' ) );
184
+		if ($item->getDomain() === 'customer/group') {
185
+			throw new \Aimeos\MShop\Customer\Exception(sprintf('Adding groups to customers is not supported, please use the eZ Publish backend'));
186 186
 		}
187 187
 
188
-		parent::saveItem( $item, $fetch );
188
+		parent::saveItem($item, $fetch);
189 189
 	}
190 190
 
191 191
 
Please login to merge, or discard this patch.
lib/custom/src/MShop/Customer/Manager/Ezpublish.php 1 patch
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
 	 *
229 229
 	 * @param array $siteids List of IDs for sites whose entries should be deleted
230 230
 	 */
231
-	public function cleanup( array $siteids )
231
+	public function cleanup(array $siteids)
232 232
 	{
233 233
 		$path = 'mshop/customer/manager/submanagers';
234
-		foreach( $this->getContext()->getConfig()->get( $path, ['address', 'group', 'lists', 'property'] ) as $domain ) {
235
-			$this->getObject()->getSubManager( $domain )->cleanup( $siteids );
234
+		foreach ($this->getContext()->getConfig()->get($path, ['address', 'group', 'lists', 'property']) as $domain) {
235
+			$this->getObject()->getSubManager($domain)->cleanup($siteids);
236 236
 		}
237 237
 	}
238 238
 
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
 	 *
243 243
 	 * @param array $ids List of IDs
244 244
 	 */
245
-	public function deleteItems( array $ids )
245
+	public function deleteItems(array $ids)
246 246
 	{
247 247
 		$service = $this->getContext()->getEzUserService();
248 248
 
249
-		foreach( $ids as $id ) {
250
-			$service->deleteUser( $service->loadUser( $id ) );
249
+		foreach ($ids as $id) {
250
+			$service->deleteUser($service->loadUser($id));
251 251
 		}
252 252
 	}
253 253
 
@@ -258,11 +258,11 @@  discard block
 block discarded – undo
258 258
 	 * @param boolean $withsub Return also attributes of sub-managers if true
259 259
 	 * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface
260 260
 	 */
261
-	public function getSearchAttributes( $withsub = true )
261
+	public function getSearchAttributes($withsub = true)
262 262
 	{
263 263
 		$path = 'mshop/customer/manager/submanagers';
264 264
 
265
-		return $this->getSearchAttributesBase( $this->searchConfig, $path, ['address', 'group', 'lists', 'property'], $withsub );
265
+		return $this->getSearchAttributesBase($this->searchConfig, $path, ['address', 'group', 'lists', 'property'], $withsub);
266 266
 	}
267 267
 
268 268
 
@@ -273,9 +273,9 @@  discard block
 block discarded – undo
273 273
 	 * @param string|null $name Name of the implementation, will be from configuration (or Default) if null
274 274
 	 * @return mixed Manager for different extensions, e.g stock, tags, locations, etc.
275 275
 	 */
276
-	public function getSubManager( $manager, $name = null )
276
+	public function getSubManager($manager, $name = null)
277 277
 	{
278
-		return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'Ezpublish' : $name ) );
278
+		return $this->getSubManagerBase('customer', $manager, ($name === null ? 'Ezpublish' : $name));
279 279
 	}
280 280
 
281 281
 
@@ -286,96 +286,96 @@  discard block
 block discarded – undo
286 286
 	 * @param boolean $fetch True if the new ID should be returned in the item
287 287
 	 * @return \Aimeos\MShop\Common\Item\Iface $item Updated item including the generated ID
288 288
 	 */
289
-	public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true )
289
+	public function saveItem(\Aimeos\MShop\Common\Item\Iface $item, $fetch = true)
290 290
 	{
291
-		self::checkClass( '\\Aimeos\\MShop\\Customer\\Item\\Iface', $item );
291
+		self::checkClass('\\Aimeos\\MShop\\Customer\\Item\\Iface', $item);
292 292
 
293
-		if( !$item->isModified() )
293
+		if (!$item->isModified())
294 294
 		{
295
-			$item = $this->savePropertyItems( $item, 'customer' );
296
-			$item = $this->saveAddressItems( $item, 'customer' );
297
-			return $this->saveListItems( $item, 'customer' );
295
+			$item = $this->savePropertyItems($item, 'customer');
296
+			$item = $this->saveAddressItems($item, 'customer');
297
+			return $this->saveListItems($item, 'customer');
298 298
 		}
299 299
 
300 300
 		$context = $this->getContext();
301 301
 
302 302
 		$class = '\Aimeos\MShop\Context\Item\Ezpublish';
303
-		if( !is_a( $context, $class ) ) {
304
-			throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $class ) );
303
+		if (!is_a($context, $class)) {
304
+			throw new \Aimeos\MShop\Customer\Exception(sprintf('Object is not of required type "%1$s"', $class));
305 305
 		}
306 306
 
307 307
 		$service = $context->getEzUserService();
308 308
 		$email = $item->getPaymentAddress()->getEmail();
309 309
 
310
-		if( $item->getId() !== null )
310
+		if ($item->getId() !== null)
311 311
 		{
312 312
 			$struct = $service->newUserUpdateStruct();
313 313
 			$struct->password = $item->getPassword();
314 314
 			$struct->enabled = $item->getStatus();
315 315
 			$struct->email = $email;
316 316
 
317
-			$user = $service->loadUser( $item->getId() );
318
-			$service->updateUser( $user, $struct );
317
+			$user = $service->loadUser($item->getId());
318
+			$service->updateUser($user, $struct);
319 319
 		}
320 320
 		else
321 321
 		{
322
-			$struct = $service->newUserCreateStruct( $item->getCode(), $email, $item->getPassword(), 'eng-GB' );
322
+			$struct = $service->newUserCreateStruct($item->getCode(), $email, $item->getPassword(), 'eng-GB');
323 323
 			$struct->enabled = $item->getStatus();
324 324
 
325
-			$user = $service->createUser( $struct, [] );
326
-			$item->setId( $user->getUserId() );
325
+			$user = $service->createUser($struct, []);
326
+			$item->setId($user->getUserId());
327 327
 		}
328 328
 
329 329
 		$dbm = $context->getDatabaseManager();
330 330
 		$dbname = $this->getResourceName();
331
-		$conn = $dbm->acquire( $dbname );
331
+		$conn = $dbm->acquire($dbname);
332 332
 
333 333
 		try
334 334
 		{
335
-			$date = date( 'Y-m-d H:i:s' );
336
-			$ctime = ( $item->getTimeCreated() ? $item->getTimeCreated() : $date );
335
+			$date = date('Y-m-d H:i:s');
336
+			$ctime = ($item->getTimeCreated() ? $item->getTimeCreated() : $date);
337 337
 			$billingAddress = $item->getPaymentAddress();
338 338
 
339 339
 			$path = 'mshop/customer/manager/ezpublish/update';
340
-			$stmt = $this->getCachedStatement( $conn, $path );
341
-
342
-			$stmt->bind( 1, $billingAddress->getCompany() );
343
-			$stmt->bind( 2, $billingAddress->getVatID() );
344
-			$stmt->bind( 3, $billingAddress->getSalutation() );
345
-			$stmt->bind( 4, $billingAddress->getTitle() );
346
-			$stmt->bind( 5, $billingAddress->getFirstname() );
347
-			$stmt->bind( 6, $billingAddress->getLastname() );
348
-			$stmt->bind( 7, $billingAddress->getAddress1() );
349
-			$stmt->bind( 8, $billingAddress->getAddress2() );
350
-			$stmt->bind( 9, $billingAddress->getAddress3() );
351
-			$stmt->bind( 10, $billingAddress->getPostal() );
352
-			$stmt->bind( 11, $billingAddress->getCity() );
353
-			$stmt->bind( 12, $billingAddress->getState() );
354
-			$stmt->bind( 13, $billingAddress->getCountryId() );
355
-			$stmt->bind( 14, $billingAddress->getLanguageId() );
356
-			$stmt->bind( 15, $billingAddress->getTelephone() );
357
-			$stmt->bind( 16, $billingAddress->getTelefax() );
358
-			$stmt->bind( 17, $billingAddress->getWebsite() );
359
-			$stmt->bind( 18, $item->getBirthday() );
360
-			$stmt->bind( 19, $item->getDateVerified() );
361
-			$stmt->bind( 20, $date ); // Modification time
362
-			$stmt->bind( 21, $context->getEditor() );
363
-			$stmt->bind( 22, $ctime ); // Creation time
364
-			$stmt->bind( 23, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT );
340
+			$stmt = $this->getCachedStatement($conn, $path);
341
+
342
+			$stmt->bind(1, $billingAddress->getCompany());
343
+			$stmt->bind(2, $billingAddress->getVatID());
344
+			$stmt->bind(3, $billingAddress->getSalutation());
345
+			$stmt->bind(4, $billingAddress->getTitle());
346
+			$stmt->bind(5, $billingAddress->getFirstname());
347
+			$stmt->bind(6, $billingAddress->getLastname());
348
+			$stmt->bind(7, $billingAddress->getAddress1());
349
+			$stmt->bind(8, $billingAddress->getAddress2());
350
+			$stmt->bind(9, $billingAddress->getAddress3());
351
+			$stmt->bind(10, $billingAddress->getPostal());
352
+			$stmt->bind(11, $billingAddress->getCity());
353
+			$stmt->bind(12, $billingAddress->getState());
354
+			$stmt->bind(13, $billingAddress->getCountryId());
355
+			$stmt->bind(14, $billingAddress->getLanguageId());
356
+			$stmt->bind(15, $billingAddress->getTelephone());
357
+			$stmt->bind(16, $billingAddress->getTelefax());
358
+			$stmt->bind(17, $billingAddress->getWebsite());
359
+			$stmt->bind(18, $item->getBirthday());
360
+			$stmt->bind(19, $item->getDateVerified());
361
+			$stmt->bind(20, $date); // Modification time
362
+			$stmt->bind(21, $context->getEditor());
363
+			$stmt->bind(22, $ctime); // Creation time
364
+			$stmt->bind(23, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT);
365 365
 
366 366
 			$stmt->execute()->finish();
367 367
 
368
-			$dbm->release( $conn, $dbname );
368
+			$dbm->release($conn, $dbname);
369 369
 		}
370
-		catch( \Exception $e )
370
+		catch (\Exception $e)
371 371
 		{
372
-			$dbm->release( $conn, $dbname );
372
+			$dbm->release($conn, $dbname);
373 373
 			throw $e;
374 374
 		}
375 375
 
376
-		$item = $this->savePropertyItems( $item, 'customer' );
377
-		$item = $this->saveAddressItems( $item, 'customer' );
378
-		return $this->saveListItems( $item, 'customer' );
376
+		$item = $this->savePropertyItems($item, 'customer');
377
+		$item = $this->saveAddressItems($item, 'customer');
378
+		return $this->saveListItems($item, 'customer');
379 379
 	}
380 380
 
381 381
 
@@ -387,11 +387,11 @@  discard block
 block discarded – undo
387 387
 	 * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface
388 388
 	 * @throws \Aimeos\MShop\Customer\Exception If creating items failed
389 389
 	 */
390
-	public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null )
390
+	public function searchItems(\Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null)
391 391
 	{
392 392
 		$dbm = $this->getContext()->getDatabaseManager();
393 393
 		$dbname = $this->getResourceName();
394
-		$conn = $dbm->acquire( $dbname );
394
+		$conn = $dbm->acquire($dbname);
395 395
 		$map = [];
396 396
 
397 397
 		try
@@ -399,34 +399,34 @@  discard block
 block discarded – undo
399 399
 			$level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL;
400 400
 			$cfgPathSearch = 'mshop/customer/manager/ezpublish/search';
401 401
 			$cfgPathCount = 'mshop/customer/manager/ezpublish/count';
402
-			$required = array( 'customer' );
402
+			$required = array('customer');
403 403
 
404
-			$results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level );
404
+			$results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level);
405 405
 
406
-			while( ( $row = $results->fetch() ) !== false )
406
+			while (($row = $results->fetch()) !== false)
407 407
 			{
408
-				$map[ $row['customer.id'] ] = $row;
409
-				$map[ $row['customer.id'] ]['groups'] = [];
408
+				$map[$row['customer.id']] = $row;
409
+				$map[$row['customer.id']]['groups'] = [];
410 410
 			}
411 411
 
412 412
 
413 413
 			$path = 'mshop/customer/manager/ezpublish/groups';
414
-			$stmt = $conn->create( $this->getGroupSql( array_keys( $map ), $path ) );
414
+			$stmt = $conn->create($this->getGroupSql(array_keys($map), $path));
415 415
 			$results = $stmt->execute();
416 416
 
417
-			while( ( $row = $results->fetch() ) !== false ) {
418
-				$map[ $row['contentobject_id'] ]['groups'][] = $row['role_id'];
417
+			while (($row = $results->fetch()) !== false) {
418
+				$map[$row['contentobject_id']]['groups'][] = $row['role_id'];
419 419
 			}
420 420
 
421
-			$dbm->release( $conn, $dbname );
421
+			$dbm->release($conn, $dbname);
422 422
 		}
423
-		catch( \Exception $e )
423
+		catch (\Exception $e)
424 424
 		{
425
-			$dbm->release( $conn, $dbname  );
425
+			$dbm->release($conn, $dbname);
426 426
 			throw $e;
427 427
 		}
428 428
 
429
-		return $this->buildItems( $map, $ref, 'customer' );
429
+		return $this->buildItems($map, $ref, 'customer');
430 430
 	}
431 431
 
432 432
 
@@ -439,11 +439,11 @@  discard block
 block discarded – undo
439 439
 	 * @param array $addresses List of address items of the customer item
440 440
 	 * @return \Aimeos\MShop\Customer\Item\Iface New customer item
441 441
 	 */
442
-	protected function createItemBase( array $values = [], array $listItems = [], array $refItems = [],
443
-		array $addresses = [], array $propItems = [] )
442
+	protected function createItemBase(array $values = [], array $listItems = [], array $refItems = [],
443
+		array $addresses = [], array $propItems = [])
444 444
 	{
445
-		if( !isset( $this->addressManager ) ) {
446
-			$this->addressManager = $this->getObject()->getSubManager( 'address' );
445
+		if (!isset($this->addressManager)) {
446
+			$this->addressManager = $this->getObject()->getSubManager('address');
447 447
 		}
448 448
 
449 449
 		$address = $this->addressManager->createItem();
@@ -462,18 +462,18 @@  discard block
 block discarded – undo
462 462
 	 * @param string $cfgpath Configuration path to the SQL statement
463 463
 	 * @return string SQL statement ready for execution
464 464
 	 */
465
-	protected function getGroupSql( array $ids, $cfgpath )
465
+	protected function getGroupSql(array $ids, $cfgpath)
466 466
 	{
467
-		if( empty( $ids ) ) { return '1=1'; }
467
+		if (empty($ids)) { return '1=1'; }
468 468
 
469 469
 		$search = $this->getObject()->createSearch();
470
-		$search->setConditions( $search->compare( '==', 'id', $ids ) );
470
+		$search->setConditions($search->compare('==', 'id', $ids));
471 471
 
472
-		$types = array( 'id' => \Aimeos\MW\DB\Statement\Base::PARAM_INT );
473
-		$translations = array( 'id' => '"contentobject_id"' );
472
+		$types = array('id' => \Aimeos\MW\DB\Statement\Base::PARAM_INT);
473
+		$translations = array('id' => '"contentobject_id"');
474 474
 
475
-		$cond = $search->getConditionString( $types, $translations );
475
+		$cond = $search->getConditionString($types, $translations);
476 476
 
477
-		return str_replace( ':cond', $cond, $this->getSqlConfig( $cfgpath ) );
477
+		return str_replace(':cond', $cond, $this->getSqlConfig($cfgpath));
478 478
 	}
479 479
 }
Please login to merge, or discard this patch.