Completed
Push — master ( f97bb5...a4e8a9 )
by Aimeos
02:10
created
controller/frontend/src/Controller/Frontend/Service/Iface.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 	 * @param array $ref List of domains for which the items referenced by the services should be fetched too
30 30
 	 * @return array List of service items implementing \Aimeos\MShop\Service\Item\Iface with referenced items
31 31
 	 */
32
-	public function getServices( $type, \Aimeos\MShop\Order\Item\Base\Iface $basket,
33
-		$ref = array( 'media', 'price', 'text' ) );
32
+	public function getServices($type, \Aimeos\MShop\Order\Item\Base\Iface $basket,
33
+		$ref = array('media', 'price', 'text'));
34 34
 
35 35
 	/**
36 36
 	 * Returns the list of attribute definitions which must be used to render the input form where the customer can
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object
42 42
 	 * @return array List of attribute definitions implementing \Aimeos\MW\Criteria\Attribute\Iface
43 43
 	 */
44
-	public function getServiceAttributes( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket );
44
+	public function getServiceAttributes($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket);
45 45
 
46 46
 	/**
47 47
 	 * Returns the price of the service.
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @throws \Aimeos\MShop\Exception If service provider isn't available
55 55
 	 * @throws \Exception If an error occurs
56 56
 	 */
57
-	public function getServicePrice( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket );
57
+	public function getServicePrice($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket);
58 58
 
59 59
 	/**
60 60
 	 * Returns a list of attributes that are invalid.
@@ -66,5 +66,5 @@  discard block
 block discarded – undo
66 66
 	 * @return array List of key/value pairs of attributes keys and an error message for values that are invalid or
67 67
 	 * 	missing
68 68
 	 */
69
-	public function checkServiceAttributes( $type, $serviceId, array $attributes );
69
+	public function checkServiceAttributes($type, $serviceId, array $attributes);
70 70
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Common/Factory/Iface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,5 +27,5 @@
 block discarded – undo
27 27
 	 * @param string|null $name Name of the controller implementation (Default if null)
28 28
 	 * @return \Aimeos\Controller\Frontend\Common\Iface Controller object
29 29
 	 */
30
-	public static function createController( \Aimeos\MShop\Context\Item\Iface $context, $name = null );
30
+	public static function createController(\Aimeos\MShop\Context\Item\Iface $context, $name = null);
31 31
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Common/Factory/Base.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * @param string $classname Full name of the class for which the object should be returned
32 32
 	 * @param \Aimeos\Controller\Frontend\Iface|null $controller Frontend controller object
33 33
 	 */
34
-	public static function injectController( $classname, \Aimeos\Controller\Frontend\Iface $controller = null )
34
+	public static function injectController($classname, \Aimeos\Controller\Frontend\Iface $controller = null)
35 35
 	{
36 36
 		self::$objects[$classname] = $controller;
37 37
 	}
@@ -46,29 +46,29 @@  discard block
 block discarded – undo
46 46
 	 * @param string $classprefix Decorator class prefix, e.g. "\Aimeos\Controller\Frontend\Basket\Decorator\"
47 47
 	 * @return \Aimeos\Controller\Frontend\Common\Iface Controller object
48 48
 	 */
49
-	protected static function addDecorators( \Aimeos\MShop\Context\Item\Iface $context,
50
-		\Aimeos\Controller\Frontend\Iface $controller, array $decorators, $classprefix )
49
+	protected static function addDecorators(\Aimeos\MShop\Context\Item\Iface $context,
50
+		\Aimeos\Controller\Frontend\Iface $controller, array $decorators, $classprefix)
51 51
 	{
52 52
 		$iface = '\\Aimeos\\Controller\\Frontend\\Common\\Decorator\\Iface';
53 53
 
54
-		foreach( $decorators as $name )
54
+		foreach ($decorators as $name)
55 55
 		{
56
-			if( ctype_alnum( $name ) === false )
56
+			if (ctype_alnum($name) === false)
57 57
 			{
58
-				$classname = is_string( $name ) ? $classprefix . $name : '<not a string>';
59
-				throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) );
58
+				$classname = is_string($name) ? $classprefix . $name : '<not a string>';
59
+				throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in class name "%1$s"', $classname));
60 60
 			}
61 61
 
62 62
 			$classname = $classprefix . $name;
63 63
 
64
-			if( class_exists( $classname ) === false ) {
65
-				throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Class "%1$s" not available', $classname ) );
64
+			if (class_exists($classname) === false) {
65
+				throw new \Aimeos\Controller\Frontend\Exception(sprintf('Class "%1$s" not available', $classname));
66 66
 			}
67 67
 
68
-			$controller = new $classname( $controller, $context );
68
+			$controller = new $classname($controller, $context);
69 69
 
70
-			if( !( $controller instanceof $iface ) ) {
71
-				throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $iface ) );
70
+			if (!($controller instanceof $iface)) {
71
+				throw new \Aimeos\Controller\Frontend\Exception(sprintf('Class "%1$s" does not implement interface "%2$s"', $classname, $iface));
72 72
 			}
73 73
 		}
74 74
 
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
 	 * @param string $domain Domain name in lower case, e.g. "product"
85 85
 	 * @return \Aimeos\Controller\Frontend\Common\Iface Controller object
86 86
 	 */
87
-	protected static function addControllerDecorators( \Aimeos\MShop\Context\Item\Iface $context,
88
-		\Aimeos\Controller\Frontend\Iface $controller, $domain )
87
+	protected static function addControllerDecorators(\Aimeos\MShop\Context\Item\Iface $context,
88
+		\Aimeos\Controller\Frontend\Iface $controller, $domain)
89 89
 	{
90
-		if( !is_string( $domain ) || $domain === '' ) {
91
-			throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid domain "%1$s"', $domain ) );
90
+		if (!is_string($domain) || $domain === '') {
91
+			throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid domain "%1$s"', $domain));
92 92
 		}
93 93
 
94
-		$localClass = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $domain ) ) );
94
+		$localClass = str_replace(' ', '\\', ucwords(str_replace('/', ' ', $domain)));
95 95
 		$config = $context->getConfig();
96 96
 
97 97
 		/** controller/frontend/common/decorators/default
@@ -116,26 +116,26 @@  discard block
 block discarded – undo
116 116
 		 * @since 2014.03
117 117
 		 * @category Developer
118 118
 		 */
