Completed
Push — master ( 786415...fa87fb )
by Aimeos
01:55
created
admin/jsonadm/templates/patch-default.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 {
2
-<?php if( isset( $this->errors ) ) : ?>
3
-	"errors": <?php echo $this->partial( $this->config( 'admin/jsonadm/partials/template-errors', 'partials/errors-standard.php' ), array( 'errors' => $this->errors ) ); ?>,
4
-<?php elseif( isset( $this->data ) ) : ?>
5
-	"data": <?php echo $this->partial( $this->config( 'admin/jsonadm/partials/template-data', 'partials/data-standard.php' ), array( 'data' => $this->get( 'data' ) ) ); ?>,
2
+<?php if (isset($this->errors)) : ?>
3
+	"errors": <?php echo $this->partial($this->config('admin/jsonadm/partials/template-errors', 'partials/errors-standard.php'), array('errors' => $this->errors)); ?>,
4
+<?php elseif (isset($this->data)) : ?>
5
+	"data": <?php echo $this->partial($this->config('admin/jsonadm/partials/template-data', 'partials/data-standard.php'), array('data' => $this->get('data'))); ?>,
6 6
 <?php endif; ?>
7 7
 
8 8
 	"meta": {
9
-		"total": <?php echo $this->get( 'total', 0 ); ?>
9
+		"total": <?php echo $this->get('total', 0); ?>
10 10
 
11 11
 	}
12 12
 }
Please login to merge, or discard this patch.
admin/jsonadm/templates/options-default.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,29 +1,29 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-$target = $this->config( 'admin/jsonadm/url/target' );
4
-$cntl = $this->config( 'admin/jsonadm/url/controller', 'jsonadm' );
5
-$action = $this->config( 'admin/jsonadm/url/action', 'get' );
6
-$config = $this->config( 'admin/jsonadm/url/config', array() );
3
+$target = $this->config('admin/jsonadm/url/target');
4
+$cntl = $this->config('admin/jsonadm/url/controller', 'jsonadm');
5
+$action = $this->config('admin/jsonadm/url/action', 'get');
6
+$config = $this->config('admin/jsonadm/url/config', array());
7 7
 
8 8
 $resources = $attributes = array();
9
-$site = $this->param( 'site', 'default' );
9
+$site = $this->param('site', 'default');
10 10
 
