Completed
Push — master ( a98373...830d97 )
by Aimeos
02:08
created
frontend/tests/Controller/Frontend/Basket/Decorator/BundleTest.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -18,40 +18,40 @@
 block discarded – undo
18 18
 	protected function setUp()
19 19
 	{
20 20
 		$this->context = \TestHelperFrontend::getContext();
21
-		$object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
22
-		$this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Bundle( $object, $this->context );
21
+		$object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
22
+		$this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Bundle($object, $this->context);
23 23
 	}
24 24
 
25 25
 
26 26
 	protected function tearDown()
27 27
 	{
28 28
 		$this->object->clear();
29
-		$this->context->getSession()->set( 'aimeos', [] );
29
+		$this->context->getSession()->set('aimeos', []);
30 30
 
31
-		unset( $this->object );
31
+		unset($this->object);
32 32
 	}
33 33
 
34 34
 
35 35
 	public function testAddProductBundle()
36 36
 	{
37
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:BUNDLE' );
37
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:BUNDLE');
38 38
 
39
-		$this->object->addProduct( $item->getId(), 1 );
39
+		$this->object->addProduct($item->getId(), 1);
40 40
 
41
-		$this->assertEquals( 1, count( $this->object->get()->getProducts() ) );
42
-		$this->assertEquals( 'U:BUNDLE', $this->object->get()->getProduct( 0 )->getProductCode() );
43
-		$this->assertEquals( 2, count( $this->object->get()->getProduct( 0 )->getProducts() ) );
41
+		$this->assertEquals(1, count($this->object->get()->getProducts()));
42
+		$this->assertEquals('U:BUNDLE', $this->object->get()->getProduct(0)->getProductCode());
43
+		$this->assertEquals(2, count($this->object->get()->getProduct(0)->getProducts()));
44 44
 	}
45 45
 
46 46
 
47 47
 	public function testAddProductNoBundle()
48 48
 	{
49
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' );
49
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC');
50 50
 
51
-		$this->object->addProduct( $item->getId(), 1 );
51
+		$this->object->addProduct($item->getId(), 1);
52 52
 
53
-		$this->assertEquals( 1, count( $this->object->get()->getProducts() ) );
54
-		$this->assertEquals( 'CNC', $this->object->get()->getProduct( 0 )->getProductCode() );
55
-		$this->assertEquals( 0, count( $this->object->get()->getProduct( 0 )->getProducts() ) );
53
+		$this->assertEquals(1, count($this->object->get()->getProducts()));
54
+		$this->assertEquals('CNC', $this->object->get()->getProduct(0)->getProductCode());
55
+		$this->assertEquals(0, count($this->object->get()->getProduct(0)->getProducts()));
56 56
 	}
57 57
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Common/Factory/BaseTest.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -20,33 +20,33 @@
 block discarded – undo
20 20
 		$this->context = \TestHelperFrontend::getContext();
21 21
 		$config = $this->context->getConfig();
22 22
 
23
-		$config->set( 'controller/frontend/common/decorators/default', [] );
24
-		$config->set( 'controller/frontend/catalog/decorators/global', [] );
25
-		$config->set( 'controller/frontend/catalog/decorators/local', [] );
23
+		$config->set('controller/frontend/common/decorators/default', []);
24
+		$config->set('controller/frontend/catalog/decorators/global', []);
25
+		$config->set('controller/frontend/catalog/decorators/local', []);
26 26
 
27 27
 	}
28 28
 
29 29
 
30 30
 	public function testInjectController()
31 31
 	{
32
-		$controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController( $this->context, 'Standard' );
33
-		\Aimeos\Controller\Frontend\Catalog\Factory::injectController( '\\Aimeos\\Controller\\Frontend\\Catalog\\Standard', $controller );
32
+		$controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController($this->context, 'Standard');
33
+		\Aimeos\Controller\Frontend\Catalog\Factory::injectController('\\Aimeos\\Controller\\Frontend\\Catalog\\Standard', $controller);
34 34
 
35
-		$injectedController = \Aimeos\Controller\Frontend\Catalog\Factory::createController( $this->context, 'Standard' );
35
+		$injectedController = \Aimeos\Controller\Frontend\Catalog\Factory::createController($this->context, 'Standard');
36 36
 
37
-		$this->assertSame( $controller, $injectedController );
37
+		$this->assertSame($controller, $injectedController);
38 38
 	}