119
-		$decorators = $config->get( 'controller/frontend/common/decorators/default', array() );
120
-		$excludes = $config->get( 'controller/frontend/' . $domain . '/decorators/excludes', array() );
119
+		$decorators = $config->get('controller/frontend/common/decorators/default', array());
120
+		$excludes = $config->get('controller/frontend/' . $domain . '/decorators/excludes', array());
121 121
 
122
-		foreach( $decorators as $key => $name )
122
+		foreach ($decorators as $key => $name)
123 123
 		{
124
-			if( in_array( $name, $excludes ) ) {
125
-				unset( $decorators[$key] );
124
+			if (in_array($name, $excludes)) {
125
+				unset($decorators[$key]);
126 126
 			}
127 127
 		}
128 128
 
129 129
 		$classprefix = '\\Aimeos\\Controller\\Frontend\\Common\\Decorator\\';
130
-		$controller = self::addDecorators( $context, $controller, $decorators, $classprefix );
130
+		$controller = self::addDecorators($context, $controller, $decorators, $classprefix);
131 131
 
132 132
 		$classprefix = '\\Aimeos\\Controller\\Frontend\\Common\\Decorator\\';
133
-		$decorators = $config->get( 'controller/frontend/' . $domain . '/decorators/global', array() );
134
-		$controller = self::addDecorators( $context, $controller, $decorators, $classprefix );
133
+		$decorators = $config->get('controller/frontend/' . $domain . '/decorators/global', array());
134
+		$controller = self::addDecorators($context, $controller, $decorators, $classprefix);
135 135
 
136
-		$classprefix = '\\Aimeos\\Controller\\Frontend\\' . ucfirst( $localClass ) . '\\Decorator\\';
137
-		$decorators = $config->get( 'controller/frontend/' . $domain . '/decorators/local', array() );
138
-		$controller = self::addDecorators( $context, $controller, $decorators, $classprefix );
136
+		$classprefix = '\\Aimeos\\Controller\\Frontend\\' . ucfirst($localClass) . '\\Decorator\\';
137
+		$decorators = $config->get('controller/frontend/' . $domain . '/decorators/local', array());
138
+		$controller = self::addDecorators($context, $controller, $decorators, $classprefix);
139 139
 
140 140
 		return $controller;
141 141
 	}
@@ -149,20 +149,20 @@  discard block
 block discarded – undo
149 149
 	 * @param string $interface Name of the controller interface
150 150
 	 * @return \Aimeos\Controller\Frontend\Common\Iface Controller object
151 151
 	 */
152
-	protected static function createControllerBase( \Aimeos\MShop\Context\Item\Iface $context, $classname, $interface )
152
+	protected static function createControllerBase(\Aimeos\MShop\Context\Item\Iface $context, $classname, $interface)
153 153
 	{
154
-		if( isset( self::$objects[$classname] ) ) {
154
+		if (isset(self::$objects[$classname])) {
155 155
 			return self::$objects[$classname];
156 156
 		}
157 157
 
158
-		if( class_exists( $classname ) === false ) {
159
-			throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Class "%1$s" not available', $classname ) );
158
+		if (class_exists($classname) === false) {
159
+			throw new \Aimeos\Controller\Frontend\Exception(sprintf('Class "%1$s" not available', $classname));
160 160
 		}
161 161
 
162
-		$controller = new $classname( $context );
162
+		$controller = new $classname($context);
163 163
 
164
-		if( !( $controller instanceof $interface ) ) {
165
-			throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $interface ) );
164
+		if (!($controller instanceof $interface)) {
165
+			throw new \Aimeos\Controller\Frontend\Exception(sprintf('Class "%1$s" does not implement interface "%2$s"', $classname, $interface));
166 166
 		}
167 167
 
168 168
 		return $controller;
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Exception.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@
 block discarded – undo
32 32
 	 * @param \Exception $previous The previous exception used for the exception chaining.
33 33
 	 * @param array $list The associative list of errors and their messages when several errors occured
34 34
 	 */
35
-	public function __construct( $msg = '', $code = 0, \Exception $previous = null, array $list = array() )
35
+	public function __construct($msg = '', $code = 0, \Exception $previous = null, array $list = array())
36 36
 	{
37
-		parent::__construct( $msg, $code, $previous );
37
+		parent::__construct($msg, $code, $previous);
38 38
 
39 39
 		$this->list = $list;
40 40
 	}
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Order/Standard.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -32,22 +32,22 @@  discard block
 block discarded – undo
32 32
 	 * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object to be stored
33 33
 	 * @return \Aimeos\MShop\Order\Item\Iface Order item that belongs to the stored basket
34 34
 	 */
35
-	public function store( \Aimeos\MShop\Order\Item\Base\Iface $basket )
35
+	public function store(\Aimeos\MShop\Order\Item\Base\Iface $basket)
36 36
 	{
37 37
 		$context = $this->getContext();
38 38
 
39
-		$orderManager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
40
-		$orderBaseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' );
39
+		$orderManager = \Aimeos\MShop\Factory::createManager($context, 'order');
40
+		$orderBaseManager = \Aimeos\MShop\Factory::createManager($context, 'order/base');
41 41
 
42 42
 
43 43
 		$orderBaseManager->begin();
44
-		$orderBaseManager->store( $basket );
44
+		$orderBaseManager->store($basket);
45 45
 		$orderBaseManager->commit();
46 46
 
47 47
 		$orderItem = $orderManager->createItem();
48
-		$orderItem->setBaseId( $basket->getId() );
49
-		$orderItem->setType( \Aimeos\MShop\Order\Item\Base::TYPE_WEB );
50
-		$orderManager->saveItem( $orderItem );
48
+		$orderItem->setBaseId($basket->getId());
49
+		$orderItem->setType(\Aimeos\MShop\Order\Item\Base::TYPE_WEB);
50
+		$orderManager->saveItem($orderItem);
51 51
 
52 52
 
53 53
 		return $orderItem;
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
74 74
 	 */
75
-	public function block( \Aimeos\MShop\Order\Item\Iface $orderItem )
75
+	public function block(\Aimeos\MShop\Order\Item\Iface $orderItem)
76 76
 	{
77
-		\Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->block( $orderItem );
77
+		\Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->block($orderItem);
78 78
 	}
79 79
 
80 80
 
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
 	 *
97 97
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
98 98
 	 */
99
-	public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem )
99
+	public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem)
100 100
 	{
101
-		\Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->unblock( $orderItem );
101
+		\Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->unblock($orderItem);
102 102
 	}
103 103
 
104 104
 
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
 	 *
117 117
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
118 118
 	 */
119
-	public function update( \Aimeos\MShop\Order\Item\Iface $orderItem )
119
+	public function update(\Aimeos\MShop\Order\Item\Iface $orderItem)
120 120
 	{
121
-		\Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->update( $orderItem );
121
+		\Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->update($orderItem);
122 122
 	}
123 123
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Order/Iface.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object to be stored
32 32
 	 * @return \Aimeos\MShop\Order\Item\Iface Order item that belongs to the stored basket
33 33
 	 */
34
-	public function store( \Aimeos\MShop\Order\Item\Base\Iface $basket );
34
+	public function store(\Aimeos\MShop\Order\Item\Base\Iface $basket);
35 35
 
36 36
 
37 37
 	/**
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
54 54
 	 * @return void
55 55
 	 */
56
-	public function block( \Aimeos\MShop\Order\Item\Iface $orderItem );
56
+	public function block(\Aimeos\MShop\Order\Item\Iface $orderItem);
57 57
 
58 58
 
59 59
 	/**
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
76 76
 	 * @return void
77 77
 	 */
78
-	public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem );
78
+	public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem);
79 79
 
