Completed
Push — master ( 7bc99f...7ea700 )
by Aimeos
02:12
created
controller/frontend/tests/Controller/Frontend/Service/StandardTest.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -19,123 +19,123 @@  discard block
 block discarded – undo
19 19
 
20 20
 	protected function setUp()
21 21
 	{
22
-		\Aimeos\MShop\Factory::setCache( true );
22
+		\Aimeos\MShop\Factory::setCache(true);
23 23
 
24 24
 		$this->context = \TestHelperFrontend::getContext();
25
-		$this->object = new \Aimeos\Controller\Frontend\Service\Standard( $this->context );
25
+		$this->object = new \Aimeos\Controller\Frontend\Service\Standard($this->context);
26 26
 	}
27 27
 
28 28
 
29 29
 	public static function setUpBeforeClass()
30 30
 	{
31
-		$orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() );
32
-		$orderBaseMgr = $orderManager->getSubManager( 'base' );
31
+		$orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext());
32
+		$orderBaseMgr = $orderManager->getSubManager('base');
33 33
 		self::$basket = $orderBaseMgr->createItem();
34 34
 	}
35 35
 
36 36
 
37 37
 	protected function tearDown()
38 38
 	{
39
-		unset( $this->object, $this->context );
39
+		unset($this->object, $this->context);
40 40
 
41
-		\Aimeos\MShop\Factory::setCache( false );
41
+		\Aimeos\MShop\Factory::setCache(false);
42 42
 		\Aimeos\MShop\Factory::clear();
43 43
 	}
44 44
 
45 45
 
46 46
 	public function testCheckAttributes()
47 47
 	{
48
-		$attributes = $this->object->checkAttributes( $this->getServiceItem()->getId(), [] );
49
-		$this->assertEquals( [], $attributes );
48
+		$attributes = $this->object->checkAttributes($this->getServiceItem()->getId(), []);
49
+		$this->assertEquals([], $attributes);
50 50
 	}
51 51
 
52 52
 
53 53
 	public function testGetProviders()
54 54
 	{
55
-		$providers = $this->object->getProviders( 'delivery' );
56
-		$this->assertGreaterThan( 0, count( $providers ) );
55
+		$providers = $this->object->getProviders('delivery');
56
+		$this->assertGreaterThan(0, count($providers));
57 57
 
58
-		foreach( $providers as $provider ) {
59
-			$this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider );
58
+		foreach ($providers as $provider) {
59
+			$this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider);
60 60
 		}
61 61
 	}
62 62
 
63 63
 
64 64
 	public function testGetProvider()
65 65
 	{
66
-		$provider = $this->object->getProvider( $this->getServiceItem()->getId() );
67
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider );
66
+		$provider = $this->object->getProvider($this->getServiceItem()->getId());
67
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider);
68 68
 	}
69 69
 
70 70
 
71 71
 	public function testProcess()
72 72
 	{
73 73
 		$form = new \Aimeos\MShop\Common\Item\Helper\Form\Standard();
74
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem();
75
-		$serviceId = \Aimeos\MShop\Factory::createManager( $this->context, 'service' )->findItem( 'unitcode' )->getId();
74
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem();
75
+		$serviceId = \Aimeos\MShop\Factory::createManager($this->context, 'service')->findItem('unitcode')->getId();
76 76
 
77
-		$provider = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard' )
77
+		$provider = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard')
78 78
 			->disableOriginalConstructor()
79
-			->setMethods( ['process'] )
79
+			->setMethods(['process'])
80 80
 			->getMock();
81 81
 
82
-		$manager = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' )
83
-			->setConstructorArgs( [$this->context] )
84
-			->setMethods( ['getProvider'] )
82
+		$manager = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard')
83
+			->setConstructorArgs([$this->context])
84
+			->setMethods(['getProvider'])
85 85
 			->getMock();
86 86
 
87
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'service', $manager );
87
+		\Aimeos\MShop\Factory::injectManager($this->context, 'service', $manager);
88 88
 
