Completed
Push — master ( 1395b9...1c2323 )
by Aimeos
02:34
created
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', [] );
120
-		$excludes = $config->get( 'controller/frontend/' . $domain . '/decorators/excludes', [] );
119
+		$decorators = $config->get('controller/frontend/common/decorators/default', []);
120
+		$excludes = $config->get('controller/frontend/' . $domain . '/decorators/excludes', []);
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', [] );
134
-		$controller = self::addDecorators( $context, $controller, $decorators, $classprefix );
133
+		$decorators = $config->get('controller/frontend/' . $domain . '/decorators/global', []);
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', [] );
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', []);
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/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/Attribute/Standard.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 	 * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching
30 30
 	 * @since 2017.03
31 31
 	 */
32
-	public function addFilterTypes( \Aimeos\MW\Criteria\Iface $filter, array $codes )
32
+	public function addFilterTypes(\Aimeos\MW\Criteria\Iface $filter, array $codes)
33 33
 	{
34
-		if( !empty( $codes ) )
34
+		if (!empty($codes))
35 35
 		{
36 36
 			$expr = [
37
-				$filter->compare( '==', 'attribute.type.code', $codes ),
37
+				$filter->compare('==', 'attribute.type.code', $codes),
38 38
 				$filter->getConditions(),
39 39
 			];
40
-			$filter->setConditions( $filter->combine( '&&', $expr ) );
40
+			$filter->setConditions($filter->combine('&&', $expr));
41 41
 		}
42 42
 
43 43
 		return $filter;
@@ -53,15 +53,15 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function createFilter()
55 55
 	{
56
-		$filter = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' )->createSearch( true );
56
+		$filter = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute')->createSearch(true);
57 57
 
58 58
 		$expr = array(
59
-			$filter->compare( '==', 'attribute.domain', 'product' ),
59
+			$filter->compare('==', 'attribute.domain', 'product'),
60 60
 			$filter->getConditions(),
61 61
 		);
62 62
 
63
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
64
-		$filter->setSortations( array( $filter->sort( '+', 'attribute.position' ) ) );
63
+		$filter->setConditions($filter->combine('&&', $expr));
64
+		$filter->setSortations(array($filter->sort('+', 'attribute.position')));
65 65
 
66 66
 		return $filter;
67 67
 	}
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 	 * @return \Aimeos\MShop\Attribute\Item\Iface Attribute item including the referenced domains items
76 76
 	 * @since 2017.03
77 77
 	 */
78
-	public function getItem( $id, array $domains = array( 'media', 'price', 'text' ) )
78
+	public function getItem($id, array $domains = array('media', 'price', 'text'))
79 79
 	{
80
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' )->getItem( $id, $domains, true );
80
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute')->getItem($id, $domains, true);
81 81
 	}
82 82
 
83 83
 
@@ -89,20 +89,20 @@  discard block
 block discarded – undo
89 89
 	 * @return \Aimeos\MShop\Attribute\Item\Iface[] Associative list of attribute item including the referenced domains items
90 90
 	 * @since 2017.03
91 91
 	 */
92
-	public function getItems( array $ids, array $domains = array( 'media', 'price', 'text' ) )
92
+	public function getItems(array $ids, array $domains = array('media', 'price', 'text'))
93 93
 	{
94
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' );
94
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute');
95 95
 
96
-		$filter = $manager->createSearch( true );
96
+		$filter = $manager->createSearch(true);
97 97
 		$expr = [
98
-			$filter->compare( '==', 'attribute.domain', 'product' ),
99
-			$filter->compare( '==', 'attribute.id', $ids ),
98
+			$filter->compare('==', 'attribute.domain', 'product'),
99
+			$filter->compare('==', 'attribute.id', $ids),
100 100
 			$filter->getConditions(),
101 101
 		];
102
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
103
-		$filter->setSortations( array( $filter->sort( '+', 'attribute.position' ) ) );
102
+		$filter->setConditions($filter->combine('&&', $expr));
103
+		$filter->setSortations(array($filter->sort('+', 'attribute.position')));
104 104
 
105
-		return $manager->searchItems( $filter, $domains );
105
+		return $manager->searchItems($filter, $domains);
106 106
 	}
107 107
 
108 108
 
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 	 * @return array Ordered list of attribute items implementing \Aimeos\MShop\Attribute\Item\Iface
116 116
 	 * @since 2017.03
117 117
 	 */
118
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null )
118
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null)
119 119
 	{
120
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' )->searchItems( $filter, $domains, $total );
120
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute')->searchItems($filter, $domains, $total);
121 121
 	}