39 39
 
40 40
 
41 41
 	public function testInjectControllerReset()
42 42
 	{
43
-		$controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController( $this->context, 'Standard' );
44
-		\Aimeos\Controller\Frontend\Catalog\Factory::injectController( '\\Aimeos\\Controller\\Frontend\\Catalog\\Standard', $controller );
45
-		\Aimeos\Controller\Frontend\Catalog\Factory::injectController( '\\Aimeos\\Controller\\Frontend\\Catalog\\Standard', null );
43
+		$controller = \Aimeos\Controller\Frontend\Catalog\Factory::createController($this->context, 'Standard');
44
+		\Aimeos\Controller\Frontend\Catalog\Factory::injectController('\\Aimeos\\Controller\\Frontend\\Catalog\\Standard', $controller);
45
+		\Aimeos\Controller\Frontend\Catalog\Factory::injectController('\\Aimeos\\Controller\\Frontend\\Catalog\\Standard', null);
46 46
 
47
-		$new = \Aimeos\Controller\Frontend\Catalog\Factory::createController( $this->context, 'Standard' );
47
+		$new = \Aimeos\Controller\Frontend\Catalog\Factory::createController($this->context, 'Standard');
48 48
 
49
-		$this->assertNotSame( $controller, $new );
49
+		$this->assertNotSame($controller, $new);
50 50
 	}
51 51
 
52 52
 }
53 53
\ No newline at end of file
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 = [] )
35
+	public function __construct($msg = '', $code = 0, \Exception $previous = null, array $list = [])
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/Locale/Iface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 * @return \Aimeos\MShop\Locale\Item\Iface Locale item including the referenced domains items
37 37
 	 * @since 2017.03
38 38
 	 */
39
-	public function getItem( $id, array $domains = [] );
39
+	public function getItem($id, array $domains = []);
40 40
 
41 41
 
42 42
 	/**
@@ -48,5 +48,5 @@  discard block
 block discarded – undo
48 48
 	 * @return array Ordered list of locale items implementing \Aimeos\MShop\Locale\Item\Iface
49 49
 	 * @since 2017.03
50 50
 	 */
51
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = [], &$total = null );
51
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = [], &$total = null);
52 52
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Locale/Standard.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,15 +31,15 @@  discard block
 block discarded – undo
31 31
 	public function createFilter()
32 32
 	{
33 33
 		$context = $this->getContext();
34
-		$filter = \Aimeos\MShop\Factory::createManager( $context, 'locale' )->createSearch( true );
34
+		$filter = \Aimeos\MShop\Factory::createManager($context, 'locale')->createSearch(true);
35 35
 
36 36
 		$expr = array(
37
-			$filter->compare( '==', 'locale.siteid', $context->getLocale()->getSitePath() ),
37
+			$filter->compare('==', 'locale.siteid', $context->getLocale()->getSitePath()),
38 38
 			$filter->getConditions(),
39 39
 		);
40 40
 
41
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
42
-		$filter->setSortations( array( $filter->sort( '+', 'locale.position' ) ) );
41
+		$filter->setConditions($filter->combine('&&', $expr));
42
+		$filter->setSortations(array($filter->sort('+', 'locale.position')));
43 43
 
44 44
 		return $filter;
45 45
 	}
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	 * @return \Aimeos\MShop\Locale\Item\Iface Locale item including the referenced domains items
54 54
 	 * @since 2017.03
55 55
 	 */
56
-	public function getItem( $id, array $domains = [] )
56
+	public function getItem($id, array $domains = [])
57 57
 	{
58
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'locale' )->getItem( $id, $domains, true );
58
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'locale')->getItem($id, $domains, true);
59 59
 	}
60 60
 
61 61
 
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 * @return array Ordered list of locale items implementing \Aimeos\MShop\Locale\Item\Iface
69 69
 	 * @since 2017.03