89
-		$provider->expects( $this->once() )->method( 'process' )->will( $this->returnValue( $form ) );
90
-		$manager->expects( $this->once() )->method( 'getProvider' )->will( $this->returnValue( $provider ) );
89
+		$provider->expects($this->once())->method('process')->will($this->returnValue($form));
90
+		$manager->expects($this->once())->method('getProvider')->will($this->returnValue($provider));
91 91
 
92 92
 
93
-		$result = $this->object->process( $item, $serviceId, [], [] );
94
-		$this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Helper\Form\Iface', $result );
93
+		$result = $this->object->process($item, $serviceId, [], []);
94
+		$this->assertInstanceOf('\Aimeos\MShop\Common\Item\Helper\Form\Iface', $result);
95 95
 	}
96 96
 
97 97
 
98 98
 	public function testUpdatePush()
99 99
 	{
100
-		$request = $this->getMockBuilder( '\Psr\Http\Message\ServerRequestInterface' )->getMock();
101
-		$response = $this->getMockBuilder( '\Psr\Http\Message\ResponseInterface' )->getMock();
100
+		$request = $this->getMockBuilder('\Psr\Http\Message\ServerRequestInterface')->getMock();
101
+		$response = $this->getMockBuilder('\Psr\Http\Message\ResponseInterface')->getMock();
102 102
 
103
-		$response->expects( $this->once() )->method( 'withStatus' )->will( $this->returnValue( $response ) );
103
+		$response->expects($this->once())->method('withStatus')->will($this->returnValue($response));
104 104
 
105
-		$this->assertInstanceOf( '\Psr\Http\Message\ResponseInterface', $this->object->updatePush( $request, $response, 'unitcode' ) );
105
+		$this->assertInstanceOf('\Psr\Http\Message\ResponseInterface', $this->object->updatePush($request, $response, 'unitcode'));
106 106
 	}
107 107
 
108 108
 
109 109
 	public function testUpdateSync()
110 110
 	{
111
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem();
111
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem();
112 112
 
113
-		$stream = $this->getMockBuilder( 'Psr\Http\Message\StreamInterface' )->getMock();
114
-		$request = $this->getMockBuilder( '\Psr\Http\Message\ServerRequestInterface' )->getMock();
115
-		$response = $this->getMockBuilder( '\Aimeos\MW\View\Helper\Response\Iface' )
113
+		$stream = $this->getMockBuilder('Psr\Http\Message\StreamInterface')->getMock();
114
+		$request = $this->getMockBuilder('\Psr\Http\Message\ServerRequestInterface')->getMock();
115
+		$response = $this->getMockBuilder('\Aimeos\MW\View\Helper\Response\Iface')
116 116
 			->getMock();
117 117
 
118
-		$provider = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard' )
119
-			->setMethods( ['updateSync', 'query', 'isImplemented'] )
118
+		$provider = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard')
119
+			->setMethods(['updateSync', 'query', 'isImplemented'])
120 120
 			->disableOriginalConstructor()
121 121
 			->getMock();
122 122
 
123
-		$manager = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' )
124
-			->setConstructorArgs( array( $this->context ) )
125
-			->setMethods( ['getProvider'] )
123
+		$manager = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard')
124
+			->setConstructorArgs(array($this->context))
125
+			->setMethods(['getProvider'])
126 126
 			->getMock();
127 127
 
128
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'service', $manager );
128
+		\Aimeos\MShop\Factory::injectManager($this->context, 'service', $manager);
129 129
 
130 130
 
131
-		$request->expects( $this->once() )->method( 'getQueryParams' )->will( $this->returnValue( ['code' => 'unitcode'] ) );
132
-		$response->expects( $this->once() )->method( 'createStreamFromString' )->will( $this->returnValue( $stream ) );
133
-		$manager->expects( $this->once() )->method( 'getProvider' )->will( $this->returnValue( $provider ) );
134
-		$provider->expects( $this->once() )->method( 'updateSync' )->will( $this->returnValue( $item ) );
135
-		$provider->expects( $this->once() )->method( 'isImplemented' )->will( $this->returnValue( true ) );
136
-		$provider->expects( $this->once() )->method( 'query' );
131
+		$request->expects($this->once())->method('getQueryParams')->will($this->returnValue(['code' => 'unitcode']));
132
+		$response->expects($this->once())->method('createStreamFromString')->will($this->returnValue($stream));
133
+		$manager->expects($this->once())->method('getProvider')->will($this->returnValue($provider));
134
+		$provider->expects($this->once())->method('updateSync')->will($this->returnValue($item));
135
+		$provider->expects($this->once())->method('isImplemented')->will($this->returnValue(true));
136
+		$provider->expects($this->once())->method('query');
137 137
 
