@@ -20,106 +20,106 @@ |
||
20 | 20 | { |
21 | 21 | $this->context = \TestHelperFrontend::getContext(); |
22 | 22 | |
23 | - $this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Supplier\Standard' ) |
|
23 | + $this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Supplier\Standard') |
|
24 | 24 | ->disableOriginalConstructor() |
25 | 25 | ->getMock(); |
26 | 26 | |
27 | - $this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Supplier\Decorator\Base' ) |
|
28 | - ->setConstructorArgs( [$this->stub, $this->context] ) |
|
27 | + $this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Supplier\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\Supplier\Decorator\Base' ) |
|
46 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
45 | + $this->getMockBuilder('\Aimeos\Controller\Frontend\Supplier\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\Supplier\Standard' ) |
|
53 | + $stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Supplier\Standard') |
|
54 | 54 | ->disableOriginalConstructor() |
55 | - ->setMethods( ['invalid'] ) |
|
55 | + ->setMethods(['invalid']) |
|
56 | 56 | ->getMock(); |
57 | 57 | |
58 | - $object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Supplier\Decorator\Base' ) |
|
59 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
58 | + $object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Supplier\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 testCreateFilter() |
69 | 69 | { |
70 | - $search = \Aimeos\MShop\Factory::createManager( $this->context, 'supplier' )->createSearch(); |
|
70 | + $search = \Aimeos\MShop\Factory::createManager($this->context, 'supplier')->createSearch(); |
|
71 | 71 | |
72 | - $this->stub->expects( $this->once() )->method( 'createFilter' ) |
|
73 | - ->will( $this->returnValue( $search ) ); |
|
72 | + $this->stub->expects($this->once())->method('createFilter') |
|
73 | + ->will($this->returnValue($search)); |
|
74 | 74 | |
75 | - $this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->createFilter() ); |
|
75 | + $this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->createFilter()); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
79 | 79 | public function testGetItem() |
80 | 80 | { |
81 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'supplier' )->createItem(); |
|
81 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'supplier')->createItem(); |
|
82 | 82 | |
83 | - $this->stub->expects( $this->once() )->method( 'getItem' ) |
|
84 | - ->will( $this->returnValue( $item ) ); |
|
83 | + $this->stub->expects($this->once())->method('getItem') |
|
84 | + ->will($this->returnValue($item)); |
|
85 | 85 | |
86 | - $this->assertInstanceOf( '\Aimeos\MShop\Supplier\Item\Iface', $this->object->getItem( -1 ) ); |
|
86 | + $this->assertInstanceOf('\Aimeos\MShop\Supplier\Item\Iface', $this->object->getItem( -1 )); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | |
90 | 90 | public function testGetItems() |
91 | 91 | { |
92 | - $this->stub->expects( $this->once() )->method( 'getItems' ) |
|
93 | - ->will( $this->returnValue( [] ) ); |
|
92 | + $this->stub->expects($this->once())->method('getItems') |
|
93 | + ->will($this->returnValue([])); |
|
94 | 94 | |
95 | - $this->assertEquals( [], $this->object->getItems( [-1], ['media'] ) ); |
|
95 | + $this->assertEquals([], $this->object->getItems([-1], ['media'])); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
99 | 99 | public function testSearchItems() |
100 | 100 | { |
101 | - $filter = \Aimeos\MShop\Factory::createManager( $this->context, 'supplier' )->createSearch(); |
|
101 | + $filter = \Aimeos\MShop\Factory::createManager($this->context, 'supplier')->createSearch(); |
|
102 | 102 | |
103 | - $this->stub->expects( $this->once() )->method( 'searchItems' ) |
|
104 | - ->will( $this->returnValue( [] ) ); |
|
103 | + $this->stub->expects($this->once())->method('searchItems') |
|
104 | + ->will($this->returnValue([])); |
|
105 | 105 | |
106 | - $this->assertEquals( [], $this->object->searchItems( $filter, ['media'] ) ); |
|
106 | + $this->assertEquals([], $this->object->searchItems($filter, ['media'])); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | |
110 | 110 | public function testGetController() |
111 | 111 | { |
112 | - $result = $this->access( 'getController' )->invokeArgs( $this->object, [] ); |
|
112 | + $result = $this->access('getController')->invokeArgs($this->object, []); |
|
113 | 113 | |
114 | - $this->assertSame( $this->stub, $result ); |
|
114 | + $this->assertSame($this->stub, $result); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
118 | - protected function access( $name ) |
|
118 | + protected function access($name) |
|
119 | 119 | { |
120 | - $class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Supplier\Decorator\Base' ); |
|
121 | - $method = $class->getMethod( $name ); |
|
122 | - $method->setAccessible( true ); |
|
120 | + $class = new \ReflectionClass('\Aimeos\Controller\Frontend\Supplier\Decorator\Base'); |
|
121 | + $method = $class->getMethod($name); |
|
122 | + $method->setAccessible(true); |
|
123 | 123 | |
124 | 124 | return $method; |
125 | 125 | } |
@@ -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 | } |
@@ -30,18 +30,18 @@ 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 | 35 | $iface = '\Aimeos\Controller\Frontend\Supplier\Iface'; |
36 | - if( !( $controller instanceof $iface ) ) |
|
36 | + if (!($controller instanceof $iface)) |
|
37 | 37 | { |
38 | - $msg = sprintf( 'Class "%1$s" does not implement interface "%2$s"', get_class( $controller ), $iface ); |
|
39 | - throw new \Aimeos\Controller\Frontend\Exception( $msg ); |
|
38 | + $msg = sprintf('Class "%1$s" does not implement interface "%2$s"', get_class($controller), $iface); |
|
39 | + throw new \Aimeos\Controller\Frontend\Exception($msg); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $this->controller = $controller; |
43 | 43 | |
44 | - parent::__construct( $context ); |
|
44 | + parent::__construct($context); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * @return mixed Returns the value of the called method |
54 | 54 | * @throws \Aimeos\Controller\Frontend\Exception If method call failed |
55 | 55 | */ |
56 | - public function __call( $name, array $param ) |
|
56 | + public function __call($name, array $param) |
|
57 | 57 | { |
58 | - return @call_user_func_array( array( $this->controller, $name ), $param ); |
|
58 | + return @call_user_func_array(array($this->controller, $name), $param); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | * @return \Aimeos\MShop\Supplier\Item\Iface Supplier item including the referenced domains items |
81 | 81 | * @since 2018.07 |
82 | 82 | */ |
83 | - public function getItem( $id, array $domains = array( 'media', 'text' ) ) |
|
83 | + public function getItem($id, array $domains = array('media', 'text')) |
|
84 | 84 | { |
85 | - return $this->controller->getItem( $id, $domains ); |
|
85 | + return $this->controller->getItem($id, $domains); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | * @return \Aimeos\MShop\Supplier\Item\Iface[] Associative list of supplier item including the referenced domains items |
95 | 95 | * @since 2018.07 |
96 | 96 | */ |
97 | - public function getItems( array $ids, array $domains = array( 'media', 'text' ) ) |
|
97 | + public function getItems(array $ids, array $domains = array('media', 'text')) |
|
98 | 98 | { |
99 | - return $this->controller->getItems( $ids, $domains ); |
|
99 | + return $this->controller->getItems($ids, $domains); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | |
@@ -109,9 +109,9 @@ discard block |
||
109 | 109 | * @return array Ordered list of supplier items implementing \Aimeos\MShop\Supplier\Item\Iface |
110 | 110 | * @since 2018.07 |
111 | 111 | */ |
112 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'text' ), &$total = null ) |
|
112 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'text'), &$total = null) |
|
113 | 113 | { |
114 | - return $this->controller->searchItems( $filter, $domains, $total ); |
|
114 | + return $this->controller->searchItems($filter, $domains, $total); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 |
@@ -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,18 +30,18 @@ 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 | 35 | $iface = '\Aimeos\Controller\Frontend\Product\Iface'; |
36 | - if( !( $controller instanceof $iface ) ) |
|
36 | + if (!($controller instanceof $iface)) |
|
37 | 37 | { |
38 | - $msg = sprintf( 'Class "%1$s" does not implement interface "%2$s"', get_class( $controller ), $iface ); |
|
39 | - throw new \Aimeos\Controller\Frontend\Exception( $msg ); |
|
38 | + $msg = sprintf('Class "%1$s" does not implement interface "%2$s"', get_class($controller), $iface); |
|
39 | + throw new \Aimeos\Controller\Frontend\Exception($msg); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $this->controller = $controller; |
43 | 43 | |
44 | - parent::__construct( $context ); |
|
44 | + parent::__construct($context); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * @return mixed Returns the value of the called method |
54 | 54 | * @throws \Aimeos\Controller\Frontend\Exception If method call failed |
55 | 55 | */ |
56 | - public function __call( $name, array $param ) |
|
56 | + public function __call($name, array $param) |
|
57 | 57 | { |
58 | - return @call_user_func_array( array( $this->controller, $name ), $param ); |
|
58 | + return @call_user_func_array(array($this->controller, $name), $param); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
70 | 70 | * @since 2017.03 |
71 | 71 | */ |
72 | - public function addFilterAttribute( \Aimeos\MW\Criteria\Iface $filter, array $attrIds, array $optIds, array $oneIds ) |
|
72 | + public function addFilterAttribute(\Aimeos\MW\Criteria\Iface $filter, array $attrIds, array $optIds, array $oneIds) |
|
73 | 73 | { |
74 | - return $this->controller->addFilterAttribute( $filter, $attrIds, $optIds, $oneIds ); |
|
74 | + return $this->controller->addFilterAttribute($filter, $attrIds, $optIds, $oneIds); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
88 | 88 | * @since 2017.03 |
89 | 89 | */ |
90 | - public function addFilterCategory( \Aimeos\MW\Criteria\Iface $filter, $catId, |
|
91 | - $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort = null, $direction = '+', $listtype = 'default' ) |
|
90 | + public function addFilterCategory(\Aimeos\MW\Criteria\Iface $filter, $catId, |
|
91 | + $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort = null, $direction = '+', $listtype = 'default') |
|
92 | 92 | { |
93 | - return $this->controller->addFilterCategory( $filter, $catId, $level, $sort, $direction, $listtype ); |
|
93 | + return $this->controller->addFilterCategory($filter, $catId, $level, $sort, $direction, $listtype); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
103 | 103 | * @since 2018.07 |
104 | 104 | */ |
105 | - public function addFilterSupplier( \Aimeos\MW\Criteria\Iface $filter, array $supIds ) |
|
105 | + public function addFilterSupplier(\Aimeos\MW\Criteria\Iface $filter, array $supIds) |
|
106 | 106 | { |
107 | - return $this->controller->addFilterSupplier( $filter, $supIds ); |
|
107 | + return $this->controller->addFilterSupplier($filter, $supIds); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
120 | 120 | * @since 2017.03 |
121 | 121 | */ |
122 | - public function addFilterText( \Aimeos\MW\Criteria\Iface $filter, $input, $sort = null, $direction = '+', $listtype = 'default' ) |
|
122 | + public function addFilterText(\Aimeos\MW\Criteria\Iface $filter, $input, $sort = null, $direction = '+', $listtype = 'default') |
|
123 | 123 | { |
124 | - return $this->controller->addFilterText( $filter, $input, $sort, $direction, $listtype ); |
|
124 | + return $this->controller->addFilterText($filter, $input, $sort, $direction, $listtype); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | * @return array Associative list of key values as key and the product count for this key as value |
134 | 134 | * @since 2015.08 |
135 | 135 | */ |
136 | - public function aggregate( \Aimeos\MW\Criteria\Iface $filter, $key ) |
|
136 | + public function aggregate(\Aimeos\MW\Criteria\Iface $filter, $key) |
|
137 | 137 | { |
138 | - return $this->controller->aggregate( $filter, $key ); |
|
138 | + return $this->controller->aggregate($filter, $key); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
151 | 151 | * @since 2015.08 |
152 | 152 | */ |
153 | - public function createFilter( $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' ) |
|
153 | + public function createFilter($sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default') |
|
154 | 154 | { |
155 | - return $this->controller->createFilter( $sort, $direction, $start, $size, $listtype ); |
|
155 | + return $this->controller->createFilter($sort, $direction, $start, $size, $listtype); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | * @return \Aimeos\MShop\Product\Item\Iface Product item including the referenced domains items |
165 | 165 | * @since 2017.03 |
166 | 166 | */ |
167 | - public function getItem( $productId, array $domains = array( 'attribute', 'media', 'price', 'product', 'product/property', 'text' ) ) |
|
167 | + public function getItem($productId, array $domains = array('attribute', 'media', 'price', 'product', 'product/property', 'text')) |
|
168 | 168 | { |
169 | - return $this->controller->getItem( $productId, $domains ); |
|
169 | + return $this->controller->getItem($productId, $domains); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | * @return \Aimeos\MShop\Product\Item\Iface[] Associative list of product IDs as keys and product items as values |
179 | 179 | * @since 2017.03 |
180 | 180 | */ |
181 | - public function getItems( array $productIds, array $domains = array( 'media', 'price', 'text' ) ) |
|
181 | + public function getItems(array $productIds, array $domains = array('media', 'price', 'text')) |
|
182 | 182 | { |
183 | - return $this->controller->getItems( $productIds, $domains ); |
|
183 | + return $this->controller->getItems($productIds, $domains); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | |
@@ -193,9 +193,9 @@ discard block |
||
193 | 193 | * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface |
194 | 194 | * @since 2015.08 |
195 | 195 | */ |
196 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null ) |
|
196 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null) |
|
197 | 197 | { |
198 | - return $this->controller->searchItems( $filter, $domains, $total ); |
|
198 | + return $this->controller->searchItems($filter, $domains, $total); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 |
@@ -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 | } |
@@ -20,161 +20,161 @@ |
||
20 | 20 | { |
21 | 21 | $this->context = \TestHelperFrontend::getContext(); |
22 | 22 | |
23 | - $this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Product\Standard' ) |
|
23 | + $this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Product\Standard') |
|
24 | 24 | ->disableOriginalConstructor() |
25 | 25 | ->getMock(); |
26 | 26 | |
27 | - $this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Product\Decorator\Base' ) |
|
28 | - ->setConstructorArgs( [$this->stub, $this->context] ) |
|
27 | + $this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Product\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\Product\Decorator\Base' ) |
|
46 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
45 | + $this->getMockBuilder('\Aimeos\Controller\Frontend\Product\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\Product\Standard' ) |
|
53 | + $stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Product\Standard') |
|
54 | 54 | ->disableOriginalConstructor() |
55 | - ->setMethods( ['invalid'] ) |
|
55 | + ->setMethods(['invalid']) |
|
56 | 56 | ->getMock(); |
57 | 57 | |
58 | - $object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Product\Decorator\Base' ) |
|
59 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
58 | + $object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Product\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 testAddFilterAttribute() |
69 | 69 | { |
70 | - $search = \Aimeos\MShop\Factory::createManager( $this->context, 'index' )->createSearch(); |
|
70 | + $search = \Aimeos\MShop\Factory::createManager($this->context, 'index')->createSearch(); |
|
71 | 71 | |
72 | - $this->stub->expects( $this->once() )->method( 'addFilterAttribute' ) |
|
73 | - ->will( $this->returnArgument( 0 ) ); |
|
72 | + $this->stub->expects($this->once())->method('addFilterAttribute') |
|
73 | + ->will($this->returnArgument(0)); |
|
74 | 74 | |
75 | - $this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->addFilterAttribute( $search, [], [], [] ) ); |
|
75 | + $this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->addFilterAttribute($search, [], [], [])); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
79 | 79 | public function testAddFilterCategory() |
80 | 80 | { |
81 | - $search = \Aimeos\MShop\Factory::createManager( $this->context, 'index' )->createSearch(); |
|
81 | + $search = \Aimeos\MShop\Factory::createManager($this->context, 'index')->createSearch(); |
|
82 | 82 | |
83 | - $this->stub->expects( $this->once() )->method( 'addFilterCategory' ) |
|
84 | - ->will( $this->returnArgument( 0 ) ); |
|
83 | + $this->stub->expects($this->once())->method('addFilterCategory') |
|
84 | + ->will($this->returnArgument(0)); |
|
85 | 85 | |
86 | - $this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->addFilterCategory( $search, -1 ) ); |
|
86 | + $this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->addFilterCategory($search, -1)); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | |
90 | 90 | public function testAddFilterSupplier() |
91 | 91 | { |
92 | - $search = \Aimeos\MShop\Factory::createManager( $this->context, 'index' )->createSearch(); |
|
92 | + $search = \Aimeos\MShop\Factory::createManager($this->context, 'index')->createSearch(); |
|
93 | 93 | |
94 | - $this->stub->expects( $this->once() )->method( 'addFilterSupplier' ) |
|
95 | - ->will( $this->returnArgument( 0 ) ); |
|
94 | + $this->stub->expects($this->once())->method('addFilterSupplier') |
|
95 | + ->will($this->returnArgument(0)); |
|
96 | 96 | |
97 | - $this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->addFilterSupplier( $search, [] ) ); |
|
97 | + $this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->addFilterSupplier($search, [])); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
101 | 101 | public function testAddFilterText() |
102 | 102 | { |
103 | - $search = \Aimeos\MShop\Factory::createManager( $this->context, 'index' )->createSearch(); |
|
103 | + $search = \Aimeos\MShop\Factory::createManager($this->context, 'index')->createSearch(); |
|
104 | 104 | |
105 | - $this->stub->expects( $this->once() )->method( 'addFilterText' ) |
|
106 | - ->will( $this->returnArgument( 0 ) ); |
|
105 | + $this->stub->expects($this->once())->method('addFilterText') |
|
106 | + ->will($this->returnArgument(0)); |
|
107 | 107 | |
108 | - $this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->addFilterText( $search, 'test' ) ); |
|
108 | + $this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->addFilterText($search, 'test')); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
112 | 112 | public function testAggregate() |
113 | 113 | { |
114 | - $search = \Aimeos\MShop\Factory::createManager( $this->context, 'index' )->createSearch(); |
|
114 | + $search = \Aimeos\MShop\Factory::createManager($this->context, 'index')->createSearch(); |
|
115 | 115 | |
116 | - $this->stub->expects( $this->once() )->method( 'aggregate' ) |
|
117 | - ->will( $this->returnValue( [] ) ); |
|
116 | + $this->stub->expects($this->once())->method('aggregate') |
|
117 | + ->will($this->returnValue([])); |
|
118 | 118 | |
119 | - $this->assertEquals( [], $this->object->aggregate( $search, 'test' ) ); |
|
119 | + $this->assertEquals([], $this->object->aggregate($search, 'test')); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | |
123 | 123 | public function testCreateFilter() |
124 | 124 | { |
125 | - $search = \Aimeos\MShop\Factory::createManager( $this->context, 'index' )->createSearch(); |
|
125 | + $search = \Aimeos\MShop\Factory::createManager($this->context, 'index')->createSearch(); |
|
126 | 126 | |
127 | - $this->stub->expects( $this->once() )->method( 'createFilter' ) |
|
128 | - ->will( $this->returnValue( $search ) ); |
|
127 | + $this->stub->expects($this->once())->method('createFilter') |
|
128 | + ->will($this->returnValue($search)); |
|
129 | 129 | |
130 | - $this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->createFilter() ); |
|
130 | + $this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->createFilter()); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
134 | 134 | public function testGetItem() |
135 | 135 | { |
136 | - $prodItem = \Aimeos\MShop\Factory::createManager( $this->context, 'index' )->createItem(); |
|
136 | + $prodItem = \Aimeos\MShop\Factory::createManager($this->context, 'index')->createItem(); |
|
137 | 137 | |
138 | - $this->stub->expects( $this->once() )->method( 'getItem' ) |
|
139 | - ->will( $this->returnValue( $prodItem ) ); |
|
138 | + $this->stub->expects($this->once())->method('getItem') |
|
139 | + ->will($this->returnValue($prodItem)); |
|
140 | 140 | |
141 | - $this->assertInstanceOf( '\Aimeos\MShop\Product\Item\Iface', $this->object->getItem( -1 ) ); |
|
141 | + $this->assertInstanceOf('\Aimeos\MShop\Product\Item\Iface', $this->object->getItem( -1 )); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | |
145 | 145 | public function testGetItems() |
146 | 146 | { |
147 | - $this->stub->expects( $this->once() )->method( 'getItems' ) |
|
148 | - ->will( $this->returnValue( [] ) ); |
|
147 | + $this->stub->expects($this->once())->method('getItems') |
|
148 | + ->will($this->returnValue([])); |
|
149 | 149 | |
150 | - $this->assertEquals( [], $this->object->getItems( [-1] ) ); |
|
150 | + $this->assertEquals([], $this->object->getItems([-1])); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | |
154 | 154 | public function testSearchItems() |
155 | 155 | { |
156 | - $search = \Aimeos\MShop\Factory::createManager( $this->context, 'index' )->createSearch(); |
|
156 | + $search = \Aimeos\MShop\Factory::createManager($this->context, 'index')->createSearch(); |
|
157 | 157 | |
158 | - $this->stub->expects( $this->once() )->method( 'searchItems' ) |
|
159 | - ->will( $this->returnValue( [] ) ); |
|
158 | + $this->stub->expects($this->once())->method('searchItems') |
|
159 | + ->will($this->returnValue([])); |
|
160 | 160 | |
161 | - $this->assertEquals( [], $this->object->searchItems( $search ) ); |
|
161 | + $this->assertEquals([], $this->object->searchItems($search)); |
|
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\Product\Decorator\Base' ); |
|
176 | - $method = $class->getMethod( $name ); |
|
177 | - $method->setAccessible( true ); |
|
175 | + $class = new \ReflectionClass('\Aimeos\Controller\Frontend\Product\Decorator\Base'); |
|
176 | + $method = $class->getMethod($name); |
|
177 | + $method->setAccessible(true); |
|
178 | 178 | |
179 | 179 | return $method; |
180 | 180 | } |
@@ -31,38 +31,38 @@ discard block |
||
31 | 31 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
32 | 32 | * @since 2017.03 |
33 | 33 | */ |
34 | - public function addFilterAttribute( \Aimeos\MW\Criteria\Iface $filter, array $attrIds, array $optIds, array $oneIds ) |
|
34 | + public function addFilterAttribute(\Aimeos\MW\Criteria\Iface $filter, array $attrIds, array $optIds, array $oneIds) |
|
35 | 35 | { |
36 | - if( ( $attrIds = $this->validateIds( $attrIds ) ) !== [] ) |
|
36 | + if (($attrIds = $this->validateIds($attrIds)) !== []) |
|
37 | 37 | { |
38 | - $func = $filter->createFunction( 'index.attributeaggregate', array( $attrIds ) ); |
|
38 | + $func = $filter->createFunction('index.attributeaggregate', array($attrIds)); |
|
39 | 39 | $expr = array( |
40 | - $filter->compare( '==', $func, count( $attrIds ) ), |
|
40 | + $filter->compare('==', $func, count($attrIds)), |
|
41 | 41 | $filter->getConditions(), |
42 | 42 | ); |
43 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
43 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
44 | 44 | } |
45 | 45 | |
46 | - if( ( $optIds = $this->validateIds( $optIds ) ) !== [] ) |
|
46 | + if (($optIds = $this->validateIds($optIds)) !== []) |
|
47 | 47 | { |
48 | - $func = $filter->createFunction( 'index.attributeaggregate', array( $optIds ) ); |
|
48 | + $func = $filter->createFunction('index.attributeaggregate', array($optIds)); |
|
49 | 49 | $expr = array( |
50 | - $filter->compare( '>', $func, 0 ), |
|
50 | + $filter->compare('>', $func, 0), |
|
51 | 51 | $filter->getConditions(), |
52 | 52 | ); |
53 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
53 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
54 | 54 | } |
55 | 55 | |
56 | - foreach( $oneIds as $type => $list ) |
|
56 | + foreach ($oneIds as $type => $list) |
|
57 | 57 | { |
58 | - if( ( $list = $this->validateIds( (array) $list ) ) !== [] ) |
|
58 | + if (($list = $this->validateIds((array) $list)) !== []) |
|
59 | 59 | { |
60 | - $func = $filter->createFunction( 'index.attributeaggregate', array( $list ) ); |
|
60 | + $func = $filter->createFunction('index.attributeaggregate', array($list)); |
|
61 | 61 | $expr = array( |
62 | - $filter->compare( '>', $func, 0 ), |
|
62 | + $filter->compare('>', $func, 0), |
|
63 | 63 | $filter->getConditions(), |
64 | 64 | ); |
65 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
65 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
@@ -82,38 +82,38 @@ discard block |
||
82 | 82 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
83 | 83 | * @since 2017.03 |
84 | 84 | */ |
85 | - public function addFilterCategory( \Aimeos\MW\Criteria\Iface $filter, $catId, |
|
86 | - $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort = null, $direction = '+', $listtype = 'default' ) |
|
85 | + public function addFilterCategory(\Aimeos\MW\Criteria\Iface $filter, $catId, |
|
86 | + $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE, $sort = null, $direction = '+', $listtype = 'default') |
|
87 | 87 | { |
88 | - $catIds = ( !is_array( $catId ) ? explode( ',', $catId ) : $catId ); |
|
88 | + $catIds = (!is_array($catId) ? explode(',', $catId) : $catId); |
|
89 | 89 | |
90 | - if( $level != \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE ) |
|
90 | + if ($level != \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE) |
|
91 | 91 | { |
92 | 92 | $list = []; |
93 | - $cntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'catalog' ); |
|
93 | + $cntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'catalog'); |
|
94 | 94 | |
95 | - foreach( $catIds as $catId ) |
|
95 | + foreach ($catIds as $catId) |
|
96 | 96 | { |
97 | - $tree = $cntl->getTree( $catId, [], $level ); |
|
98 | - $list = array_merge( $list, $this->getCatalogIdsFromTree( $tree ) ); |
|
97 | + $tree = $cntl->getTree($catId, [], $level); |
|
98 | + $list = array_merge($list, $this->getCatalogIdsFromTree($tree)); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | $catIds = $list; |
102 | 102 | } |
103 | 103 | |
104 | - $expr = array( $filter->compare( '==', 'index.catalog.id', array_unique( $catIds ) ) ); |
|
104 | + $expr = array($filter->compare('==', 'index.catalog.id', array_unique($catIds))); |
|
105 | 105 | $expr[] = $filter->getConditions(); |
106 | 106 | |
107 | - if( $sort === 'relevance' ) |
|
107 | + if ($sort === 'relevance') |
|
108 | 108 | { |
109 | - $cmpfunc = $filter->createFunction( 'index.catalog.position', array( $listtype, $catIds ) ); |
|
110 | - $expr[] = $filter->compare( '>=', $cmpfunc, 0 ); |
|
109 | + $cmpfunc = $filter->createFunction('index.catalog.position', array($listtype, $catIds)); |
|
110 | + $expr[] = $filter->compare('>=', $cmpfunc, 0); |
|
111 | 111 | |
112 | - $sortfunc = $filter->createFunction( 'sort:index.catalog.position', array( $listtype, $catIds ) ); |
|
113 | - $filter->setSortations( array( $filter->sort( $direction, $sortfunc ) ) ); |
|
112 | + $sortfunc = $filter->createFunction('sort:index.catalog.position', array($listtype, $catIds)); |
|
113 | + $filter->setSortations(array($filter->sort($direction, $sortfunc))); |
|
114 | 114 | } |
115 | 115 | |
116 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
116 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
117 | 117 | |
118 | 118 | return $filter; |
119 | 119 | } |
@@ -127,16 +127,16 @@ discard block |
||
127 | 127 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
128 | 128 | * @since 2018.07 |
129 | 129 | */ |
130 | - public function addFilterSupplier( \Aimeos\MW\Criteria\Iface $filter, array $supIds ) |
|
130 | + public function addFilterSupplier(\Aimeos\MW\Criteria\Iface $filter, array $supIds) |
|
131 | 131 | { |
132 | - if( !empty( $supIds ) ) |
|
132 | + if (!empty($supIds)) |
|
133 | 133 | { |
134 | - $supIds = $this->validateIds( $supIds ); |
|
134 | + $supIds = $this->validateIds($supIds); |
|
135 | 135 | $expr = array( |
136 | - $filter->compare( '==', 'index.supplier.id', $supIds ), |
|
136 | + $filter->compare('==', 'index.supplier.id', $supIds), |
|
137 | 137 | $filter->getConditions(), |
138 | 138 | ); |
139 | - $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
139 | + $filter->setConditions($filter->combine('&&', $expr)); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | return $filter; |
@@ -154,13 +154,13 @@ discard block |
||
154 | 154 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
155 | 155 | * @since 2017.03 |
156 | 156 | */ |
157 | - public function addFilterText( \Aimeos\MW\Criteria\Iface $filter, $input, $sort = null, $direction = '+', $listtype = 'default' ) |
|
157 | + public function addFilterText(\Aimeos\MW\Criteria\Iface $filter, $input, $sort = null, $direction = '+', $listtype = 'default') |
|
158 | 158 | { |
159 | 159 | $langid = $this->getContext()->getLocale()->getLanguageId(); |
160 | - $cmpfunc = $filter->createFunction( 'index.text.relevance', array( $listtype, $langid, $input ) ); |
|
161 | - $expr = array( $filter->compare( '>', $cmpfunc, 0 ), $filter->getConditions() ); |
|
160 | + $cmpfunc = $filter->createFunction('index.text.relevance', array($listtype, $langid, $input)); |
|
161 | + $expr = array($filter->compare('>', $cmpfunc, 0), $filter->getConditions()); |
|
162 | 162 | |
163 | - return $filter->setConditions( $filter->combine( '&&', $expr ) ); |
|
163 | + return $filter->setConditions($filter->combine('&&', $expr)); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | * @return array Associative list of key values as key and the product count for this key as value |
173 | 173 | * @since 2017.03 |
174 | 174 | */ |
175 | - public function aggregate( \Aimeos\MW\Criteria\Iface $filter, $key ) |
|
175 | + public function aggregate(\Aimeos\MW\Criteria\Iface $filter, $key) |
|
176 | 176 | { |
177 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index' )->aggregate( $filter, $key ); |
|
177 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'index')->aggregate($filter, $key); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -189,11 +189,11 @@ discard block |
||
189 | 189 | * @return \Aimeos\MW\Criteria\Iface Criteria object containing the conditions for searching |
190 | 190 | * @since 2017.03 |
191 | 191 | */ |
192 | - public function createFilter( $sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default' ) |
|
192 | + public function createFilter($sort = null, $direction = '+', $start = 0, $size = 100, $listtype = 'default') |
|
193 | 193 | { |
194 | 194 | $sortations = []; |
195 | 195 | $context = $this->getContext(); |
196 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'index' ); |
|
196 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'index'); |
|
197 | 197 | |
198 | 198 | |
199 | 199 | /** controller/frontend/product/ignore-dates |
@@ -208,55 +208,55 @@ discard block |
||
208 | 208 | * @since 2017.10 |
209 | 209 | * @category Developer |
210 | 210 | */ |
211 | - if( $context->getConfig()->get( 'controller/frontend/product/ignore-dates', false ) ) |
|
211 | + if ($context->getConfig()->get('controller/frontend/product/ignore-dates', false)) |
|
212 | 212 | { |
213 | 213 | $search = $manager->createSearch(); |
214 | - $search->setConditions( $search->compare( '>', 'product.status', 0 ) ); |
|
214 | + $search->setConditions($search->compare('>', 'product.status', 0)); |
|
215 | 215 | } |
216 | 216 | else |
217 | 217 | { |
218 | - $search = $manager->createSearch( true ); |
|
218 | + $search = $manager->createSearch(true); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | |
222 | - $expr = array( $search->compare( '!=', 'index.catalog.id', null ) ); |
|
222 | + $expr = array($search->compare('!=', 'index.catalog.id', null)); |
|
223 | 223 | |
224 | - switch( $sort ) |
|
224 | + switch ($sort) |
|
225 | 225 | { |
226 | 226 | case 'code': |
227 | - $sortations[] = $search->sort( $direction, 'product.code' ); |
|
227 | + $sortations[] = $search->sort($direction, 'product.code'); |
|
228 | 228 | break; |
229 | 229 | |
230 | 230 | case 'ctime': |
231 | - $sortations[] = $search->sort( $direction, 'product.ctime' ); |
|
231 | + $sortations[] = $search->sort($direction, 'product.ctime'); |
|
232 | 232 | break; |
233 | 233 | |
234 | 234 | case 'name': |
235 | 235 | $langid = $context->getLocale()->getLanguageId(); |
236 | 236 | |
237 | - $cmpfunc = $search->createFunction( 'index.text.value', array( $listtype, $langid, 'name', 'product' ) ); |
|
238 | - $expr[] = $search->compare( '>=', $cmpfunc, '' ); |
|
237 | + $cmpfunc = $search->createFunction('index.text.value', array($listtype, $langid, 'name', 'product')); |
|
238 | + $expr[] = $search->compare('>=', $cmpfunc, ''); |
|
239 | 239 | |
240 | - $sortfunc = $search->createFunction( 'sort:index.text.value', array( $listtype, $langid, 'name' ) ); |
|
241 | - $sortations[] = $search->sort( $direction, $sortfunc ); |
|
240 | + $sortfunc = $search->createFunction('sort:index.text.value', array($listtype, $langid, 'name')); |
|
241 | + $sortations[] = $search->sort($direction, $sortfunc); |
|
242 | 242 | break; |
243 | 243 | |
244 | 244 | case 'price': |
245 | 245 | $currencyid = $context->getLocale()->getCurrencyId(); |
246 | 246 | |
247 | - $cmpfunc = $search->createFunction( 'index.price.value', array( $listtype, $currencyid, 'default' ) ); |
|
248 | - $expr[] = $search->compare( '>=', $cmpfunc, '0.00' ); |
|
247 | + $cmpfunc = $search->createFunction('index.price.value', array($listtype, $currencyid, 'default')); |
|
248 | + $expr[] = $search->compare('>=', $cmpfunc, '0.00'); |
|
249 | 249 | |
250 | - $sortfunc = $search->createFunction( 'sort:index.price.value', array( $listtype, $currencyid, 'default' ) ); |
|
251 | - $sortations[] = $search->sort( $direction, $sortfunc ); |
|
250 | + $sortfunc = $search->createFunction('sort:index.price.value', array($listtype, $currencyid, 'default')); |
|
251 | + $sortations[] = $search->sort($direction, $sortfunc); |
|
252 | 252 | break; |
253 | 253 | } |
254 | 254 | |
255 | 255 | $expr[] = $search->getConditions(); |
256 | 256 | |
257 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
258 | - $search->setSortations( $sortations ); |
|
259 | - $search->setSlice( $start, $size ); |
|
257 | + $search->setConditions($search->combine('&&', $expr)); |
|
258 | + $search->setSortations($sortations); |
|
259 | + $search->setSlice($start, $size); |
|
260 | 260 | |
261 | 261 | return $search; |
262 | 262 | } |
@@ -270,15 +270,15 @@ discard block |
||
270 | 270 | * @return \Aimeos\MShop\Product\Item\Iface Product item including the referenced domains items |
271 | 271 | * @since 2017.03 |
272 | 272 | */ |
273 | - public function getItem( $productId, array $domains = array( 'attribute', 'media', 'price', 'product', 'product/property', 'text' ) ) |
|
273 | + public function getItem($productId, array $domains = array('attribute', 'media', 'price', 'product', 'product/property', 'text')) |
|
274 | 274 | { |
275 | - $items = $this->getItems( [$productId], $domains ); |
|
275 | + $items = $this->getItems([$productId], $domains); |
|
276 | 276 | |
277 | - if( ( $item = reset( $items ) ) !== false ) { |
|
277 | + if (($item = reset($items)) !== false) { |
|
278 | 278 | return $item; |
279 | 279 | } |
280 | 280 | |
281 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Product item with ID "%1$s" not found', $productId ) ); |
|
281 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Product item with ID "%1$s" not found', $productId)); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | |
@@ -290,10 +290,10 @@ discard block |
||
290 | 290 | * @return \Aimeos\MShop\Product\Item\Iface[] Associative list of product IDs as keys and product items as values |
291 | 291 | * @since 2017.03 |
292 | 292 | */ |
293 | - public function getItems( array $productIds, array $domains = array( 'media', 'price', 'text' ) ) |
|
293 | + public function getItems(array $productIds, array $domains = array('media', 'price', 'text')) |
|
294 | 294 | { |
295 | 295 | $context = $this->getContext(); |
296 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
296 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
297 | 297 | |
298 | 298 | /** controller/frontend/order/ignore-dates |
299 | 299 | * Ignore start and end dates of products |
@@ -307,24 +307,24 @@ discard block |
||
307 | 307 | * @since 2017.08 |
308 | 308 | * @category Developer |
309 | 309 | */ |
310 | - if( $context->getConfig()->get( 'controller/frontend/product/ignore-dates', false ) ) |
|
310 | + if ($context->getConfig()->get('controller/frontend/product/ignore-dates', false)) |
|
311 | 311 | { |
312 | 312 | $search = $manager->createSearch(); |
313 | - $search->setConditions( $search->compare( '>', 'product.status', 0 ) ); |
|
313 | + $search->setConditions($search->compare('>', 'product.status', 0)); |
|
314 | 314 | } |
315 | 315 | else |
316 | 316 | { |
317 | - $search = $manager->createSearch( true ); |
|
317 | + $search = $manager->createSearch(true); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | $expr = array( |
321 | - $search->compare( '==', 'product.id', $productIds ), |
|
321 | + $search->compare('==', 'product.id', $productIds), |
|
322 | 322 | $search->getConditions(), |
323 | 323 | ); |
324 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
325 | - $search->setSlice( 0, count( $productIds ) ); |
|
324 | + $search->setConditions($search->combine('&&', $expr)); |
|
325 | + $search->setSlice(0, count($productIds)); |
|
326 | 326 | |
327 | - return $manager->searchItems( $search, $domains ); |
|
327 | + return $manager->searchItems($search, $domains); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | |
@@ -337,9 +337,9 @@ discard block |
||
337 | 337 | * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface |
338 | 338 | * @since 2017.03 |
339 | 339 | */ |
340 | - public function searchItems( \Aimeos\MW\Criteria\Iface $filter, array $domains = array( 'media', 'price', 'text' ), &$total = null ) |
|
340 | + public function searchItems(\Aimeos\MW\Criteria\Iface $filter, array $domains = array('media', 'price', 'text'), &$total = null) |
|
341 | 341 | { |
342 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'index' )->searchItems( $filter, $domains, $total ); |
|
342 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'index')->searchItems($filter, $domains, $total); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | |
@@ -349,12 +349,12 @@ discard block |
||
349 | 349 | * @param \Aimeos\MShop\Catalog\Item\Iface $item Catalog item with children |
350 | 350 | * @return array List of catalog IDs |
351 | 351 | */ |
352 | - protected function getCatalogIdsFromTree( \Aimeos\MShop\Catalog\Item\Iface $item ) |
|
352 | + protected function getCatalogIdsFromTree(\Aimeos\MShop\Catalog\Item\Iface $item) |
|
353 | 353 | { |
354 | - $list = array( $item->getId() ); |
|
354 | + $list = array($item->getId()); |
|
355 | 355 | |
356 | - foreach( $item->getChildren() as $child ) { |
|
357 | - $list = array_merge( $list, $this->getCatalogIdsFromTree( $child ) ); |
|
356 | + foreach ($item->getChildren() as $child) { |
|
357 | + $list = array_merge($list, $this->getCatalogIdsFromTree($child)); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | return $list; |
@@ -367,13 +367,13 @@ discard block |
||
367 | 367 | * @param array $ids List of IDs to validate |
368 | 368 | * @return array List of validated IDs |
369 | 369 | */ |
370 | - protected function validateIds( array $ids ) |
|
370 | + protected function validateIds(array $ids) |
|
371 | 371 | { |
372 | 372 | $list = []; |
373 | 373 | |
374 | - foreach( $ids as $id ) |
|
374 | + foreach ($ids as $id) |
|
375 | 375 | { |
376 | - if( $id != '' ) { |
|
376 | + if ($id != '') { |
|
377 | 377 | $list[] = (int) $id; |
378 | 378 | } |
379 | 379 | } |