70 70
 	 */
71
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = [], &$total = null )
71
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = [], &$total = null)
72 72
 	{
73
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'locale' )->searchItems( $filter, $domains, $total );
73
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'locale')->searchItems($filter, $domains, $total);
74 74
 	}
75 75
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Factory.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
 	 * @param integer $id Context ID the objects have been created with (string of \Aimeos\MShop\Context\Item\Iface)
31 31
 	 * @param string $path Path describing the controller to clear, e.g. "basket"
32 32
 	 */
33
-	static public function clear( $id = null, $path = null )
33
+	static public function clear($id = null, $path = null)
34 34
 	{
35
-		if( $id !== null )
35
+		if ($id !== null)
36 36
 		{
37
-			if( $path !== null ) {
37
+			if ($path !== null) {
38 38
 				self::$controllers[$id][$path] = null;
39 39
 			} else {
40 40
 				self::$controllers[$id] = [];
@@ -62,37 +62,37 @@  discard block
 block discarded – undo
62 62
 	 * @return \Aimeos\Controller\Frontend\Iface New frontend controller
63 63
 	 * @throws \Aimeos\Controller\Frontend\Exception If the given path is invalid or the manager wasn't found
64 64
 	 */
65
-	static public function createController( \Aimeos\MShop\Context\Item\Iface $context, $path )
65
+	static public function createController(\Aimeos\MShop\Context\Item\Iface $context, $path)
66 66
 	{
67
-		if( empty( $path ) ) {
68
-			throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Controller path is empty' ) );
67
+		if (empty($path)) {
68
+			throw new \Aimeos\Controller\Frontend\Exception(sprintf('Controller path is empty'));
69 69
 		}
70 70
 
71 71
 		$id = (string) $context;
72 72
 
73
-		if( self::$cache === false || !isset( self::$controllers[$id][$path] ) )
73
+		if (self::$cache === false || !isset(self::$controllers[$id][$path]))
74 74
 		{
75
-			$parts = explode( '/', $path );
75
+			$parts = explode('/', $path);
76 76
 
77
-			foreach( $parts as $key => $part )
77
+			foreach ($parts as $key => $part)
78 78
 			{
79
-				if( ctype_alnum( $part ) === false ) {
80
-					throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in controller name "%1$s" in "%2$s"', $part, $path ) );
79
+				if (ctype_alnum($part) === false) {
80
+					throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in controller name "%1$s" in "%2$s"', $part, $path));
81 81
 				}
82 82
 
83
-				$parts[$key] = ucwords( $part );
83
+				$parts[$key] = ucwords($part);
84 84
 			}
85 85
 
86
-			$factory = '\\Aimeos\\Controller\\Frontend\\' . join( '\\', $parts ) . '\\Factory';
86
+			$factory = '\\Aimeos\\Controller\\Frontend\\' . join('\\', $parts) . '\\Factory';
87 87
 
88
-			if( class_exists( $factory ) === false ) {
89
-				throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Class "%1$s" not available', $factory ) );
88
+			if (class_exists($factory) === false) {
89
+				throw new \Aimeos\Controller\Frontend\Exception(sprintf('Class "%1$s" not available', $factory));
90 90
 			}
91 91
 
92
-			$manager = call_user_func_array( array( $factory, 'createController' ), array( $context ) );
92
+			$manager = call_user_func_array(array($factory, 'createController'), array($context));
93 93
 
94
-			if( $manager === false ) {
95
-				throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid factory "%1$s"', $factory ) );
94
+			if ($manager === false) {
95
+				throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid factory "%1$s"', $factory));
96 96
 			}
97 97
 
98 98
 			self::$controllers[$id][$path] = $manager;
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 * @param boolean $value True to enable caching, false to disable it.
109 109
 	 * @return boolean Previous cache setting
110 110
 	 */
111
-	static public function setCache( $value )
111
+	static public function setCache($value)
112 112
 	{
113 113
 		$old = self::$cache;
114 114
 		self::$cache = (boolean) $value;
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Customer/Iface.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 * @return \Aimeos\MShop\Customer\Item\Iface Customer item
27 27
 	 * @since 2017.04
28 28
 	 */
29
-	public function addItem( array $values );
29
+	public function addItem(array $values);
30 30
 
31 31
 
32 32
 	/**
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @return \Aimeos\MShop\Customer\Item\Iface Customer item
36 36
 	 * @since 2017.04
37 37
 	 */
38
-	public function createItem( array $values = [] );
38
+	public function createItem(array $values = []);
39 39
 
40 40
 
41 41
 	/**
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * @param string $id Unique customer ID
45 45
 	 * @since 2017.04
46 46
 	 */
47
-	public function deleteItem( $id );
47
+	public function deleteItem($id);
48 48
 
49 49
 
50 50
 	/**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 * @return \Aimeos\MShop\Customer\Item\Iface Customer item
56 56
 	 * @since 2017.04
57 57
 	 */
58
-	public function editItem( $id, array $values );
58
+	public function editItem($id, array $values);
59 59
 
60 60
 
61 61
 	/**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items
67 67
 	 * @since 2017.04
68 68
 	 */
69
-	public function getItem( $id = null, array $domains = [] );
69
+	public function getItem($id = null, array $domains = []);
70 70
 
71 71
 
72 72
 	/**
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items
80 80
 	 * @since 2017.04
81 81
 	 */
82
-	public function findItem( $code, array $domains = [] );
82
+	public function findItem($code, array $domains = []);
83 83
 
84 84
 
85 85
 	/**
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID
90 90
 	 * @since 2017.04
91 91
 	 */
92
-	public function saveItem( \Aimeos\MShop\Customer\Item\Iface $item );
92
+	public function saveItem(\Aimeos\MShop\Customer\Item\Iface $item);
93 93
 
94 94
 
95 95
 	/**
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @return \Aimeos\MShop\Customer\Item\Iface Customer address item
100 100
 	 * @since 2017.04
101 101
 	 */
102
-	public function addAddressItem( array $values );
102
+	public function addAddressItem(array $values);
103 103
 
104 104
 
105 105
 	/**
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item
109 109
 	 * @since 2017.04
110 110
 	 */
111
-	public function createAddressItem( array $values = [] );
111
+	public function createAddressItem(array $values = []);
112 112
 
113 113
 
114 114
 	/**
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 * @param string $id Unique customer address ID
118 118
 	 * @since 2017.04
119 119
 	 */
120
-	public function deleteAddressItem( $id );
120
+	public function deleteAddressItem($id);
121 121
 
122 122
 
123 123
 	/**
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * @return \Aimeos\MShop\Customer\Item\Iface Customer address item
129 129
 	 * @since 2017.04
130 130
 	 */
131
-	public function editAddressItem( $id, array $values );
131
+	public function editAddressItem($id, array $values);
132 132
 
133 133
 
134 134
 	/**
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item
139 139
 	 * @since 2017.04
140 140
 	 */
141
-	public function getAddressItem( $id );
141
+	public function getAddressItem($id);
142 142
 
143 143
 
144 144
 	/**
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID
149 149
 	 * @since 2017.04
150 150
 	 */
151
-	public function saveAddressItem( \Aimeos\MShop\Customer\Item\Address\Iface $item );
151
+	public function saveAddressItem(\Aimeos\MShop\Customer\Item\Address\Iface $item);
152 152
 
153 153
 	/**
154 154
 	 * Creates and returns a new list item object
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item
158 158
 	 * @since 2017.06
159 159
 	 */
160
-	public function addListItem( array $values );
160
+	public function addListItem(array $values);
161 161
 
162 162
 	/**
163 163
 	 * Returns a new customer lists filter criteria object
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	 * @param string $id Unique customer address ID
174 174
 	 * @since 2017.06
175 175
 	 */
176
-	public function deleteListItem( $id );
176
+	public function deleteListItem($id);
177 177
 
178 178
 	/**
179 179
 	 * Saves a modified customer lists item object
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item
184 184
 	 * @since 2017.06
185 185
 	 */
186
-	public function editListItem( $id, array $values );
186
+	public function editListItem($id, array $values);
187 187
 
188 188
 	/**
189 189
 	 * Returns the customer item for the given customer ID
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item
193 193
 	 * @since 2017.06
194 194
 	 */
195
-	public function getListItem( $id );
195
+	public function getListItem($id);
196 196
 
197 197
 	/**
198 198
 	 * Returns the customer lists items filtered by the given criteria
@@ -202,5 +202,5 @@  discard block
 block discarded – undo
202 202
 	 * @return \Aimeos\MShop\Common\Item\Lists\Iface[] Customer list items
203 203
 	 * @since 2017.06
204 204
 	 */
205
-	public function searchListItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null );
205
+	public function searchListItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null);
206 206
 }
Please login to merge, or discard this patch.
controller/frontend/tests/TestHelperFrontend.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -15,15 +15,15 @@  discard block
 block discarded – undo
15 15
 	public static function bootstrap()
16 16
 	{
17 17
 		self::getAimeos();
18
-		\Aimeos\MShop\Factory::setCache( false );
19
-		\Aimeos\Controller\Frontend\Factory::setCache( false );
18
+		\Aimeos\MShop\Factory::setCache(false);
19
+		\Aimeos\Controller\Frontend\Factory::setCache(false);
20 20
 	}
21 21
 
22 22
 
23
-	public static function getContext( $site = 'unittest' )
23
+	public static function getContext($site = 'unittest')
24 24
 	{
25
-		if( !isset( self::$context[$site] ) ) {
26
-			self::$context[$site] = self::createContext( $site );
25
+		if (!isset(self::$context[$site])) {
26
+			self::$context[$site] = self::createContext($site);
27 27
 		}
28 28
 
29 29
 		return clone self::$context[$site];
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 
33 33
 	private static function getAimeos()
34 34
 	{
35
-		if( !isset( self::$aimeos ) )
35
+		if (!isset(self::$aimeos))
36 36
 		{
37 37
 			require_once 'Bootstrap.php';
38
-			spl_autoload_register( 'Aimeos\\Bootstrap::autoload' );
38
+			spl_autoload_register('Aimeos\\Bootstrap::autoload');
39 39
 
40
-			$extdir = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) );
41
-			self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), true );
40
+			$extdir = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
41
+			self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true);
42 42
 		}
43 43
 
44 44
 		return self::$aimeos;
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	/**
49 49
 	 * @param string $site
50 50
 	 */
51
-	private static function createContext( $site )
51
+	private static function createContext($site)
52 52
 	{
53 53
 		$ctx = new \Aimeos\MShop\Context\Item\Standard();
54 54
 		$aimeos = self::getAimeos();
@@ -58,38 +58,38 @@  discard block
 block discarded – undo
58 58
 		$paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config';
59 59
 		$file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser';
60 60
 
61
-		$conf = new \Aimeos\MW\Config\PHPArray( [], $paths );
62
-		$conf = new \Aimeos\MW\Config\Decorator\Memory( $conf );
63
-		$conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file );
64
-		$ctx->setConfig( $conf );
61
+		$conf = new \Aimeos\MW\Config\PHPArray([], $paths);
62
+		$conf = new \Aimeos\MW\Config\Decorator\Memory($conf);
63
+		$conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file);
64
+		$ctx->setConfig($conf);
65 65
 
66 66
 
67
-		$dbm = new \Aimeos\MW\DB\Manager\PDO( $conf );
68
-		$ctx->setDatabaseManager( $dbm );
67
+		$dbm = new \Aimeos\MW\DB\Manager\PDO($conf);
68
+		$ctx->setDatabaseManager($dbm);
69 69
 
70 70
 
71
-		$mq = new \Aimeos\MW\MQueue\Manager\Standard( $conf );
72
-		$ctx->setMessageQueueManager( $mq );
71
+		$mq = new \Aimeos\MW\MQueue\Manager\Standard($conf);
72
+		$ctx->setMessageQueueManager($mq);
73 73
 
74 74
 
75
-		$logger = new \Aimeos\MW\Logger\File( 'unittest.log', \Aimeos\MW\Logger\Base::DEBUG );
76
-		$ctx->setLogger( $logger );
75
+		$logger = new \Aimeos\MW\Logger\File('unittest.log', \Aimeos\MW\Logger\Base::DEBUG);
76
+		$ctx->setLogger($logger);
77 77
 
78 78
 
79
-		$i18n = new \Aimeos\MW\Translation\None( 'de' );
80
-		$ctx->setI18n( array( 'de' => $i18n ) );
79
+		$i18n = new \Aimeos\MW\Translation\None('de');
80
+		$ctx->setI18n(array('de' => $i18n));
81 81
 
82 82
 
83 83
 		$session = new \Aimeos\MW\Session\None();
84
-		$ctx->setSession( $session );
84
+		$ctx->setSession($session);
85 85
 
86 86
 
87
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx );
88
-		$locale = $localeManager->bootstrap( $site, '', '', false );
89
-		$ctx->setLocale( $locale );
87
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx);
88
+		$locale = $localeManager->bootstrap($site, '', '', false);
89
+		$ctx->setLocale($locale);
90 90
 
91 91
 
92
-		$ctx->setEditor( 'core:controller/frontend' );
92
+		$ctx->setEditor('core:controller/frontend');
93 93
 
94 94
 		return $ctx;
95 95
 	}
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Order/Standard.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
 	 * @param string $type Arbitrary order type (max. eight chars)
30 30
 	 * @return \Aimeos\MShop\Order\Item\Iface Created order object
31 31
 	 */
32
-	public function addItem( $baseId, $type )
32
+	public function addItem($baseId, $type)
33 33
 	{
34 34
 		$total = 0;
35 35
 		$context = $this->getContext();
36
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
36
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'order');
37 37
 
38 38
 		/** controller/frontend/order/limit-seconds
39 39
 		 * Order limitation time frame in seconds
@@ -51,24 +51,24 @@  discard block
 block discarded – undo
51 51
 		 * @see controller/frontend/basket/limit-count
52 52
 		 * @see controller/frontend/basket/limit-seconds
53 53
 		 */
54
-		$seconds = $context->getConfig()->get( 'controller/frontend/order/limit-seconds', 300 );
54
+		$seconds = $context->getConfig()->get('controller/frontend/order/limit-seconds', 300);
55 55
 
56 56
 		$search = $manager->createSearch();
57 57
 		$expr = [
58
-			$search->compare( '==', 'order.baseid', $baseId ),
59
-			$search->compare( '>=', 'order.ctime', date( 'Y-m-d H:i:s', time() - $seconds ) ),
58
+			$search->compare('==', 'order.baseid', $baseId),
59
+			$search->compare('>=', 'order.ctime', date('Y-m-d H:i:s', time() - $seconds)),
60 60
 		];
61
-		$search->setConditions( $search->combine( '&&', $expr ) );
62
-		$search->setSlice( 0, 0 );
61
+		$search->setConditions($search->combine('&&', $expr));
62
+		$search->setSlice(0, 0);
63 63
 
64
-		$manager->searchItems( $search, [], $total );
64
+		$manager->searchItems($search, [], $total);
65 65
 
66
-		if( $total > 0 ) {
67
-			throw new \Aimeos\Controller\Frontend\Order\Exception( sprintf( 'The order has already been created' ) );
66
+		if ($total > 0) {
67
+			throw new \Aimeos\Controller\Frontend\Order\Exception(sprintf('The order has already been created'));
68 68
 		}
69 69
 
70
-		$item = $manager->createItem()->setBaseId( $baseId )->setType( $type );
71
-		return $manager->saveItem( $item );
70
+		$item = $manager->createItem()->setBaseId($baseId)->setType($type);
71
+		return $manager->saveItem($item);
72 72
 	}
73 73
 
74 74
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function createFilter()
81 81
 	{
82
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order' )->createSearch( true );
82
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'order')->createSearch(true);
83 83
 	}
84 84
 
85 85
 
@@ -90,30 +90,30 @@  discard block
 block discarded – undo
90 90
 	 * @param boolean $default Use default criteria to limit orders
91 91
 	 * @return \Aimeos\MShop\Order\Item\Iface Order object
92 92
 	 */
93
-	public function getItem( $id, $default = true )
93
+	public function getItem($id, $default = true)
94 94
 	{
95 95
 		$context = $this->getContext();
96
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
96
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'order');
97 97
 
98
-		$search = $manager->createSearch( true );
98
+		$search = $manager->createSearch(true);
99 99
 		$expr = [
100
-			$search->compare( '==', 'order.id', $id ),
100
+			$search->compare('==', 'order.id', $id),
101 101
 			$search->getConditions(),
102 102
 		];
103 103
 
104
-		if( $default !== false ) {
105
-			$expr[] = $search->compare( '==', 'order.editor', $context->getEditor() );
104
+		if ($default !== false) {
105
+			$expr[] = $search->compare('==', 'order.editor', $context->getEditor());
106 106
 		}
107 107
 
108
-		$search->setConditions( $search->combine( '&&', $expr ) );
108
+		$search->setConditions($search->combine('&&', $expr));
109 109
 
110
-		$items = $manager->searchItems( $search );
110
+		$items = $manager->searchItems($search);
111 111
 
112
-		if( ( $item = reset( $items ) ) !== false ) {
112
+		if (($item = reset($items)) !== false) {
113 113
 			return $item;
114 114
 		}
115 115
 
116
-		throw new \Aimeos\Controller\Frontend\Order\Exception( sprintf( 'No order item for ID "%1$s" found', $id ) );
116
+		throw new \Aimeos\Controller\Frontend\Order\Exception(sprintf('No order item for ID "%1$s" found', $id));
117 117
 	}
118 118
 
119 119
 
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
 	 * @param \Aimeos\MShop\Order\Item\Iface $item Order object
124 124
 	 * @return \Aimeos\MShop\Order\Item\Iface Saved order item
125 125
 	 */
126
-	public function saveItem( \Aimeos\MShop\Order\Item\Iface $item )
126
+	public function saveItem(\Aimeos\MShop\Order\Item\Iface $item)
127 127
 	{
128
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order' );
129
-		return $manager->saveItem( $item );
128
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order');
129
+		return $manager->saveItem($item);
130 130
 	}
131 131
 
132 132
 
@@ -137,18 +137,18 @@  discard block
 block discarded – undo
137 137
 	 * @param integer|null &$total Variable that will contain the total number of available items
138 138
 	 * @return \Aimeos\MShop\Order\Item\Iface[] Associative list of IDs as keys and order objects as values
139 139
 	 */
140
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null )
140
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null)
141 141
 	{
142 142
 		$context = $this->getContext();
143
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
143
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'order');
144 144
 