11
-foreach( $this->get( 'resources', array() ) as $resource ) {
12
-	$resources[$resource] = $this->url( $target, $cntl, $action, array( 'site' => $site, 'resource' => $resource, 'id' => '' ), array(), $config );
11
+foreach ($this->get('resources', array()) as $resource) {
12
+	$resources[$resource] = $this->url($target, $cntl, $action, array('site' => $site, 'resource' => $resource, 'id' => ''), array(), $config);
13 13
 }
14 14
 
15
-foreach( $this->get( 'attributes', array() ) as $attr ) {
15
+foreach ($this->get('attributes', array()) as $attr) {
16 16
 	$attributes[$attr->getCode()] = $attr->toArray();
17 17
 }
18 18
 
19 19
 ?>
20 20
 {
21 21
 	"meta": {
22
-		"resources": <?php echo json_encode( $resources ); ?>,
23
-		"attributes": <?php echo json_encode( $attributes ); ?>
22
+		"resources": <?php echo json_encode($resources); ?>,
23
+		"attributes": <?php echo json_encode($attributes); ?>
24 24
 	}
25
-<?php if( isset( $this->errors ) ) : ?>
26
-	,"errors": <?php echo $this->partial( $this->config( 'admin/jsonadm/partials/template-errors', 'partials/errors-standard.php' ), array( 'errors' => $this->errors ) ); ?>
25
+<?php if (isset($this->errors)) : ?>
26
+	,"errors": <?php echo $this->partial($this->config('admin/jsonadm/partials/template-errors', 'partials/errors-standard.php'), array('errors' => $this->errors)); ?>
27 27
 <?php endif; ?>
28 28
 
29 29
 }
Please login to merge, or discard this patch.
admin/jsonadm/templates/put-default.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 {
2
-<?php if( isset( $this->errors ) ) : ?>
3
-	"errors": <?php echo $this->partial( $this->config( 'admin/jsonadm/partials/template-errors', 'partials/errors-standard.php' ), array( 'errors' => $this->errors ) ); ?>
2
+<?php if (isset($this->errors)) : ?>
3
+	"errors": <?php echo $this->partial($this->config('admin/jsonadm/partials/template-errors', 'partials/errors-standard.php'), array('errors' => $this->errors)); ?>
4 4
 <?php endif; ?>
5 5
 
6 6
 }
Please login to merge, or discard this patch.
admin/jsonadm/templates/get-default.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * @see admin/jsonadm/url/action
15 15
  * @see admin/jsonadm/url/config
16 16
  */
17
-$target = $this->config( 'admin/jsonadm/url/target' );
17
+$target = $this->config('admin/jsonadm/url/target');
18 18
 
19 19
 /** admin/jsonadm/url/controller
20 20
  * Name of the client whose action should be called
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
  * @see admin/jsonadm/url/action
31 31
  * @see admin/jsonadm/url/config
32 32
  */
33
-$cntl = $this->config( 'admin/jsonadm/url/controller', 'jsonadm' );
33
+$cntl = $this->config('admin/jsonadm/url/controller', 'jsonadm');
34 34
 
35 35
 /** admin/jsonadm/url/action
36 36
  * Name of the action that should create the output
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
  * @see admin/jsonadm/url/controller
47 47
  * @see admin/jsonadm/url/config
48 48
  */
49
-$action = $this->config( 'admin/jsonadm/url/action', 'get' );
49
+$action = $this->config('admin/jsonadm/url/action', 'get');
50 50
 
51 51
 /** admin/jsonadm/url/config
52 52
  * Associative list of configuration options used for generating the URL
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
  * @see admin/jsonadm/url/controller
69 69
  * @see admin/jsonadm/url/action
70 70
  */
71
-$config = $this->config( 'admin/jsonadm/url/config', array() );
71
+$config = $this->config('admin/jsonadm/url/config', array());
72 72
 
73 73
 
74 74
 /** admin/jsonadm/partials/template-errors
@@ -120,22 +120,22 @@  discard block
 block discarded – undo
120 120
  */
121 121
 
122 122
 
123
-$ref = array( 'id', 'resource', 'filter', 'page', 'sort', 'include', 'fields' );
124
-$params = array_intersect_key( $this->param(), array_flip( $ref ) );
123
+$ref = array('id', 'resource', 'filter', 'page', 'sort', 'include', 'fields');
124
+$params = array_intersect_key($this->param(), array_flip($ref));
125 125
 
126
-if( !isset( $params['id'] ) ) {
126
+if (!isset($params['id'])) {
127 127
 	$params['id'] = '';
128 128
 }
129 129
 
130 130
 
131
-$total = $this->get( 'total', 0 );
132
-$offset = max( $this->param( 'page/offset', 0 ), 0 );
133
-$limit = max( $this->param( 'page/limit', 25 ), 1 );
131
+$total = $this->get('total', 0);
132
+$offset = max($this->param('page/offset', 0), 0);
133
+$limit = max($this->param('page/limit', 25), 1);
134 134
 
135
-$first = ( $offset > 0 ? 0 : null );
136
-$prev = ( $offset - $limit >= 0 ? $offset - $limit : null );
137
-$next = ( $offset + $limit < $total ? $offset + $limit : null );
138
-$last = ( ((int) ($total / $limit)) * $limit > $offset ? ((int) ($total / $limit)) * $limit : null );
135
+$first = ($offset > 0 ? 0 : null);
136
+$prev = ($offset - $limit >= 0 ? $offset - $limit : null);
137
+$next = ($offset + $limit < $total ? $offset + $limit : null);
138
+$last = (((int) ($total / $limit)) * $limit > $offset ? ((int) ($total / $limit)) * $limit : null);
139 139
 
140 140
 ?>
141 141
 {
@@ -144,27 +144,27 @@  discard block
 block discarded – undo
144 144
 
145 145
 	},
146 146
 	"links": {
147
-<?php if( is_array( $this->get( 'data' ) ) ) : ?>
148
-<?php	if( $first !== null ) : ?>
149
-		"first": "<?php $params['page']['offset'] = $first; echo $this->url( $target, $cntl, $action, $params, array(), $config ); ?>",
147
+<?php if (is_array($this->get('data'))) : ?>
148
+<?php	if ($first !== null) : ?>
149
+		"first": "<?php $params['page']['offset'] = $first; echo $this->url($target, $cntl, $action, $params, array(), $config); ?>",
150 150
 <?php	endif; ?>
151
-<?php	if( $prev !== null ) : ?>
152
-		"prev": "<?php $params['page']['offset'] = $prev; echo $this->url( $target, $cntl, $action, $params, array(), $config ); ?>",
151
+<?php	if ($prev !== null) : ?>
152
+		"prev": "<?php $params['page']['offset'] = $prev; echo $this->url($target, $cntl, $action, $params, array(), $config); ?>",
153 153
 <?php	endif; ?>
154
-<?php	if( $next !== null ) : ?>
155
-		"next": "<?php $params['page']['offset'] = $next; echo $this->url( $target, $cntl, $action, $params, array(), $config ); ?>",
154
+<?php	if ($next !== null) : ?>
155
+		"next": "<?php $params['page']['offset'] = $next; echo $this->url($target, $cntl, $action, $params, array(), $config); ?>",
156 156
 <?php	endif; ?>
157
-<?php	if( $last !== null ) : ?>
158
-		"last": "<?php $params['page']['offset'] = $last; echo $this->url( $target, $cntl, $action, $params, array(), $config ); ?>",
157
+<?php	if ($last !== null) : ?>
158
+		"last": "<?php $params['page']['offset'] = $last; echo $this->url($target, $cntl, $action, $params, array(), $config); ?>",
159 159
 <?php	endif; ?>
160 160
 <?php endif; ?>
161
-		"self": "<?php $params['page']['offset'] = $offset; echo $this->url( $target, $cntl, $action, $params, array(), $config ); ?>"
161
+		"self": "<?php $params['page']['offset'] = $offset; echo $this->url($target, $cntl, $action, $params, array(), $config); ?>"
162 162
 	},
163
-<?php if( isset( $this->errors ) ) : ?>
164
-	"errors": <?php echo $this->partial( $this->config( $this->get( 'partial-errors', 'admin/jsonadm/partials/template-errors' ), 'partials/errors-standard.php' ), array( 'errors' => $this->errors ) ); ?>
165
-<?php elseif( isset( $this->data ) ) : ?>
166
-	"data": <?php echo $this->partial( $this->config( $this->get( 'partial-data', 'admin/jsonadm/partials/template-data' ), 'partials/data-standard.php' ), array( 'data' => $this->get( 'data' ), 'childItems' => $this->get( 'childItems', array() ), 'listItems' => $this->get( 'listItems', array() ) ) ); ?>,
167
-	"included": <?php echo $this->partial( $this->config( $this->get( 'partial-included', 'admin/jsonadm/partials/template-included' ), 'partials/included-standard.php' ), array( 'childItems' => $this->get( 'childItems', array() ), 'refItems' => $this->get( 'refItems', array() ) ) ); ?>
163
+<?php if (isset($this->errors)) : ?>
164
+	"errors": <?php echo $this->partial($this->config($this->get('partial-errors', 'admin/jsonadm/partials/template-errors'), 'partials/errors-standard.php'), array('errors' => $this->errors)); ?>
165
+<?php elseif (isset($this->data)) : ?>
166
+	"data": <?php echo $this->partial($this->config($this->get('partial-data', 'admin/jsonadm/partials/template-data'), 'partials/data-standard.php'), array('data' => $this->get('data'), 'childItems' => $this->get('childItems', array()), 'listItems' => $this->get('listItems', array()))); ?>,
167
+	"included": <?php echo $this->partial($this->config($this->get('partial-included', 'admin/jsonadm/partials/template-included'), 'partials/included-standard.php'), array('childItems' => $this->get('childItems', array()), 'refItems' => $this->get('refItems', array()))); ?>
168 168
 <?php endif; ?>
169 169
 
170 170
 }
Please login to merge, or discard this patch.
admin/jsonadm/templates/delete-default.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 {
2 2
 	"meta": {
3
-		"total": <?php echo $this->get( 'total', 0 ); ?>
3
+		"total": <?php echo $this->get('total', 0); ?>
4 4
 
5 5
 	}
6
-<?php if( isset( $this->errors ) ) : ?>
7
-	,"errors": <?php echo $this->partial( $this->config( 'admin/jsonadm/partials/template-errors', 'partials/errors-standard.php' ), array( 'errors' => $this->errors ) ); ?>
6
+<?php if (isset($this->errors)) : ?>
7
+	,"errors": <?php echo $this->partial($this->config('admin/jsonadm/partials/template-errors', 'partials/errors-standard.php'), array('errors' => $this->errors)); ?>
8 8
 <?php endif; ?>
9 9
 
10 10
 }
Please login to merge, or discard this patch.
admin/jsonadm/templates/partials/data-standard.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,12 +52,10 @@
 block discarded – undo
52 52
 	foreach( $data as $item ) {
53 53
 		$response[] = $build( $item, $fields, $childItems );
54 54
 	}
55
-}
56
-elseif( $data !== null )
55
+} elseif( $data !== null )
57 56
 {
58 57
 	$response = $build( $data, $fields, $childItems );
59
-}
60
-else
58
+} else
61 59
 {
62 60
 	$response = null;
63 61
 }
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -1,25 +1,25 @@  discard block
 block discarded – undo
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, \Aimeos\MShop\Common\Item\Iface $item, array $fields, array $childItems, array $listItems )
9
+$build = function(\Aimeos\MW\View\Iface $view, \Aimeos\MShop\Common\Item\Iface $item, array $fields, array $childItems, array $listItems)
10 10
 {
11 11
 	$id = $item->getId();
12 12
 	$attributes = $item->toArray();
13 13
 	$type = $item->getResourceType();
14
-	$params = array( 'resource' => $item->getResourceType(), 'id' => $id );
14
+	$params = array('resource' => $item->getResourceType(), 'id' => $id);
15 15
 
16
-	$target = $view->config( 'admin/jsonadm/url/target' );
17
-	$cntl = $view->config( 'admin/jsonadm/url/controller', 'jsonadm' );
18
-	$action = $view->config( 'admin/jsonadm/url/action', 'get' );
19
-	$config = $view->config( 'admin/jsonadm/url/config', array() );
16
+	$target = $view->config('admin/jsonadm/url/target');
17
+	$cntl = $view->config('admin/jsonadm/url/controller', 'jsonadm');
18
+	$action = $view->config('admin/jsonadm/url/action', 'get');
19
+	$config = $view->config('admin/jsonadm/url/config', array());
20 20
 
21
-	if( isset( $fields[$type] ) ) {
22
-		$attributes = array_intersect_key( $attributes, $fields[$type] );
21
+	if (isset($fields[$type])) {
22
+		$attributes = array_intersect_key($attributes, $fields[$type]);
23 23
 	}
24 24
 
25 25
 	$result = array(
@@ -27,33 +27,33 @@  discard block
 block discarded – undo
27 27
 		'type' => $type,
28 28
 		'attributes' => $attributes,
29 29
 		'links' => array(
30
-			'self' => $view->url( $target, $cntl, $action, $params, array(), $config )
30
+			'self' => $view->url($target, $cntl, $action, $params, array(), $config)
31 31
 		),
32 32
 		'relationships' => array()
33 33
 	);
34 34
 
35
-	foreach( $childItems as $childItem )
35
+	foreach ($childItems as $childItem)
36 36
 	{
37
-		if( $childItem->getParentId() == $id )
37
+		if ($childItem->getParentId() == $id)
38 38
 		{
39 39
 			$type = $childItem->getResourceType();
40
-			$result['relationships'][$type][] = array( 'data' => array( 'id' => $childItem->getId(), 'type' => $type ) );
40
+			$result['relationships'][$type][] = array('data' => array('id' => $childItem->getId(), 'type' => $type));
41 41
 		}
42 42
 	}
43 43
 
44
-	foreach( $listItems as $listId => $listItem )
44
+	foreach ($listItems as $listId => $listItem)
45 45
 	{
46
-		if( $listItem->getParentId() == $id )
46
+		if ($listItem->getParentId() == $id)
47 47
 		{
48 48
 			$type = $listItem->getDomain();
49
-			$params = array( 'resource' => $listItem->getResourceType(), 'id' => $listId );
49
+			$params = array('resource' => $listItem->getResourceType(), 'id' => $listId);
50 50
 
51
-			$result['relationships'][$type][] = array( 'data' => array(
51
+			$result['relationships'][$type][] = array('data' => array(
52 52
 				'id' => $listItem->getRefId(), 'type' => $type,
53 53
 				'attributes' => $listItem->toArray(), 'links' => array(
54
-					'self' => $view->url( $target, $cntl, $action, $params, array(), $config )
54
+					'self' => $view->url($target, $cntl, $action, $params, array(), $config)
55 55
 				)
56
-			) );
56
+			));
57 57
 		}
58 58
 	}
59 59
 
@@ -61,28 +61,28 @@  discard block
 block discarded – undo
61 61
 };
62 62
 
63 63
 
64
-$fields = $this->param( 'fields', array() );
64
+$fields = $this->param('fields', array());
65 65
 
66
-foreach( (array) $fields as $resource => $list ) {
67
-	$fields[$resource] = array_flip( explode( ',', $list ) );
66
+foreach ((array) $fields as $resource => $list) {
67
+	$fields[$resource] = array_flip(explode(',', $list));
68 68
 }
69 69
 
70 70
 
71
-$data = $this->get( 'data', array() );
72
-$childItems = $this->get( 'childItems', array() );
73
-$listItems = $this->get( 'listItems', array() );
71
+$data = $this->get('data', array());
72
+$childItems = $this->get('childItems', array());
73
+$listItems = $this->get('listItems', array());
74 74
 
75
-if( is_array( $data ) )
75
+if (is_array($data))
76 76
 {
77 77
 	$response = array();
78 78
 
79
-	foreach( $data as $item ) {
80
-		$response[] = $build( $this, $item, $fields, $childItems, $listItems );
79
+	foreach ($data as $item) {
80
+		$response[] = $build($this, $item, $fields, $childItems, $listItems);
81 81
 	}
82 82
 }
83
-elseif( $data !== null )
83
+elseif ($data !== null)
84 84
 {
85
-	$response = $build( $this, $data, $fields, $childItems, $listItems );
85
+	$response = $build($this, $data, $fields, $childItems, $listItems);
86 86
 }
87 87
 else
88 88
 {
@@ -90,4 +90,4 @@  discard block
 block discarded – undo
90 90
 }
91 91
 
92 92
 
93
-echo json_encode( $response, $options );
94 93
\ No newline at end of file
94
+echo json_encode($response, $options);
95 95
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/templates/partials/order/data-standard.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,12 +52,10 @@
 block discarded – undo
52 52
 	foreach( $data as $item ) {
53 53
 		$response[] = $build( $item, $fields, $childItems );
54 54
 	}
55
-}
56
-elseif( $data !== null )
55
+} elseif( $data !== null )
57 56
 {
58 57
 	$response = $build( $data, $fields, $childItems );
59
-}
60
-else
58
+} else
61 59
 {
62 60
 	$response = null;
63 61
 }
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -1,25 +1,25 @@  discard block
 block discarded – undo
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
-$build = function( \Aimeos\MW\View\Iface $view, \Aimeos\MShop\Order\Item\Iface $item, array $fields, array $childItems )
8
+$build = function(\Aimeos\MW\View\Iface $view, \Aimeos\MShop\Order\Item\Iface $item, array $fields, array $childItems)
9 9
 {
10 10
 	$id = $item->getId();
11 11
 	$baseId = $item->getBaseId();
12 12
 	$attributes = $item->toArray();
13 13
 	$type = $item->getResourceType();
14
-	$params = array( 'resource' => $item->getResourceType(), 'id' => $id );
14
+	$params = array('resource' => $item->getResourceType(), 'id' => $id);
15 15
 
16
-	$target = $view->config( 'admin/jsonadm/url/target' );
17
-	$cntl = $view->config( 'admin/jsonadm/url/controller', 'jsonadm' );
18
-	$action = $view->config( 'admin/jsonadm/url/action', 'get' );
19
-	$config = $view->config( 'admin/jsonadm/url/config', array() );
16
+	$target = $view->config('admin/jsonadm/url/target');
17
+	$cntl = $view->config('admin/jsonadm/url/controller', 'jsonadm');
18
+	$action = $view->config('admin/jsonadm/url/action', 'get');
19
+	$config = $view->config('admin/jsonadm/url/config', array());
20 20
 
21
-	if( isset( $fields[$type] ) ) {
22
-		$attributes = array_intersect_key( $attributes, $fields[$type] );
21
+	if (isset($fields[$type])) {
22
+		$attributes = array_intersect_key($attributes, $fields[$type]);
23 23
 	}
24 24
 
25 25
 	$result = array(
@@ -27,25 +27,25 @@  discard block
 block discarded – undo
27 27
 		'type' => $type,
28 28
 		'attributes' => $attributes,
29 29
 		'links' => array(
30
-			'self' => $view->url( $target, $cntl, $action, $params, array(), $config )
30
+			'self' => $view->url($target, $cntl, $action, $params, array(), $config)
31 31
 		),
32 32
 		'relationships' => array()
33 33
 	);
34 34
 
35
-	foreach( $childItems as $childId => $childItem )
35
+	foreach ($childItems as $childId => $childItem)
36 36
 	{
37
-		if( $childItem instanceof \Aimeos\MShop\Order\Item\Status\Iface && $childItem->getParentId() == $id
37
+		if ($childItem instanceof \Aimeos\MShop\Order\Item\Status\Iface && $childItem->getParentId() == $id
38 38
 			|| $childItem instanceof \Aimeos\MShop\Order\Item\Base\Iface && $childItem->getId() == $baseId
39 39
 		) {
40 40
 			$type = $childItem->getResourceType();
41
-			$params = array( 'resource' => $childItem->getResourceType(), 'id' => $childId );
41
+			$params = array('resource' => $childItem->getResourceType(), 'id' => $childId);
42 42
 
43
-			$result['relationships'][$type][] = array( 'data' => array(
43
+			$result['relationships'][$type][] = array('data' => array(
44 44
 				'id' => $childId, 'type' => $type,
45 45
 				'links' => array(
46
-					'self' => $view->url( $target, $cntl, $action, $params, array(), $config )
46
+					'self' => $view->url($target, $cntl, $action, $params, array(), $config)
47 47
 				)
48
-			) );
48
+			));
49 49
 		}
50 50
 	}
51 51
 
@@ -53,27 +53,27 @@  discard block
 block discarded – undo
53 53
 };
54 54
 
55 55
 
56
-$fields = $this->param( 'fields', array() );
56
+$fields = $this->param('fields', array());
57 57
 
58
-foreach( (array) $fields as $resource => $list ) {
59
-	$fields[$resource] = array_flip( explode( ',', $list ) );
58
+foreach ((array) $fields as $resource => $list) {
59
+	$fields[$resource] = array_flip(explode(',', $list));
60 60
 }
61 61
 
62 62
 
63
-$data = $this->get( 'data', array() );
64
-$childItems = $this->get( 'childItems', array() );
63
+$data = $this->get('data', array());
64
+$childItems = $this->get('childItems', array());
65 65
 
66
-if( is_array( $data ) )
66
+if (is_array($data))
67 67
 {
68 68
 	$response = array();
69 69
 
70
-	foreach( $data as $item ) {
71
-		$response[] = $build( $this, $item, $fields, $childItems );
70
+	foreach ($data as $item) {
71
+		$response[] = $build($this, $item, $fields, $childItems);
72 72
 	}
73 73
 }
74
-elseif( $data !== null )
74
+elseif ($data !== null)
75 75
 {
76
-	$response = $build( $this, $data, $fields, $childItems );
76
+	$response = $build($this, $data, $fields, $childItems);
77 77
 }
78 78
 else
79 79
 {
@@ -81,4 +81,4 @@  discard block
 block discarded – undo
81 81
 }
82 82
 
83 83
 
84
-echo json_encode( $response, $options );
85 84
\ No newline at end of file
85
+echo json_encode($response, $options);
86 86
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/templates/post-default.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 {
2
-<?php if( isset( $this->errors ) ) : ?>
3
-	"errors": <?php echo $this->partial( $this->config( 'admin/jsonadm/partials/template-errors', 'partials/errors-standard.php' ), array( 'errors' => $this->errors ) ); ?>,
4
-<?php elseif( isset( $this->data ) ) : ?>
5
-	"data": <?php echo $this->partial( $this->config( 'admin/jsonadm/partials/template-data', 'partials/data-standard.php' ), array( 'data' => $this->get( 'data' ) ) ); ?>,
2
+<?php if (isset($this->errors)) : ?>
3
+	"errors": <?php echo $this->partial($this->config('admin/jsonadm/partials/template-errors', 'partials/errors-standard.php'), array('errors' => $this->errors)); ?>,
4
+<?php elseif (isset($this->data)) : ?>
5
+	"data": <?php echo $this->partial($this->config('admin/jsonadm/partials/template-data', 'partials/data-standard.php'), array('data' => $this->get('data'))); ?>,
6 6
 <?php endif; ?>
7 7
 
8 8
 	"meta": {
9
-		"total": <?php echo $this->get( 'total', 0 ); ?>
9
+		"total": <?php echo $this->get('total', 0); ?>
10 10
 
11 11
 	}
12 12
 }
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/FactoryTest.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 		$context = \TestHelperJadm::getContext();
17 17
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
18 18
 
19
-		$client = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' );
20
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client );
19
+		$client = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order');
20
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client);
21 21
 	}
22 22
 
23 23
 
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 		$context = \TestHelperJadm::getContext();
27 27
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
28 28
 
29
-		$client = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order/base' );
30
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client );
29
+		$client = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base');
30
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client);
31 31
 	}