80 80
 
81 81
 	/**
@@ -93,5 +93,5 @@  discard block
 block discarded – undo
93 93
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
94 94
 	 * @return void
95 95
 	 */
96
-	public function update( \Aimeos\MShop\Order\Item\Iface $orderItem );
96
+	public function update(\Aimeos\MShop\Order\Item\Iface $orderItem);
97 97
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/FactoryTest.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -17,92 +17,92 @@
 block discarded – undo
17 17
 {
18 18
 	public function testCreateController()
19 19
 	{
20
-		$controller = \Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), 'basket' );
21
-		$this->assertInstanceOf( '\\Aimeos\\Controller\\Frontend\\Iface', $controller );
20
+		$controller = \Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), 'basket');
21
+		$this->assertInstanceOf('\\Aimeos\\Controller\\Frontend\\Iface', $controller);
22 22
 	}
23 23
 
24 24
 
25 25
 	public function testCreateControllerEmpty()
26 26
 	{
27
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
28
-		\Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), "\t\n" );
27
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
28
+		\Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), "\t\n");
29 29
 	}
30 30
 
31 31
 
32 32
 	public function testCreateControllerInvalidName()
33 33
 	{
34
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
35
-		\Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), '%^' );
34
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
35
+		\Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), '%^');
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testCreateControllerNotExisting()
40 40
 	{
41
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
42
-		\Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' );
41
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
42
+		\Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), 'notexist');
43 43
 	}
44 44
 
45 45
 
46 46
 	public function testCreateSubControllerNotExisting()
47 47
 	{
48
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' );
49
-		\Aimeos\Controller\Frontend\Factory::createController( \TestHelperFrontend::getContext(), 'basket/notexist' );
48
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception');
49
+		\Aimeos\Controller\Frontend\Factory::createController(\TestHelperFrontend::getContext(), 'basket/notexist');
50 50
 	}
51 51
 
52 52
 
53 53
 	public function testClear()
54 54
 	{
55
-		$cache = \Aimeos\Controller\Frontend\Factory::setCache( true );
55
+		$cache = \Aimeos\Controller\Frontend\Factory::setCache(true);
56 56
 
57 57
 		$context = \TestHelperFrontend::getContext();
58 58
 
59
-		$controller1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' );
59
+		$controller1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
60 60
 		\Aimeos\Controller\Frontend\Factory::clear();
61
-		$controller2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' );
61
+		$controller2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
62 62
 
63
-		\Aimeos\Controller\Frontend\Factory::setCache( $cache );
63
+		\Aimeos\Controller\Frontend\Factory::setCache($cache);
64 64
 
65
-		$this->assertNotSame( $controller1, $controller2 );
65
+		$this->assertNotSame($controller1, $controller2);
66 66
 	}
67 67
 
68 68
 
69 69
 	public function testClearSite()
70 70
 	{
71
-		$cache = \Aimeos\Controller\Frontend\Factory::setCache( true );
71
+		$cache = \Aimeos\Controller\Frontend\Factory::setCache(true);
72 72
 
73 73
 		$context = \TestHelperFrontend::getContext();
74 74
 
75
-		$basket1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' );
76
-		$catalog1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
77
-		\Aimeos\Controller\Frontend\Factory::clear( (string) $context );
75
+		$basket1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
76
+		$catalog1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
77
+		\Aimeos\Controller\Frontend\Factory::clear((string) $context);
78 78
 
79
-		$basket2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' );
80
-		$catalog2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
79
+		$basket2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
80
+		$catalog2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
81 81
 
82
-		\Aimeos\Controller\Frontend\Factory::setCache( $cache );
82
+		\Aimeos\Controller\Frontend\Factory::setCache($cache);
83 83
 
84
-		$this->assertNotSame( $basket1, $basket2 );
85
-		$this->assertNotSame( $catalog1, $catalog2 );
84
+		$this->assertNotSame($basket1, $basket2);
85
+		$this->assertNotSame($catalog1, $catalog2);
86 86
 	}
87 87
 
88 88
 
89 89
 	public function testClearSpecific()
90 90
 	{
91
-		$cache = \Aimeos\Controller\Frontend\Factory::setCache( true );
91
+		$cache = \Aimeos\Controller\Frontend\Factory::setCache(true);
92 92
 
93 93
 		$context = \TestHelperFrontend::getContext();
94 94
 
95
-		$basket1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' );
96
-		$catalog1 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
97
-		\Aimeos\Controller\Frontend\Factory::clear( (string) $context, 'basket' );
95
+		$basket1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
96
+		$catalog1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
97
+		\Aimeos\Controller\Frontend\Factory::clear((string) $context, 'basket');
98 98
 
99
-		$basket2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' );
100
-		$catalog2 = \Aimeos\Controller\Frontend\Factory::createController( $context, 'catalog' );
99
+		$basket2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
100
+		$catalog2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
101 101
 
102
-		\Aimeos\Controller\Frontend\Factory::setCache( $cache );
102
+		\Aimeos\Controller\Frontend\Factory::setCache($cache);
103 103
 
104
-		$this->assertNotSame( $basket1, $basket2 );
105
-		$this->assertSame( $catalog1, $catalog2 );
104
+		$this->assertNotSame($basket1, $basket2);
105
+		$this->assertSame($catalog1, $catalog2);
106 106
 	}
107 107
 
108 108
 }