138
-		$this->object->updateSync( $request, $response, [], 'paypalexpress', -1 );
138
+		$this->object->updateSync($request, $response, [], 'paypalexpress', -1);
139 139
 	}
140 140
 
141 141
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	protected function getServiceItem()
146 146
 	{
147
-		$manager = \Aimeos\MShop\Service\Manager\Factory::createManager( \TestHelperFrontend::getContext() );
148
-		return $manager->findItem( 'unitcode' );
147
+		$manager = \Aimeos\MShop\Service\Manager\Factory::createManager(\TestHelperFrontend::getContext());
148
+		return $manager->findItem('unitcode');
149 149
 	}
150 150
 }
Please login to merge, or discard this patch.
frontend/tests/Controller/Frontend/Service/Decorator/BaseTest.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -20,130 +20,130 @@
 block discarded – undo
20 20
 	{
21 21
 		$this->context = \TestHelperFrontend::getContext();
22 22
 
23
-		$this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Standard' )
23
+		$this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Standard')
24 24
 			->disableOriginalConstructor()
25 25
 			->getMock();
26 26
 
27
-		$this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Decorator\Base' )
28
-			->setConstructorArgs( [$this->stub, $this->context] )
27
+		$this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Decorator\Base')
28
+			->setConstructorArgs([$this->stub, $this->context])
29 29
 			->getMockForAbstractClass();
30 30
 	}
31 31
 
32 32
 
33 33
 	protected function tearDown()
34 34
 	{
35
-		unset( $this->context, $this->object, $this->stub );
35
+		unset($this->context, $this->object, $this->stub);
36 36
 	}
37 37
 
38 38
 
39 39
 	public function testConstructException()
40 40
 	{
41
-		$stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Iface' )->getMock();
41
+		$stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Iface')->getMock();
42 42
 
43
-		$this->setExpectedException( '\Aimeos\Controller\Frontend\Exception' );
43
+		$this->setExpectedException('\Aimeos\Controller\Frontend\Exception');
44 44
 
45
-		$this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Decorator\Base' )
46
-			->setConstructorArgs( [$stub, $this->context] )
45
+		$this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Decorator\Base')
46
+			->setConstructorArgs([$stub, $this->context])
47 47
 			->getMockForAbstractClass();
48 48
 	}
49 49
 
50 50
 
51 51
 	public function testCall()
52 52
 	{
53
-		$stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Standard' )
53
+		$stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Standard')
54 54
 			->disableOriginalConstructor()
55
-			->setMethods( ['invalid'] )
55
+			->setMethods(['invalid'])
56 56
 			->getMock();
57 57
 
58
-		$object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Service\Decorator\Base' )
59
-			->setConstructorArgs( [$stub, $this->context] )
58
+		$object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Service\Decorator\Base')
59
+			->setConstructorArgs([$stub, $this->context])
60 60
 			->getMockForAbstractClass();
61 61
 
62
-		$stub->expects( $this->once() )->method( 'invalid' )->will( $this->returnValue( true ) );
62
+		$stub->expects($this->once())->method('invalid')->will($this->returnValue(true));
63 63
 
64
-		$this->assertTrue( $object->invalid() );
64
+		$this->assertTrue($object->invalid());
65 65
 	}
66 66
 
67 67
 
68 68
 	public function testCheckAttributes()
