@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @param string|null $name Name of the controller implementaton (default: "Standard") |
29 | 29 | * @return \Aimeos\Controller\Frontend\Subscription\Iface Controller object |
30 | 30 | */ |
31 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, $name = null ) |
|
31 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, $name = null) |
|
32 | 32 | { |
33 | 33 | /** controller/frontend/subscription/name |
34 | 34 | * Class name of the used subscription frontend controller implementation |
@@ -63,19 +63,19 @@ discard block |
||
63 | 63 | * @since 2018.04 |
64 | 64 | * @category Developer |
65 | 65 | */ |
66 | - if( $name === null ) { |
|
67 | - $name = $context->getConfig()->get( 'controller/frontend/subscription/name', 'Standard' ); |
|
66 | + if ($name === null) { |
|
67 | + $name = $context->getConfig()->get('controller/frontend/subscription/name', 'Standard'); |
|
68 | 68 | } |
69 | 69 | |
70 | - if( ctype_alnum( $name ) === false ) { |
|
71 | - $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Frontend\\Subscription\\' . $name : '<not a string>'; |
|
72 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
70 | + if (ctype_alnum($name) === false) { |
|
71 | + $classname = is_string($name) ? '\\Aimeos\\Controller\\Frontend\\Subscription\\' . $name : '<not a string>'; |
|
72 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | $iface = '\\Aimeos\\Controller\\Frontend\\Subscription\\Iface'; |
76 | 76 | $classname = '\\Aimeos\\Controller\\Frontend\\Subscription\\' . $name; |
77 | 77 | |
78 | - $manager = self::createControllerBase( $context, $classname, $iface ); |
|
78 | + $manager = self::createControllerBase($context, $classname, $iface); |
|
79 | 79 | |
80 | 80 | /** controller/frontend/subscription/decorators/excludes |
81 | 81 | * Excludes decorators added by the "common" option from the subscription frontend controllers |
@@ -151,6 +151,6 @@ discard block |
||
151 | 151 | * @see controller/frontend/subscription/decorators/excludes |
152 | 152 | * @see controller/frontend/subscription/decorators/global |
153 | 153 | */ |
154 | - return self::addControllerDecorators( $context, $manager, 'subscription' ); |
|
154 | + return self::addControllerDecorators($context, $manager, 'subscription'); |
|
155 | 155 | } |
156 | 156 | } |
@@ -17,104 +17,104 @@ |
||
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\Subscription\Standard( $this->context ); |
|
23 | + $this->object = new \Aimeos\Controller\Frontend\Subscription\Standard($this->context); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
27 | 27 | protected function tearDown() |
28 | 28 | { |
29 | - unset( $this->object, $this->context ); |
|
29 | + unset($this->object, $this->context); |
|
30 | 30 | |
31 | - \Aimeos\MShop\Factory::setCache( false ); |
|
31 | + \Aimeos\MShop\Factory::setCache(false); |
|
32 | 32 | \Aimeos\MShop\Factory::clear(); |
33 | 33 | } |
34 | 34 | |
35 | 35 | |
36 | 36 | public function testCancel() |
37 | 37 | { |
38 | - $this->context->setUserId( $this->getCustomerId() ); |
|
39 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' )->createItem(); |
|
38 | + $this->context->setUserId($this->getCustomerId()); |
|
39 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'subscription')->createItem(); |
|
40 | 40 | |
41 | - $cntl = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Subscription\Standard' ) |
|
42 | - ->setConstructorArgs( [$this->context] ) |
|
43 | - ->setMethods( ['saveItem'] ) |
|
41 | + $cntl = $this->getMockBuilder('\Aimeos\Controller\Frontend\Subscription\Standard') |
|
42 | + ->setConstructorArgs([$this->context]) |
|
43 | + ->setMethods(['saveItem']) |
|
44 | 44 | ->getMock(); |
45 | 45 | |
46 | - $cntl->expects( $this->once() )->method( 'saveItem' ) |
|
47 | - ->will( $this->returnValue( $item ) ); |
|
46 | + $cntl->expects($this->once())->method('saveItem') |
|
47 | + ->will($this->returnValue($item)); |
|
48 | 48 | |
49 | - $this->assertInstanceOf( '\Aimeos\MShop\Subscription\Item\Iface', $cntl->cancel( $this->getSubscriptionId() ) ); |
|
49 | + $this->assertInstanceOf('\Aimeos\MShop\Subscription\Item\Iface', $cntl->cancel($this->getSubscriptionId())); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
53 | 53 | public function testCreateFilter() |
54 | 54 | { |
55 | - $this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->createFilter() ); |
|
55 | + $this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->createFilter()); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
59 | 59 | public function testGetIntervals() |
60 | 60 | { |
61 | - $this->assertGreaterThan( 0, count( $this->object->getIntervals() ) ); |
|
61 | + $this->assertGreaterThan(0, count($this->object->getIntervals())); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
65 | 65 | public function testGetItem() |
66 | 66 | { |
67 | 67 | $id = $this->getSubscriptionId(); |
68 | - $this->context->setUserId( $this->getCustomerId() ); |
|
68 | + $this->context->setUserId($this->getCustomerId()); |
|
69 | 69 | |
70 | - $this->assertInstanceOf( '\Aimeos\MShop\Subscription\Item\Iface', $this->object->getItem( $id ) ); |
|
70 | + $this->assertInstanceOf('\Aimeos\MShop\Subscription\Item\Iface', $this->object->getItem($id)); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
74 | 74 | public function testGetItemException() |
75 | 75 | { |
76 | - $this->setExpectedException( '\Aimeos\Controller\Frontend\Subscription\Exception' ); |
|
76 | + $this->setExpectedException('\Aimeos\Controller\Frontend\Subscription\Exception'); |
|
77 | 77 | $this->object->getItem( -1 ); |
78 | 78 | } |
79 | 79 | |
80 | 80 | |
81 | 81 | public function testSaveItem() |
82 | 82 | { |
83 | - $manager = $this->getMockBuilder( '\\Aimeos\\MShop\\Subscription\\Manager\\Standard' ) |
|
84 | - ->setConstructorArgs( [$this->context] ) |
|
85 | - ->setMethods( ['saveItem'] ) |
|
83 | + $manager = $this->getMockBuilder('\\Aimeos\\MShop\\Subscription\\Manager\\Standard') |
|
84 | + ->setConstructorArgs([$this->context]) |
|
85 | + ->setMethods(['saveItem']) |
|
86 | 86 | ->getMock(); |
87 | 87 | |
88 | - \Aimeos\MShop\Factory::injectManager( $this->context, 'subscription', $manager ); |
|
88 | + \Aimeos\MShop\Factory::injectManager($this->context, 'subscription', $manager); |
|
89 | 89 | |
90 | - $manager->expects( $this->once() )->method( 'saveItem' ) |
|
91 | - ->will( $this->returnValue( $manager->createItem() ) ); |
|
90 | + $manager->expects($this->once())->method('saveItem') |
|
91 | + ->will($this->returnValue($manager->createItem())); |
|
92 | 92 | |
93 | - $this->assertInstanceOf( '\Aimeos\MShop\Subscription\Item\Iface', $this->object->saveItem( $manager->createItem() ) ); |
|
93 | + $this->assertInstanceOf('\Aimeos\MShop\Subscription\Item\Iface', $this->object->saveItem($manager->createItem())); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
97 | 97 | public function testSearchItems() |
98 | 98 | { |
99 | - $this->assertGreaterThan( 1, $this->object->searchItems( $this->object->createFilter() ) ); |
|
99 | + $this->assertGreaterThan(1, $this->object->searchItems($this->object->createFilter())); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | protected function getCustomerId() |
103 | 103 | { |
104 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' ); |
|
105 | - return $manager->findItem( 'UTC001' )->getId(); |
|
104 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer'); |
|
105 | + return $manager->findItem('UTC001')->getId(); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
109 | 109 | protected function getSubscriptionId() |
110 | 110 | { |
111 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'subscription' ); |
|
112 | - $search = $manager->createSearch()->setSlice( 0, 1 ); |
|
113 | - $search->setConditions( $search->compare( '==', 'order.base.customerid', $this->getCustomerId() ) ); |
|
114 | - $result = $manager->searchItems( $search ); |
|
111 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'subscription'); |
|
112 | + $search = $manager->createSearch()->setSlice(0, 1); |
|
113 | + $search->setConditions($search->compare('==', 'order.base.customerid', $this->getCustomerId())); |
|
114 | + $result = $manager->searchItems($search); |
|
115 | 115 | |
116 | - if( ( $item = reset( $result ) ) === false ) { |
|
117 | - throw new \RuntimeException( 'No subscription item found' ); |
|
116 | + if (($item = reset($result)) === false) { |
|
117 | + throw new \RuntimeException('No subscription item found'); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | return $item->getId(); |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | * @param string $id Unique subscription ID |
28 | 28 | * @return \Aimeos\MShop\Subscription\Item\Iface Canceled subscription item |
29 | 29 | */ |
30 | - public function cancel( $id ) |
|
30 | + public function cancel($id) |
|
31 | 31 | { |
32 | - $item = $this->getItem( $id ); |
|
33 | - $item->setDateEnd( $item->getDateNext() ); |
|
32 | + $item = $this->getItem($id); |
|
33 | + $item->setDateEnd($item->getDateNext()); |
|
34 | 34 | |
35 | - return $this->saveItem( $item ); |
|
35 | + return $this->saveItem($item); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function createFilter() |
45 | 45 | { |
46 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'subscription' )->createSearch(); |
|
46 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'subscription')->createSearch(); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -53,25 +53,25 @@ discard block |
||
53 | 53 | * @param string $id Unique subscription ID |
54 | 54 | * @return \Aimeos\MShop\Subscription\Item\Iface Subscription object |
55 | 55 | */ |
56 | - public function getItem( $id ) |
|
56 | + public function getItem($id) |
|
57 | 57 | { |
58 | 58 | $context = $this->getContext(); |
59 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' ); |
|
59 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'subscription'); |
|
60 | 60 | |
61 | 61 | $filter = $manager->createSearch(); |
62 | 62 | $expr = [ |
63 | - $filter->compare( '==', 'subscription.id', $id ), |
|
64 | - $filter->compare( '==', 'order.base.customerid', $context->getUserId() ), |
|
63 | + $filter->compare('==', 'subscription.id', $id), |
|
64 | + $filter->compare('==', 'order.base.customerid', $context->getUserId()), |
|
65 | 65 | $filter->getConditions(), |
66 | 66 | ]; |
67 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
67 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
68 | 68 | |
69 | - $items = $this->searchItems( $filter ); |
|
69 | + $items = $this->searchItems($filter); |
|
70 | 70 | |
71 | - if( ( $item = reset( $items ) ) === false ) |
|
71 | + if (($item = reset($items)) === false) |
|
72 | 72 | { |
73 | 73 | $msg = 'Invalid subscription ID "%1$s" for customer ID "%2$s"'; |
74 | - throw new \Aimeos\Controller\Frontend\Subscription\Exception( sprintf( $msg, $id, $context->getUserId() ) ); |
|
74 | + throw new \Aimeos\Controller\Frontend\Subscription\Exception(sprintf($msg, $id, $context->getUserId())); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | return $item; |
@@ -86,18 +86,18 @@ discard block |
||
86 | 86 | public function getIntervals() |
87 | 87 | { |
88 | 88 | $intervals = []; |
89 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute' ); |
|
89 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute'); |
|
90 | 90 | |
91 | - $search = $manager->createSearch( true ); |
|
91 | + $search = $manager->createSearch(true); |
|
92 | 92 | $expr = array( |
93 | 93 | $search->getConditions(), |
94 | - $search->compare( '==', 'attribute.domain', 'product' ), |
|
95 | - $search->compare( '==', 'attribute.type.code', 'interval' ), |
|
94 | + $search->compare('==', 'attribute.domain', 'product'), |
|
95 | + $search->compare('==', 'attribute.type.code', 'interval'), |
|
96 | 96 | ); |
97 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
98 | - $search->setSlice( 0, 0x7fffffff ); |
|
97 | + $search->setConditions($search->combine('&&', $expr)); |
|
98 | + $search->setSlice(0, 0x7fffffff); |
|
99 | 99 | |
100 | - foreach( $manager->searchItems( $search, ['text'] ) as $attrItem ) { |
|
100 | + foreach ($manager->searchItems($search, ['text']) as $attrItem) { |
|
101 | 101 | $intervals[$attrItem->getCode()] = $attrItem; |
102 | 102 | } |
103 | 103 | |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | * @param \Aimeos\MShop\Subscription\Item\Iface $item Subscription object |
111 | 111 | * @return \Aimeos\MShop\Subscription\Item\Iface Saved subscription item |
112 | 112 | */ |
113 | - public function saveItem( \Aimeos\MShop\Subscription\Item\Iface $item ) |
|
113 | + public function saveItem(\Aimeos\MShop\Subscription\Item\Iface $item) |
|
114 | 114 | { |
115 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'subscription' )->saveItem( $item ); |
|
115 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'subscription')->saveItem($item); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -123,17 +123,17 @@ discard block |
||
123 | 123 | * @param integer &$total|null Variable that will contain the total number of available items |
124 | 124 | * @return \Aimeos\MShop\Subscription\Item\Iface[] Associative list of IDs as keys and subscription objects as values |
125 | 125 | */ |
126 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ) |
|
126 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null) |
|
127 | 127 | { |
128 | 128 | $context = $this->getContext(); |
129 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'subscription' ); |
|
129 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'subscription'); |
|
130 | 130 | |
131 | 131 | $expr = [ |
132 | - $filter->compare( '==', 'order.base.customerid', $context->getUserId() ), |
|
132 | + $filter->compare('==', 'order.base.customerid', $context->getUserId()), |
|
133 | 133 | $filter->getConditions(), |
134 | 134 | ]; |
135 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
135 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
136 | 136 | |
137 | - return $manager->searchItems( $filter, [], $total ); |
|
137 | + return $manager->searchItems($filter, [], $total); |
|
138 | 138 | } |
139 | 139 | } |
@@ -118,7 +118,7 @@ |
||
118 | 118 | /** |
119 | 119 | * Returns the frontend controller |
120 | 120 | * |
121 | - * @return \Aimeos\Controller\Frontend\Supplier\Iface Frontend controller object |
|
121 | + * @return \Aimeos\Controller\Frontend\Iface Frontend controller object |
|
122 | 122 | */ |
123 | 123 | protected function getController() |
124 | 124 | { |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | * @param \Aimeos\Controller\Frontend\Iface $controller Controller object |
31 | 31 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
32 | 32 | */ |
33 | - public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context ) |
|
33 | + public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context) |
|
34 | 34 | { |
35 | - \Aimeos\MW\Common\Base::checkClass( '\\Aimeos\\Controller\\Frontend\\Supplier\\Iface', $controller ); |
|
35 | + \Aimeos\MW\Common\Base::checkClass('\\Aimeos\\Controller\\Frontend\\Supplier\\Iface', $controller); |
|
36 | 36 | |
37 | 37 | $this->controller = $controller; |
38 | 38 | |
39 | - parent::__construct( $context ); |
|
39 | + parent::__construct($context); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | * @return mixed Returns the value of the called method |
49 | 49 | * @throws \Aimeos\Controller\Frontend\Exception If method call failed |
50 | 50 | */ |
51 | - public function __call( $name, array $param ) |
|
51 | + public function __call($name, array $param) |
|
52 | 52 | { |
53 | - return @call_user_func_array( array( $this->controller, $name ), $param ); |
|
53 | + return @call_user_func_array(array($this->controller, $name), $param); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | * @return \Aimeos\MShop\Supplier\Item\Iface Supplier item including the referenced domains items |
76 | 76 | * @since 2018.07 |
77 | 77 | */ |
78 | - public function getItem( $id, array $domains = array( 'media', 'text' ) ) |
|
78 | + public function getItem($id, array $domains = array('media', 'text')) |
|
79 | 79 | { |
80 | - return $this->controller->getItem( $id, $domains ); |
|
80 | + return $this->controller->getItem($id, $domains); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | * @return \Aimeos\MShop\Supplier\Item\Iface[] Associative list of supplier item including the referenced domains items |
90 | 90 | * @since 2018.07 |
91 | 91 | */ |
92 | - public function getItems( array $ids, array $domains = array( 'media', 'text' ) ) |
|
92 | + public function getItems(array $ids, array $domains = array('media', 'text')) |
|
93 | 93 | { |
94 | - return $this->controller->getItems( $ids, $domains ); |
|
94 | + return $this->controller->getItems($ids, $domains); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | * @return array Ordered list of supplier items implementing \Aimeos\MShop\Supplier\Item\Iface |
105 | 105 | * @since 2018.07 |
106 | 106 | */ |
107 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'text' ), &$total = null ) |
|
107 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'text'), &$total = null) |
|
108 | 108 | { |
109 | - return $this->controller->searchItems( $filter, $domains, $total ); |
|
109 | + return $this->controller->searchItems($filter, $domains, $total); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 |
@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | |
17 | 17 | protected function setUp() |
18 | 18 | { |
19 | - $this->object = new \Aimeos\Controller\Frontend\Supplier\Standard( \TestHelperFrontend::getContext() ); |
|
19 | + $this->object = new \Aimeos\Controller\Frontend\Supplier\Standard(\TestHelperFrontend::getContext()); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
23 | 23 | protected function tearDown() |
24 | 24 | { |
25 | - unset( $this->object ); |
|
25 | + unset($this->object); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | |
@@ -30,34 +30,34 @@ discard block |
||
30 | 30 | { |
31 | 31 | $filter = $this->object->createFilter(); |
32 | 32 | |
33 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
34 | - $this->assertEquals( 0, $filter->getSliceStart() ); |
|
35 | - $this->assertEquals( 100, $filter->getSliceSize() ); |
|
33 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
34 | + $this->assertEquals(0, $filter->getSliceStart()); |
|
35 | + $this->assertEquals(100, $filter->getSliceSize()); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | 39 | public function testGetItem() |
40 | 40 | { |
41 | 41 | $context = \TestHelperFrontend::getContext(); |
42 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'supplier' ); |
|
43 | - $id = $manager->findItem( 'unitCode001' )->getId(); |
|
42 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'supplier'); |
|
43 | + $id = $manager->findItem('unitCode001')->getId(); |
|
44 | 44 | |
45 | - $result = $this->object->getItem( $id ); |
|
45 | + $result = $this->object->getItem($id); |
|
46 | 46 | |
47 | - $this->assertInstanceOf( '\Aimeos\MShop\Supplier\Item\Iface', $result ); |
|
47 | + $this->assertInstanceOf('\Aimeos\MShop\Supplier\Item\Iface', $result); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
51 | 51 | public function testGetItems() |
52 | 52 | { |
53 | 53 | $context = \TestHelperFrontend::getContext(); |
54 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'supplier' ); |
|
55 | - $id = $manager->findItem( 'unitCode001' )->getId(); |
|
54 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'supplier'); |
|
55 | + $id = $manager->findItem('unitCode001')->getId(); |
|
56 | 56 | |
57 | - $result = $this->object->getItems( [$id] ); |
|
57 | + $result = $this->object->getItems([$id]); |
|
58 | 58 | |
59 | - $this->assertInternalType( 'array', $result ); |
|
60 | - $this->assertEquals( 1, count( $result ) ); |
|
59 | + $this->assertInternalType('array', $result); |
|
60 | + $this->assertEquals(1, count($result)); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | $filter = $this->object->createFilter(); |
67 | 67 | |
68 | 68 | $total = 0; |
69 | - $results = $this->object->searchItems( $filter, [], $total ); |
|
69 | + $results = $this->object->searchItems($filter, [], $total); |
|
70 | 70 | |
71 | - $this->assertEquals( 2, $total ); |
|
72 | - $this->assertEquals( 2, count( $results ) ); |
|
71 | + $this->assertEquals(2, $total); |
|
72 | + $this->assertEquals(2, count($results)); |
|
73 | 73 | } |
74 | 74 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @param string|null $name Name of the controller implementaton (default: "Standard") |
29 | 29 | * @return \Aimeos\Controller\Frontend\Supplier\Iface Controller object |
30 | 30 | */ |
31 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, $name = null ) |
|
31 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, $name = null) |
|
32 | 32 | { |
33 | 33 | /** controller/frontend/supplier/name |
34 | 34 | * Class name of the used supplier frontend controller implementation |
@@ -63,20 +63,20 @@ discard block |
||
63 | 63 | * @since 2018.07 |
64 | 64 | * @category Developer |
65 | 65 | */ |
66 | - if( $name === null ) { |
|
67 | - $name = $context->getConfig()->get( 'controller/frontend/supplier/name', 'Standard' ); |
|
66 | + if ($name === null) { |
|
67 | + $name = $context->getConfig()->get('controller/frontend/supplier/name', 'Standard'); |
|
68 | 68 | } |
69 | 69 | |
70 | - if( ctype_alnum( $name ) === false ) |
|
70 | + if (ctype_alnum($name) === false) |
|
71 | 71 | { |
72 | - $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Frontend\\Supplier\\' . $name : '<not a string>'; |
|
73 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
72 | + $classname = is_string($name) ? '\\Aimeos\\Controller\\Frontend\\Supplier\\' . $name : '<not a string>'; |
|
73 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | $iface = '\\Aimeos\\Controller\\Frontend\\Supplier\\Iface'; |
77 | 77 | $classname = '\\Aimeos\\Controller\\Frontend\\Supplier\\' . $name; |
78 | 78 | |
79 | - $manager = self::createControllerBase( $context, $classname, $iface ); |
|
79 | + $manager = self::createControllerBase($context, $classname, $iface); |
|
80 | 80 | |
81 | 81 | /** controller/frontend/supplier/decorators/excludes |
82 | 82 | * Excludes decorators added by the "common" option from the supplier frontend controllers |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * @see controller/frontend/supplier/decorators/excludes |
153 | 153 | * @see controller/frontend/supplier/decorators/global |
154 | 154 | */ |
155 | - return self::addControllerDecorators( $context, $manager, 'supplier' ); |
|
155 | + return self::addControllerDecorators($context, $manager, 'supplier'); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function createFilter() |
32 | 32 | { |
33 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'supplier' )->createSearch( true ); |
|
33 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'supplier')->createSearch(true); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | * @return \Aimeos\MShop\Supplier\Item\Iface Supplier item including the referenced domains items |
43 | 43 | * @since 2018.07 |
44 | 44 | */ |
45 | - public function getItem( $id, array $domains = array( 'media', 'text' ) ) |
|
45 | + public function getItem($id, array $domains = array('media', 'text')) |
|
46 | 46 | { |
47 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'supplier' )->getItem( $id, $domains, true ); |
|
47 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'supplier')->getItem($id, $domains, true); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
@@ -56,18 +56,18 @@ discard block |
||
56 | 56 | * @return \Aimeos\MShop\Supplier\Item\Iface[] Associative list of supplier item including the referenced domains items |
57 | 57 | * @since 2018.07 |
58 | 58 | */ |
59 | - public function getItems( array $ids, array $domains = array( 'media', 'text' ) ) |
|
59 | + public function getItems(array $ids, array $domains = array('media', 'text')) |
|
60 | 60 | { |
61 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'supplier' ); |
|
61 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'supplier'); |
|
62 | 62 | |
63 | - $filter = $manager->createSearch( true ); |
|
63 | + $filter = $manager->createSearch(true); |
|
64 | 64 | $expr = [ |
65 | - $filter->compare( '==', 'supplier.id', $ids ), |
|
65 | + $filter->compare('==', 'supplier.id', $ids), |
|
66 | 66 | $filter->getConditions(), |
67 | 67 | ]; |
68 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
68 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
69 | 69 | |
70 | - return $manager->searchItems( $filter, $domains ); |
|
70 | + return $manager->searchItems($filter, $domains); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * @return array Ordered list of supplier items implementing \Aimeos\MShop\Supplier\Item\Iface |
81 | 81 | * @since 2018.07 |
82 | 82 | */ |
83 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'text' ), &$total = null ) |
|
83 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'text'), &$total = null) |
|
84 | 84 | { |
85 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'supplier' )->searchItems( $filter, $domains, $total ); |
|
85 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'supplier')->searchItems($filter, $domains, $total); |
|
86 | 86 | } |
87 | 87 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @return \Aimeos\MShop\Supplier\Item\Iface Supplier item including the referenced domains items |
37 | 37 | * @since 2018.07 |
38 | 38 | */ |
39 | - public function getItem( $id, array $domains = array( 'media', 'text' ) ); |
|
39 | + public function getItem($id, array $domains = array('media', 'text')); |
|
40 | 40 | |
41 | 41 | |
42 | 42 | /** |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @return \Aimeos\MShop\Supplier\Item\Iface[] Associative list of supplier item including the referenced domains items |
48 | 48 | * @since 2018.07 |
49 | 49 | */ |
50 | - public function getItems( array $ids, array $domains = array( 'media', 'text' ) ); |
|
50 | + public function getItems(array $ids, array $domains = array('media', 'text')); |
|
51 | 51 | |
52 | 52 | |
53 | 53 | /** |
@@ -59,5 +59,5 @@ discard block |
||
59 | 59 | * @return array Ordered list of supplier items implementing \Aimeos\MShop\Supplier\Item\Iface |
60 | 60 | * @since 2018.07 |
61 | 61 | */ |
62 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'text' ), &$total = null ); |
|
62 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'text'), &$total = null); |
|
63 | 63 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
31 | 31 | * @since 2017.03 |
32 | 32 | */ |
33 | - public function addFilterAttribute( \Aimeos\MW\Criteria\Iface $filter, array $attrIds, array $optIds, array $oneIds ); |
|
33 | + public function addFilterAttribute(\Aimeos\MW\Criteria\Iface $filter, array $attrIds, array $optIds, array $oneIds); |
|
34 | 34 | |
35 | 35 | |
36 | 36 | /** |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
46 | 46 | * @since 2017.03 |
47 | 47 | */ |
48 | - public function addFilterCategory( \Aimeos\MW\Criteria\Iface $filter, $catId, |
|
49 | - $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort = null, $direction = '+', $listtype = 'default' ); |
|
48 | + public function addFilterCategory(\Aimeos\MW\Criteria\Iface $filter, $catId, |
|
49 | + $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort = null, $direction = '+', $listtype = 'default'); |
|
50 | 50 | |
51 | 51 | |
52 | 52 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
58 | 58 | * @since 2018.07 |
59 | 59 | */ |
60 | - public function addFilterSupplier( \Aimeos\MW\Criteria\Iface $filter, array $supIds ); |
|
60 | + public function addFilterSupplier(\Aimeos\MW\Criteria\Iface $filter, array $supIds); |
|
61 | 61 | |
62 | 62 | |
63 | 63 | /** |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
72 | 72 | * @since 2017.03 |
73 | 73 | */ |
74 | - public function addFilterText( \Aimeos\MW\Criteria\Iface $filter, $input, $sort = null, $direction = '+', $listtype = 'default' ); |
|
74 | + public function addFilterText(\Aimeos\MW\Criteria\Iface $filter, $input, $sort = null, $direction = '+', $listtype = 'default'); |
|
75 | 75 | |
76 | 76 | |
77 | 77 | /** |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @return array Associative list of key values as key and the product count for this key as value |
83 | 83 | * @since 2017.03 |
84 | 84 | */ |
85 | - public function aggregate( \Aimeos\MW\Criteria\Iface $filter, $key ); |
|
85 | + public function aggregate(\Aimeos\MW\Criteria\Iface $filter, $key); |
|
86 | 86 | |
87 | 87 | |
88 | 88 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
97 | 97 | * @since 2017.03 |
98 | 98 | */ |
99 | - public function createFilter( $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' ); |
|
99 | + public function createFilter($sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default'); |
|
100 | 100 | |
101 | 101 | |
102 | 102 | /** |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @return \Aimeos\MShop\Product\Item\Iface Product item including the referenced domains items |
108 | 108 | * @since 2017.03 |
109 | 109 | */ |
110 | - public function getItem( $productId, array $domains = array( 'attribute', 'media', 'price', 'product', 'product/property', 'text' ) ); |
|
110 | + public function getItem($productId, array $domains = array('attribute', 'media', 'price', 'product', 'product/property', 'text')); |
|
111 | 111 | |
112 | 112 | |
113 | 113 | /** |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @return \Aimeos\MShop\Product\Item\Iface[] Associative list of product IDs as keys and product items as values |
119 | 119 | * @since 2017.03 |
120 | 120 | */ |
121 | - public function getItems( array $productIds, array $domains = array( 'media', 'price', 'text' ) ); |
|
121 | + public function getItems(array $productIds, array $domains = array('media', 'price', 'text')); |
|
122 | 122 | |
123 | 123 | |
124 | 124 | /** |
@@ -130,5 +130,5 @@ discard block |
||
130 | 130 | * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface |
131 | 131 | * @since 2017.03 |
132 | 132 | */ |
133 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null ); |
|
133 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null); |
|
134 | 134 | } |