32 32
 
33 33
 
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 		$context = \TestHelperJadm::getContext();
37 37
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
38 38
 
39
-		$client = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, '' );
40
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client );
39
+		$client = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, '');
40
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client);
41 41
 	}
42 42
 
43 43
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 		$context = \TestHelperJadm::getContext();
47 47
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
48 48
 
49
-		$this->setExpectedException( '\\Aimeos\\Admin\\JsonAdm\\Exception' );
50
-		\Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, '%^' );
49
+		$this->setExpectedException('\\Aimeos\\Admin\\JsonAdm\\Exception');
50
+		\Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, '%^');
51 51
 	}
52 52
 
53 53
 
@@ -56,68 +56,68 @@  discard block
 block discarded – undo
56 56
 		$context = \TestHelperJadm::getContext();
57 57
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
58 58
 
59
-		$this->setExpectedException( '\\Aimeos\\Admin\\JsonAdm\\Exception' );
60
-		\Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, '', '%^' );
59
+		$this->setExpectedException('\\Aimeos\\Admin\\JsonAdm\\Exception');
60
+		\Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, '', '%^');
61 61
 	}
62 62
 
63 63
 
64 64
 	public function testClear()
65 65
 	{
66
-		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache( true );
66
+		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache(true);
67 67
 
68 68
 		$context = \TestHelperJadm::getContext();
69 69
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
70 70
 
71
-		$client1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' );
71
+		$client1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order');
72 72
 		\Aimeos\Admin\JsonAdm\Factory::clear();
73
-		$client2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' );
73
+		$client2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order');
74 74
 
75
-		\Aimeos\Admin\JsonAdm\Factory::setCache( $cache );
75
+		\Aimeos\Admin\JsonAdm\Factory::setCache($cache);
76 76
 
77
-		$this->assertNotSame( $client1, $client2 );
77
+		$this->assertNotSame($client1, $client2);
78 78
 	}