69 69
 	{
70
-		$this->stub->expects( $this->once() )->method( 'checkAttributes' )
71
-			->will( $this->returnValue( [] ) );
70
+		$this->stub->expects($this->once())->method('checkAttributes')
71
+			->will($this->returnValue([]));
72 72
 
73
-		$this->assertEquals( [], $this->object->checkAttributes( -1, [] ) );
73
+		$this->assertEquals([], $this->object->checkAttributes( -1, [] ));
74 74
 	}
75 75
 
76 76
 
77 77
 	public function testGetProvider()
78 78
 	{
79
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' );
80
-		$provider = $manager->getProvider( $manager->findItem( 'unitcode', [], 'service', 'delivery' ) );
79
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'service');
80
+		$provider = $manager->getProvider($manager->findItem('unitcode', [], 'service', 'delivery'));
81 81
 
82
-		$this->stub->expects( $this->once() )->method( 'getProvider' )
83
-			->will( $this->returnValue( $provider ) );
82
+		$this->stub->expects($this->once())->method('getProvider')
83
+			->will($this->returnValue($provider));
84 84
 
85
-		$this->assertSame( $provider, $this->object->getProvider( -1 ) );
85
+		$this->assertSame($provider, $this->object->getProvider( -1 ));
86 86
 	}
87 87
 
88 88
 
89 89
 	public function testGetProviders()
90 90
 	{
91
-		$this->stub->expects( $this->once() )->method( 'getProviders' )
92
-			->will( $this->returnValue( [] ) );
91
+		$this->stub->expects($this->once())->method('getProviders')
92
+			->will($this->returnValue([]));
93 93
 
94
-		$this->assertEquals( [], $this->object->getProviders( 'payment' ) );
94
+		$this->assertEquals([], $this->object->getProviders('payment'));
95 95
 	}
96 96
 
97 97
 
98 98
 	public function testProcess()
99 99
 	{
100
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem();
100
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem();
101 101
 
102
-		$this->stub->expects( $this->once() )->method( 'process' )
103
-			->will( $this->returnValue( new \Aimeos\MShop\Common\Item\Helper\Form\Standard() ) );
102
+		$this->stub->expects($this->once())->method('process')
103
+			->will($this->returnValue(new \Aimeos\MShop\Common\Item\Helper\Form\Standard()));
104 104
 
105
-		$this->assertInstanceOf( 'Aimeos\MShop\Common\Item\Helper\Form\Iface', $this->object->process( $item, -1, [], [] ) );
105
+		$this->assertInstanceOf('Aimeos\MShop\Common\Item\Helper\Form\Iface', $this->object->process($item, -1, [], []));
106 106
 	}
107 107
 
108 108
 
109 109
 	public function testUpdatePush()
110 110
 	{
111
-		$response = $this->getMockBuilder( '\Psr\Http\Message\ResponseInterface' )->getMock();
112
-		$request = $this->getMockBuilder( '\Psr\Http\Message\ServerRequestInterface' )->getMock();
111
+		$response = $this->getMockBuilder('\Psr\Http\Message\ResponseInterface')->getMock();
112
+		$request = $this->getMockBuilder('\Psr\Http\Message\ServerRequestInterface')->getMock();
113 113
 
114
-		$this->stub->expects( $this->once() )->method( 'updatePush' )
115
-			->will( $this->returnValue( $response ) );
114
+		$this->stub->expects($this->once())->method('updatePush')
115
+			->will($this->returnValue($response));
116 116
 
117
-		$this->assertInstanceOf( '\Psr\Http\Message\ResponseInterface', $this->object->updatePush( $request, $response, 'test' ) );
117
+		$this->assertInstanceOf('\Psr\Http\Message\ResponseInterface', $this->object->updatePush($request, $response, 'test'));
118 118
 	}
119 119
 
120 120
 
121 121
 	public function testUpdateSync()