109 109
\ No newline at end of file
Please login to merge, or discard this patch.
frontend/tests/Controller/Frontend/Basket/Decorator/CategoryTest.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -12,35 +12,35 @@
 block discarded – undo
12 12
 	protected function setUp()
13 13
 	{
14 14
 		$this->context = \TestHelperFrontend::getContext();
15
-		$object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
16
-		$this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Category( $object, $this->context );
15
+		$object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
16
+		$this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Category($object, $this->context);
17 17
 	}
18 18
 
19 19
 
20 20
 	protected function tearDown()
21 21
 	{
22 22
 		$this->object->clear();
23
-		$this->context->getSession()->set( 'aimeos', array() );
23
+		$this->context->getSession()->set('aimeos', array());
24 24
 
25
-		unset( $this->object );
25
+		unset($this->object);
26 26
 	}
27 27
 
28 28
 
29 29
 	public function testAddProductWithCategory()
30 30
 	{
31
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' );
32
-		$item = $manager->findItem( 'CNE' );
31
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'product');
32
+		$item = $manager->findItem('CNE');
33 33
 
34
-		$this->object->addProduct( $item->getId(), 5 );
34
+		$this->object->addProduct($item->getId(), 5);
35 35
 	}
36 36
 
37 37
 
38 38
 	public function testAddProductNoCategory()
39 39
 	{
40
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' );
41
-		$item = $manager->findItem( 'ABCD' );
40
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'product');
41
+		$item = $manager->findItem('ABCD');
42 42
 
43
-		$this->setExpectedException( '\Aimeos\Controller\Frontend\Basket\Exception' );
44
-		$this->object->addProduct( $item->getId(), 5 );
43
+		$this->setExpectedException('\Aimeos\Controller\Frontend\Basket\Exception');
44
+		$this->object->addProduct($item->getId(), 5);
45 45
 	}
46 46
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Basket/Base.php 2 patches
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -160,8 +160,7 @@  discard block
 block discarded – undo
160 160
 			{
161 161
 				$this->setAddress( $type, $item->toArray() );
162 162
 				$basket->deleteAddress( $type );
163
-			}
164
-			catch( \Exception $e )
163
+			} catch( \Exception $e )
165 164
 			{
166 165
 				$logger = $this->getContext()->getLogger();
167 166
 				$str = 'Error migrating address with type "%1$s" in basket to locale "%2$s": %3$s';
@@ -190,8 +189,7 @@  discard block
 block discarded – undo
190 189
 			{
191 190
 				$this->addCoupon( $code );
192 191
 				$basket->deleteCoupon( $code, true );
193
-			}
194
-			catch( \Exception $e )
192
+			} catch( \Exception $e )
195 193
 			{
196 194
 				$logger = $this->getContext()->getLogger();
197 195
 				$str = 'Error migrating coupon with code "%1$s" in basket to locale "%2$s": %3$s';
@@ -240,8 +238,7 @@  discard block
 block discarded – undo
240 238
 				);
241 239
 
242 240
 				$basket->deleteProduct( $pos );
243
-			}
244
-			catch( \Exception $e )
241
+			} catch( \Exception $e )
245 242
 			{
246 243
 				$code = $product->getProductCode();
247 244
 				$logger = $this->getContext()->getLogger();
@@ -276,8 +273,7 @@  discard block
 block discarded – undo
276 273
 
277 274
 				$this->setService( $type, $item->getServiceId(), $attributes );
278 275
 				$basket->deleteService( $type );
279
-			}
280
-			catch( \Exception $e ) { ; } // Don't notify the user as appropriate services can be added automatically
276
+			} catch( \Exception $e ) { ; } // Don't notify the user as appropriate services can be added automatically
281 277
 		}
282 278
 
283 279
 		return $errors;
Please login to merge, or discard this patch.
Spacing   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -31,32 +31,32 @@  discard block
 block discarded – undo
31 31
 	 * @param integer $quantity New product quantity
32 32
 	 * @return \Aimeos\MShop\Price\Item\Iface Price item with calculated price
33 33
 	 */
34
-	protected function calcPrice( \Aimeos\MShop\Order\Item\Base\Product\Iface $product, array $prices, $quantity )
34
+	protected function calcPrice(\Aimeos\MShop\Order\Item\Base\Product\Iface $product, array $prices, $quantity)
35 35
 	{
36 36
 		$context = $this->getContext();
37 37
 
38
-		if( empty( $prices ) )
38
+		if (empty($prices))
39 39
 		{
40
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' );
41
-			$prices = $manager->getItem( $product->getProductId(), array( 'price' ) )->getRefItems( 'price', 'default' );
40
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product');
41
+			$prices = $manager->getItem($product->getProductId(), array('price'))->getRefItems('price', 'default');
42 42
 		}
43 43
 
44
-		$priceManager = \Aimeos\MShop\Factory::createManager( $context, 'price' );
45
-		$price = $priceManager->getLowestPrice( $prices, $quantity );
44
+		$priceManager = \Aimeos\MShop\Factory::createManager($context, 'price');
45
+		$price = $priceManager->getLowestPrice($prices, $quantity);
46 46
 
47
-		foreach( $this->getAttributeItems( $product->getAttributes() ) as $attrItem )
47
+		foreach ($this->getAttributeItems($product->getAttributes()) as $attrItem)
48 48
 		{
49
-			$prices = $attrItem->getRefItems( 'price', 'default' );
49
+			$prices = $attrItem->getRefItems('price', 'default');
50 50
 
51
-			if( count( $prices ) > 0 )
51
+			if (count($prices) > 0)
52 52
 			{
53
-				$attrPrice = $priceManager->getLowestPrice( $prices, $quantity );
54
-				$price->addItem( $attrPrice );
53
+				$attrPrice = $priceManager->getLowestPrice($prices, $quantity);
54
+				$price->addItem($attrPrice);
55 55
 			}
56 56
 		}
57 57
 
58 58
 		// remove product rebate of original price in favor to rebates granted for the order
59
-		$price->setRebate( '0.00' );
59
+		$price->setRebate('0.00');
60 60
 
61 61
 		return $price;
62 62
 	}
@@ -71,34 +71,34 @@  discard block
 block discarded – undo
71 71
 	 * @param array $refIds List of IDs that must be associated to the product
72 72
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If one or more of the IDs are not associated
73 73
 	 */
74
-	protected function checkReferences( $prodId, $domain, $listTypeId, array $refIds )
74
+	protected function checkReferences($prodId, $domain, $listTypeId, array $refIds)
75 75
 	{
76
-		$productManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' );
77
-		$search = $productManager->createSearch( true );
76
+		$productManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product');
77
+		$search = $productManager->createSearch(true);
78 78
 
79 79
 		$expr = array(
80
-			$search->compare( '==', 'product.id', $prodId ),
80
+			$search->compare('==', 'product.id', $prodId),
81 81
 			$search->getConditions(),
82 82
 		);
83 83
 
84
-		if( count( $refIds ) > 0 )
84
+		if (count($refIds) > 0)
85 85
 		{
86
-			foreach( $refIds as $key => $refId ) {
86
+			foreach ($refIds as $key => $refId) {
87 87
 				$refIds[$key] = (string) $refId;
88 88
 			}
89 89
 
90
-			$param = array( $domain, $listTypeId, $refIds );
91
-			$cmpfunc = $search->createFunction( 'product.contains', $param );
90
+			$param = array($domain, $listTypeId, $refIds);
91
+			$cmpfunc = $search->createFunction('product.contains', $param);
92 92
 
93
-			$expr[] = $search->compare( '==', $cmpfunc, count( $refIds ) );
93
+			$expr[] = $search->compare('==', $cmpfunc, count($refIds));
94 94
 		}
95 95
 
96
-		$search->setConditions( $search->combine( '&&', $expr ) );
96
+		$search->setConditions($search->combine('&&', $expr));
97 97
 
98
-		if( count( $productManager->searchItems( $search, array() ) ) === 0 )
98
+		if (count($productManager->searchItems($search, array())) === 0)
99 99
 		{
100
-			$msg = sprintf( 'Invalid "%1$s" references for product with ID %2$s', $domain, json_encode( $prodId ) );
101
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
100
+			$msg = sprintf('Invalid "%1$s" references for product with ID %2$s', $domain, json_encode($prodId));
101
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
102 102
 		}
103 103
 	}
104 104
 
@@ -113,34 +113,34 @@  discard block
 block discarded – undo
113 113
 		$session = $context->getSession();
114 114
 		$locale = $this->get()->getLocale();
115 115
 
116
-		$localeStr = $session->get( 'aimeos/basket/locale' );
116
+		$localeStr = $session->get('aimeos/basket/locale');
117 117
 		$localeKey = $locale->getSite()->getCode() . '|' . $locale->getLanguageId() . '|' . $locale->getCurrencyId();
118 118
 
119
-		if( $localeStr !== null && $localeStr !== $localeKey )
119
+		if ($localeStr !== null && $localeStr !== $localeKey)
120 120
 		{
121
-			$locParts = explode( '|', $localeStr );
122
-			$locSite = ( isset( $locParts[0] ) ? $locParts[0] : '' );
123
-			$locLanguage = ( isset( $locParts[1] ) ? $locParts[1] : '' );
124
-			$locCurrency = ( isset( $locParts[2] ) ? $locParts[2] : '' );
121
+			$locParts = explode('|', $localeStr);
122
+			$locSite = (isset($locParts[0]) ? $locParts[0] : '');
123
+			$locLanguage = (isset($locParts[1]) ? $locParts[1] : '');
124
+			$locCurrency = (isset($locParts[2]) ? $locParts[2] : '');
125 125
 
126
-			$localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' );
127
-			$locale = $localeManager->bootstrap( $locSite, $locLanguage, $locCurrency, false );
126
+			$localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
127
+			$locale = $localeManager->bootstrap($locSite, $locLanguage, $locCurrency, false);
128 128
 
129 129
 			$context = clone $context;
130
-			$context->setLocale( $locale );
130
+			$context->setLocale($locale);
131 131
 
132
-			$manager = \Aimeos\MShop\Order\Manager\Factory::createManager( $context )->getSubManager( 'base' );
132
+			$manager = \Aimeos\MShop\Order\Manager\Factory::createManager($context)->getSubManager('base');
133 133
 			$basket = $manager->getSession();
134 134
 
135
-			$this->copyAddresses( $basket, $errors, $localeKey );
136
-			$this->copyServices( $basket, $errors );
137
-			$this->copyProducts( $basket, $errors, $localeKey );
138
-			$this->copyCoupons( $basket, $errors, $localeKey );
135
+			$this->copyAddresses($basket, $errors, $localeKey);
136
+			$this->copyServices($basket, $errors);
137
+			$this->copyProducts($basket, $errors, $localeKey);
138
+			$this->copyCoupons($basket, $errors, $localeKey);
139 139
 
140
-			$manager->setSession( $basket );
140
+			$manager->setSession($basket);
141 141
 		}
142 142
 
143
-		$session->set( 'aimeos/basket/locale', $localeKey );
143
+		$session->set('aimeos/basket/locale', $localeKey);
144 144
 	}
145 145
 
146 146
 
@@ -152,20 +152,20 @@  discard block
 block discarded – undo
152 152
 	 * @param string $localeKey Unique identifier of the site, language and currency
153 153
 	 * @return array Associative list of errors occured
154 154
 	 */