79 79
 
80 80
 
81 81
 	public function testClearSite()
82 82
 	{
83
-		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache( true );
83
+		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache(true);
84 84
 
85 85
 		$context = \TestHelperJadm::getContext();
86 86
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
87 87
 
88
-		$cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' );
89
-		$cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order/base' );
90
-		\Aimeos\Admin\JsonAdm\Factory::clear( (string) $context );
88
+		$cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order');
89
+		$cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base');
90
+		\Aimeos\Admin\JsonAdm\Factory::clear((string) $context);
91 91
 
92
-		$cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' );
93
-		$cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order/base' );
92
+		$cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order');
93
+		$cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base');
94 94
 
95
-		\Aimeos\Admin\JsonAdm\Factory::setCache( $cache );
95
+		\Aimeos\Admin\JsonAdm\Factory::setCache($cache);
96 96
 
97
-		$this->assertNotSame( $cntlA1, $cntlA2 );
98
-		$this->assertNotSame( $cntlB1, $cntlB2 );
97
+		$this->assertNotSame($cntlA1, $cntlA2);
98
+		$this->assertNotSame($cntlB1, $cntlB2);
99 99
 	}
100 100
 
101 101
 
102 102
 	public function testClearSpecific()
103 103
 	{
104
-		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache( true );
104
+		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache(true);
105 105
 
106 106
 		$context = \TestHelperJadm::getContext();
107 107
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
108 108
 
109
-		$cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' );
110
-		$cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order/base' );
109
+		$cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order');
110
+		$cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base');
111 111
 
112
-		\Aimeos\Admin\JsonAdm\Factory::clear( (string) $context, 'order' );
112
+		\Aimeos\Admin\JsonAdm\Factory::clear((string) $context, 'order');
113 113
 
114
-		$cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' );
115
-		$cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order/base' );
114
+		$cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order');
115
+		$cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base');
116 116
 
117
-		\Aimeos\Admin\JsonAdm\Factory::setCache( $cache );
117
+		\Aimeos\Admin\JsonAdm\Factory::setCache($cache);
118 118
 
119
-		$this->assertNotSame( $cntlA1, $cntlA2 );
120
-		$this->assertSame( $cntlB1, $cntlB2 );
119
+		$this->assertNotSame($cntlA1, $cntlA2);
120
+		$this->assertSame($cntlB1, $cntlB2);
121 121
 	}
122 122
 
123 123
 }
124 124
\ No newline at end of file
Please login to merge, or discard this patch.