122 122
 	{
123
-		$response = $this->getMockBuilder( '\Psr\Http\Message\ResponseInterface' )->getMock();
124
-		$request = $this->getMockBuilder( '\Psr\Http\Message\ServerRequestInterface' )->getMock();
125
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem();
123
+		$response = $this->getMockBuilder('\Psr\Http\Message\ResponseInterface')->getMock();
124
+		$request = $this->getMockBuilder('\Psr\Http\Message\ServerRequestInterface')->getMock();
125
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem();
126 126
 
127
-		$this->stub->expects( $this->once() )->method( 'updateSync' )
128
-			->will( $this->returnValue( $item ) );
127
+		$this->stub->expects($this->once())->method('updateSync')
128
+			->will($this->returnValue($item));
129 129
 
130
-		$this->assertInstanceOf( 'Aimeos\MShop\Order\Item\Iface', $this->object->updateSync( $request, $response, [], 'test', -1 ) );
130
+		$this->assertInstanceOf('Aimeos\MShop\Order\Item\Iface', $this->object->updateSync($request, $response, [], 'test', -1));
131 131
 	}
132 132
 
133 133
 
134 134
 	public function testGetController()
135 135
 	{
136
-		$result = $this->access( 'getController' )->invokeArgs( $this->object, [] );
136
+		$result = $this->access('getController')->invokeArgs($this->object, []);
137 137
 
138
-		$this->assertSame( $this->stub, $result );
138
+		$this->assertSame($this->stub, $result);
139 139
 	}
140 140
 
141 141
 
142
-	protected function access( $name )
142
+	protected function access($name)
143 143
 	{
144
-		$class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Service\Decorator\Base' );
145
-		$method = $class->getMethod( $name );
146
-		$method->setAccessible( true );
144
+		$class = new \ReflectionClass('\Aimeos\Controller\Frontend\Service\Decorator\Base');
145
+		$method = $class->getMethod($name);
146
+		$method->setAccessible(true);
147 147
 
148 148
 		return $method;
149 149
 	}
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Service/Standard.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
 	 * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value
36 36
 	 * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values
37 37
 	 */
38
-	public function checkAttributes( $serviceId, array $attributes )
38
+	public function checkAttributes($serviceId, array $attributes)
39 39
 	{
40
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
41
-		$provider = $manager->getProvider( $manager->getItem( $serviceId, [], true ) );
40
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
41
+		$provider = $manager->getProvider($manager->getItem($serviceId, [], true));
42 42
 
43
-		return array_filter( $provider->checkConfigFE( $attributes ) );
43
+		return array_filter($provider->checkConfigFE($attributes));
44 44
 	}
45 45
 
46 46
 
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
 	 * @param string[] $ref List of domain names whose items should be fetched too
52 52
 	 * @return \Aimeos\MShop\Service\Provider\Iface Service provider object
53 53
 	 */
54
-	public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] )
54
+	public function getProvider($serviceId, $ref = ['media', 'price', 'text'])
55 55
 	{
56
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
57
-		return $manager->getProvider( $manager->getItem( $serviceId, $ref, true ) );
56
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
57
+		return $manager->getProvider($manager->getItem($serviceId, $ref, true));
58 58
 	}
59 59
 
60 60
 
@@ -65,26 +65,26 @@  discard block
 block discarded – undo
65 65
 	 * @param string[] $ref List of domain names whose items should be fetched too
66 66
 	 * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values
67 67
 	 */