122 122
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Customer/StandardTest.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -18,114 +18,114 @@  discard block
 block discarded – undo
18 18
 	protected function setUp()
19 19
 	{
20 20
 		$this->context = \TestHelperFrontend::getContext();
21
-		$this->object = new \Aimeos\Controller\Frontend\Customer\Standard( $this->context );
21
+		$this->object = new \Aimeos\Controller\Frontend\Customer\Standard($this->context);
22 22
 	}
23 23
 
24 24
 
25 25
 	protected function tearDown()
26 26
 	{
27
-		unset( $this->context, $this->object );
27
+		unset($this->context, $this->object);
28 28
 	}
29 29
 
30 30
 
31 31
 	public function testAddEditSaveDeleteItem()
32 32
 	{
33
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' );
34
-		$id = $manager->findItem( 'UTC001' )->getId();
33
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer');
34
+		$id = $manager->findItem('UTC001')->getId();
35 35
 
36
-		$this->context->setUserId( $id );
37
-		$item = $this->object->addItem( ['customer.code' => 'unittest-ctnl', 'customer.status' => 1] );
38
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item );
36
+		$this->context->setUserId($id);
37
+		$item = $this->object->addItem(['customer.code' => 'unittest-ctnl', 'customer.status' => 1]);
38
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item);
39 39
 
40
-		$this->context->setUserId( $item->getId() );
41
-		$item = $this->object->editItem( $item->getId(), ['customer.code' => 'unittest-ctnl2'] );
42
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item );
40
+		$this->context->setUserId($item->getId());
41
+		$item = $this->object->editItem($item->getId(), ['customer.code' => 'unittest-ctnl2']);
42
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item);
43 43
 
44
-		$item->setStatus( 0 );
45
-		$this->object->saveItem( $item );
46
-		$this->assertEquals( 0, $item->getStatus() );
44
+		$item->setStatus(0);
45
+		$this->object->saveItem($item);
46
+		$this->assertEquals(0, $item->getStatus());
47 47
 
48
-		$this->object->deleteItem( $item->getId() );
48
+		$this->object->deleteItem($item->getId());
49 49
 
50
-		$this->setExpectedException( '\Aimeos\MShop\Exception' );
51
-		$manager->findItem( 'unittest-ctnl' );
50
+		$this->setExpectedException('\Aimeos\MShop\Exception');
51
+		$manager->findItem('unittest-ctnl');
52 52
 	}
53 53
 
54 54
 
55 55
 	public function testCreateItem()
56 56
 	{
57 57
 		$result = $this->object->createItem();
58
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result );
58
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result);
59 59
 	}
60 60
 
61 61
 
62 62
 	public function testGetItem()
63 63
 	{
64
-		$id = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' )->getId();
65
-		$this->context->setUserId( $id );
64
+		$id = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001')->getId();
65
+		$this->context->setUserId($id);
66 66
 
67
-		$result = $this->object->getItem( $id, ['customer/address', 'text'] );
67
+		$result = $this->object->getItem($id, ['customer/address', 'text']);
68 68
 
69
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result );
70
-		$this->assertEquals( 1, count( $result->getRefItems( 'text' ) ) );
71
-		$this->assertEquals( 1, count( $result->getAddressItems() ) );
69
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result);
70
+		$this->assertEquals(1, count($result->getRefItems('text')));
71
+		$this->assertEquals(1, count($result->getAddressItems()));
72 72
 	}
73 73
 
74 74
 
75 75
 	public function testFindItem()
76 76
 	{
77
-		$result = $this->object->findItem( 'UTC001' );
78
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result );
77
+		$result = $this->object->findItem('UTC001');
78
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result);
79 79
 	}
80 80
 
81 81
 
82 82
 	public function testAddEditSaveDeleteAddressItem()
83 83
 	{
84
-		$customer = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' );
85
-		$this->context->setUserId( $customer->getId() );
84
+		$customer = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001');
85
+		$this->context->setUserId($customer->getId());
86 86
 
87
-		$item = $this->object->addAddressItem( ['customer.address.lastname' => 'unittest-ctnl'] );
88
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item );
87
+		$item = $this->object->addAddressItem(['customer.address.lastname' => 'unittest-ctnl']);
88
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item);
89 89
 
