@@ -17,125 +17,125 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | protected function setUp() |
| 19 | 19 | { |
| 20 | - \Aimeos\MShop\Factory::setCache( true ); |
|
| 20 | + \Aimeos\MShop\Factory::setCache(true); |
|
| 21 | 21 | |
| 22 | 22 | $this->context = \TestHelperFrontend::getContext(); |
| 23 | - $this->object = new \Aimeos\Controller\Frontend\Service\Standard( $this->context ); |
|
| 23 | + $this->object = new \Aimeos\Controller\Frontend\Service\Standard($this->context); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | public static function setUpBeforeClass() |
| 28 | 28 | { |
| 29 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
| 30 | - $orderBaseMgr = $orderManager->getSubManager( 'base' ); |
|
| 29 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
| 30 | + $orderBaseMgr = $orderManager->getSubManager('base'); |
|
| 31 | 31 | self::$basket = $orderBaseMgr->createItem(); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | protected function tearDown() |
| 36 | 36 | { |
| 37 | - unset( $this->object, $this->context ); |
|
| 37 | + unset($this->object, $this->context); |
|
| 38 | 38 | |
| 39 | - \Aimeos\MShop\Factory::setCache( false ); |
|
| 39 | + \Aimeos\MShop\Factory::setCache(false); |
|
| 40 | 40 | \Aimeos\MShop\Factory::clear(); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | public function testCheckAttributes() |
| 45 | 45 | { |
| 46 | - $attributes = $this->object->checkAttributes( $this->getServiceItem()->getId(), [] ); |
|
| 47 | - $this->assertEquals( [], $attributes ); |
|
| 46 | + $attributes = $this->object->checkAttributes($this->getServiceItem()->getId(), []); |
|
| 47 | + $this->assertEquals([], $attributes); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | public function testGetProviders() |
| 52 | 52 | { |
| 53 | - $providers = $this->object->getProviders( 'delivery' ); |
|
| 54 | - $this->assertGreaterThan( 0, count( $providers ) ); |
|
| 53 | + $providers = $this->object->getProviders('delivery'); |
|
| 54 | + $this->assertGreaterThan(0, count($providers)); |
|
| 55 | 55 | |
| 56 | - foreach( $providers as $provider ) { |
|
| 57 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider ); |
|
| 56 | + foreach ($providers as $provider) { |
|
| 57 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider); |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | public function testGetProvider() |
| 63 | 63 | { |
| 64 | - $provider = $this->object->getProvider( $this->getServiceItem()->getId() ); |
|
| 65 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider ); |
|
| 64 | + $provider = $this->object->getProvider($this->getServiceItem()->getId()); |
|
| 65 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Provider\\Iface', $provider); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | |
| 69 | 69 | public function testProcess() |
| 70 | 70 | { |
| 71 | 71 | $form = new \Aimeos\MShop\Common\Item\Helper\Form\Standard(); |
| 72 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
| 73 | - $serviceId = \Aimeos\MShop\Factory::createManager( $this->context, 'service' )->findItem( 'unitcode' )->getId(); |
|
| 72 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
| 73 | + $serviceId = \Aimeos\MShop\Factory::createManager($this->context, 'service')->findItem('unitcode')->getId(); |
|
| 74 | 74 | |
| 75 | - $provider = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard' ) |
|
| 75 | + $provider = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard') |
|
| 76 | 76 | ->disableOriginalConstructor() |
| 77 | - ->setMethods( ['process'] ) |
|
| 77 | + ->setMethods(['process']) |
|
| 78 | 78 | ->getMock(); |
| 79 | 79 | |
| 80 | - $manager = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' ) |
|
| 81 | - ->setConstructorArgs( [$this->context] ) |
|
| 82 | - ->setMethods( ['getProvider'] ) |
|
| 80 | + $manager = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard') |
|
| 81 | + ->setConstructorArgs([$this->context]) |
|
| 82 | + ->setMethods(['getProvider']) |
|
| 83 | 83 | ->getMock(); |
| 84 | 84 | |
| 85 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'service', $manager ); |
|
| 85 | + \Aimeos\MShop\Factory::injectManager($this->context, 'service', $manager); |
|
| 86 | 86 | |
| 87 | - $provider->expects( $this->once() )->method( 'process' )->will( $this->returnValue( $form ) ); |
|
| 88 | - $manager->expects( $this->once() )->method( 'getProvider' )->will( $this->returnValue( $provider ) ); |
|
| 87 | + $provider->expects($this->once())->method('process')->will($this->returnValue($form)); |
|
| 88 | + $manager->expects($this->once())->method('getProvider')->will($this->returnValue($provider)); |
|
| 89 | 89 | |
| 90 | 90 | |
| 91 | - $result = $this->object->process( $item, $serviceId, [], [] ); |
|
| 92 | - $this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Helper\Form\Iface', $result ); |
|
| 91 | + $result = $this->object->process($item, $serviceId, [], []); |
|
| 92 | + $this->assertInstanceOf('\Aimeos\MShop\Common\Item\Helper\Form\Iface', $result); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | public function testUpdateSync() |
| 97 | 97 | { |
| 98 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
| 98 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
| 99 | 99 | |
| 100 | - $stream = $this->getMockBuilder( 'Psr\Http\Message\StreamInterface' )->getMock(); |
|
| 101 | - $request = $this->getMockBuilder( '\Psr\Http\Message\ServerRequestInterface' )->getMock(); |
|
| 102 | - $response = $this->getMockBuilder( '\Aimeos\MW\View\Helper\Response\Iface' ) |
|
| 100 | + $stream = $this->getMockBuilder('Psr\Http\Message\StreamInterface')->getMock(); |
|
| 101 | + $request = $this->getMockBuilder('\Psr\Http\Message\ServerRequestInterface')->getMock(); |
|
| 102 | + $response = $this->getMockBuilder('\Aimeos\MW\View\Helper\Response\Iface') |
|
| 103 | 103 | ->getMock(); |
| 104 | 104 | |
| 105 | - $provider = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard' ) |
|
| 106 | - ->setMethods( ['updateSync', 'query', 'isImplemented'] ) |
|
| 105 | + $provider = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Delivery\\Standard') |
|
| 106 | + ->setMethods(['updateSync', 'query', 'isImplemented']) |
|
| 107 | 107 | ->disableOriginalConstructor() |
| 108 | 108 | ->getMock(); |
| 109 | 109 | |
| 110 | - $manager = $this->getMockBuilder( '\\Aimeos\\MShop\\Service\\Manager\\Standard' ) |
|
| 111 | - ->setConstructorArgs( array( $this->context ) ) |
|
| 112 | - ->setMethods( ['getProvider'] ) |
|
| 110 | + $manager = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Manager\\Standard') |
|
| 111 | + ->setConstructorArgs(array($this->context)) |
|
| 112 | + ->setMethods(['getProvider']) |
|
| 113 | 113 | ->getMock(); |
| 114 | 114 | |
| 115 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'service', $manager ); |
|
| 115 | + \Aimeos\MShop\Factory::injectManager($this->context, 'service', $manager); |
|
| 116 | 116 | |
| 117 | 117 | |
| 118 | - $request->expects( $this->once() )->method( 'getQueryParams' )->will( $this->returnValue( ['code' => 'unitcode'] ) ); |
|
| 119 | - $response->expects( $this->once() )->method( 'createStreamFromString' )->will( $this->returnValue( $stream ) ); |
|
| 120 | - $manager->expects( $this->once() )->method( 'getProvider' )->will( $this->returnValue( $provider ) ); |
|
| 121 | - $provider->expects( $this->once() )->method( 'updateSync' )->will( $this->returnValue( $item ) ); |
|
| 122 | - $provider->expects( $this->once() )->method( 'isImplemented' )->will( $this->returnValue( true ) ); |
|
| 123 | - $provider->expects( $this->once() )->method( 'query' ); |
|
| 118 | + $request->expects($this->once())->method('getQueryParams')->will($this->returnValue(['code' => 'unitcode'])); |
|
| 119 | + $response->expects($this->once())->method('createStreamFromString')->will($this->returnValue($stream)); |
|
| 120 | + $manager->expects($this->once())->method('getProvider')->will($this->returnValue($provider)); |
|
| 121 | + $provider->expects($this->once())->method('updateSync')->will($this->returnValue($item)); |
|
| 122 | + $provider->expects($this->once())->method('isImplemented')->will($this->returnValue(true)); |
|
| 123 | + $provider->expects($this->once())->method('query'); |
|
| 124 | 124 | |
| 125 | - $this->object->updateSync( $request, $response, [], 'paypalexpress', -1 ); |
|
| 125 | + $this->object->updateSync($request, $response, [], 'paypalexpress', -1); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
| 129 | 129 | public function testGetServices() |
| 130 | 130 | { |
| 131 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
| 132 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
| 131 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
| 132 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
| 133 | 133 | |
| 134 | - $services = $this->object->getServices( 'delivery', $basket ); |
|
| 135 | - $this->assertGreaterThan( 0, count( $services ) ); |
|
| 134 | + $services = $this->object->getServices('delivery', $basket); |
|
| 135 | + $this->assertGreaterThan(0, count($services)); |
|
| 136 | 136 | |
| 137 | - foreach( $services as $service ) { |
|
| 138 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Service\\Item\\Iface', $service ); |
|
| 137 | + foreach ($services as $service) { |
|
| 138 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Service\\Item\\Iface', $service); |
|
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | |
@@ -143,83 +143,83 @@ discard block |
||
| 143 | 143 | public function testGetServiceAttributes() |
| 144 | 144 | { |
| 145 | 145 | $service = $this->getServiceItem(); |
| 146 | - $attributes = $this->object->getServiceAttributes( 'delivery', $service->getId(), self::$basket ); |
|
| 146 | + $attributes = $this->object->getServiceAttributes('delivery', $service->getId(), self::$basket); |
|
| 147 | 147 | |
| 148 | - $this->assertEquals( 0, count( $attributes ) ); |
|
| 148 | + $this->assertEquals(0, count($attributes)); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | |
| 152 | 152 | public function testGetServiceAttributesCache() |
| 153 | 153 | { |
| 154 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
| 155 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
| 154 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
| 155 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
| 156 | 156 | |
| 157 | - $services = $this->object->getServices( 'delivery', $basket ); |
|
| 157 | + $services = $this->object->getServices('delivery', $basket); |
|
| 158 | 158 | |
| 159 | - if( ( $service = reset( $services ) ) === false ) { |
|
| 160 | - throw new \RuntimeException( 'No service item found' ); |
|
| 159 | + if (($service = reset($services)) === false) { |
|
| 160 | + throw new \RuntimeException('No service item found'); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - $attributes = $this->object->getServiceAttributes( 'delivery', $service->getId(), self::$basket ); |
|
| 163 | + $attributes = $this->object->getServiceAttributes('delivery', $service->getId(), self::$basket); |
|
| 164 | 164 | |
| 165 | - $this->assertEquals( 0, count( $attributes ) ); |
|
| 165 | + $this->assertEquals(0, count($attributes)); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | |
| 169 | 169 | public function testGetServiceAttributesNoItems() |
| 170 | 170 | { |
| 171 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 172 | - $this->object->getServiceAttributes( 'invalid', -1, self::$basket ); |
|
| 171 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 172 | + $this->object->getServiceAttributes('invalid', -1, self::$basket); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | |
| 176 | 176 | public function testGetServicePrice() |
| 177 | 177 | { |
| 178 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
| 179 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
| 178 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
| 179 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
| 180 | 180 | |
| 181 | 181 | $service = $this->getServiceItem(); |
| 182 | - $price = $this->object->getServicePrice( 'delivery', $service->getId(), $basket ); |
|
| 182 | + $price = $this->object->getServicePrice('delivery', $service->getId(), $basket); |
|
| 183 | 183 | |
| 184 | - $this->assertEquals( '12.95', $price->getValue() ); |
|
| 185 | - $this->assertEquals( '1.99', $price->getCosts() ); |
|
| 184 | + $this->assertEquals('12.95', $price->getValue()); |
|
| 185 | + $this->assertEquals('1.99', $price->getCosts()); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | |
| 189 | 189 | public function testGetServicePriceCache() |
| 190 | 190 | { |
| 191 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
| 192 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
| 191 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
| 192 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
| 193 | 193 | |
| 194 | - $services = $this->object->getServices( 'delivery', $basket ); |
|
| 194 | + $services = $this->object->getServices('delivery', $basket); |
|
| 195 | 195 | |
| 196 | - if( ( $service = reset( $services ) ) === false ) { |
|
| 197 | - throw new \RuntimeException( 'No service item found' ); |
|
| 196 | + if (($service = reset($services)) === false) { |
|
| 197 | + throw new \RuntimeException('No service item found'); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - $price = $this->object->getServicePrice( 'delivery', $service->getId(), $basket ); |
|
| 200 | + $price = $this->object->getServicePrice('delivery', $service->getId(), $basket); |
|
| 201 | 201 | |
| 202 | - $this->assertEquals( '12.95', $price->getValue() ); |
|
| 203 | - $this->assertEquals( '1.99', $price->getCosts() ); |
|
| 202 | + $this->assertEquals('12.95', $price->getValue()); |
|
| 203 | + $this->assertEquals('1.99', $price->getCosts()); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | |
| 207 | 207 | public function testGetServicePriceNoItems() |
| 208 | 208 | { |
| 209 | - $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
| 210 | - $basket = $orderManager->getSubManager( 'base' )->createItem(); |
|
| 209 | + $orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
| 210 | + $basket = $orderManager->getSubManager('base')->createItem(); |
|
| 211 | 211 | |
| 212 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
| 213 | - $this->object->getServicePrice( 'invalid', -1, $basket ); |
|
| 212 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
| 213 | + $this->object->getServicePrice('invalid', -1, $basket); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | |
| 217 | 217 | public function testCheckServiceAttributes() |
| 218 | 218 | { |
| 219 | 219 | $service = $this->getServiceItem(); |
| 220 | - $attributes = $this->object->checkServiceAttributes( 'delivery', $service->getId(), [] ); |
|
| 220 | + $attributes = $this->object->checkServiceAttributes('delivery', $service->getId(), []); |
|
| 221 | 221 | |
| 222 | - $this->assertEquals( [], $attributes ); |
|
| 222 | + $this->assertEquals([], $attributes); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | protected function getServiceItem() |
| 230 | 230 | { |
| 231 | - $manager = \Aimeos\MShop\Service\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
| 232 | - return $manager->findItem( 'unitcode' ); |
|
| 231 | + $manager = \Aimeos\MShop\Service\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
| 232 | + return $manager->findItem('unitcode'); |
|
| 233 | 233 | } |
| 234 | 234 | } |
@@ -20,161 +20,161 @@ |
||
| 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 testUpdateSync() |
| 110 | 110 | { |
| 111 | - $response = $this->getMockBuilder( '\Psr\Http\Message\ResponseInterface' )->getMock(); |
|
| 112 | - $request = $this->getMockBuilder( '\Psr\Http\Message\ServerRequestInterface' )->getMock(); |
|
| 113 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem(); |
|
| 111 | + $response = $this->getMockBuilder('\Psr\Http\Message\ResponseInterface')->getMock(); |
|
| 112 | + $request = $this->getMockBuilder('\Psr\Http\Message\ServerRequestInterface')->getMock(); |
|
| 113 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem(); |
|
| 114 | 114 | |
| 115 | - $this->stub->expects( $this->once() )->method( 'updateSync' ) |
|
| 116 | - ->will( $this->returnValue( $item ) ); |
|
| 115 | + $this->stub->expects($this->once())->method('updateSync') |
|
| 116 | + ->will($this->returnValue($item)); |
|
| 117 | 117 | |
| 118 | - $this->assertInstanceOf( 'Aimeos\MShop\Order\Item\Iface', $this->object->updateSync( $request, $response, [], 'test', -1 ) ); |
|
| 118 | + $this->assertInstanceOf('Aimeos\MShop\Order\Item\Iface', $this->object->updateSync($request, $response, [], 'test', -1)); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | |
| 122 | 122 | public function testGetServices() |
| 123 | 123 | { |
| 124 | - $basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); |
|
| 124 | + $basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem(); |
|
| 125 | 125 | |
| 126 | - $this->stub->expects( $this->once() )->method( 'getServices' ) |
|
| 127 | - ->will( $this->returnValue( [] ) ); |
|
| 126 | + $this->stub->expects($this->once())->method('getServices') |
|
| 127 | + ->will($this->returnValue([])); |
|
| 128 | 128 | |
| 129 | - $this->assertEquals( [], $this->object->getServices( 'payment', $basket ) ); |
|
| 129 | + $this->assertEquals([], $this->object->getServices('payment', $basket)); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | |
| 133 | 133 | public function testGetServiceAttributes() |
| 134 | 134 | { |
| 135 | - $basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); |
|
| 135 | + $basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem(); |
|
| 136 | 136 | |
| 137 | - $this->stub->expects( $this->once() )->method( 'getServiceAttributes' ) |
|
| 138 | - ->will( $this->returnValue( [] ) ); |
|
| 137 | + $this->stub->expects($this->once())->method('getServiceAttributes') |
|
| 138 | + ->will($this->returnValue([])); |
|
| 139 | 139 | |
| 140 | - $this->assertEquals( [], $this->object->getServiceAttributes( 'payment', -1, $basket ) ); |
|
| 140 | + $this->assertEquals([], $this->object->getServiceAttributes('payment', -1, $basket)); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | |
| 144 | 144 | public function testGetServicePrice() |
| 145 | 145 | { |
| 146 | - $priceItem = \Aimeos\MShop\Factory::createManager( $this->context, 'price' )->createItem(); |
|
| 147 | - $basket = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' )->createItem(); |
|
| 146 | + $priceItem = \Aimeos\MShop\Factory::createManager($this->context, 'price')->createItem(); |
|
| 147 | + $basket = \Aimeos\MShop\Factory::createManager($this->context, 'order/base')->createItem(); |
|
| 148 | 148 | |
| 149 | - $this->stub->expects( $this->once() )->method( 'getServicePrice' ) |
|
| 150 | - ->will( $this->returnValue( $priceItem ) ); |
|
| 149 | + $this->stub->expects($this->once())->method('getServicePrice') |
|
| 150 | + ->will($this->returnValue($priceItem)); |
|
| 151 | 151 | |
| 152 | - $this->assertInstanceOf( '\Aimeos\MShop\Price\Item\Iface', $this->object->getServicePrice( 'payment', -1, $basket ) ); |
|
| 152 | + $this->assertInstanceOf('\Aimeos\MShop\Price\Item\Iface', $this->object->getServicePrice('payment', -1, $basket)); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
| 156 | 156 | public function testCheckServiceAttributes() |
| 157 | 157 | { |
| 158 | - $this->stub->expects( $this->once() )->method( 'checkServiceAttributes' ) |
|
| 159 | - ->will( $this->returnValue( [] ) ); |
|
| 158 | + $this->stub->expects($this->once())->method('checkServiceAttributes') |
|
| 159 | + ->will($this->returnValue([])); |
|
| 160 | 160 | |
| 161 | - $this->assertEquals( [], $this->object->checkServiceAttributes( 'payment', -1, [] ) ); |
|
| 161 | + $this->assertEquals([], $this->object->checkServiceAttributes('payment', -1, [])); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | |
| 165 | 165 | public function testGetController() |
| 166 | 166 | { |
| 167 | - $result = $this->access( 'getController' )->invokeArgs( $this->object, [] ); |
|
| 167 | + $result = $this->access('getController')->invokeArgs($this->object, []); |
|
| 168 | 168 | |
| 169 | - $this->assertSame( $this->stub, $result ); |
|
| 169 | + $this->assertSame($this->stub, $result); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | |
| 173 | - protected function access( $name ) |
|
| 173 | + protected function access($name) |
|
| 174 | 174 | { |
| 175 | - $class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Service\Decorator\Base' ); |
|
| 176 | - $method = $class->getMethod( $name ); |
|
| 177 | - $method->setAccessible( true ); |
|
| 175 | + $class = new \ReflectionClass('\Aimeos\Controller\Frontend\Service\Decorator\Base'); |
|
| 176 | + $method = $class->getMethod($name); |
|
| 177 | + $method->setAccessible(true); |
|
| 178 | 178 | |
| 179 | 179 | return $method; |
| 180 | 180 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | * Updates the payment or delivery status for the given request |
@@ -74,5 +74,5 @@ discard block |
||
| 74 | 74 | * @param string $orderid Unique ID of the order whose payment status should be updated |
| 75 | 75 | * @return \Aimeos\MShop\Order\Item\Iface $orderItem Order item that has been updated |
| 76 | 76 | */ |
| 77 | - public function updateSync( ServerRequestInterface $request, ResponseInterface $response, array $urls, $code, $orderid ); |
|
| 77 | + public function updateSync(ServerRequestInterface $request, ResponseInterface $response, array $urls, $code, $orderid); |
|
| 78 | 78 | } |
@@ -35,12 +35,12 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -124,38 +124,38 @@ discard block |
||
| 124 | 124 | * @param string $orderid Unique ID of the order whose payment status should be updated |
| 125 | 125 | * @return \Aimeos\MShop\Order\Item\Iface $orderItem Order item that has been updated |
| 126 | 126 | */ |
| 127 | - public function updateSync( ServerRequestInterface $request, ResponseInterface $response, array $urls, $code, $orderid ) |
|
| 127 | + public function updateSync(ServerRequestInterface $request, ResponseInterface $response, array $urls, $code, $orderid) |
|
| 128 | 128 | { |
| 129 | 129 | $params = (array) $request->getAttributes() + (array) $request->getParsedBody() + (array) $request->getQueryParams(); |
| 130 | 130 | $params['orderid'] = $orderid; |
| 131 | 131 | |
| 132 | 132 | $context = $this->getContext(); |
| 133 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
| 133 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
| 134 | 134 | |
| 135 | - $provider = $manager->getProvider( $manager->findItem( $code ) ); |
|
| 136 | - $provider->injectGlobalConfigBE( $urls ); |
|
| 135 | + $provider = $manager->getProvider($manager->findItem($code)); |
|
| 136 | + $provider->injectGlobalConfigBE($urls); |
|
| 137 | 137 | |
| 138 | 138 | $body = (string) $request->getBody(); |
| 139 | 139 | $output = null; |
| 140 | 140 | $headers = []; |
| 141 | 141 | |
| 142 | - if( ( $orderItem = $provider->updateSync( $params, $body, $output, $headers ) ) !== null ) |
|
| 142 | + if (($orderItem = $provider->updateSync($params, $body, $output, $headers)) !== null) |
|
| 143 | 143 | { |
| 144 | - if( $orderItem->getPaymentStatus() === \Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED |
|
| 145 | - && $provider->isImplemented( \Aimeos\MShop\Service\Provider\Payment\Base::FEAT_QUERY ) |
|
| 144 | + if ($orderItem->getPaymentStatus() === \Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED |
|
| 145 | + && $provider->isImplemented(\Aimeos\MShop\Service\Provider\Payment\Base::FEAT_QUERY) |
|
| 146 | 146 | ) { |
| 147 | - $provider->query( $orderItem ); |
|
| 147 | + $provider->query($orderItem); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | // update stock, coupons, etc. |
| 151 | - \Aimeos\Controller\Frontend\Factory::createController( $context, 'order' )->update( $orderItem ); |
|
| 151 | + \Aimeos\Controller\Frontend\Factory::createController($context, 'order')->update($orderItem); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - foreach( $headers as $name => $header ) { |
|
| 155 | - $response->withHeader( $name, $header ); |
|
| 154 | + foreach ($headers as $name => $header) { |
|
| 155 | + $response->withHeader($name, $header); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - $response->withBody( $response->createStreamFromString( $output ) ); |
|
| 158 | + $response->withBody($response->createStreamFromString($output)); |
|
| 159 | 159 | |
| 160 | 160 | return $orderItem; |
| 161 | 161 | } |
@@ -171,38 +171,38 @@ discard block |
||
| 171 | 171 | * @throws \Exception If an error occurs |
| 172 | 172 | * @deprecated Use getProviders() instead |
| 173 | 173 | */ |
| 174 | - public function getServices( $type, \Aimeos\MShop\Order\Item\Base\Iface $basket, $ref = ['media', 'price', 'text'] ) |
|
| 174 | + public function getServices($type, \Aimeos\MShop\Order\Item\Base\Iface $basket, $ref = ['media', 'price', 'text']) |
|
| 175 | 175 | { |
| 176 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 176 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 177 | 177 | |
| 178 | - $search = $serviceManager->createSearch( true ); |
|
| 178 | + $search = $serviceManager->createSearch(true); |
|
| 179 | 179 | $expr = array( |
| 180 | 180 | $search->getConditions(), |
| 181 | - $search->compare( '==', 'service.type.domain', 'service' ), |
|
| 182 | - $search->compare( '==', 'service.type.code', $type ), |
|
| 181 | + $search->compare('==', 'service.type.domain', 'service'), |
|
| 182 | + $search->compare('==', 'service.type.code', $type), |
|
| 183 | 183 | ); |
| 184 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 185 | - $search->setSortations( array( $search->sort( '+', 'service.position' ) ) ); |
|
| 184 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 185 | + $search->setSortations(array($search->sort('+', 'service.position'))); |
|
| 186 | 186 | |
| 187 | - $items = $serviceManager->searchItems( $search, $ref ); |
|
| 187 | + $items = $serviceManager->searchItems($search, $ref); |
|
| 188 | 188 | |
| 189 | 189 | |
| 190 | - foreach( $items as $id => $service ) |
|
| 190 | + foreach ($items as $id => $service) |
|
| 191 | 191 | { |
| 192 | 192 | try |
| 193 | 193 | { |
| 194 | - $provider = $serviceManager->getProvider( $service ); |
|
| 194 | + $provider = $serviceManager->getProvider($service); |
|
| 195 | 195 | |
| 196 | - if( $provider->isAvailable( $basket ) ) { |
|
| 196 | + if ($provider->isAvailable($basket)) { |
|
| 197 | 197 | $this->providers[$type][$id] = $provider; |
| 198 | 198 | } else { |
| 199 | - unset( $items[$id] ); |
|
| 199 | + unset($items[$id]); |
|
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | - catch( \Aimeos\MShop\Service\Exception $e ) |
|
| 202 | + catch (\Aimeos\MShop\Service\Exception $e) |
|
| 203 | 203 | { |
| 204 | - $msg = sprintf( 'Unable to create provider "%1$s" for service with ID "%2$s"', $service->getCode(), $id ); |
|
| 205 | - $this->getContext()->getLogger()->log( $msg, \Aimeos\MW\Logger\Base::WARN ); |
|
| 204 | + $msg = sprintf('Unable to create provider "%1$s" for service with ID "%2$s"', $service->getCode(), $id); |
|
| 205 | + $this->getContext()->getLogger()->log($msg, \Aimeos\MW\Logger\Base::WARN); |
|
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | |
@@ -223,16 +223,16 @@ discard block |
||
| 223 | 223 | * @throws \Exception If an error occurs |
| 224 | 224 | * @deprecated Use getProvider() instead |
| 225 | 225 | */ |
| 226 | - public function getServiceAttributes( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
| 226 | + public function getServiceAttributes($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
| 227 | 227 | { |
| 228 | - if( isset( $this->providers[$type][$serviceId] ) ) { |
|
| 229 | - return $this->providers[$type][$serviceId]->getConfigFE( $basket ); |
|
| 228 | + if (isset($this->providers[$type][$serviceId])) { |
|
| 229 | + return $this->providers[$type][$serviceId]->getConfigFE($basket); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 233 | - $item = $serviceManager->getItem( $serviceId, ['price'], true ); |
|
| 232 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 233 | + $item = $serviceManager->getItem($serviceId, ['price'], true); |
|
| 234 | 234 | |
| 235 | - return $serviceManager->getProvider( $item )->getConfigFE( $basket ); |
|
| 235 | + return $serviceManager->getProvider($item)->getConfigFE($basket); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | |
@@ -248,16 +248,16 @@ discard block |
||
| 248 | 248 | * @throws \Exception If an error occurs |
| 249 | 249 | * @deprecated Use getProvider() instead |
| 250 | 250 | */ |
| 251 | - public function getServicePrice( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
| 251 | + public function getServicePrice($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
| 252 | 252 | { |
| 253 | - if( isset( $this->providers[$type][$serviceId] ) ) { |
|
| 254 | - return $this->providers[$type][$serviceId]->calcPrice( $basket ); |
|
| 253 | + if (isset($this->providers[$type][$serviceId])) { |
|
| 254 | + return $this->providers[$type][$serviceId]->calcPrice($basket); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 258 | - $item = $serviceManager->getItem( $serviceId, ['price'], true ); |
|
| 257 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 258 | + $item = $serviceManager->getItem($serviceId, ['price'], true); |
|
| 259 | 259 | |
| 260 | - return $serviceManager->getProvider( $item )->calcPrice( $basket ); |
|
| 260 | + return $serviceManager->getProvider($item)->calcPrice($basket); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | |
@@ -273,22 +273,22 @@ discard block |
||
| 273 | 273 | * @throws \Aimeos\Controller\Frontend\Service\Exception If no active service provider for this ID is available |
| 274 | 274 | * @deprecated Use checkAttributes() instead |
| 275 | 275 | */ |
| 276 | - public function checkServiceAttributes( $type, $serviceId, array $attributes ) |
|
| 276 | + public function checkServiceAttributes($type, $serviceId, array $attributes) |
|
| 277 | 277 | { |
| 278 | - if( !isset( $this->providers[$type][$serviceId] ) ) |
|
| 278 | + if (!isset($this->providers[$type][$serviceId])) |
|
| 279 | 279 | { |
| 280 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 281 | - $item = $serviceManager->getItem( $serviceId, ['price'], true ); |
|
| 280 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 281 | + $item = $serviceManager->getItem($serviceId, ['price'], true); |
|
| 282 | 282 | |
| 283 | - $this->providers[$type][$serviceId] = $serviceManager->getProvider( $item ); |
|
| 283 | + $this->providers[$type][$serviceId] = $serviceManager->getProvider($item); |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | - $errors = $this->providers[$type][$serviceId]->checkConfigFE( $attributes ); |
|
| 286 | + $errors = $this->providers[$type][$serviceId]->checkConfigFE($attributes); |
|
| 287 | 287 | |
| 288 | - foreach( $errors as $key => $msg ) |
|
| 288 | + foreach ($errors as $key => $msg) |
|
| 289 | 289 | { |
| 290 | - if( $msg === null ) { |
|
| 291 | - unset( $errors[$key] ); |
|
| 290 | + if ($msg === null) { |
|
| 291 | + unset($errors[$key]); |
|
| 292 | 292 | } |
| 293 | 293 | } |
| 294 | 294 | |
@@ -33,18 +33,18 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | * @param string $orderid Unique ID of the order whose payment status should be updated |
| 130 | 130 | * @return \Aimeos\MShop\Order\Item\Iface $orderItem Order item that has been updated |
| 131 | 131 | */ |
| 132 | - public function updateSync( ServerRequestInterface $request, ResponseInterface $response, array $urls, $code, $orderid ) |
|
| 132 | + public function updateSync(ServerRequestInterface $request, ResponseInterface $response, array $urls, $code, $orderid) |
|
| 133 | 133 | { |
| 134 | - return $this->controller->updateSync( $request, $response, $urls, $code, $orderid ); |
|
| 134 | + return $this->controller->updateSync($request, $response, $urls, $code, $orderid); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | |
@@ -144,10 +144,10 @@ discard block |
||
| 144 | 144 | * @return array List of service items implementing \Aimeos\MShop\Service\Item\Iface with referenced items |
| 145 | 145 | * @deprecated Use getProviders() instead |
| 146 | 146 | */ |
| 147 | - public function getServices( $type, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
| 148 | - $ref = array( 'media', 'price', 'text' ) ) |
|
| 147 | + public function getServices($type, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
| 148 | + $ref = array('media', 'price', 'text')) |
|
| 149 | 149 | { |
| 150 | - return $this->controller->getServices( $type, $basket, $ref ); |
|
| 150 | + return $this->controller->getServices($type, $basket, $ref); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
@@ -161,9 +161,9 @@ discard block |
||
| 161 | 161 | * @return array List of attribute definitions implementing \Aimeos\MW\Criteria\Attribute\Iface |
| 162 | 162 | * @deprecated Use getProvider() instead |
| 163 | 163 | */ |
| 164 | - public function getServiceAttributes( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
| 164 | + public function getServiceAttributes($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
| 165 | 165 | { |
| 166 | - return $this->controller->getServiceAttributes( $type, $serviceId, $basket ); |
|
| 166 | + return $this->controller->getServiceAttributes($type, $serviceId, $basket); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | |
@@ -179,9 +179,9 @@ discard block |
||
| 179 | 179 | * @throws \Exception If an error occurs |
| 180 | 180 | * @deprecated Use getProvider() instead |
| 181 | 181 | */ |
| 182 | - public function getServicePrice( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
| 182 | + public function getServicePrice($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
| 183 | 183 | { |
| 184 | - return $this->controller->getServicePrice( $type, $serviceId, $basket ); |
|
| 184 | + return $this->controller->getServicePrice($type, $serviceId, $basket); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | |
@@ -196,9 +196,9 @@ discard block |
||
| 196 | 196 | * missing |
| 197 | 197 | * @deprecated Use checkAttributes() instead |
| 198 | 198 | */ |
| 199 | - public function checkServiceAttributes( $type, $serviceId, array $attributes ) |
|
| 199 | + public function checkServiceAttributes($type, $serviceId, array $attributes) |
|
| 200 | 200 | { |
| 201 | - return $this->controller->checkServiceAttributes( $type, $serviceId, $attributes ); |
|
| 201 | + return $this->controller->checkServiceAttributes($type, $serviceId, $attributes); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | |