@@ -21,29 +21,29 @@ discard block |
||
| 21 | 21 | $this->context = \TestHelperJadm::getContext(); |
| 22 | 22 | $this->view = $this->context->getView(); |
| 23 | 23 | |
| 24 | - $this->client = new \Aimeos\Admin\JsonAdm\Product\Standard( $this->context, $this->view, [], '' ); |
|
| 24 | + $this->client = new \Aimeos\Admin\JsonAdm\Product\Standard($this->context, $this->view, [], ''); |
|
| 25 | 25 | |
| 26 | - $this->object = $this->getMockBuilder( '\Aimeos\Admin\JsonAdm\Common\Factory\Base' ) |
|
| 26 | + $this->object = $this->getMockBuilder('\Aimeos\Admin\JsonAdm\Common\Factory\Base') |
|
| 27 | 27 | ->getMockForAbstractClass(); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 | public function testinjectClient() |
| 32 | 32 | { |
| 33 | - $this->object->injectClient( 'test', $this->client ); |
|
| 33 | + $this->object->injectClient('test', $this->client); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | public function testAddClientDecorators() |
| 38 | 38 | { |
| 39 | 39 | $config = $this->context->getConfig(); |
| 40 | - $config->set( 'client/jsonapi/common/decorators/default', ['Test'] ); |
|
| 41 | - $config->set( 'client/jsonapi/product/decorators/excludes', ['Test'] ); |
|
| 40 | + $config->set('client/jsonapi/common/decorators/default', ['Test']); |
|
| 41 | + $config->set('client/jsonapi/product/decorators/excludes', ['Test']); |
|
| 42 | 42 | |
| 43 | 43 | $params = [$this->client, $this->context, $this->view, [], 'product']; |
| 44 | - $result = $this->access( 'addClientDecorators' )->invokeArgs( $this->object, $params ); |
|
| 44 | + $result = $this->access('addClientDecorators')->invokeArgs($this->object, $params); |
|
| 45 | 45 | |
| 46 | - $this->assertInstanceOf( '\Aimeos\\Admin\\JsonAdm\\Iface', $result ); |
|
| 46 | + $this->assertInstanceOf('\Aimeos\\Admin\\JsonAdm\\Iface', $result); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | $prefix = '\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\'; |
| 53 | 53 | $params = [$this->client, ['Example'], $prefix, $this->context, $this->view, [], '']; |
| 54 | 54 | |
| 55 | - $result = $this->access( 'addDecorators' )->invokeArgs( $this->object, $params ); |
|
| 55 | + $result = $this->access('addDecorators')->invokeArgs($this->object, $params); |
|
| 56 | 56 | |
| 57 | - $this->assertInstanceOf( '\Aimeos\\Admin\\JsonAdm\\Iface', $result ); |
|
| 57 | + $this->assertInstanceOf('\Aimeos\\Admin\\JsonAdm\\Iface', $result); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | $prefix = '\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\'; |
| 64 | 64 | $params = [$this->client, ['Test'], $prefix, $this->context, $this->view, [], '']; |
| 65 | 65 | |
| 66 | - $this->setExpectedException( '\Aimeos\Admin\JsonAdm\Exception' ); |
|
| 67 | - $this->access( 'addDecorators' )->invokeArgs( $this->object, $params ); |
|
| 66 | + $this->setExpectedException('\Aimeos\Admin\JsonAdm\Exception'); |
|
| 67 | + $this->access('addDecorators')->invokeArgs($this->object, $params); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | $prefix = '\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\'; |
| 74 | 74 | $params = [$this->client, [''], $prefix, $this->context, $this->view, [], '']; |
| 75 | 75 | |
| 76 | - $this->setExpectedException( '\Aimeos\Admin\JsonAdm\Exception' ); |
|
| 77 | - $this->access( 'addDecorators' )->invokeArgs( $this->object, $params ); |
|
| 76 | + $this->setExpectedException('\Aimeos\Admin\JsonAdm\Exception'); |
|
| 77 | + $this->access('addDecorators')->invokeArgs($this->object, $params); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | |
@@ -84,9 +84,9 @@ discard block |
||
| 84 | 84 | $class = '\Aimeos\\Admin\\JsonAdm\\Product\\Standard'; |
| 85 | 85 | $params = [$class, $iface, $this->context, $this->view, [], '']; |
| 86 | 86 | |
| 87 | - $result = $this->access( 'createClientBase' )->invokeArgs( $this->object, $params ); |
|
| 87 | + $result = $this->access('createClientBase')->invokeArgs($this->object, $params); |
|
| 88 | 88 | |
| 89 | - $this->assertInstanceOf( '\Aimeos\\Admin\\JsonAdm\\Iface', $result ); |
|
| 89 | + $this->assertInstanceOf('\Aimeos\\Admin\\JsonAdm\\Iface', $result); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | |
@@ -95,10 +95,10 @@ discard block |
||
| 95 | 95 | $iface = '\Aimeos\\Admin\\JsonAdm\\Iface'; |
| 96 | 96 | $params = ['test', $iface, $this->context, $this->view, [], '']; |
| 97 | 97 | |
| 98 | - $this->object->injectClient( 'test', $this->client ); |
|
| 99 | - $result = $this->access( 'createClientBase' )->invokeArgs( $this->object, $params ); |
|
| 98 | + $this->object->injectClient('test', $this->client); |
|
| 99 | + $result = $this->access('createClientBase')->invokeArgs($this->object, $params); |
|
| 100 | 100 | |
| 101 | - $this->assertSame( $this->client, $result ); |
|
| 101 | + $this->assertSame($this->client, $result); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | $iface = '\Aimeos\\Admin\\JsonAdm\\Iface'; |
| 108 | 108 | $params = ['invalid', $iface, $this->context, $this->view, [], '']; |
| 109 | 109 | |
| 110 | - $this->setExpectedException( '\Aimeos\Admin\JsonAdm\Exception' ); |
|
| 111 | - $this->access( 'createClientBase' )->invokeArgs( $this->object, $params ); |
|
| 110 | + $this->setExpectedException('\Aimeos\Admin\JsonAdm\Exception'); |
|
| 111 | + $this->access('createClientBase')->invokeArgs($this->object, $params); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | |
@@ -118,16 +118,16 @@ discard block |
||
| 118 | 118 | $class = '\Aimeos\\Admin\\JsonAdm\\Product\\Standard'; |
| 119 | 119 | $params = [$class, $iface, $this->context, $this->view, [], '']; |
| 120 | 120 | |
| 121 | - $this->setExpectedException( '\Aimeos\Admin\JsonAdm\Exception' ); |
|
| 122 | - $this->access( 'createClientBase' )->invokeArgs( $this->object, $params ); |
|
| 121 | + $this->setExpectedException('\Aimeos\Admin\JsonAdm\Exception'); |
|
| 122 | + $this->access('createClientBase')->invokeArgs($this->object, $params); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | |
| 126 | - protected function access( $name ) |
|
| 126 | + protected function access($name) |
|
| 127 | 127 | { |
| 128 | - $class = new \ReflectionClass( '\Aimeos\Admin\JsonAdm\Common\Factory\Base' ); |
|
| 129 | - $method = $class->getMethod( $name ); |
|
| 130 | - $method->setAccessible( true ); |
|
| 128 | + $class = new \ReflectionClass('\Aimeos\Admin\JsonAdm\Common\Factory\Base'); |
|
| 129 | + $method = $class->getMethod($name); |
|
| 130 | + $method->setAccessible(true); |
|
| 131 | 131 | |
| 132 | 132 | return $method; |
| 133 | 133 | } |
@@ -21,88 +21,88 @@ |
||
| 21 | 21 | $context = \TestHelperJadm::getContext(); |
| 22 | 22 | $this->view = $context->getView(); |
| 23 | 23 | |
| 24 | - $this->stub = $this->getMockBuilder( '\\Aimeos\\Admin\\JsonAdm\\Standard' ) |
|
| 25 | - ->setConstructorArgs( array( $context, $this->view, [], 'attribute' ) ) |
|
| 24 | + $this->stub = $this->getMockBuilder('\\Aimeos\\Admin\\JsonAdm\\Standard') |
|
| 25 | + ->setConstructorArgs(array($context, $this->view, [], 'attribute')) |
|
| 26 | 26 | ->getMock(); |
| 27 | 27 | |
| 28 | - $this->object = $this->getMockBuilder( '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\Base' ) |
|
| 29 | - ->setConstructorArgs( [$this->stub, $context, $this->view, [], ''] ) |
|
| 28 | + $this->object = $this->getMockBuilder('\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\Base') |
|
| 29 | + ->setConstructorArgs([$this->stub, $context, $this->view, [], '']) |
|
| 30 | 30 | ->getMockForAbstractClass(); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | protected function tearDown() |
| 35 | 35 | { |
| 36 | - unset( $this->object, $this->stub, $this->view ); |
|
| 36 | + unset($this->object, $this->stub, $this->view); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | public function testDelete() |
| 41 | 41 | { |
| 42 | - $this->stub->expects( $this->once() )->method( 'delete' )->will( $this->returnArgument( 1 ) ); |
|
| 42 | + $this->stub->expects($this->once())->method('delete')->will($this->returnArgument(1)); |
|
| 43 | 43 | $response = $this->view->response(); |
| 44 | 44 | |
| 45 | - $this->assertSame( $response, $this->object->delete( $this->view->request(), $response ) ); |
|
| 45 | + $this->assertSame($response, $this->object->delete($this->view->request(), $response)); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | public function testGet() |
| 50 | 50 | { |
| 51 | - $this->stub->expects( $this->once() )->method( 'get' )->will( $this->returnArgument( 1 ) ); |
|
| 51 | + $this->stub->expects($this->once())->method('get')->will($this->returnArgument(1)); |
|
| 52 | 52 | $response = $this->view->response(); |
| 53 | 53 | |
| 54 | - $this->assertSame( $response, $this->object->get( $this->view->request(), $response ) ); |
|
| 54 | + $this->assertSame($response, $this->object->get($this->view->request(), $response)); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | public function testPatch() |
| 59 | 59 | { |
| 60 | - $this->stub->expects( $this->once() )->method( 'patch' )->will( $this->returnArgument( 1 ) ); |
|
| 60 | + $this->stub->expects($this->once())->method('patch')->will($this->returnArgument(1)); |
|
| 61 | 61 | $response = $this->view->response(); |
| 62 | 62 | |
| 63 | - $this->assertSame( $response, $this->object->patch( $this->view->request(), $response ) ); |
|
| 63 | + $this->assertSame($response, $this->object->patch($this->view->request(), $response)); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | |
| 67 | 67 | public function testPost() |
| 68 | 68 | { |
| 69 | - $this->stub->expects( $this->once() )->method( 'post' )->will( $this->returnArgument( 1 ) ); |
|
| 69 | + $this->stub->expects($this->once())->method('post')->will($this->returnArgument(1)); |
|
| 70 | 70 | $response = $this->view->response(); |
| 71 | 71 | |
| 72 | - $this->assertSame( $response, $this->object->post( $this->view->request(), $response ) ); |
|
| 72 | + $this->assertSame($response, $this->object->post($this->view->request(), $response)); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | |
| 76 | 76 | public function testPut() |
| 77 | 77 | { |
| 78 | - $this->stub->expects( $this->once() )->method( 'put' )->will( $this->returnArgument( 1 ) ); |
|
| 78 | + $this->stub->expects($this->once())->method('put')->will($this->returnArgument(1)); |
|
| 79 | 79 | $response = $this->view->response(); |
| 80 | 80 | |
| 81 | - $this->assertSame( $response, $this->object->put( $this->view->request(), $response ) ); |
|
| 81 | + $this->assertSame($response, $this->object->put($this->view->request(), $response)); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | |
| 85 | 85 | public function testOptions() |
| 86 | 86 | { |
| 87 | - $this->stub->expects( $this->once() )->method( 'options' )->will( $this->returnArgument( 1 ) ); |
|
| 87 | + $this->stub->expects($this->once())->method('options')->will($this->returnArgument(1)); |
|
| 88 | 88 | $response = $this->view->response(); |
| 89 | 89 | |
| 90 | - $this->assertSame( $response, $this->object->options( $this->view->request(), $response ) ); |
|
| 90 | + $this->assertSame($response, $this->object->options($this->view->request(), $response)); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | |
| 94 | 94 | public function testGetClient() |
| 95 | 95 | { |
| 96 | - $result = $this->access( 'getClient' )->invokeArgs( $this->object, [] ); |
|
| 97 | - $this->assertSame( $this->stub, $result ); |
|
| 96 | + $result = $this->access('getClient')->invokeArgs($this->object, []); |
|
| 97 | + $this->assertSame($this->stub, $result); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | |
| 101 | - protected function access( $name ) |
|
| 101 | + protected function access($name) |
|
| 102 | 102 | { |
| 103 | - $class = new \ReflectionClass( '\Aimeos\Admin\JsonAdm\Common\Decorator\Base' ); |
|
| 104 | - $method = $class->getMethod( $name ); |
|
| 105 | - $method->setAccessible( true ); |
|
| 103 | + $class = new \ReflectionClass('\Aimeos\Admin\JsonAdm\Common\Decorator\Base'); |
|
| 104 | + $method = $class->getMethod($name); |
|
| 105 | + $method->setAccessible(true); |
|
| 106 | 106 | |
| 107 | 107 | return $method; |
| 108 | 108 | } |
@@ -107,20 +107,20 @@ discard block |
||
| 107 | 107 | * @param array $include List of resource types that should be fetched |
| 108 | 108 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface |
| 109 | 109 | */ |
| 110 | - protected function getChildItems( array $items, array $include ) |
|
| 110 | + protected function getChildItems(array $items, array $include) |
|
| 111 | 111 | { |
| 112 | 112 | $list = []; |
| 113 | - $prodIds = array_keys( $items ); |
|
| 114 | - $include = array_intersect( $include, array( 'product/property' ) ); |
|
| 113 | + $prodIds = array_keys($items); |
|
| 114 | + $include = array_intersect($include, array('product/property')); |
|
| 115 | 115 | |
| 116 | - foreach( $include as $type ) |
|
| 116 | + foreach ($include as $type) |
|
| 117 | 117 | { |
| 118 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $type ); |
|
| 118 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $type); |
|
| 119 | 119 | |
| 120 | 120 | $search = $manager->createSearch(); |
| 121 | - $search->setConditions( $search->compare( '==', str_replace( '/', '.', $type ) . '.parentid', $prodIds ) ); |
|
| 121 | + $search->setConditions($search->compare('==', str_replace('/', '.', $type) . '.parentid', $prodIds)); |
|
| 122 | 122 | |
| 123 | - $list = array_merge( $list, $manager->searchItems( $search ) ); |
|
| 123 | + $list = array_merge($list, $manager->searchItems($search)); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | return $list; |
@@ -134,17 +134,17 @@ discard block |
||
| 134 | 134 | * @param array $include List of resource types that should be fetched |
| 135 | 135 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface |
| 136 | 136 | */ |
| 137 | - protected function getListItems( array $items, array $include ) |
|
| 137 | + protected function getListItems(array $items, array $include) |
|
| 138 | 138 | { |
| 139 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/lists' ); |
|
| 139 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/lists'); |
|
| 140 | 140 | |
| 141 | 141 | $search = $manager->createSearch(); |
| 142 | 142 | $expr = array( |
| 143 | - $search->compare( '==', 'product.lists.parentid', array_keys( $items ) ), |
|
| 144 | - $search->compare( '==', 'product.lists.domain', $include ), |
|
| 143 | + $search->compare('==', 'product.lists.parentid', array_keys($items)), |
|
| 144 | + $search->compare('==', 'product.lists.domain', $include), |
|
| 145 | 145 | ); |
| 146 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 146 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 147 | 147 | |
| 148 | - return $manager->searchItems( $search ); |
|
| 148 | + return $manager->searchItems($search); |
|
| 149 | 149 | } |
| 150 | 150 | } |
@@ -107,20 +107,20 @@ discard block |
||
| 107 | 107 | * @param array $include List of resource types that should be fetched |
| 108 | 108 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface |
| 109 | 109 | */ |
| 110 | - protected function getChildItems( array $items, array $include ) |
|
| 110 | + protected function getChildItems(array $items, array $include) |
|
| 111 | 111 | { |
| 112 | 112 | $list = []; |
| 113 | - $refIds = array_keys( $items ); |
|
| 114 | - $include = array_intersect( $include, array( 'customer/address' ) ); |
|
| 113 | + $refIds = array_keys($items); |
|
| 114 | + $include = array_intersect($include, array('customer/address')); |
|
| 115 | 115 | |
| 116 | - foreach( $include as $type ) |
|
| 116 | + foreach ($include as $type) |
|
| 117 | 117 | { |
| 118 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $type ); |
|
| 118 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $type); |
|
| 119 | 119 | |
| 120 | 120 | $search = $manager->createSearch(); |
| 121 | - $search->setConditions( $search->compare( '==', str_replace( '/', '.', $type ) . '.parentid', $refIds ) ); |
|
| 121 | + $search->setConditions($search->compare('==', str_replace('/', '.', $type) . '.parentid', $refIds)); |
|
| 122 | 122 | |
| 123 | - $list = array_merge( $list, $manager->searchItems( $search ) ); |
|
| 123 | + $list = array_merge($list, $manager->searchItems($search)); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | return $list; |
@@ -134,17 +134,17 @@ discard block |
||
| 134 | 134 | * @param array $include List of resource types that should be fetched |
| 135 | 135 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface |
| 136 | 136 | */ |
| 137 | - protected function getListItems( array $items, array $include ) |
|
| 137 | + protected function getListItems(array $items, array $include) |
|
| 138 | 138 | { |
| 139 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); |
|
| 139 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); |
|
| 140 | 140 | |
| 141 | 141 | $search = $manager->createSearch(); |
| 142 | 142 | $expr = array( |
| 143 | - $search->compare( '==', 'customer.lists.parentid', array_keys( $items ) ), |
|
| 144 | - $search->compare( '==', 'customer.lists.domain', $include ), |
|
| 143 | + $search->compare('==', 'customer.lists.parentid', array_keys($items)), |
|
| 144 | + $search->compare('==', 'customer.lists.domain', $include), |
|
| 145 | 145 | ); |
| 146 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 146 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 147 | 147 | |
| 148 | - return $manager->searchItems( $search ); |
|
| 148 | + return $manager->searchItems($search); |
|
| 149 | 149 | } |
| 150 | 150 | } |
@@ -107,20 +107,20 @@ discard block |
||
| 107 | 107 | * @param array $include List of resource types that should be fetched |
| 108 | 108 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface |
| 109 | 109 | */ |
| 110 | - protected function getChildItems( array $items, array $include ) |
|
| 110 | + protected function getChildItems(array $items, array $include) |
|
| 111 | 111 | { |
| 112 | 112 | $list = []; |
| 113 | - $refIds = array_keys( $items ); |
|
| 114 | - $include = array_intersect( $include, array( 'supplier/address' ) ); |
|
| 113 | + $refIds = array_keys($items); |
|
| 114 | + $include = array_intersect($include, array('supplier/address')); |
|
| 115 | 115 | |
| 116 | - foreach( $include as $type ) |
|
| 116 | + foreach ($include as $type) |
|
| 117 | 117 | { |
| 118 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $type ); |
|
| 118 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $type); |
|
| 119 | 119 | |
| 120 | 120 | $search = $manager->createSearch(); |
| 121 | - $search->setConditions( $search->compare( '==', str_replace( '/', '.', $type ) . '.parentid', $refIds ) ); |
|
| 121 | + $search->setConditions($search->compare('==', str_replace('/', '.', $type) . '.parentid', $refIds)); |
|
| 122 | 122 | |
| 123 | - $list = array_merge( $list, $manager->searchItems( $search ) ); |
|
| 123 | + $list = array_merge($list, $manager->searchItems($search)); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | return $list; |
@@ -134,17 +134,17 @@ discard block |
||
| 134 | 134 | * @param array $include List of resource types that should be fetched |
| 135 | 135 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface |
| 136 | 136 | */ |
| 137 | - protected function getListItems( array $items, array $include ) |
|
| 137 | + protected function getListItems(array $items, array $include) |
|
| 138 | 138 | { |
| 139 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'supplier/lists' ); |
|
| 139 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'supplier/lists'); |
|
| 140 | 140 | |
| 141 | 141 | $search = $manager->createSearch(); |
| 142 | 142 | $expr = array( |
| 143 | - $search->compare( '==', 'supplier.lists.parentid', array_keys( $items ) ), |
|
| 144 | - $search->compare( '==', 'supplier.lists.domain', $include ), |
|
| 143 | + $search->compare('==', 'supplier.lists.parentid', array_keys($items)), |
|
| 144 | + $search->compare('==', 'supplier.lists.domain', $include), |
|
| 145 | 145 | ); |
| 146 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 146 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 147 | 147 | |
| 148 | - return $manager->searchItems( $search ); |
|
| 148 | + return $manager->searchItems($search); |
|
| 149 | 149 | } |
| 150 | 150 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @param string $classname Full name of the class for which the object should be returned |
| 32 | 32 | * @param \Aimeos\Admin\JsonAdm\Iface|null $client JSON API client object |
| 33 | 33 | */ |
| 34 | - public static function injectClient( $classname, \Aimeos\Admin\JsonAdm\Iface $client = null ) |
|
| 34 | + public static function injectClient($classname, \Aimeos\Admin\JsonAdm\Iface $client = null) |
|
| 35 | 35 | { |
| 36 | 36 | self::$objects[$classname] = $client; |
| 37 | 37 | } |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | * @param string $path Name of the client separated by slashes, e.g "product/property" |
| 48 | 48 | * @return \Aimeos\Admin\JsonAdm\Common\Iface Client object |
| 49 | 49 | */ |
| 50 | - protected static function addClientDecorators( \Aimeos\Admin\JsonAdm\Iface $client, |
|
| 51 | - \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path ) |
|
| 50 | + protected static function addClientDecorators(\Aimeos\Admin\JsonAdm\Iface $client, |
|
| 51 | + \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path) |
|
| 52 | 52 | { |
| 53 | 53 | $config = $context->getConfig(); |
| 54 | 54 | |
@@ -74,38 +74,38 @@ discard block |
||
| 74 | 74 | * @since 2015.12 |
| 75 | 75 | * @category Developer |
| 76 | 76 | */ |
| 77 | - $decorators = $config->get( 'admin/jsonadm/common/decorators/default', [] ); |
|
| 77 | + $decorators = $config->get('admin/jsonadm/common/decorators/default', []); |
|
| 78 | 78 | |
| 79 | - if( $path !== null && is_string( $path ) ) |
|
| 79 | + if ($path !== null && is_string($path)) |
|
| 80 | 80 | { |
| 81 | - $dpath = trim( $path, '/' ); |
|
| 82 | - $dpath = ( $dpath !== '' ? $dpath . '/' : $dpath ); |
|
| 81 | + $dpath = trim($path, '/'); |
|
| 82 | + $dpath = ($dpath !== '' ? $dpath . '/' : $dpath); |
|
| 83 | 83 | |
| 84 | - $excludes = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/excludes', [] ); |
|
| 85 | - $localClass = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $path ) ) ); |
|
| 84 | + $excludes = $config->get('admin/jsonadm/' . $dpath . 'decorators/excludes', []); |
|
| 85 | + $localClass = str_replace(' ', '\\', ucwords(str_replace('/', ' ', $path))); |
|
| 86 | 86 | |
| 87 | - foreach( $decorators as $key => $name ) |
|
| 87 | + foreach ($decorators as $key => $name) |
|
| 88 | 88 | { |
| 89 | - if( in_array( $name, $excludes ) ) { |
|
| 90 | - unset( $decorators[$key] ); |
|
| 89 | + if (in_array($name, $excludes)) { |
|
| 90 | + unset($decorators[$key]); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | $classprefix = '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\'; |
| 95 | - $decorators = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/global', [] ); |
|
| 96 | - $client = self::addDecorators( $client, $decorators, $classprefix, $context, $view, $templatePaths, $path ); |
|
| 95 | + $decorators = $config->get('admin/jsonadm/' . $dpath . 'decorators/global', []); |
|
| 96 | + $client = self::addDecorators($client, $decorators, $classprefix, $context, $view, $templatePaths, $path); |
|
| 97 | 97 | |
| 98 | - if( !empty( $path ) ) |
|
| 98 | + if (!empty($path)) |
|
| 99 | 99 | { |
| 100 | - $classprefix = '\\Aimeos\\Admin\\JsonAdm\\' . ucfirst( $localClass ) . '\\Decorator\\'; |
|
| 101 | - $decorators = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/local', [] ); |
|
| 102 | - $client = self::addDecorators( $client, $decorators, $classprefix, $context, $view, $templatePaths, $path ); |
|
| 100 | + $classprefix = '\\Aimeos\\Admin\\JsonAdm\\' . ucfirst($localClass) . '\\Decorator\\'; |
|
| 101 | + $decorators = $config->get('admin/jsonadm/' . $dpath . 'decorators/local', []); |
|
| 102 | + $client = self::addDecorators($client, $decorators, $classprefix, $context, $view, $templatePaths, $path); |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | else |
| 106 | 106 | { |
| 107 | 107 | $classprefix = '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\'; |
| 108 | - $client = self::addDecorators( $client, $decorators, $classprefix, $context, $view, $templatePaths, $path ); |
|
| 108 | + $client = self::addDecorators($client, $decorators, $classprefix, $context, $view, $templatePaths, $path); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | return $client; |
@@ -124,29 +124,29 @@ discard block |
||
| 124 | 124 | * @param string $path Name of the client separated by slashes, e.g "product/stock" |
| 125 | 125 | * @return \Aimeos\Admin\JsonAdm\Common\Iface Client object |
| 126 | 126 | */ |
| 127 | - protected static function addDecorators( \Aimeos\Admin\JsonAdm\Iface $client, array $decorators, $classprefix, |
|
| 128 | - \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, $templatePaths, $path ) |
|
| 127 | + protected static function addDecorators(\Aimeos\Admin\JsonAdm\Iface $client, array $decorators, $classprefix, |
|
| 128 | + \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, $templatePaths, $path) |
|
| 129 | 129 | { |
| 130 | 130 | $iface = '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\Iface'; |
| 131 | 131 | |
| 132 | - foreach( $decorators as $name ) |
|
| 132 | + foreach ($decorators as $name) |
|
| 133 | 133 | { |
| 134 | - if( ctype_alnum( $name ) === false ) |
|
| 134 | + if (ctype_alnum($name) === false) |
|
| 135 | 135 | { |
| 136 | - $classname = is_string( $name ) ? $classprefix . $name : '<not a string>'; |
|
| 137 | - throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid class name "%1$s"', $classname ), 404 ); |
|
| 136 | + $classname = is_string($name) ? $classprefix . $name : '<not a string>'; |
|
| 137 | + throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid class name "%1$s"', $classname), 404); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | $classname = $classprefix . $name; |
| 141 | 141 | |
| 142 | - if( class_exists( $classname ) === false ) { |
|
| 143 | - throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Class "%1$s" not found', $classname ), 404 ); |
|
| 142 | + if (class_exists($classname) === false) { |
|
| 143 | + throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Class "%1$s" not found', $classname), 404); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - $client = new $classname( $client, $context, $view, $templatePaths, $path ); |
|
| 146 | + $client = new $classname($client, $context, $view, $templatePaths, $path); |
|
| 147 | 147 | |
| 148 | - if( !( $client instanceof $iface ) ) { |
|
| 149 | - throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Class "%1$s" does not implement "%2$s"', $classname, $iface ), 404 ); |
|
| 148 | + if (!($client instanceof $iface)) { |
|
| 149 | + throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Class "%1$s" does not implement "%2$s"', $classname, $iface), 404); |
|
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
@@ -165,21 +165,21 @@ discard block |
||
| 165 | 165 | * @param string $path Name of the client separated by slashes, e.g "product/stock" |
| 166 | 166 | * @return \Aimeos\Admin\JsonAdm\Common\Iface Client object |
| 167 | 167 | */ |
| 168 | - protected static function createClientBase( $classname, $interface, \Aimeos\MShop\Context\Item\Iface $context, |
|
| 169 | - \Aimeos\MW\View\Iface $view, array $templatePaths, $path ) |
|
| 168 | + protected static function createClientBase($classname, $interface, \Aimeos\MShop\Context\Item\Iface $context, |
|
| 169 | + \Aimeos\MW\View\Iface $view, array $templatePaths, $path) |
|
| 170 | 170 | { |
| 171 | - if( isset( self::$objects[$classname] ) ) { |
|
| 171 | + if (isset(self::$objects[$classname])) { |
|
| 172 | 172 | return self::$objects[$classname]; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - if( class_exists( $classname ) === false ) { |
|
| 176 | - throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Class "%1$s" not found', $classname ), 404 ); |
|
| 175 | + if (class_exists($classname) === false) { |
|
| 176 | + throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Class "%1$s" not found', $classname), 404); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - $client = new $classname( $context, $view, $templatePaths, $path ); |
|
| 179 | + $client = new $classname($context, $view, $templatePaths, $path); |
|
| 180 | 180 | |
| 181 | - if( !( $client instanceof $interface ) ) { |
|
| 182 | - throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Class "%1$s" does not implement "%2$s"', $classname, $interface ), 500 ); |
|
| 181 | + if (!($client instanceof $interface)) { |
|
| 182 | + throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Class "%1$s" does not implement "%2$s"', $classname, $interface), 500); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | return $client; |
@@ -101,8 +101,7 @@ |
||
| 101 | 101 | $decorators = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/local', [] ); |
| 102 | 102 | $client = self::addDecorators( $client, $decorators, $classprefix, $context, $view, $templatePaths, $path ); |
| 103 | 103 | } |
| 104 | - } |
|
| 105 | - else |
|
| 104 | + } else |
|
| 106 | 105 | { |
| 107 | 106 | $classprefix = '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\'; |
| 108 | 107 | $client = self::addDecorators( $client, $decorators, $classprefix, $context, $view, $templatePaths, $path ); |
@@ -107,20 +107,20 @@ |
||
| 107 | 107 | * @param array $include List of resource types that should be fetched |
| 108 | 108 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface |
| 109 | 109 | */ |
| 110 | - protected function getChildItems( array $items, array $include ) |
|
| 110 | + protected function getChildItems(array $items, array $include) |
|
| 111 | 111 | { |
| 112 | 112 | $list = []; |
| 113 | - $ids = array_keys( $items ); |
|
| 114 | - $include = array_intersect( $include, array( 'coupon/code' ) ); |
|
| 113 | + $ids = array_keys($items); |
|
| 114 | + $include = array_intersect($include, array('coupon/code')); |
|
| 115 | 115 | |
| 116 | - foreach( $include as $type ) |
|
| 116 | + foreach ($include as $type) |
|
| 117 | 117 | { |
| 118 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $type ); |
|
| 118 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $type); |
|
| 119 | 119 | |
| 120 | 120 | $search = $manager->createSearch(); |
| 121 | - $search->setConditions( $search->compare( '==', str_replace( '/', '.', $type ) . '.parentid', $ids ) ); |
|
| 121 | + $search->setConditions($search->compare('==', str_replace('/', '.', $type) . '.parentid', $ids)); |
|
| 122 | 122 | |
| 123 | - $list = array_merge( $list, $manager->searchItems( $search ) ); |
|
| 123 | + $list = array_merge($list, $manager->searchItems($search)); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | return $list; |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
| 111 | 111 | * @return \Psr\Http\Message\ResponseInterface Modified response object |
| 112 | 112 | */ |
| 113 | - public function get( ServerRequestInterface $request, ResponseInterface $response ) |
|
| 113 | + public function get(ServerRequestInterface $request, ResponseInterface $response) |
|
| 114 | 114 | { |
| 115 | 115 | /** admin/jsonadm/partials/order/base/template-data |
| 116 | 116 | * Relative path to the data partial template file for the order base client |
@@ -127,9 +127,9 @@ discard block |
||
| 127 | 127 | * @since 2016.01 |
| 128 | 128 | * @category Developer |
| 129 | 129 | */ |
| 130 | - $this->getView()->assign( array( 'partial-data' => 'admin/jsonadm/partials/order/base/template-data' ) ); |
|
| 130 | + $this->getView()->assign(array('partial-data' => 'admin/jsonadm/partials/order/base/template-data')); |
|
| 131 | 131 | |
| 132 | - return parent::get( $request, $response ); |
|
| 132 | + return parent::get($request, $response); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | |
@@ -140,21 +140,21 @@ discard block |
||
| 140 | 140 | * @param array $include List of resource types that should be fetched |
| 141 | 141 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface |
| 142 | 142 | */ |
| 143 | - protected function getChildItems( array $items, array $include ) |
|
| 143 | + protected function getChildItems(array $items, array $include) |
|
| 144 | 144 | { |
| 145 | 145 | $list = []; |
| 146 | - $ids = array_keys( $items ); |
|
| 147 | - $keys = array( 'order/base/address', 'order/base/coupon', 'order/base/product', 'order/base/service' ); |
|
| 148 | - $include = array_intersect( $include, $keys ); |
|
| 146 | + $ids = array_keys($items); |
|
| 147 | + $keys = array('order/base/address', 'order/base/coupon', 'order/base/product', 'order/base/service'); |
|
| 148 | + $include = array_intersect($include, $keys); |
|
| 149 | 149 | |
| 150 | - foreach( $include as $type ) |
|
| 150 | + foreach ($include as $type) |
|
| 151 | 151 | { |
| 152 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $type ); |
|
| 152 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $type); |
|
| 153 | 153 | |
| 154 | 154 | $search = $manager->createSearch(); |
| 155 | - $search->setConditions( $search->compare( '==', str_replace( '/', '.', $type ) . '.baseid', $ids ) ); |
|
| 155 | + $search->setConditions($search->compare('==', str_replace('/', '.', $type) . '.baseid', $ids)); |
|
| 156 | 156 | |
| 157 | - $list = array_merge( $list, $manager->searchItems( $search ) ); |
|
| 157 | + $list = array_merge($list, $manager->searchItems($search)); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | return $list; |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @param \Psr\Http\Message\ResponseInterface $response Response object |
| 111 | 111 | * @return \Psr\Http\Message\ResponseInterface Modified response object |
| 112 | 112 | */ |
| 113 | - public function get( ServerRequestInterface $request, ResponseInterface $response ) |
|
| 113 | + public function get(ServerRequestInterface $request, ResponseInterface $response) |
|
| 114 | 114 | { |
| 115 | 115 | /** admin/jsonadm/partials/order/template-data |
| 116 | 116 | * Relative path to the data partial template file for the order client |
@@ -127,9 +127,9 @@ discard block |
||
| 127 | 127 | * @since 2016.01 |
| 128 | 128 | * @category Developer |
| 129 | 129 | */ |
| 130 | - $this->getView()->assign( array( 'partial-data' => 'admin/jsonadm/partials/order/template-data' ) ); |
|
| 130 | + $this->getView()->assign(array('partial-data' => 'admin/jsonadm/partials/order/template-data')); |
|
| 131 | 131 | |
| 132 | - return parent::get( $request, $response ); |
|
| 132 | + return parent::get($request, $response); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | |
@@ -140,35 +140,35 @@ discard block |
||
| 140 | 140 | * @param array $include List of resource types that should be fetched |
| 141 | 141 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface |
| 142 | 142 | */ |
| 143 | - protected function getChildItems( array $items, array $include ) |
|
| 143 | + protected function getChildItems(array $items, array $include) |
|
| 144 | 144 | { |
| 145 | 145 | $list = []; |
| 146 | 146 | |
| 147 | - if( in_array( 'order/base', $include ) ) |
|
| 147 | + if (in_array('order/base', $include)) |
|
| 148 | 148 | { |
| 149 | 149 | $ids = []; |
| 150 | 150 | |
| 151 | - foreach( $items as $item ) { |
|
| 151 | + foreach ($items as $item) { |
|
| 152 | 152 | $ids[] = $item->getBaseId(); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base' ); |
|
| 155 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base'); |
|
| 156 | 156 | |
| 157 | 157 | $search = $manager->createSearch(); |
| 158 | - $search->setConditions( $search->compare( '==', 'order.base.id', $ids ) ); |
|
| 158 | + $search->setConditions($search->compare('==', 'order.base.id', $ids)); |
|
| 159 | 159 | |
| 160 | - $list = array_merge( $list, $manager->searchItems( $search ) ); |
|
| 160 | + $list = array_merge($list, $manager->searchItems($search)); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - if( in_array( 'order/status', $include ) ) |
|
| 163 | + if (in_array('order/status', $include)) |
|
| 164 | 164 | { |
| 165 | - $ids = array_keys( $items ); |
|
| 166 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/status' ); |
|
| 165 | + $ids = array_keys($items); |
|
| 166 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/status'); |
|
| 167 | 167 | |
| 168 | 168 | $search = $manager->createSearch(); |
| 169 | - $search->setConditions( $search->compare( '==', 'order.status.parentid', $ids ) ); |
|
| 169 | + $search->setConditions($search->compare('==', 'order.status.parentid', $ids)); |
|
| 170 | 170 | |
| 171 | - $list = array_merge( $list, $manager->searchItems( $search ) ); |
|
| 171 | + $list = array_merge($list, $manager->searchItems($search)); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | return $list; |