@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param integer &$status Variable which contains the HTTP status afterwards |
109 | 109 | * @return string Content for response body |
110 | 110 | */ |
111 | - public function get( $body, array &$header, &$status ) |
|
111 | + public function get($body, array &$header, &$status) |
|
112 | 112 | { |
113 | 113 | /** admin/jsonadm/partials/order/template-data |
114 | 114 | * Relative path to the data partial template file for the order client |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | * @since 2016.01 |
126 | 126 | * @category Developer |
127 | 127 | */ |
128 | - $this->getView()->assign( array( 'partial-data' => 'admin/jsonadm/partials/order/template-data' ) ); |
|
128 | + $this->getView()->assign(array('partial-data' => 'admin/jsonadm/partials/order/template-data')); |
|
129 | 129 | |
130 | - return parent::get( $body, $header, $status ); |
|
130 | + return parent::get($body, $header, $status); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
@@ -138,35 +138,35 @@ discard block |
||
138 | 138 | * @param array $include List of resource types that should be fetched |
139 | 139 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface |
140 | 140 | */ |
141 | - protected function getChildItems( array $items, array $include ) |
|
141 | + protected function getChildItems(array $items, array $include) |
|
142 | 142 | { |
143 | 143 | $list = array(); |
144 | 144 | |
145 | - if( in_array( 'order/base', $include ) ) |
|
145 | + if (in_array('order/base', $include)) |
|
146 | 146 | { |
147 | 147 | $ids = array(); |
148 | 148 | |
149 | - foreach( $items as $item ) { |
|
149 | + foreach ($items as $item) { |
|
150 | 150 | $ids[] = $item->getBaseId(); |
151 | 151 | } |
152 | 152 | |
153 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base' ); |
|
153 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base'); |
|
154 | 154 | |
155 | 155 | $search = $manager->createSearch(); |
156 | - $search->setConditions( $search->compare( '==', 'order.base.id', $ids ) ); |
|
156 | + $search->setConditions($search->compare('==', 'order.base.id', $ids)); |
|
157 | 157 | |
158 | - $list = array_merge( $list, $manager->searchItems( $search ) ); |
|
158 | + $list = array_merge($list, $manager->searchItems($search)); |
|
159 | 159 | } |
160 | 160 | |
161 | - if( in_array( 'order/status', $include ) ) |
|
161 | + if (in_array('order/status', $include)) |
|
162 | 162 | { |
163 | - $ids = array_keys( $items ); |
|
164 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/status' ); |
|
163 | + $ids = array_keys($items); |
|
164 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/status'); |
|
165 | 165 | |
166 | 166 | $search = $manager->createSearch(); |
167 | - $search->setConditions( $search->compare( '==', 'order.status.parentid', $ids ) ); |
|
167 | + $search->setConditions($search->compare('==', 'order.status.parentid', $ids)); |
|
168 | 168 | |
169 | - $list = array_merge( $list, $manager->searchItems( $search ) ); |
|
169 | + $list = array_merge($list, $manager->searchItems($search)); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | return $list; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param integer &$status Variable which contains the HTTP status afterwards |
109 | 109 | * @return string Content for response body |
110 | 110 | */ |
111 | - public function get( $body, array &$header, &$status ) |
|
111 | + public function get($body, array &$header, &$status) |
|
112 | 112 | { |
113 | 113 | /** admin/jsonadm/partials/order/base/template-data |
114 | 114 | * Relative path to the data partial template file for the order base client |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | * @since 2016.01 |
126 | 126 | * @category Developer |
127 | 127 | */ |
128 | - $this->getView()->assign( array( 'partial-data' => 'admin/jsonadm/partials/order/base/template-data' ) ); |
|
128 | + $this->getView()->assign(array('partial-data' => 'admin/jsonadm/partials/order/base/template-data')); |
|
129 | 129 | |
130 | - return parent::get( $body, $header, $status ); |
|
130 | + return parent::get($body, $header, $status); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
@@ -138,21 +138,21 @@ discard block |
||
138 | 138 | * @param array $include List of resource types that should be fetched |
139 | 139 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface |
140 | 140 | */ |
141 | - protected function getChildItems( array $items, array $include ) |
|
141 | + protected function getChildItems(array $items, array $include) |
|
142 | 142 | { |
143 | 143 | $list = array(); |
144 | - $ids = array_keys( $items ); |
|
145 | - $keys = array( 'order/base/address', 'order/base/coupon', 'order/base/product', 'order/base/service' ); |
|
146 | - $include = array_intersect( $include, $keys ); |
|
144 | + $ids = array_keys($items); |
|
145 | + $keys = array('order/base/address', 'order/base/coupon', 'order/base/product', 'order/base/service'); |
|
146 | + $include = array_intersect($include, $keys); |
|
147 | 147 | |
148 | - foreach( $include as $type ) |
|
148 | + foreach ($include as $type) |
|
149 | 149 | { |
150 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $type ); |
|
150 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $type); |
|
151 | 151 | |
152 | 152 | $search = $manager->createSearch(); |
153 | - $search->setConditions( $search->compare( '==', str_replace( '/', '.', $type ) . '.baseid', $ids ) ); |
|
153 | + $search->setConditions($search->compare('==', str_replace('/', '.', $type) . '.baseid', $ids)); |
|
154 | 154 | |
155 | - $list = array_merge( $list, $manager->searchItems( $search ) ); |
|
155 | + $list = array_merge($list, $manager->searchItems($search)); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | return $list; |
@@ -107,17 +107,17 @@ |
||
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\Lists\Iface |
109 | 109 | */ |
110 | - protected function getListItems( array $items, array $include ) |
|
110 | + protected function getListItems(array $items, array $include) |
|
111 | 111 | { |
112 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'text/lists' ); |
|
112 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'text/lists'); |
|
113 | 113 | |
114 | 114 | $search = $manager->createSearch(); |
115 | 115 | $expr = array( |
116 | - $search->compare( '==', 'text.lists.parentid', array_keys( $items ) ), |
|
117 | - $search->compare( '==', 'text.lists.domain', $include ), |
|
116 | + $search->compare('==', 'text.lists.parentid', array_keys($items)), |
|
117 | + $search->compare('==', 'text.lists.domain', $include), |
|
118 | 118 | ); |
119 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
119 | + $search->setConditions($search->combine('&&', $expr)); |
|
120 | 120 | |
121 | - return $manager->searchItems( $search ); |
|
121 | + return $manager->searchItems($search); |
|
122 | 122 | } |
123 | 123 | } |
@@ -107,17 +107,17 @@ |
||
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\Lists\Iface |
109 | 109 | */ |
110 | - protected function getListItems( array $items, array $include ) |
|
110 | + protected function getListItems(array $items, array $include) |
|
111 | 111 | { |
112 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'price/lists' ); |
|
112 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'price/lists'); |
|
113 | 113 | |
114 | 114 | $search = $manager->createSearch(); |
115 | 115 | $expr = array( |
116 | - $search->compare( '==', 'price.lists.parentid', array_keys( $items ) ), |
|
117 | - $search->compare( '==', 'price.lists.domain', $include ), |
|
116 | + $search->compare('==', 'price.lists.parentid', array_keys($items)), |
|
117 | + $search->compare('==', 'price.lists.domain', $include), |
|
118 | 118 | ); |
119 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
119 | + $search->setConditions($search->combine('&&', $expr)); |
|
120 | 120 | |
121 | - return $manager->searchItems( $search ); |
|
121 | + return $manager->searchItems($search); |
|
122 | 122 | } |
123 | 123 | } |
@@ -107,17 +107,17 @@ |
||
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\Lists\Iface |
109 | 109 | */ |
110 | - protected function getListItems( array $items, array $include ) |
|
110 | + protected function getListItems(array $items, array $include) |
|
111 | 111 | { |
112 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute/lists' ); |
|
112 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute/lists'); |
|
113 | 113 | |
114 | 114 | $search = $manager->createSearch(); |
115 | 115 | $expr = array( |
116 | - $search->compare( '==', 'attribute.lists.parentid', array_keys( $items ) ), |
|
117 | - $search->compare( '==', 'attribute.lists.domain', $include ), |
|
116 | + $search->compare('==', 'attribute.lists.parentid', array_keys($items)), |
|
117 | + $search->compare('==', 'attribute.lists.domain', $include), |
|
118 | 118 | ); |
119 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
119 | + $search->setConditions($search->combine('&&', $expr)); |
|
120 | 120 | |
121 | - return $manager->searchItems( $search ); |
|
121 | + return $manager->searchItems($search); |
|
122 | 122 | } |
123 | 123 | } |
@@ -107,17 +107,17 @@ |
||
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\Lists\Iface |
109 | 109 | */ |
110 | - protected function getListItems( array $items, array $include ) |
|
110 | + protected function getListItems(array $items, array $include) |
|
111 | 111 | { |
112 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service/lists' ); |
|
112 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service/lists'); |
|
113 | 113 | |
114 | 114 | $search = $manager->createSearch(); |
115 | 115 | $expr = array( |
116 | - $search->compare( '==', 'service.lists.parentid', array_keys( $items ) ), |
|
117 | - $search->compare( '==', 'service.lists.domain', $include ), |
|
116 | + $search->compare('==', 'service.lists.parentid', array_keys($items)), |
|
117 | + $search->compare('==', 'service.lists.domain', $include), |
|
118 | 118 | ); |
119 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
119 | + $search->setConditions($search->combine('&&', $expr)); |
|
120 | 120 | |
121 | - return $manager->searchItems( $search ); |
|
121 | + return $manager->searchItems($search); |
|
122 | 122 | } |
123 | 123 | } |
@@ -107,17 +107,17 @@ |
||
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\Lists\Iface |
109 | 109 | */ |
110 | - protected function getListItems( array $items, array $include ) |
|
110 | + protected function getListItems(array $items, array $include) |
|
111 | 111 | { |
112 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'media/lists' ); |
|
112 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'media/lists'); |
|
113 | 113 | |
114 | 114 | $search = $manager->createSearch(); |
115 | 115 | $expr = array( |
116 | - $search->compare( '==', 'media.lists.parentid', array_keys( $items ) ), |
|
117 | - $search->compare( '==', 'media.lists.domain', $include ), |
|
116 | + $search->compare('==', 'media.lists.parentid', array_keys($items)), |
|
117 | + $search->compare('==', 'media.lists.domain', $include), |
|
118 | 118 | ); |
119 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
119 | + $search->setConditions($search->combine('&&', $expr)); |
|
120 | 120 | |
121 | - return $manager->searchItems( $search ); |
|
121 | + return $manager->searchItems($search); |
|
122 | 122 | } |
123 | 123 | } |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $options = 0; |
4 | -if( defined( 'JSON_PRETTY_PRINT' ) ) { |
|
4 | +if (defined('JSON_PRETTY_PRINT')) { |
|
5 | 5 | $options = JSON_PRETTY_PRINT; |
6 | 6 | } |
7 | 7 | |
8 | 8 | |
9 | -echo json_encode( $this->get( 'errors', array() ), $options ); |
|
10 | 9 | \ No newline at end of file |
10 | +echo json_encode($this->get('errors', array()), $options); |
|
11 | 11 | \ No newline at end of file |
@@ -1,28 +1,28 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $options = 0; |
4 | -if( defined( 'JSON_PRETTY_PRINT' ) ) { |
|
4 | +if (defined('JSON_PRETTY_PRINT')) { |
|
5 | 5 | $options = JSON_PRETTY_PRINT; |
6 | 6 | } |
7 | 7 | |
8 | 8 | |
9 | -$build = function( \Aimeos\MW\View\Iface $view, array $items, array $fields ) |
|
9 | +$build = function(\Aimeos\MW\View\Iface $view, array $items, array $fields) |
|
10 | 10 | { |
11 | 11 | $list = array(); |
12 | 12 | |
13 | - $target = $view->config( 'admin/jsonadm/url/target' ); |
|
14 | - $cntl = $view->config( 'admin/jsonadm/url/controller', 'jsonadm' ); |
|
15 | - $action = $view->config( 'admin/jsonadm/url/action', 'get' ); |
|
16 | - $config = $view->config( 'admin/jsonadm/url/config', array() ); |
|
13 | + $target = $view->config('admin/jsonadm/url/target'); |
|
14 | + $cntl = $view->config('admin/jsonadm/url/controller', 'jsonadm'); |
|
15 | + $action = $view->config('admin/jsonadm/url/action', 'get'); |
|
16 | + $config = $view->config('admin/jsonadm/url/config', array()); |
|
17 | 17 | |
18 | - foreach( (array) $items as $item ) |
|
18 | + foreach ((array) $items as $item) |
|
19 | 19 | { |
20 | 20 | $id = $item->getId(); |
21 | 21 | $attributes = $item->toArray(); |
22 | 22 | $type = $item->getResourceType(); |
23 | 23 | |
24 | - if( isset( $fields[$type] ) ) { |
|
25 | - $attributes = array_intersect_key( $attributes, $fields[$type] ); |
|
24 | + if (isset($fields[$type])) { |
|
25 | + $attributes = array_intersect_key($attributes, $fields[$type]); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | $list[] = array( |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | 'type' => $type, |
31 | 31 | 'attributes' => $attributes, |
32 | 32 | 'links' => array( |
33 | - 'self' => $view->url( $target, $cntl, $action, array( 'resource' => $type, 'id' => $id ), array(), $config ), |
|
33 | + 'self' => $view->url($target, $cntl, $action, array('resource' => $type, 'id' => $id), array(), $config), |
|
34 | 34 | 'related' => array( |
35 | - 'href' => $view->url( $target, $cntl, $action, array( 'resource' => $type, 'id' => null ), array(), $config ) |
|
35 | + 'href' => $view->url($target, $cntl, $action, array('resource' => $type, 'id' => null), array(), $config) |
|
36 | 36 | ) |
37 | 37 | ) |
38 | 38 | ); |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | |
44 | 44 | |
45 | 45 | $response = array(); |
46 | -$fields = $this->param( 'fields', array() ); |
|
46 | +$fields = $this->param('fields', array()); |
|
47 | 47 | |
48 | -foreach( (array) $fields as $resource => $list ) { |
|
49 | - $fields[$resource] = array_flip( explode( ',', $list ) ); |
|
48 | +foreach ((array) $fields as $resource => $list) { |
|
49 | + $fields[$resource] = array_flip(explode(',', $list)); |
|
50 | 50 | } |
51 | 51 | |
52 | -$response = $build( $this, $this->get( 'childItems', array() ), $fields ); |
|
53 | -$response = array_merge( $response, $build( $this, $this->get( 'refItems', array() ), $fields ) ); |
|
52 | +$response = $build($this, $this->get('childItems', array()), $fields); |
|
53 | +$response = array_merge($response, $build($this, $this->get('refItems', array()), $fields)); |
|
54 | 54 | |
55 | 55 | |
56 | -echo json_encode( $response, $options ); |
|
57 | 56 | \ No newline at end of file |
57 | +echo json_encode($response, $options); |
|
58 | 58 | \ No newline at end of file |