Completed
Push — master ( 10ff4e...12c65b )
by Aimeos
02:25
created
controller/frontend/src/Controller/Frontend/Service/Standard.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
 	 * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value
33 33
 	 * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values
34 34
 	 */
35
-	public function checkAttributes( $serviceId, array $attributes )
35
+	public function checkAttributes($serviceId, array $attributes)
36 36
 	{
37
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
38
-		$provider = $manager->getProvider( $manager->getItem( $serviceId, [], true ) );
37
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
38
+		$provider = $manager->getProvider($manager->getItem($serviceId, [], true));
39 39
 
40
-		return array_filter( $provider->checkConfigFE( $attributes ) );
40
+		return array_filter($provider->checkConfigFE($attributes));
41 41
 	}
42 42
 
43 43
 
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
 	 * @param string[] $ref List of domain names whose items should be fetched too
49 49
 	 * @return \Aimeos\MShop\Service\Provider\Iface Service provider object
50 50
 	 */
51
-	public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] )
51
+	public function getProvider($serviceId, $ref = ['media', 'price', 'text'])
52 52
 	{
53
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
54
-		return $manager->getProvider( $manager->getItem( $serviceId, $ref, true ) );
53
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
54
+		return $manager->getProvider($manager->getItem($serviceId, $ref, true));
55 55
 	}
56 56
 
57 57
 
@@ -62,26 +62,26 @@  discard block
 block discarded – undo
62 62
 	 * @param string[] $ref List of domain names whose items should be fetched too
63 63
 	 * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values
64 64
 	 */
65
-	public function getProviders( $type = null, $ref = ['media', 'price', 'text'] )
65
+	public function getProviders($type = null, $ref = ['media', 'price', 'text'])
66 66
 	{
67 67
 		$list = [];
68
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
68
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
69 69
 
70
-		$search = $manager->createSearch( true );
71
-		$search->setSortations( array( $search->sort( '+', 'service.position' ) ) );
70
+		$search = $manager->createSearch(true);
71
+		$search->setSortations(array($search->sort('+', 'service.position')));
72 72
 
73
-		if( $type != null )
73
+		if ($type != null)
74 74
 		{
75 75
 			$expr = array(
76 76
 				$search->getConditions(),
77
-				$search->compare( '==', 'service.type.code', $type ),
78
-				$search->compare( '==', 'service.type.domain', 'service' ),
77
+				$search->compare('==', 'service.type.code', $type),
78
+				$search->compare('==', 'service.type.domain', 'service'),
79 79
 			);
80
-			$search->setConditions( $search->combine( '&&', $expr ) );
80
+			$search->setConditions($search->combine('&&', $expr));
81 81
 		}
82 82
 
83
-		foreach( $manager->searchItems( $search, $ref ) as $id => $item ) {
84
-			$list[$id] = $manager->getProvider( $item );
83
+		foreach ($manager->searchItems($search, $ref) as $id => $item) {
84
+			$list[$id] = $manager->getProvider($item);
85 85
 		}
86 86
 
87 87
 		return $list;
@@ -98,38 +98,38 @@  discard block
 block discarded – undo
98 98
 	 * @throws \Exception If an error occurs
99 99
 	 * @deprecated Use getProviders() instead
100 100
 	 */
101
-	public function getServices( $type, \Aimeos\MShop\Order\Item\Base\Iface $basket, $ref = ['media', 'price', 'text'] )
101
+	public function getServices($type, \Aimeos\MShop\Order\Item\Base\Iface $basket, $ref = ['media', 'price', 'text'])
102 102
 	{
103
-		$serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
103
+		$serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
104 104
 
105
-		$search = $serviceManager->createSearch( true );
105
+		$search = $serviceManager->createSearch(true);
106 106
 		$expr = array(
107 107
 			$search->getConditions(),
108
-			$search->compare( '==', 'service.type.domain', 'service' ),
109
-			$search->compare( '==', 'service.type.code', $type ),
108
+			$search->compare('==', 'service.type.domain', 'service'),
109
+			$search->compare('==', 'service.type.code', $type),
110 110
 		);
111
-		$search->setConditions( $search->combine( '&&', $expr ) );
112
-		$search->setSortations( array( $search->sort( '+', 'service.position' ) ) );
111
+		$search->setConditions($search->combine('&&', $expr));
112
+		$search->setSortations(array($search->sort('+', 'service.position')));
113 113
 
114
-		$items = $serviceManager->searchItems( $search, $ref );
114
+		$items = $serviceManager->searchItems($search, $ref);
115 115
 
116 116
 
117
-		foreach( $items as $id => $service )
117
+		foreach ($items as $id => $service)
118 118
 		{
119 119
 			try
120 120
 			{
121
-				$provider = $serviceManager->getProvider( $service );
121
+				$provider = $serviceManager->getProvider($service);
122 122
 
123
-				if( $provider->isAvailable( $basket ) ) {
123
+				if ($provider->isAvailable($basket)) {
124 124
 					$this->providers[$type][$id] = $provider;
125 125
 				} else {
126
-					unset( $items[$id] );
126
+					unset($items[$id]);
127 127
 				}
128 128
 			}
129
-			catch( \Aimeos\MShop\Service\Exception $e )
129
+			catch (\Aimeos\MShop\Service\Exception $e)
130 130
 			{
131
-				$msg = sprintf( 'Unable to create provider "%1$s" for service with ID "%2$s"', $service->getCode(), $id );
132
-				$this->getContext()->getLogger()->log( $msg, \Aimeos\MW\Logger\Base::WARN );
131
+				$msg = sprintf('Unable to create provider "%1$s" for service with ID "%2$s"', $service->getCode(), $id);
132
+				$this->getContext()->getLogger()->log($msg, \Aimeos\MW\Logger\Base::WARN);
133 133
 			}
134 134
 		}
135 135
 
@@ -150,16 +150,16 @@  discard block
 block discarded – undo
150 150
 	 * @throws \Exception If an error occurs
151 151
 	 * @deprecated Use getProvider() instead
152 152
 	 */
153
-	public function getServiceAttributes( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket )
153
+	public function getServiceAttributes($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket)
154 154
 	{
155
-		if( isset( $this->providers[$type][$serviceId] ) ) {
156
-			return $this->providers[$type][$serviceId]->getConfigFE( $basket );
155
+		if (isset($this->providers[$type][$serviceId])) {
156
+			return $this->providers[$type][$serviceId]->getConfigFE($basket);
157 157
 		}
158 158
 
159
-		$serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
160
-		$item = $serviceManager->getItem( $serviceId, ['price'], true );
159
+		$serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
160
+		$item = $serviceManager->getItem($serviceId, ['price'], true);
161 161
 
162
-		return $serviceManager->getProvider( $item )->getConfigFE( $basket );
162
+		return $serviceManager->getProvider($item)->getConfigFE($basket);
163 163
 	}
164 164
 
165 165
 
@@ -175,16 +175,16 @@  discard block
 block discarded – undo
175 175
 	 * @throws \Exception If an error occurs
176 176
 	 * @deprecated Use getProvider() instead
177 177
 	 */
178
-	public function getServicePrice( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket )
178
+	public function getServicePrice($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket)
179 179
 	{
180
-		if( isset( $this->providers[$type][$serviceId] ) ) {
181
-			return $this->providers[$type][$serviceId]->calcPrice( $basket );
180
+		if (isset($this->providers[$type][$serviceId])) {
181
+			return $this->providers[$type][$serviceId]->calcPrice($basket);
182 182
 		}
183 183
 
184
-		$serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
185
-		$item = $serviceManager->getItem( $serviceId, ['price'], true );
184
+		$serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
185
+		$item = $serviceManager->getItem($serviceId, ['price'], true);
186 186
 
187
-		return $serviceManager->getProvider( $item )->calcPrice( $basket );
187
+		return $serviceManager->getProvider($item)->calcPrice($basket);
188 188
 	}
189 189
 
190 190
 
@@ -200,22 +200,22 @@  discard block
 block discarded – undo
200 200
 	 * @throws \Aimeos\Controller\Frontend\Service\Exception If no active service provider for this ID is available
201 201
 	 * @deprecated Use checkAttributes() instead
202 202
 	 */
203
-	public function checkServiceAttributes( $type, $serviceId, array $attributes )
203
+	public function checkServiceAttributes($type, $serviceId, array $attributes)
204 204
 	{
205
-		if( !isset( $this->providers[$type][$serviceId] ) )
205
+		if (!isset($this->providers[$type][$serviceId]))
206 206
 		{
207
-			$serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
208
-			$item = $serviceManager->getItem( $serviceId, ['price'], true );
207
+			$serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
208
+			$item = $serviceManager->getItem($serviceId, ['price'], true);
209 209
 
210
-			$this->providers[$type][$serviceId] = $serviceManager->getProvider( $item );
210
+			$this->providers[$type][$serviceId] = $serviceManager->getProvider($item);
211 211
 		}
212 212
 
213
-		$errors = $this->providers[$type][$serviceId]->checkConfigFE( $attributes );
213
+		$errors = $this->providers[$type][$serviceId]->checkConfigFE($attributes);
214 214
 
215
-		foreach( $errors as $key => $msg )
215
+		foreach ($errors as $key => $msg)
216 216
 		{
217
-			if( $msg === null ) {
218
-				unset( $errors[$key] );
217
+			if ($msg === null) {
218
+				unset($errors[$key]);
219 219
 			}
220 220
 		}
221 221
 
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Service/Iface.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value
28 28
 	 * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values
29 29
 	 */
30
-	public function checkAttributes( $serviceId, array $attributes );
30
+	public function checkAttributes($serviceId, array $attributes);
31 31
 
32 32
 	/**
33 33
 	 * Returns the service item for the given ID
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 * @param array $ref List of domains for which the items referenced by the services should be fetched too
37 37
 	 * @return \Aimeos\MShop\Service\Provider\Iface Service provider object
38 38
 	 */
39
-	public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] );
39
+	public function getProvider($serviceId, $ref = ['media', 'price', 'text']);
40 40
 
41 41
 	/**
42 42
 	 * Returns the service providers for the given type
@@ -45,5 +45,5 @@  discard block
 block discarded – undo
45 45
 	 * @param array $ref List of domains for which the items referenced by the services should be fetched too
46 46
 	 * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values
47 47
 	 */
48
-	public function getProviders( $type = null, $ref = ['media', 'price', 'text'] );
48
+	public function getProviders($type = null, $ref = ['media', 'price', 'text']);
49 49
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Service/Decorator/Base.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
 	 * @param \Aimeos\Controller\Frontend\Iface $controller Controller object
31 31
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects
32 32
 	 */
33
-	public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context )
33
+	public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context)
34 34
 	{
35 35
 		$iface = '\Aimeos\Controller\Frontend\Service\Iface';
36
-		if( !( $controller instanceof $iface ) )
36
+		if (!($controller instanceof $iface))
37 37
 		{
38
-			$msg = sprintf( 'Class "%1$s" does not implement interface "%2$s"', get_class( $controller ), $iface );
39
-			throw new \Aimeos\Controller\Frontend\Exception( $msg );
38
+			$msg = sprintf('Class "%1$s" does not implement interface "%2$s"', get_class($controller), $iface);
39
+			throw new \Aimeos\Controller\Frontend\Exception($msg);
40 40
 		}
41 41
 
42 42
 		$this->controller = $controller;
43 43
 
44
-		parent::__construct( $context );
44
+		parent::__construct($context);
45 45
 	}
46 46
 
47 47
 
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	 * @return mixed Returns the value of the called method
54 54
 	 * @throws \Aimeos\Controller\Frontend\Exception If method call failed
55 55
 	 */
56
-	public function __call( $name, array $param )
56
+	public function __call($name, array $param)
57 57
 	{
58
-		return @call_user_func_array( array( $this->controller, $name ), $param );
58
+		return @call_user_func_array(array($this->controller, $name), $param);
59 59
 	}
60 60
 
61 61
 
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value
67 67
 	 * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values
68 68
 	 */
69
-	public function checkAttributes( $serviceId, array $attributes )
69
+	public function checkAttributes($serviceId, array $attributes)
70 70
 	{
71
-		return $this->controller->checkAttributes( $serviceId, $attributes );
71
+		return $this->controller->checkAttributes($serviceId, $attributes);
72 72
 	}
73 73
 
74 74
 
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 	 * @param array $ref List of domains for which the items referenced by the services should be fetched too
80 80
 	 * @return \Aimeos\MShop\Service\Provider\Iface Service provider object
81 81
 	 */
82
-	public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] )
82
+	public function getProvider($serviceId, $ref = ['media', 'price', 'text'])
83 83
 	{
84
-		return $this->controller->getProvider( $serviceId, $ref );
84
+		return $this->controller->getProvider($serviceId, $ref);
85 85
 	}
86 86
 
87 87
 
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
 	 * @param array $ref List of domains for which the items referenced by the services should be fetched too
93 93
 	 * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values
94 94
 	 */
95
-	public function getProviders( $type = null, $ref = ['media', 'price', 'text'] )
95
+	public function getProviders($type = null, $ref = ['media', 'price', 'text'])
96 96
 	{
97
-		return $this->controller->getProviders( $type, $ref );
97
+		return $this->controller->getProviders($type, $ref);
98 98
 	}
99 99
 
100 100
 
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
 	 * @return array List of service items implementing \Aimeos\MShop\Service\Item\Iface with referenced items
109 109
 	 * @deprecated Use getProviders() instead
110 110
 	 */
111
-	public function getServices( $type, \Aimeos\MShop\Order\Item\Base\Iface $basket,
112
-		$ref = array( 'media', 'price', 'text' ) )
111
+	public function getServices($type, \Aimeos\MShop\Order\Item\Base\Iface $basket,
112
+		$ref = array('media', 'price', 'text'))
113 113
 	{
114
-		return $this->controller->getServices( $type, $basket, $ref );
114
+		return $this->controller->getServices($type, $basket, $ref);
115 115
 	}
116 116
 
117 117
 
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 	 * @return array List of attribute definitions implementing \Aimeos\MW\Criteria\Attribute\Iface
126 126
 	 * @deprecated Use getProvider() instead
127 127
 	 */
128
-	public function getServiceAttributes( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket )
128
+	public function getServiceAttributes($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket)
129 129
 	{
130
-		return $this->controller->getServiceAttributes( $type, $serviceId, $basket );
130
+		return $this->controller->getServiceAttributes($type, $serviceId, $basket);
131 131
 	}
132 132
 
133 133
 
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
 	 * @throws \Exception If an error occurs
144 144
 	 * @deprecated Use getProvider() instead
145 145
 	 */
146
-	public function getServicePrice( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket )
146
+	public function getServicePrice($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket)
147 147
 	{
148
-		return $this->controller->getServicePrice( $type, $serviceId, $basket );
148
+		return $this->controller->getServicePrice($type, $serviceId, $basket);
149 149
 	}
150 150
 
151 151
 
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
 	 * 	missing
161 161
 	 * @deprecated Use checkAttributes() instead
162 162
 	 */
163
-	public function checkServiceAttributes( $type, $serviceId, array $attributes )
163
+	public function checkServiceAttributes($type, $serviceId, array $attributes)
164 164
 	{
165
-		return $this->controller->checkServiceAttributes( $type, $serviceId, $attributes );
165
+		return $this->controller->checkServiceAttributes($type, $serviceId, $attributes);
166 166
 	}
167 167
 
168 168
 
Please login to merge, or discard this patch.