@@ -36,7 +36,7 @@ discard block |
||
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 |
||
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 | } |
@@ -31,15 +31,15 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -30,11 +30,11 @@ discard block |
||
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 |
||
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 |
||
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; |
@@ -29,15 +29,15 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @param string $type Arbitrary order type (max. eight chars) |
28 | 28 | * @return \Aimeos\MShop\Order\Item\Iface Created order object |
29 | 29 | */ |
30 | - public function addItem( $baseId, $type ); |
|
30 | + public function addItem($baseId, $type); |
|
31 | 31 | |
32 | 32 | |
33 | 33 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param boolean $default Use default criteria to limit orders |
46 | 46 | * @return \Aimeos\MShop\Order\Item\Iface Order object |
47 | 47 | */ |
48 | - public function getItem( $id, $default = true ); |
|
48 | + public function getItem($id, $default = true); |
|
49 | 49 | |
50 | 50 | |
51 | 51 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @param integer &$total|null Variable that will contain the total number of available items |
56 | 56 | * @return \Aimeos\MShop\Order\Item\Iface[] Associative list of IDs as keys and order objects as values |
57 | 57 | */ |
58 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ); |
|
58 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null); |
|
59 | 59 | |
60 | 60 | |
61 | 61 | /** |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
78 | 78 | * @return void |
79 | 79 | */ |
80 | - public function block( \Aimeos\MShop\Order\Item\Iface $orderItem ); |
|
80 | + public function block(\Aimeos\MShop\Order\Item\Iface $orderItem); |
|
81 | 81 | |
82 | 82 | |
83 | 83 | /** |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
100 | 100 | * @return void |
101 | 101 | */ |
102 | - public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem ); |
|
102 | + public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem); |
|
103 | 103 | |
104 | 104 | |
105 | 105 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
118 | 118 | * @return void |
119 | 119 | */ |
120 | - public function update( \Aimeos\MShop\Order\Item\Iface $orderItem ); |
|
120 | + public function update(\Aimeos\MShop\Order\Item\Iface $orderItem); |
|
121 | 121 | |
122 | 122 | |
123 | 123 | /** |
@@ -131,5 +131,5 @@ discard block |
||
131 | 131 | * @return \Aimeos\MShop\Order\Item\Iface Order item that belongs to the stored basket |
132 | 132 | * @deprecated 2017.04 Use store() from basket controller instead |
133 | 133 | */ |
134 | - public function store( \Aimeos\MShop\Order\Item\Base\Iface $basket ); |
|
134 | + public function store(\Aimeos\MShop\Order\Item\Base\Iface $basket); |
|
135 | 135 | } |
@@ -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 | } |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | * @param string $stocktype Unique code of the stock type to deliver the products from |
42 | 42 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available |
43 | 43 | */ |
44 | - public function addProduct( $prodid, $quantity = 1, array $options = [], array $variantAttributeIds = [], |
|
44 | + public function addProduct($prodid, $quantity = 1, array $options = [], array $variantAttributeIds = [], |
|
45 | 45 | array $configAttributeIds = [], array $hiddenAttributeIds = [], array $customAttributeValues = [], |
46 | - $stocktype = 'default' ) |
|
46 | + $stocktype = 'default') |
|
47 | 47 | { |
48 | 48 | $context = $this->getContext(); |
49 | - $productManager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
49 | + $productManager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
50 | 50 | |
51 | - if( $productManager->getItem( $prodid, [], true )->getType() !== 'bundle' ) |
|
51 | + if ($productManager->getItem($prodid, [], true)->getType() !== 'bundle') |
|
52 | 52 | { |
53 | 53 | return $this->getController()->addProduct( |
54 | 54 | $prodid, $quantity, $options, $variantAttributeIds, $configAttributeIds, |
@@ -57,29 +57,29 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | $attributeMap = [ |
60 | - 'custom' => array_keys( $customAttributeValues ), |
|
60 | + 'custom' => array_keys($customAttributeValues), |
|
61 | 61 | 'config' => $configAttributeIds, |
62 | 62 | 'hidden' => $hiddenAttributeIds, |
63 | 63 | ]; |
64 | - $this->checkListRef( $prodid, 'attribute', $attributeMap ); |
|
64 | + $this->checkListRef($prodid, 'attribute', $attributeMap); |
|
65 | 65 | |
66 | 66 | |
67 | - $productItem = $productManager->getItem( $prodid, array( 'media', 'supplier', 'price', 'product', 'text' ), true ); |
|
68 | - $prices = $productItem->getRefItems( 'price', 'default', 'default' ); |
|
67 | + $productItem = $productManager->getItem($prodid, array('media', 'supplier', 'price', 'product', 'text'), true); |
|
68 | + $prices = $productItem->getRefItems('price', 'default', 'default'); |
|
69 | 69 | |
70 | - $orderBaseProductItem = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' )->createItem(); |
|
71 | - $orderBaseProductItem->copyFrom( $productItem )->setQuantity( $quantity )->setStockType( $stocktype ); |
|
70 | + $orderBaseProductItem = \Aimeos\MShop\Factory::createManager($context, 'order/base/product')->createItem(); |
|
71 | + $orderBaseProductItem->copyFrom($productItem)->setQuantity($quantity)->setStockType($stocktype); |
|
72 | 72 | |
73 | - $this->addBundleProducts( $orderBaseProductItem, $productItem, $variantAttributeIds, $stocktype ); |
|
73 | + $this->addBundleProducts($orderBaseProductItem, $productItem, $variantAttributeIds, $stocktype); |
|
74 | 74 | |
75 | - $attr = $this->getOrderProductAttributes( 'custom', array_keys( $customAttributeValues ), $customAttributeValues ); |
|
76 | - $attr = array_merge( $attr, $this->getOrderProductAttributes( 'config', $configAttributeIds ) ); |
|
77 | - $attr = array_merge( $attr, $this->getOrderProductAttributes( 'hidden', $hiddenAttributeIds ) ); |
|
75 | + $attr = $this->getOrderProductAttributes('custom', array_keys($customAttributeValues), $customAttributeValues); |
|
76 | + $attr = array_merge($attr, $this->getOrderProductAttributes('config', $configAttributeIds)); |
|
77 | + $attr = array_merge($attr, $this->getOrderProductAttributes('hidden', $hiddenAttributeIds)); |
|
78 | 78 | |
79 | - $orderBaseProductItem->setAttributes( $attr ); |
|
80 | - $orderBaseProductItem->setPrice( $this->calcPrice( $orderBaseProductItem, $prices, $quantity ) ); |
|
79 | + $orderBaseProductItem->setAttributes($attr); |
|
80 | + $orderBaseProductItem->setPrice($this->calcPrice($orderBaseProductItem, $prices, $quantity)); |
|
81 | 81 | |
82 | - $this->getController()->get()->addProduct( $orderBaseProductItem ); |
|
82 | + $this->getController()->get()->addProduct($orderBaseProductItem); |
|
83 | 83 | $this->getController()->save(); |
84 | 84 | } |
85 | 85 | |
@@ -92,43 +92,43 @@ discard block |
||
92 | 92 | * @param array $variantAttributeIds List of product variant attribute IDs |
93 | 93 | * @param string $stocktype |
94 | 94 | */ |
95 | - protected function addBundleProducts( \Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem, |
|
96 | - \Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds, $stocktype ) |
|
95 | + protected function addBundleProducts(\Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem, |
|
96 | + \Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds, $stocktype) |
|
97 | 97 | { |
98 | 98 | $quantity = $orderBaseProductItem->getQuantity(); |
99 | 99 | $products = $subProductIds = $orderProducts = []; |
100 | - $orderProductManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/product' ); |
|
100 | + $orderProductManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/product'); |
|
101 | 101 | |
102 | - foreach( $productItem->getRefItems( 'product', null, 'default' ) as $item ) { |
|
102 | + foreach ($productItem->getRefItems('product', null, 'default') as $item) { |
|
103 | 103 | $subProductIds[] = $item->getId(); |
104 | 104 | } |
105 | 105 | |
106 | - if( count( $subProductIds ) > 0 ) |
|
106 | + if (count($subProductIds) > 0) |
|
107 | 107 | { |
108 | - $productManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' ); |
|
108 | + $productManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product'); |
|
109 | 109 | |
110 | - $search = $productManager->createSearch( true ); |
|
110 | + $search = $productManager->createSearch(true); |
|
111 | 111 | $expr = array( |
112 | - $search->compare( '==', 'product.id', $subProductIds ), |
|
112 | + $search->compare('==', 'product.id', $subProductIds), |
|
113 | 113 | $search->getConditions(), |
114 | 114 | ); |
115 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
115 | + $search->setConditions($search->combine('&&', $expr)); |
|
116 | 116 | |
117 | - $products = $productManager->searchItems( $search, array( 'attribute', 'media', 'price', 'text' ) ); |
|
117 | + $products = $productManager->searchItems($search, array('attribute', 'media', 'price', 'text')); |
|
118 | 118 | } |
119 | 119 | |
120 | - foreach( $products as $product ) |
|
120 | + foreach ($products as $product) |
|
121 | 121 | { |
122 | - $prices = $product->getRefItems( 'price', 'default', 'default' ); |
|
122 | + $prices = $product->getRefItems('price', 'default', 'default'); |
|
123 | 123 | |
124 | 124 | $orderProduct = $orderProductManager->createItem(); |
125 | - $orderProduct->copyFrom( $product ); |
|
126 | - $orderProduct->setStockType( $stocktype ); |
|
127 | - $orderProduct->setPrice( $this->calcPrice( $orderProduct, $prices, $quantity ) ); |
|
125 | + $orderProduct->copyFrom($product); |
|
126 | + $orderProduct->setStockType($stocktype); |
|
127 | + $orderProduct->setPrice($this->calcPrice($orderProduct, $prices, $quantity)); |
|
128 | 128 | |
129 | 129 | $orderProducts[] = $orderProduct; |
130 | 130 | } |
131 | 131 | |
132 | - $orderBaseProductItem->setProducts( $orderProducts ); |
|
132 | + $orderBaseProductItem->setProducts($orderProducts); |
|
133 | 133 | } |
134 | 134 | } |