155
-	protected function copyAddresses( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey )
155
+	protected function copyAddresses(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey)
156 156
 	{
157
-		foreach( $basket->getAddresses() as $type => $item )
157
+		foreach ($basket->getAddresses() as $type => $item)
158 158
 		{
159 159
 			try
160 160
 			{
161
-				$this->setAddress( $type, $item->toArray() );
162
-				$basket->deleteAddress( $type );
161
+				$this->setAddress($type, $item->toArray());
162
+				$basket->deleteAddress($type);
163 163
 			}
164
-			catch( \Exception $e )
164
+			catch (\Exception $e)
165 165
 			{
166 166
 				$logger = $this->getContext()->getLogger();
167 167
 				$str = 'Error migrating address with type "%1$s" in basket to locale "%2$s": %3$s';
168
-				$logger->log( sprintf( $str, $type, $localeKey, $e->getMessage() ), \Aimeos\MW\Logger\Base::INFO );
168
+				$logger->log(sprintf($str, $type, $localeKey, $e->getMessage()), \Aimeos\MW\Logger\Base::INFO);
169 169
 				$errors['address'][$type] = $e->getMessage();
170 170
 			}
171 171
 		}
@@ -182,20 +182,20 @@  discard block
 block discarded – undo
182 182
 	 * @param string $localeKey Unique identifier of the site, language and currency
183 183
 	 * @return array Associative list of errors occured
184 184
 	 */
185
-	protected function copyCoupons( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey )
185
+	protected function copyCoupons(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey)
186 186
 	{
187
-		foreach( $basket->getCoupons() as $code => $list )
187
+		foreach ($basket->getCoupons() as $code => $list)
188 188
 		{
189 189
 			try
190 190
 			{
191
-				$this->addCoupon( $code );
192
-				$basket->deleteCoupon( $code, true );
191
+				$this->addCoupon($code);
192
+				$basket->deleteCoupon($code, true);
193 193
 			}
194
-			catch( \Exception $e )
194
+			catch (\Exception $e)
195 195
 			{
196 196
 				$logger = $this->getContext()->getLogger();
197 197
 				$str = 'Error migrating coupon with code "%1$s" in basket to locale "%2$s": %3$s';
198
-				$logger->log( sprintf( $str, $code, $localeKey, $e->getMessage() ), \Aimeos\MW\Logger\Base::INFO );
198
+				$logger->log(sprintf($str, $code, $localeKey, $e->getMessage()), \Aimeos\MW\Logger\Base::INFO);
199 199
 				$errors['coupon'][$code] = $e->getMessage();
200 200
 			}
201 201
 		}
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
 	 * @param string $localeKey Unique identifier of the site, language and currency
213 213
 	 * @return array Associative list of errors occured
214 214
 	 */
215
-	protected function copyProducts( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey )
215
+	protected function copyProducts(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors, $localeKey)
216 216
 	{
217
-		foreach( $basket->getProducts() as $pos => $product )
217
+		foreach ($basket->getProducts() as $pos => $product)
218 218
 		{
219
-			if( $product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE ) {
219
+			if ($product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE) {
220 220
 				continue;
221 221
 			}
222 222
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 			{
225 225
 				$attrIds = array();
226 226
 
227
-				foreach( $product->getAttributes() as $attrItem ) {
227
+				foreach ($product->getAttributes() as $attrItem) {
228 228
 					$attrIds[$attrItem->getType()][] = $attrItem->getAttributeId();
229 229
 				}
230 230
 
@@ -232,21 +232,21 @@  discard block
 block discarded – undo
232 232
 						$product->getProductId(),
233 233
 						$product->getQuantity(),
234 234
 						array(),
235
-						$this->getValue( $attrIds, 'variant', array() ),
236
-						$this->getValue( $attrIds, 'config', array() ),
237
-						$this->getValue( $attrIds, 'hidden', array() ),
238
-						$this->getValue( $attrIds, 'custom', array() ),
235
+						$this->getValue($attrIds, 'variant', array()),
236
+						$this->getValue($attrIds, 'config', array()),
237
+						$this->getValue($attrIds, 'hidden', array()),
238
+						$this->getValue($attrIds, 'custom', array()),
239 239
 						$product->getStockType()
240 240
 				);
241 241
 
242
-				$basket->deleteProduct( $pos );
242
+				$basket->deleteProduct($pos);
243 243
 			}
244
-			catch( \Exception $e )
244
+			catch (\Exception $e)
245 245
 			{
246 246
 				$code = $product->getProductCode();
247 247
 				$logger = $this->getContext()->getLogger();
248 248
 				$str = 'Error migrating product with code "%1$s" in basket to locale "%2$s": %3$s';
249
-				$logger->log( sprintf( $str, $code, $localeKey, $e->getMessage() ), \Aimeos\MW\Logger\Base::INFO );
249
+				$logger->log(sprintf($str, $code, $localeKey, $e->getMessage()), \Aimeos\MW\Logger\Base::INFO);
250 250
 				$errors['product'][$pos] = $e->getMessage();
251 251
 			}
252 252
 		}
@@ -262,22 +262,22 @@  discard block
 block discarded – undo
262 262
 	 * @param array $errors Associative list of previous errors
263 263
 	 * @return array Associative list of errors occured
264 264
 	 */
265
-	protected function copyServices( \Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors )
265
+	protected function copyServices(\Aimeos\MShop\Order\Item\Base\Iface $basket, array $errors)
266 266
 	{
267
-		foreach( $basket->getServices() as $type => $item )
267
+		foreach ($basket->getServices() as $type => $item)
268 268
 		{
269 269
 			try
270 270
 			{
271 271
 				$attributes = array();
272 272
 
273
-				foreach( $item->getAttributes() as $attrItem ) {
273
+				foreach ($item->getAttributes() as $attrItem) {
274 274
 					$attributes[$attrItem->getCode()] = $attrItem->getValue();
275 275
 				}
276 276
 
277
-				$this->setService( $type, $item->getServiceId(), $attributes );
278
-				$basket->deleteService( $type );
277
+				$this->setService($type, $item->getServiceId(), $attributes);
278
+				$basket->deleteService($type);
279 279
 			}
280
-			catch( \Exception $e ) { ; } // Don't notify the user as appropriate services can be added automatically
280
+			catch (\Exception $e) {; } // Don't notify the user as appropriate services can be added automatically
281 281
 		}
282 282
 
283 283
 		return $errors;
@@ -295,36 +295,36 @@  discard block
 block discarded – undo
295 295
 	 * @param array $attributeValues Associative list of attribute IDs as keys and their codes as values
296 296
 	 * @return array List of items implementing \Aimeos\MShop\Order\Item\Product\Attribute\Iface
297 297
 	 */
298
-	protected function createOrderProductAttributes( \Aimeos\MShop\Price\Item\Iface $price, $prodid, $quantity,
299
-			array $attributeIds, $type, array $attributeValues = array() )
298
+	protected function createOrderProductAttributes(\Aimeos\MShop\Price\Item\Iface $price, $prodid, $quantity,
299
+			array $attributeIds, $type, array $attributeValues = array())
300 300
 	{
301
-		if( empty( $attributeIds ) ) {
301
+		if (empty($attributeIds)) {
302 302
 			return array();
303 303
 		}
304 304
 
305
-		$attrTypeId = $this->getProductListTypeItem( 'attribute', $type )->getId();
306
-		$this->checkReferences( $prodid, 'attribute', $attrTypeId, $attributeIds );
305
+		$attrTypeId = $this->getProductListTypeItem('attribute', $type)->getId();
306
+		$this->checkReferences($prodid, 'attribute', $attrTypeId, $attributeIds);
307 307
 
308 308
 		$list = array();
309 309
 		$context = $this->getContext();
310 310
 
311
-		$priceManager = \Aimeos\MShop\Factory::createManager( $context, 'price' );
312
-		$orderProductAttributeManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product/attribute' );
311
+		$priceManager = \Aimeos\MShop\Factory::createManager($context, 'price');
312
+		$orderProductAttributeManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/product/attribute');
313 313
 
314
-		foreach( $this->getAttributes( $attributeIds ) as $id => $attrItem )
314
+		foreach ($this->getAttributes($attributeIds) as $id => $attrItem)
315 315
 		{
316
-			$prices = $attrItem->getRefItems( 'price', 'default', 'default' );
316
+			$prices = $attrItem->getRefItems('price', 'default', 'default');
317 317
 
318
-			if( !empty( $prices ) ) {
319
-				$price->addItem( $priceManager->getLowestPrice( $prices, $quantity ) );
318
+			if (!empty($prices)) {
319
+				$price->addItem($priceManager->getLowestPrice($prices, $quantity));
320 320
 			}
321 321
 
322 322
 			$item = $orderProductAttributeManager->createItem();
323
-			$item->copyFrom( $attrItem );
324
-			$item->setType( $type );
323
+			$item->copyFrom($attrItem);
324
+			$item->setType($type);
325 325
 
326
-			if( isset( $attributeValues[$id] ) ) {
327
-				$item->setValue( $attributeValues[$id] );
326
+			if (isset($attributeValues[$id])) {
327
+				$item->setValue($attributeValues[$id]);
328 328
 			}
329 329
 
330 330
 			$list[] = $item;
@@ -342,31 +342,31 @@  discard block
 block discarded – undo
342 342
 	 * @return array List of items implementing \Aimeos\MShop\Attribute\Item\Iface
343 343
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception If the actual attribute number doesn't match the expected one
344 344
 	 */
345
-	protected function getAttributes( array $attributeIds, array $domains = array( 'price', 'text' ) )
345
+	protected function getAttributes(array $attributeIds, array $domains = array('price', 'text'))
346 346
 	{
347
-		if( empty( $attributeIds ) ) {
347
+		if (empty($attributeIds)) {
348 348
 			return array();
349 349
 		}
350 350
 
351
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' );
351
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute');
352 352
 
353
-		$search = $attributeManager->createSearch( true );
353
+		$search = $attributeManager->createSearch(true);
354 354
 		$expr = array(
355
-				$search->compare( '==', 'attribute.id', $attributeIds ),
355
+				$search->compare('==', 'attribute.id', $attributeIds),
356 356
 				$search->getConditions(),
357 357
 		);
358
-		$search->setConditions( $search->combine( '&&', $expr ) );
359
-		$search->setSlice( 0, 0x7fffffff );
358
+		$search->setConditions($search->combine('&&', $expr));
359
+		$search->setSlice(0, 0x7fffffff);
360 360
 
361
-		$attrItems = $attributeManager->searchItems( $search, $domains );
361
+		$attrItems = $attributeManager->searchItems($search, $domains);
362 362
 
363
-		if( count( $attrItems ) !== count( $attributeIds ) )
363
+		if (count($attrItems) !== count($attributeIds))
364 364
 		{
365
-			$expected = implode( ',', $attributeIds );
366
-			$actual = implode( ',', array_keys( $attrItems ) );
367
-			$msg = sprintf( 'Available attribute IDs "%1$s" do not match the given attribute IDs "%2$s"', $actual, $expected );
365
+			$expected = implode(',', $attributeIds);
366
+			$actual = implode(',', array_keys($attrItems));
367
+			$msg = sprintf('Available attribute IDs "%1$s" do not match the given attribute IDs "%2$s"', $actual, $expected);
368 368
 
369
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
369
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
370 370
 		}
371 371
 
372 372
 		return $attrItems;
@@ -379,31 +379,31 @@  discard block
 block discarded – undo
379 379
 	 * @param \Aimeos\MShop\Order\Item\Base\Product\Attribute\Item[] $orderAttributes List of order product attribute items
380 380
 	 * @return \Aimeos\MShop\Attribute\Item\Iface[] Associative list of attribute IDs as key and attribute items as values
381 381
 	 */
382
-	protected function getAttributeItems( array $orderAttributes )
382
+	protected function getAttributeItems(array $orderAttributes)
383 383
 	{
384
-		if( empty( $orderAttributes ) ) {
384
+		if (empty($orderAttributes)) {
385 385
 			return array();
386 386
 		}
387 387
 
388
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' );
389
-		$search = $attributeManager->createSearch( true );
388
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute');
389
+		$search = $attributeManager->createSearch(true);
390 390
 		$expr = array();
391 391
 
392
-		foreach( $orderAttributes as $item )
392
+		foreach ($orderAttributes as $item)
393 393
 		{
394 394
 			$tmp = array(
395
-				$search->compare( '==', 'attribute.domain', 'product' ),
396
-				$search->compare( '==', 'attribute.code', $item->getValue() ),
397
-				$search->compare( '==', 'attribute.type.domain', 'product' ),
398
-				$search->compare( '==', 'attribute.type.code', $item->getCode() ),
399
-				$search->compare( '>', 'attribute.type.status', 0 ),
395
+				$search->compare('==', 'attribute.domain', 'product'),
396
+				$search->compare('==', 'attribute.code', $item->getValue()),
397
+				$search->compare('==', 'attribute.type.domain', 'product'),
398
+				$search->compare('==', 'attribute.type.code', $item->getCode()),
399
+				$search->compare('>', 'attribute.type.status', 0),
400 400
 				$search->getConditions(),
401 401
 			);
402
-			$expr[] = $search->combine( '&&', $tmp );
402
+			$expr[] = $search->combine('&&', $tmp);
403 403
 		}
404 404
 
405
-		$search->setConditions( $search->combine( '||', $expr ) );
406
-		return $attributeManager->searchItems( $search, array( 'price' ) );
405
+		$search->setConditions($search->combine('||', $expr));
406
+		return $attributeManager->searchItems($search, array('price'));
407 407
 	}
408 408
 
409 409
 
@@ -417,23 +417,23 @@  discard block
 block discarded – undo
417 417
 	 * @return \Aimeos\MShop\Common\Item\Iface Domain item object
418 418
 	 * @throws \Aimeos\Controller\Frontend\Basket\Exception
419 419
 	 */
420
-	protected function getDomainItem( $domain, $key, $value, array $ref )
420
+	protected function getDomainItem($domain, $key, $value, array $ref)
421 421
 	{
422
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $domain );
422
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $domain);
423 423
 
424
-		$search = $manager->createSearch( true );
424
+		$search = $manager->createSearch(true);
425 425
 		$expr = array(
426
-				$search->compare( '==', $key, $value ),
426
+				$search->compare('==', $key, $value),
427 427
 				$search->getConditions(),
428 428
 		);
429
-		$search->setConditions( $search->combine( '&&', $expr ) );
429
+		$search->setConditions($search->combine('&&', $expr));
430 430
 
431
-		$result = $manager->searchItems( $search, $ref );
431
+		$result = $manager->searchItems($search, $ref);
432 432
 
433
-		if( ( $item = reset( $result ) ) === false )
433
+		if (($item = reset($result)) === false)
434 434
 		{
435
-			$msg = sprintf( 'No item for "%1$s" (%2$s) found', $value, $key );
436
-			throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
435
+			$msg = sprintf('No item for "%1$s" (%2$s) found', $value, $key);
436
+			throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
437 437
 		}
438 438
 
439 439
 		return $item;
@@ -447,26 +447,26 @@  discard block
 block discarded – undo
447 447
 	 * @param string $code Code of the list type
448 448
 	 * @return \Aimeos\MShop\Common\Item\Type\Iface List type item
449 449
 	 */
450
-	protected function getProductListTypeItem( $domain, $code )
450
+	protected function getProductListTypeItem($domain, $code)
451 451
 	{
452
-		if( !isset( $this->listTypeAttributes[$domain][$code] ) )
452
+		if (!isset($this->listTypeAttributes[$domain][$code]))
453 453
 		{
454
-			$listTypeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/lists/type' );
454
+			$listTypeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/lists/type');
455 455
 
456
-			$listTypeSearch = $listTypeManager->createSearch( true );
456
+			$listTypeSearch = $listTypeManager->createSearch(true);
457 457
 			$expr = array(
458
-				$listTypeSearch->compare( '==', 'product.lists.type.domain', $domain ),
459
-				$listTypeSearch->compare( '==', 'product.lists.type.code', $code ),
458
+				$listTypeSearch->compare('==', 'product.lists.type.domain', $domain),
459
+				$listTypeSearch->compare('==', 'product.lists.type.code', $code),
460 460
 				$listTypeSearch->getConditions(),
461 461
 			);
462
-			$listTypeSearch->setConditions( $listTypeSearch->combine( '&&', $expr ) );
462
+			$listTypeSearch->setConditions($listTypeSearch->combine('&&', $expr));
463 463
 
464
-			$listTypeItems = $listTypeManager->searchItems( $listTypeSearch );
464
+			$listTypeItems = $listTypeManager->searchItems($listTypeSearch);
465 465
 
466
-			if( ( $listTypeItem = reset( $listTypeItems ) ) === false )
466
+			if (($listTypeItem = reset($listTypeItems)) === false)
467 467
 			{
468
-				$msg = sprintf( 'List type for domain "%1$s" and code "%2$s" not found', $domain, $code );
469
-				throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg );
468
+				$msg = sprintf('List type for domain "%1$s" and code "%2$s" not found', $domain, $code);
469
+				throw new \Aimeos\Controller\Frontend\Basket\Exception($msg);
470 470
 			}
471 471
 
472 472
 			$this->listTypeAttributes[$domain][$code] = $listTypeItem;
@@ -484,43 +484,43 @@  discard block
 block discarded – undo
484 484
 	 * @param array $domains Names of the domain items that should be fetched too
485 485
 	 * @return array List of products matching the given attributes
486 486
 	 */
487
-	protected function getProductVariants( \Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds,
488
-			array $domains = array( 'attribute', 'media', 'price', 'text' ) )
487
+	protected function getProductVariants(\Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds,
488
+			array $domains = array('attribute', 'media', 'price', 'text'))
489 489
 	{
490 490
 		$subProductIds = array();
491
-		foreach( $productItem->getRefItems( 'product', 'default', 'default' ) as $item ) {
491
+		foreach ($productItem->getRefItems('product', 'default', 'default') as $item) {
492 492
 			$subProductIds[] = $item->getId();
493 493
 		}
494 494
 
495
-		if( count( $subProductIds ) === 0 ) {
495
+		if (count($subProductIds) === 0) {
496 496
 			return array();
497 497
 		}
498 498
 
499
-		$productManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' );
500
-		$search = $productManager->createSearch( true );
499
+		$productManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product');
500
+		$search = $productManager->createSearch(true);
501 501
 
502 502
 		$expr = array(
503
-			$search->compare( '==', 'product.id', $subProductIds ),
503
+			$search->compare('==', 'product.id', $subProductIds),
504 504
 			$search->getConditions(),
505 505
 		);
506 506
 
507
-		if( count( $variantAttributeIds ) > 0 )
507
+		if (count($variantAttributeIds) > 0)
508 508
 		{
509
-			foreach( $variantAttributeIds as $key => $id ) {
509
+			foreach ($variantAttributeIds as $key => $id) {
510 510
 				$variantAttributeIds[$key] = (string) $id;
511 511
 			}
512 512
 
513
-			$listTypeItem = $this->getProductListTypeItem( 'attribute', 'variant' );
513
+			$listTypeItem = $this->getProductListTypeItem('attribute', 'variant');
514 514
 
515
-			$param = array( 'attribute', $listTypeItem->getId(), $variantAttributeIds );
516
-			$cmpfunc = $search->createFunction( 'product.contains', $param );
515
+			$param = array('attribute', $listTypeItem->getId(), $variantAttributeIds);
516
+			$cmpfunc = $search->createFunction('product.contains', $param);
517 517
 
518
-			$expr[] = $search->compare( '==', $cmpfunc, count( $variantAttributeIds ) );
518
+			$expr[] = $search->compare('==', $cmpfunc, count($variantAttributeIds));
519 519
 		}
520 520
 
521
-		$search->setConditions( $search->combine( '&&', $expr ) );
521
+		$search->setConditions($search->combine('&&', $expr));
522 522
 
523
-		return $productManager->searchItems( $search, $domains );
523
+		return $productManager->searchItems($search, $domains);
524 524
 	}
525 525
 
526 526
 
@@ -532,9 +532,9 @@  discard block
 block discarded – undo
532 532
 	 * @param mixed $default Default value if no value is available for the given name
533 533
 	 * @return mixed Value from the array or default value
534 534
 	 */
535
-	protected function getValue( array $values, $name, $default = null )
535
+	protected function getValue(array $values, $name, $default = null)
536 536
 	{
537
-		if( isset( $values[$name] ) ) {
537
+		if (isset($values[$name])) {
538 538
 			return $values[$name];
539 539
 		}
540 540
 
Please login to merge, or discard this patch.