90
-		$item = $this->object->editAddressItem( $item->getId(), ['customer.address.lastname' => 'unittest-ctnl2'] );
91
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item );
90
+		$item = $this->object->editAddressItem($item->getId(), ['customer.address.lastname' => 'unittest-ctnl2']);
91
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item);
92 92
 
93
-		$item->setLastName( 'test' );
94
-		$this->object->saveAddressItem( $item );
95
-		$this->assertEquals( 'test', $item->getLastName() );
93
+		$item->setLastName('test');
94
+		$this->object->saveAddressItem($item);
95
+		$this->assertEquals('test', $item->getLastName());
96 96
 
97
-		$this->object->deleteAddressItem( $item->getId() );
97
+		$this->object->deleteAddressItem($item->getId());
98 98
 	}
99 99
 
100 100
 
101 101
 	public function testCreateAddressItem()
102 102
 	{
103 103
 		$result = $this->object->createAddressItem();
104
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result );
104
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result);
105 105
 	}
106 106
 
107 107
 
108 108
 	public function testGetAddressItem()
109 109
 	{
110
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/address' );
110
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer/address');
111 111
 		$search = $manager->createSearch();
112
-		$search->setSlice( 0, 1 );
113
-		$result = $manager->searchItems( $search );
112
+		$search->setSlice(0, 1);
113
+		$result = $manager->searchItems($search);
114 114
 
115
-		if( ( $item = reset( $result ) ) === false ) {
116
-			throw new \RuntimeException( 'No customer address available' );
115
+		if (($item = reset($result)) === false) {
116
+			throw new \RuntimeException('No customer address available');
117 117
 		}
118 118
 
119
-		$this->context->setUserId( $item->getParentId() );
120
-		$result = $this->object->getAddressItem( $item->getId() );
121
-		$this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result );
119
+		$this->context->setUserId($item->getParentId());
120
+		$result = $this->object->getAddressItem($item->getId());
121
+		$this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result);
122 122
 	}
123 123
 
124 124
 
125 125
 	public function testAddEditDeleteListItem()
126 126
 	{
127
-		$customer = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' );
128
-		$this->context->setUserId( $customer->getId() );
127
+		$customer = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001');
128
+		$this->context->setUserId($customer->getId());
129 129
 
130 130
 		$values = [
131 131
 			'customer.lists.type' => 'favorite',
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 			'customer.lists.refid' => '-1'
134 134
 		];
135 135
 
136
-		$item = $this->object->addListItem( $values );
137
-		$this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item );
136
+		$item = $this->object->addListItem($values);
137
+		$this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item);
138 138
 
139 139
 		$values = [
140 140
 			'customer.lists.type' => 'favorite',
@@ -142,46 +142,46 @@  discard block
 block discarded – undo
142 142
 			'customer.lists.refid' => '-2'
143 143
 		];
144 144
 
145
-		$item = $this->object->editListItem( $item->getId(), $values );
146
-		$this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item );
145
+		$item = $this->object->editListItem($item->getId(), $values);
146
+		$this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item);
147 147
 
148
-		$this->object->deleteListItem( $item->getId() );
148
+		$this->object->deleteListItem($item->getId());
149 149
 
150
-		$this->setExpectedException( '\Aimeos\MShop\Exception' );
151
-		$this->object->getListItem( $item->getId() );
150
+		$this->setExpectedException('\Aimeos\MShop\Exception');
151
+		$this->object->getListItem($item->getId());
152 152
 	}
153 153
 
154 154
 
155 155
 	public function testGetListItem()
156 156
 	{
157
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/lists' );
157
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer/lists');
158 158
 		$search = $manager->createSearch();
159
-		$search->setSlice( 0, 1 );
160
-		$result = $manager->searchItems( $search );
159
+		$search->setSlice(0, 1);
160
+		$result = $manager->searchItems($search);
161 161
 
162
-		if( ( $item = reset( $result ) ) === false ) {
163
-			throw new \RuntimeException( 'No customer lists item available' );
162
+		if (($item = reset($result)) === false) {
163
+			throw new \RuntimeException('No customer lists item available');
164 164
 		}
165 165
 
166
-		$this->context->setUserId( $item->getParentId() );
167
-		$result = $this->object->getListItem( $item->getId() );
168
-		$this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $result );
166
+		$this->context->setUserId($item->getParentId());
167
+		$result = $this->object->getListItem($item->getId());
168
+		$this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $result);
169 169
 	}
170 170
 
171 171
 
172 172
 	public function testSearchListItem()
173 173
 	{
174
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' );
175
-		$customer = $manager->findItem( 'UTC001' );
176
-		$this->context->setUserId( $customer->getId() );
174
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer');
175
+		$customer = $manager->findItem('UTC001');
176
+		$this->context->setUserId($customer->getId());
177 177
 
178 178
 		$filter = $this->object->createListsFilter();
179
-		$result = $this->object->searchListItems( $filter );
179
+		$result = $this->object->searchListItems($filter);
180 180
 
181
-		foreach( $result as $item )
181
+		foreach ($result as $item)
182 182
 		{
183
-			$this->assertEquals( $customer->getId(), $item->getParentId() );
184
-			$this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item );
183
+			$this->assertEquals($customer->getId(), $item->getParentId());
184
+			$this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item);
185 185
 		}
186 186
 	}
187 187
 }
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
 	/**
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 * @param \Aimeos\MShop\Customer\Item\Iface Customer item
89 89
 	 * @since 2017.04
90 90
 	 */
91
-	public function saveItem( \Aimeos\MShop\Customer\Item\Iface $item );
91
+	public function saveItem(\Aimeos\MShop\Customer\Item\Iface $item);
92 92
 
93 93
 
94 94
 	/**
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 * @return \Aimeos\MShop\Customer\Item\Iface Customer address item
99 99
 	 * @since 2017.04
100 100
 	 */
101
-	public function addAddressItem( array $values );
101
+	public function addAddressItem(array $values);
102 102
 
103 103
 
104 104
 	/**
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item
108 108
 	 * @since 2017.04
109 109
 	 */
110
-	public function createAddressItem( array $values = [] );
110
+	public function createAddressItem(array $values = []);
111 111
 
112 112
 
113 113
 	/**
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 * @param string $id Unique customer address ID
117 117
 	 * @since 2017.04
118 118
 	 */
119
-	public function deleteAddressItem( $id );
119
+	public function deleteAddressItem($id);
120 120
 
121 121
 
122 122
 	/**
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 * @return \Aimeos\MShop\Customer\Item\Iface Customer address item
128 128
 	 * @since 2017.04
129 129
 	 */
130
-	public function editAddressItem( $id, array $values );
130
+	public function editAddressItem($id, array $values);
131 131
 
132 132
 
133 133
 	/**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item
138 138
 	 * @since 2017.04
139 139
 	 */
140
-	public function getAddressItem( $id );
140
+	public function getAddressItem($id);
141 141
 
142 142
 
143 143
 	/**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @param \Aimeos\MShop\Customer\Item\Address\Iface Customer address item
147 147
 	 * @since 2017.04
148 148
 	 */
149
-	public function saveAddressItem( \Aimeos\MShop\Customer\Item\Address\Iface $item );
149
+	public function saveAddressItem(\Aimeos\MShop\Customer\Item\Address\Iface $item);
150 150
 
151 151
 	/**
152 152
 	 * Creates and returns a new list item object
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item
156 156
 	 * @since 2017.06
157 157
 	 */
158
-	public function addListItem( array $values );
158
+	public function addListItem(array $values);
159 159
 
160 160
 	/**
161 161
 	 * Returns a new customer lists filter criteria object
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	 * @param string $id Unique customer address ID
172 172
 	 * @since 2017.06
173 173
 	 */
174
-	public function deleteListItem( $id );
174
+	public function deleteListItem($id);
175 175
 
176 176
 	/**
177 177
 	 * Saves a modified customer lists item object
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item
182 182
 	 * @since 2017.06
183 183
 	 */
184
-	public function editListItem( $id, array $values );
184
+	public function editListItem($id, array $values);
185 185
 
186 186
 	/**
187 187
 	 * Returns the customer item for the given customer ID
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item
191 191
 	 * @since 2017.06
192 192
 	 */
193
-	public function getListItem( $id );
193
+	public function getListItem($id);
194 194
 