68
-	public function getProviders( $type = null, $ref = ['media', 'price', 'text'] )
68
+	public function getProviders($type = null, $ref = ['media', 'price', 'text'])
69 69
 	{
70 70
 		$list = [];
71
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
71
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
72 72
 
73
-		$search = $manager->createSearch( true );
74
-		$search->setSortations( array( $search->sort( '+', 'service.position' ) ) );
73
+		$search = $manager->createSearch(true);
74
+		$search->setSortations(array($search->sort('+', 'service.position')));
75 75
 
76
-		if( $type != null )
76
+		if ($type != null)
77 77
 		{
78 78
 			$expr = array(
79 79
 				$search->getConditions(),
80
-				$search->compare( '==', 'service.type.code', $type ),
81
-				$search->compare( '==', 'service.type.domain', 'service' ),
80
+				$search->compare('==', 'service.type.code', $type),
81
+				$search->compare('==', 'service.type.domain', 'service'),
82 82
 			);
83
-			$search->setConditions( $search->combine( '&&', $expr ) );
83
+			$search->setConditions($search->combine('&&', $expr));
84 84
 		}
85 85
 
86
-		foreach( $manager->searchItems( $search, $ref ) as $id => $item ) {
87
-			$list[$id] = $manager->getProvider( $item );
86
+		foreach ($manager->searchItems($search, $ref) as $id => $item) {
87
+			$list[$id] = $manager->getProvider($item);
88 88
 		}
89 89
 
90 90
 		return $list;
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
 	 * @return \Aimeos\MShop\Common\Item\Helper\Form\Iface|null Form object with URL, parameters, etc.
103 103
 	 * 	or null if no form data is required
104 104
 	 */
105
-	public function process( \Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params )
105
+	public function process(\Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params)
106 106
 	{
107
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
107
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
108 108
 
109
-		$provider = $manager->getProvider( $manager->getItem( $serviceId, [], true ) );
110
-		$provider->injectGlobalConfigBE( $urls );
109
+		$provider = $manager->getProvider($manager->getItem($serviceId, [], true));
110
+		$provider->injectGlobalConfigBE($urls);
111 111
 
112
-		return $provider->process( $orderItem, $params );
112
+		return $provider->process($orderItem, $params);
113 113
 	}
114 114
 
115 115
 
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
 	 * @param string $code Unique code of the service used for the current order
122 122
 	 * @return \Psr\Http\Message\ResponseInterface Response object
123 123
 	 */
124
-	public function updatePush( ServerRequestInterface $request, ResponseInterface $response, $code )
124
+	public function updatePush(ServerRequestInterface $request, ResponseInterface $response, $code)
125 125
 	{
126
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' );
127
-		$provider = $manager->getProvider( $manager->findItem( $code ) );
126
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service');
127
+		$provider = $manager->getProvider($manager->findItem($code));
128 128
 
129
-		return $provider->updatePush( $request, $response );
129
+		return $provider->updatePush($request, $response);
130 130
 	}
131 131
 
132 132
 
@@ -141,38 +141,38 @@  discard block
 block discarded – undo
141 141
 	 * @param string $orderid Unique ID of the order whose payment status should be updated
142 142
 	 * @return \Aimeos\MShop\Order\Item\Iface $orderItem Order item that has been updated
143 143
 	 */
144
-	public function updateSync( ServerRequestInterface $request, ResponseInterface $response, array $urls, $code, $orderid )
144
+	public function updateSync(ServerRequestInterface $request, ResponseInterface $response, array $urls, $code, $orderid)
145 145
 	{
146 146
 		$params = (array) $request->getAttributes() + (array) $request->getParsedBody() + (array) $request->getQueryParams();
147 147
 		$params['orderid'] = $orderid;
148 148
 
149 149
 		$context = $this->getContext();
150
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'service' );
150
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'service');
151 151
 
152
-		$provider = $manager->getProvider( $manager->findItem( $code ) );
153
-		$provider->injectGlobalConfigBE( $urls );
152
+		$provider = $manager->getProvider($manager->findItem($code));
153
+		$provider->injectGlobalConfigBE($urls);
154 154
 
155 155
 		$body = (string) $request->getBody();
156 156
 		$output = null;
157 157
 		$headers = [];
158 158
 
159
-		if( ( $orderItem = $provider->updateSync( $params, $body, $output, $headers ) ) !== null )
159
+		if (($orderItem = $provider->updateSync($params, $body, $output, $headers)) !== null)
160 160
 		{
161
-			if( $orderItem->getPaymentStatus() === \Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED
162
-				&& $provider->isImplemented( \Aimeos\MShop\Service\Provider\Payment\Base::FEAT_QUERY )
161
+			if ($orderItem->getPaymentStatus() === \Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED
162
+				&& $provider->isImplemented(\Aimeos\MShop\Service\Provider\Payment\Base::FEAT_QUERY)
163 163
 			) {
164
-				$provider->query( $orderItem );
164
+				$provider->query($orderItem);
165 165
 			}
166 166
 
167 167
 			// update stock, coupons, etc.
168
-			\Aimeos\Controller\Frontend\Factory::createController( $context, 'order' )->update( $orderItem );
168
+			\Aimeos\Controller\Frontend\Factory::createController($context, 'order')->update($orderItem);
169 169
 		}
170 170
 
171
-		foreach( $headers as $name => $header ) {
172
-			$response->withHeader( $name, $header );
171
+		foreach ($headers as $name => $header) {
172
+			$response->withHeader($name, $header);
173 173
 		}
174 174
 
175
-		$response->withBody( $response->createStreamFromString( $output ) );
175
+		$response->withBody($response->createStreamFromString($output));
176 176
 
177 177
 		return $orderItem;
178 178
 	}
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Service/Iface.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value
31 31
 	 * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values
32 32
 	 */
33
-	public function checkAttributes( $serviceId, array $attributes );
33
+	public function checkAttributes($serviceId, array $attributes);
34 34
 
35 35
 	/**
36 36
 	 * Returns the service item for the given ID
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @param array $ref List of domains for which the items referenced by the services should be fetched too
40 40
 	 * @return \Aimeos\MShop\Service\Provider\Iface Service provider object
41 41
 	 */
42
-	public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] );
42
+	public function getProvider($serviceId, $ref = ['media', 'price', 'text']);
43 43
 
44 44
 	/**
45 45
 	 * Returns the service providers for the given type
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * @param array $ref List of domains for which the items referenced by the services should be fetched too
49 49
 	 * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values
50 50
 	 */
51
-	public function getProviders( $type = null, $ref = ['media', 'price', 'text'] );
51
+	public function getProviders($type = null, $ref = ['media', 'price', 'text']);
52 52
 
53 53
 	/**
54 54
 	 * Processes the service for the given order, e.g. payment and delivery services
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 * @return \Aimeos\MShop\Common\Item\Helper\Form\Iface|null Form object with URL, parameters, etc.
62 62
 	 * 	or null if no form data is required
63 63
 	 */
64
-	public function process( \Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params );
64
+	public function process(\Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params);
65 65
 
66 66
 
67 67
 	/**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 * @param string $code Unique code of the service used for the current order
73 73
 	 * @return \Psr\Http\Message\ResponseInterface Response object
74 74
 	 */
75
-	public function updatePush( \Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, $code );
75
+	public function updatePush(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, $code);
76 76
 
77 77
 
78 78
 	/**
@@ -86,5 +86,5 @@  discard block
 block discarded – undo
86 86
 	 * @param string $orderid Unique ID of the order whose payment status should be updated
87 87
 	 * @return \Aimeos\MShop\Order\Item\Iface $orderItem Order item that has been updated
88 88
 	 */
89
-	public function updateSync( ServerRequestInterface $request, ResponseInterface $response, array $urls, $code, $orderid );
89
+	public function updateSync(ServerRequestInterface $request, ResponseInterface $response, array $urls, $code, $orderid);
90 90
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Service/Decorator/Base.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -33,18 +33,18 @@  discard block
 block discarded – undo
33 33
 	 * @param \Aimeos\Controller\Frontend\Iface $controller Controller object
34 34
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects
35 35
 	 */
36
-	public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context )
36
+	public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context)
37 37
 	{
38 38
 		$iface = '\Aimeos\Controller\Frontend\Service\Iface';
39
-		if( !( $controller instanceof $iface ) )
39
+		if (!($controller instanceof $iface))
40 40
 		{
41
-			$msg = sprintf( 'Class "%1$s" does not implement interface "%2$s"', get_class( $controller ), $iface );
42
-			throw new \Aimeos\Controller\Frontend\Exception( $msg );
41
+			$msg = sprintf('Class "%1$s" does not implement interface "%2$s"', get_class($controller), $iface);
42
+			throw new \Aimeos\Controller\Frontend\Exception($msg);
43 43
 		}
44 44
 
45 45
 		$this->controller = $controller;
46 46
 
47
-		parent::__construct( $context );
47
+		parent::__construct($context);
48 48
 	}
49 49
 