145 145
 		$expr = [
146 146
 			$filter->getConditions(),
147
-			$filter->compare( '==', 'order.base.customerid', $context->getUserId() ),
147
+			$filter->compare('==', 'order.base.customerid', $context->getUserId()),
148 148
 		];
149
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
149
+		$filter->setConditions($filter->combine('&&', $expr));
150 150
 
151
-		return $manager->searchItems( $filter, [], $total );
151
+		return $manager->searchItems($filter, [], $total);
152 152
 	}
153 153
 
154 154
 
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
172 172
 	 */
173
-	public function block( \Aimeos\MShop\Order\Item\Iface $orderItem )
173
+	public function block(\Aimeos\MShop\Order\Item\Iface $orderItem)
174 174
 	{
175
-		\Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->block( $orderItem );
175
+		\Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->block($orderItem);
176 176
 	}
177 177
 
178 178
 
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 	 *
195 195
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
196 196
 	 */
197
-	public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem )
197
+	public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem)
198 198
 	{
199
-		\Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->unblock( $orderItem );
199
+		\Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->unblock($orderItem);
200 200
 	}
201 201
 
202 202
 
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
 	 *
215 215
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
216 216
 	 */
217
-	public function update( \Aimeos\MShop\Order\Item\Iface $orderItem )
217
+	public function update(\Aimeos\MShop\Order\Item\Iface $orderItem)
218 218
 	{
219
-		\Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->update( $orderItem );
219
+		\Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->update($orderItem);
220 220
 	}
221 221
 }
Please login to merge, or discard this patch.