195 195
 	/**
196 196
 	 * Returns the customer lists items filtered by the given criteria
@@ -200,5 +200,5 @@  discard block
 block discarded – undo
200 200
 	 * @return \Aimeos\MShop\Common\Item\Lists\Iface[] Customer list items
201 201
 	 * @since 2017.06
202 202
 	 */
203
-	public function searchListItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null );
203
+	public function searchListItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null);
204 204
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Order/StandardTest.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -18,183 +18,183 @@
 block discarded – undo
18 18
 
19 19
 	protected function setUp()
20 20
 	{
21
-		\Aimeos\MShop\Factory::setCache( true );
21
+		\Aimeos\MShop\Factory::setCache(true);
22 22
 
23 23
 		$this->context = \TestHelperFrontend::getContext();
24
-		$this->object = new \Aimeos\Controller\Frontend\Order\Standard( $this->context );
24
+		$this->object = new \Aimeos\Controller\Frontend\Order\Standard($this->context);
25 25
 	}
26 26
 
27 27
 
28 28
 	protected function tearDown()
29 29
 	{
30
-		unset( $this->object, $this->context );
30
+		unset($this->object, $this->context);
31 31
 
32
-		\Aimeos\MShop\Factory::setCache( false );
32
+		\Aimeos\MShop\Factory::setCache(false);
33 33
 		\Aimeos\MShop\Factory::clear();
34 34
 	}
35 35
 
36 36
 
37 37
 	public function testAddItem()
38 38
 	{
39
-		$manager = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' )
40
-			->setConstructorArgs( [$this->context] )
41
-			->setMethods( ['saveItem'] )
39
+		$manager = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')
40
+			->setConstructorArgs([$this->context])
41
+			->setMethods(['saveItem'])
42 42
 			->getMock();
43 43
 
44
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'order', $manager );
44
+		\Aimeos\MShop\Factory::injectManager($this->context, 'order', $manager);
45 45
 
46
-		$manager->expects( $this->once() )->method( 'saveItem' );
46
+		$manager->expects($this->once())->method('saveItem');
47 47
 
48
-		$this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Iface', $this->object->addItem( -1, 'test' ) );
48
+		$this->assertInstanceOf('\Aimeos\MShop\Order\Item\Iface', $this->object->addItem( -1, 'test' ));
49 49
 	}
50 50
 
51 51
 
52 52
 	public function testAddItemLimit()
53 53
 	{
54
-		$this->context->getConfig()->set( 'controller/frontend/order/limit-seconds', 86400 * 365 );
54
+		$this->context->getConfig()->set('controller/frontend/order/limit-seconds', 86400 * 365);
55 55
 
56
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' );
57
-		$result = $manager->searchItems( $manager->createSearch()->setSlice( 0, 1 ) );
56
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base');
57
+		$result = $manager->searchItems($manager->createSearch()->setSlice(0, 1));
58 58
 
59
-		if( ( $item = reset( $result ) ) === false ) {
60
-			throw new \RuntimeException( 'No order item found' );
59
+		if (($item = reset($result)) === false) {
60
+			throw new \RuntimeException('No order item found');
61 61
 		}
62 62
 
63
-		$this->setExpectedException( '\Aimeos\Controller\Frontend\Order\Exception' );
64
-		$this->object->addItem( $item->getId(), 'test' );
63
+		$this->setExpectedException('\Aimeos\Controller\Frontend\Order\Exception');
64
+		$this->object->addItem($item->getId(), 'test');
65 65
 	}
66 66
 
67 67
 
68 68
 	public function testCreateFilter()
69 69
 	{
70
-		$this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->createFilter() );
70
+		$this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->createFilter());
71 71
 	}
72 72
 
73 73
 
74 74
 	public function testGetItem()
75 75
 	{
76
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' );
77
-		$customerItem = $manager->findItem( 'UTC001' );
76
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer');
77
+		$customerItem = $manager->findItem('UTC001');
78 78
 
79
-		$this->context->setEditor( 'core:unittest' );
79
+		$this->context->setEditor('core:unittest');
80 80
 
81
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'order' );
82
-		$search = $manager->createSearch()->setSlice( 0, 1 );
83
-		$search->setConditions( $search->compare( '==', 'order.base.customerid', $customerItem->getId() ) );
84
-		$result = $manager->searchItems( $search );
81
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'order');
82
+		$search = $manager->createSearch()->setSlice(0, 1);
83
+		$search->setConditions($search->compare('==', 'order.base.customerid', $customerItem->getId()));
84
+		$result = $manager->searchItems($search);
85 85
 