50 50
 
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 	 * @return mixed Returns the value of the called method
57 57
 	 * @throws \Aimeos\Controller\Frontend\Exception If method call failed
58 58
 	 */
59
-	public function __call( $name, array $param )
59
+	public function __call($name, array $param)
60 60
 	{
61
-		return @call_user_func_array( array( $this->controller, $name ), $param );
61
+		return @call_user_func_array(array($this->controller, $name), $param);
62 62
 	}
63 63
 
64 64
 
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
 	 * @param string[] $attributes List of attribute codes as keys and strings entered by the customer as value
70 70
 	 * @return string[] List of attributes codes as keys and error messages as values for invalid or missing values
71 71
 	 */
72
-	public function checkAttributes( $serviceId, array $attributes )
72
+	public function checkAttributes($serviceId, array $attributes)
73 73
 	{
74
-		return $this->controller->checkAttributes( $serviceId, $attributes );
74
+		return $this->controller->checkAttributes($serviceId, $attributes);
75 75
 	}
76 76
 
77 77
 
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 	 * @param array $ref List of domains for which the items referenced by the services should be fetched too
83 83
 	 * @return \Aimeos\MShop\Service\Provider\Iface Service provider object
84 84
 	 */
85
-	public function getProvider( $serviceId, $ref = ['media', 'price', 'text'] )
85
+	public function getProvider($serviceId, $ref = ['media', 'price', 'text'])
86 86
 	{
87
-		return $this->controller->getProvider( $serviceId, $ref );
87
+		return $this->controller->getProvider($serviceId, $ref);
88 88
 	}
89 89
 
90 90
 
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
 	 * @param array $ref List of domains for which the items referenced by the services should be fetched too
96 96
 	 * @return \Aimeos\MShop\Service\Provider\Iface[] List of service IDs as keys and service provider objects as values
97 97
 	 */
98
-	public function getProviders( $type = null, $ref = ['media', 'price', 'text'] )
98
+	public function getProviders($type = null, $ref = ['media', 'price', 'text'])
99 99
 	{
100
-		return $this->controller->getProviders( $type, $ref );
100
+		return $this->controller->getProviders($type, $ref);
101 101
 	}
102 102
 
103 103
 
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
 	 * @return \Aimeos\MShop\Common\Item\Helper\Form\Iface|null Form object with URL, parameters, etc.
113 113
 	 * 	or null if no form data is required
114 114
 	 */
115
-	public function process( \Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params )
115
+	public function process(\Aimeos\MShop\Order\Item\Iface $orderItem, $serviceId, array $urls, array $params)
116 116
 	{
117
-		return $this->controller->process( $orderItem, $serviceId, $urls, $params );
117
+		return $this->controller->process($orderItem, $serviceId, $urls, $params);
118 118
 	}
119 119
 
120 120
 
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 	 * @param string $code Unique code of the service used for the current order
127 127
 	 * @return \Psr\Http\Message\ResponseInterface Response object
128 128
 	 */
129
-	public function updatePush( ServerRequestInterface $request, ResponseInterface $response, $code )
129
+	public function updatePush(ServerRequestInterface $request, ResponseInterface $response, $code)
130 130
 	{
131
-		return $this->controller->updatePush( $request, $response, $code );
131
+		return $this->controller->updatePush($request, $response, $code);
132 132
 	}
133 133
 
134 134
 
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
 	 * @param string $orderid Unique ID of the order whose payment status should be updated
144 144
 	 * @return \Aimeos\MShop\Order\Item\Iface $orderItem Order item that has been updated
145 145
 	 */
146
-	public function updateSync( ServerRequestInterface $request, ResponseInterface $response, array $urls, $code, $orderid )
146
+	public function updateSync(ServerRequestInterface $request, ResponseInterface $response, array $urls, $code, $orderid)
147 147
 	{
148
-		return $this->controller->updateSync( $request, $response, $urls, $code, $orderid );
148
+		return $this->controller->updateSync($request, $response, $urls, $code, $orderid);
149 149
 	}
150 150
 
151 151
 
Please login to merge, or discard this patch.