86
-		if( ( $item = reset( $result ) ) === false ) {
87
-			throw new \RuntimeException( 'No order item found' );
86
+		if (($item = reset($result)) === false) {
87
+			throw new \RuntimeException('No order item found');
88 88
 		}
89 89
 
90
-		$this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Iface', $this->object->getItem( $item->getId() ) );
90
+		$this->assertInstanceOf('\Aimeos\MShop\Order\Item\Iface', $this->object->getItem($item->getId()));
91 91
 	}
92 92
 
93 93
 
94 94
 	public function testGetItemException()
95 95
 	{
96
-		$this->setExpectedException( '\Aimeos\Controller\Frontend\Order\Exception' );
96
+		$this->setExpectedException('\Aimeos\Controller\Frontend\Order\Exception');
97 97
 		$this->object->getItem( -1 );
98 98
 	}
99 99
 
100 100
 
101 101
 	public function testSearchItems()
102 102
 	{
103
-		$this->assertGreaterThan( 1, $this->object->searchItems( $this->object->createFilter() ) );
103
+		$this->assertGreaterThan(1, $this->object->searchItems($this->object->createFilter()));
104 104
 	}
105 105
 
106 106
 
107 107
 	public function testStore()
108 108
 	{
109 109
 		$name = 'ControllerFrontendOrderStore';
110
-		$this->context->getConfig()->set( 'mshop/order/manager/name', $name );
110
+		$this->context->getConfig()->set('mshop/order/manager/name', $name);
111 111
 
112 112
 
113
-		$orderManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' )
114
-			->setMethods( array( 'saveItem', 'getSubManager' ) )
115
-			->setConstructorArgs( array( $this->context ) )
113
+		$orderManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')
114
+			->setMethods(array('saveItem', 'getSubManager'))
115
+			->setConstructorArgs(array($this->context))
116 116
 			->getMock();
117 117
 
118
-		$orderBaseManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard' )
119
-			->setMethods( array( 'store' ) )
120
-			->setConstructorArgs( array( $this->context ) )
118
+		$orderBaseManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard')
119
+			->setMethods(array('store'))
120
+			->setConstructorArgs(array($this->context))
121 121
 			->getMock();
122 122
 
123
-		\Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub );
123
+		\Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub);
124 124
 
125 125
 
126 126
 		$orderBaseItem = $orderBaseManagerStub->createItem();
127
-		$orderBaseItem->setId( 1 );
127
+		$orderBaseItem->setId(1);
128 128
 
129 129
 
130
-		$orderBaseManagerStub->expects( $this->once() )->method( 'store' );
130
+		$orderBaseManagerStub->expects($this->once())->method('store');
131 131
 
132
-		$orderManagerStub->expects( $this->once() )->method( 'getSubManager' )
133
-			->will( $this->returnValue( $orderBaseManagerStub ) );
132
+		$orderManagerStub->expects($this->once())->method('getSubManager')
133
+			->will($this->returnValue($orderBaseManagerStub));
134 134
 
135
-		$orderManagerStub->expects( $this->once() )->method( 'saveItem' );
135
+		$orderManagerStub->expects($this->once())->method('saveItem');
136 136
 
137 137
 
138
-		$this->object->store( $orderBaseItem );
138
+		$this->object->store($orderBaseItem);
139 139
 	}
140 140
 
141 141
 
142 142
 	public function testBlock()
143 143
 	{
144 144
 		$name = 'ControllerFrontendOrderBlock';
145
-		$this->context->getConfig()->set( 'controller/common/order/name', $name );
145
+		$this->context->getConfig()->set('controller/common/order/name', $name);
146 146
 
147 147
 
148
-		$orderCntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Order\\Standard' )
149
-			->setMethods( array( 'block' ) )
150
-			->setConstructorArgs( array( $this->context ) )
148
+		$orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard')
149
+			->setMethods(array('block'))
150
+			->setConstructorArgs(array($this->context))
151 151
 			->getMock();
152 152
 
153
-		\Aimeos\Controller\Common\Order\Factory::injectController( '\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub );
153
+		\Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub);
154 154
 
155
-		$orderCntlStub->expects( $this->once() )->method( 'block' );
155
+		$orderCntlStub->expects($this->once())->method('block');
156 156
 
157 157
 
158
-		$this->object->block( \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem() );
158
+		$this->object->block(\Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem());
159 159
 	}
160 160
 
161 161
 
162 162
 	public function testUnblock()
163 163
 	{
164 164
 		$name = 'ControllerFrontendOrderUnblock';
165
-		$this->context->getConfig()->set( 'controller/common/order/name', $name );
165
+		$this->context->getConfig()->set('controller/common/order/name', $name);
166 166
 
167 167
 
168
-		$orderCntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Order\\Standard' )
169
-			->setMethods( array( 'unblock' ) )
170
-			->setConstructorArgs( array( $this->context ) )
168
+		$orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard')
169
+			->setMethods(array('unblock'))
170
+			->setConstructorArgs(array($this->context))
171 171
 			->getMock();
172 172
 
173
-		\Aimeos\Controller\Common\Order\Factory::injectController( '\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub );
173
+		\Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub);
174 174
 
175
-		$orderCntlStub->expects( $this->once() )->method( 'unblock' );
175
+		$orderCntlStub->expects($this->once())->method('unblock');
176 176
 
177 177
 
178
-		$this->object->unblock( \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem() );
178
+		$this->object->unblock(\Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem());
179 179
 	}
180 180
 
181 181
 
182 182
 	public function testUpdate()
183 183
 	{
184 184
 		$name = 'ControllerFrontendOrderUpdate';
185
-		$this->context->getConfig()->set( 'controller/common/order/name', $name );
185
+		$this->context->getConfig()->set('controller/common/order/name', $name);
186 186
 
187 187
 
188
-		$orderCntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Order\\Standard' )
189
-			->setMethods( array( 'update' ) )
190
-			->setConstructorArgs( array( $this->context ) )
188
+		$orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard')
189
+			->setMethods(array('update'))
190
+			->setConstructorArgs(array($this->context))
191 191
 			->getMock();
192 192
 
193
-		\Aimeos\Controller\Common\Order\Factory::injectController( '\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub );
193
+		\Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub);
194 194
 
195
-		$orderCntlStub->expects( $this->once() )->method( 'update' );
195
+		$orderCntlStub->expects($this->once())->method('update');
196 196
 
197 197
 
198
-		$this->object->update( \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem() );
198
+		$this->object->update(\Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem());
199 199
 	}
200 200
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Order/Standard.php 1 patch
Spacing   +41 added lines, -41 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
-		$manager->saveItem( $item );
70
+		$item = $manager->createItem()->setBaseId($baseId)->setType($type);
71
+		$manager->saveItem($item);
72 72
 
73 73
 		return $item;
74 74
 	}
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public function createFilter()
83 83
 	{
84
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order' )->createSearch( true );
84
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'order')->createSearch(true);
85 85
 	}
86 86
 
87 87
 
@@ -92,30 +92,30 @@  discard block
 block discarded – undo
92 92
 	 * @param boolean $default Use default criteria to limit orders
93 93
 	 * @return \Aimeos\MShop\Order\Item\Iface Order object
94 94
 	 */
95
-	public function getItem( $id, $default = true )
95
+	public function getItem($id, $default = true)
96 96
 	{
97 97
 		$context = $this->getContext();
98
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
98
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'order');
99 99
 
100
-		$search = $manager->createSearch( true );
100
+		$search = $manager->createSearch(true);
101 101
 		$expr = [
102
-			$search->compare( '==', 'order.id', $id ),
102
+			$search->compare('==', 'order.id', $id),
103 103
 			$search->getConditions(),
104 104
 		];
105 105
 
106
-		if( $default !== false ) {
107
-			$expr[] = $search->compare( '==', 'order.editor', $context->getEditor() );
106
+		if ($default !== false) {
107
+			$expr[] = $search->compare('==', 'order.editor', $context->getEditor());
108 108
 		}
109 109
 
110
-		$search->setConditions( $search->combine( '&&', $expr ) );
110
+		$search->setConditions($search->combine('&&', $expr));
111 111
 
112
-		$items = $manager->searchItems( $search );
112
+		$items = $manager->searchItems($search);
113 113
 
114
-		if( ( $item = reset( $items ) ) !== false ) {
114
+		if (($item = reset($items)) !== false) {
115 115
 			return $item;
116 116
 		}
117 117
 
118
-		throw new \Aimeos\Controller\Frontend\Order\Exception( sprintf( 'No order item for ID "%1$s" found', $id ) );
118
+		throw new \Aimeos\Controller\Frontend\Order\Exception(sprintf('No order item for ID "%1$s" found', $id));
119 119
 	}
120 120
 
121 121
 
@@ -126,18 +126,18 @@  discard block
 block discarded – undo
126 126
 	 * @param integer|null &$total Variable that will contain the total number of available items
127 127
 	 * @return \Aimeos\MShop\Order\Item\Iface[] Associative list of IDs as keys and order objects as values
128 128
 	 */
129
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null )
129
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null)
130 130
 	{
131 131
 		$context = $this->getContext();
132
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
132
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'order');
133 133
 
134 134
 		$expr = [
135 135
 			$filter->getConditions(),
136
-			$filter->compare( '==', 'order.base.customerid', $context->getUserId() ),
136
+			$filter->compare('==', 'order.base.customerid', $context->getUserId()),
137 137
 		];
138
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
138
+		$filter->setConditions($filter->combine('&&', $expr));
139 139
 
140
-		return $manager->searchItems( $filter, [], $total );
140
+		return $manager->searchItems($filter, [], $total);
141 141
 	}
142 142
 
143 143
 
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
 	 *
160 160
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
161 161
 	 */
162
-	public function block( \Aimeos\MShop\Order\Item\Iface $orderItem )
162
+	public function block(\Aimeos\MShop\Order\Item\Iface $orderItem)
163 163
 	{
164
-		\Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->block( $orderItem );
164
+		\Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->block($orderItem);
165 165
 	}
166 166
 
167 167
 
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
 	 *
184 184
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
185 185
 	 */
186
-	public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem )
186
+	public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem)
187 187
 	{
188
-		\Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->unblock( $orderItem );
188
+		\Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->unblock($orderItem);
189 189
 	}
190 190
 
191 191
 
@@ -203,9 +203,9 @@  discard block
 block discarded – undo
203 203
 	 *
204 204
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
205 205
 	 */
206
-	public function update( \Aimeos\MShop\Order\Item\Iface $orderItem )
206
+	public function update(\Aimeos\MShop\Order\Item\Iface $orderItem)
207 207
 	{
208
-		\Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->update( $orderItem );
208
+		\Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->update($orderItem);
209 209
 	}
210 210
 
211 211
 
@@ -220,22 +220,22 @@  discard block
 block discarded – undo
220 220
 	 * @return \Aimeos\MShop\Order\Item\Iface Order item that belongs to the stored basket
221 221
 	 * @deprecated 2017.04 Use store() from basket controller instead
222 222
 	 */
223
-	public function store( \Aimeos\MShop\Order\Item\Base\Iface $basket )
223
+	public function store(\Aimeos\MShop\Order\Item\Base\Iface $basket)
224 224
 	{
225 225
 		$context = $this->getContext();
226 226
 
227
-		$orderManager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
228
-		$orderBaseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' );
227
+		$orderManager = \Aimeos\MShop\Factory::createManager($context, 'order');
228
+		$orderBaseManager = \Aimeos\MShop\Factory::createManager($context, 'order/base');
229 229
 
230 230
 
231 231
 		$orderBaseManager->begin();
232
-		$orderBaseManager->store( $basket );
232
+		$orderBaseManager->store($basket);
233 233
 		$orderBaseManager->commit();
234 234
 
235 235
 		$orderItem = $orderManager->createItem();
236
-		$orderItem->setBaseId( $basket->getId() );
237
-		$orderItem->setType( \Aimeos\MShop\Order\Item\Base::TYPE_WEB );
238
-		$orderManager->saveItem( $orderItem );
236
+		$orderItem->setBaseId($basket->getId());
237
+		$orderItem->setType(\Aimeos\MShop\Order\Item\Base::TYPE_WEB);
238
+		$orderManager->saveItem($orderItem);
239 239
 
240 240
 
241 241
 		return $orderItem;
Please login to merge, or discard this patch.