Completed
Push — master ( eb8dc7...b8be04 )
by Aimeos
02:39
created
admin/jsonadm/src/Admin/JsonAdm/Order/Base/Standard.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Text/Standard.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -107,17 +107,17 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Price/Standard.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -107,17 +107,17 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Factory.php 2 patches
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
 	 * @param integer $id Context ID the objects have been created with (string of \Aimeos\MShop\Context\Item\Iface)
34 34
 	 * @param string $path Path describing the client to clear, e.g. "product/lists/type"
35 35
 	 */
36
-	static public function clear( $id = null, $path = null )
36
+	static public function clear($id = null, $path = null)
37 37
 	{
38
-		if( $id !== null )
38
+		if ($id !== null)
39 39
 		{
40
-			if( $path !== null ) {
40
+			if ($path !== null) {
41 41
 				self::$clients[$id][$path] = null;
42 42
 			} else {
43 43
 				self::$clients[$id] = array();
@@ -64,47 +64,47 @@  discard block
 block discarded – undo
64 64
 	 * @param string|null $name Name of the client implementation ("Standard" if null)
65 65
 	 * @throws \Aimeos\Admin\JsonAdm\Exception If the given path is invalid
66 66
 	 */
67
-	static public function createClient( \Aimeos\MShop\Context\Item\Iface $context,
68
-		array $templatePaths, $path, $name = null )
67
+	static public function createClient(\Aimeos\MShop\Context\Item\Iface $context,
68
+		array $templatePaths, $path, $name = null)
69 69
 	{
70
-		$path = strtolower( trim( $path, "/ \n\t\r\0\x0B" ) );
70
+		$path = strtolower(trim($path, "/ \n\t\r\0\x0B"));
71 71
 
72
-		if( empty( $path ) ) {
73
-			return self::createClientRoot( $context, $context->getView(), $templatePaths, $path, $name );
72
+		if (empty($path)) {
73
+			return self::createClientRoot($context, $context->getView(), $templatePaths, $path, $name);
74 74
 		}
75 75
 
76 76
 		$id = (string) $context;
77 77
 
78
-		if( self::$cache === false || !isset( self::$clients[$id][$path] ) )
78
+		if (self::$cache === false || !isset(self::$clients[$id][$path]))
79 79
 		{
80
-			$parts = explode( '/', $path );
80
+			$parts = explode('/', $path);
81 81
 
82
-			foreach( $parts as $key => $part )
82
+			foreach ($parts as $key => $part)
83 83
 			{
84
-				if( ctype_alnum( $part ) === false )
84
+				if (ctype_alnum($part) === false)
85 85
 				{
86
-					$msg = sprintf( 'Invalid client "%1$s" in "%2$s"', $part, $path );
87
-					throw new \Aimeos\Admin\JsonAdm\Exception( $msg, 400 );
86
+					$msg = sprintf('Invalid client "%1$s" in "%2$s"', $part, $path);
87
+					throw new \Aimeos\Admin\JsonAdm\Exception($msg, 400);
88 88
 				}
89 89
 
90
-				$parts[$key] = ucwords( $part );
90
+				$parts[$key] = ucwords($part);
91 91
 			}
92 92
 
93 93
 
94 94
 			$view = $context->getView();
95
-			$factory = '\\Aimeos\\Admin\\JsonAdm\\' . join( '\\', $parts ) . '\\Factory';
95
+			$factory = '\\Aimeos\\Admin\\JsonAdm\\' . join('\\', $parts) . '\\Factory';
96 96
 
97
-			if( class_exists( $factory ) === true )
97
+			if (class_exists($factory) === true)
98 98
 			{
99
-				$args = array( $context, $view, $templatePaths, $path, $name );
99
+				$args = array($context, $view, $templatePaths, $path, $name);
100 100
 
101
-				if( ( $client = @call_user_func_array( array( $factory, 'createClient' ), $args ) ) === false ) {
102
-					throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid factory "%1$s"', $factory ), 400 );
101
+				if (($client = @call_user_func_array(array($factory, 'createClient'), $args)) === false) {
102
+					throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid factory "%1$s"', $factory), 400);
103 103
 				}
104 104
 			}
105 105
 			else
106 106
 			{
107
-				$client = self::createClientRoot( $context, $view, $templatePaths, $path, $name );
107
+				$client = self::createClientRoot($context, $view, $templatePaths, $path, $name);
108 108
 			}
109 109
 
110 110
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 * @param boolean $value True to enable caching, false to disable it.
122 122
 	 * @return boolean Previous cache setting
123 123
 	 */
124
-	static public function setCache( $value )
124
+	static public function setCache($value)
125 125
 	{
126 126
 		$old = self::$cache;
127 127
 		self::$cache = (boolean) $value;
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
 	 * @param string|null $name Name of the JsonAdm client (default: "Standard")
141 141
 	 * @throws \Aimeos\Admin\JsonAdm\Exception If the client couldn't be created
142 142
 	 */
143
-	protected static function createClientRoot( \Aimeos\MShop\Context\Item\Iface $context,
144
-		\Aimeos\MW\View\Iface $view, array $templatePaths, $path, $name = null )
143
+	protected static function createClientRoot(\Aimeos\MShop\Context\Item\Iface $context,
144
+		\Aimeos\MW\View\Iface $view, array $templatePaths, $path, $name = null)
145 145
 	{
146 146
 		/** admin/jsonadm/name
147 147
 		 * Class name of the used JSON API client implementation
@@ -176,20 +176,20 @@  discard block
 block discarded – undo
176 176
 		 * @since 2015.12
177 177
 		 * @category Developer
178 178
 		 */
179
-		if( $name === null ) {
180
-			$name = $context->getConfig()->get( 'admin/jsonadm/name', 'Standard' );
179
+		if ($name === null) {
180
+			$name = $context->getConfig()->get('admin/jsonadm/name', 'Standard');
181 181
 		}
182 182
 
183
-		if( ctype_alnum( $name ) === false )
183
+		if (ctype_alnum($name) === false)
184 184
 		{
185
-			$classname = is_string( $name ) ? '\\Aimeos\\Admin\\JsonAdm\\' . $name : '<not a string>';
186
-			throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid class name "%1$s"', $classname ) );
185
+			$classname = is_string($name) ? '\\Aimeos\\Admin\\JsonAdm\\' . $name : '<not a string>';
186
+			throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid class name "%1$s"', $classname));
187 187
 		}
188 188
 
189 189
 		$iface = '\\Aimeos\\Admin\\JsonAdm\\Iface';
190 190
 		$classname = '\\Aimeos\\Admin\\JsonAdm\\' . $name;
191 191
 
192
-		$client = self::createClientBase( $classname, $iface, $context, $view, $templatePaths, $path );
192
+		$client = self::createClientBase($classname, $iface, $context, $view, $templatePaths, $path);
193 193
 
194 194
 		/** admin/jsonadm/decorators/excludes
195 195
 		 * Excludes decorators added by the "common" option from the JSON API clients
@@ -269,6 +269,6 @@  discard block
 block discarded – undo
269 269
 		 * @see admin/jsonadm/decorators/global
270 270
 		 */
271 271
 
272
-		return self::addClientDecorators( $client, $context, $view, $templatePaths, $path );
272
+		return self::addClientDecorators($client, $context, $view, $templatePaths, $path);
273 273
 	}
274 274
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -101,8 +101,7 @@
 block discarded – undo
101 101
 				if( ( $client = @call_user_func_array( array( $factory, 'createClient' ), $args ) ) === false ) {
102 102
 					throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid factory "%1$s"', $factory ), 400 );
103 103
 				}
104
-			}
105
-			else
104
+			} else
106 105
 			{
107 106
 				$client = self::createClientRoot( $context, $view, $templatePaths, $path, $name );
108 107
 			}
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Base.php 3 patches
Spacing   +176 added lines, -176 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @param string $path Name of the client separated by slashes, e.g "product/stock"
35 35
 	 * @return void
36 36
 	 */
37
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path )
37
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path)
38 38
 	{
39 39
 		$this->view = $view;
40 40
 		$this->context = $context;
@@ -51,73 +51,73 @@  discard block
 block discarded – undo
51 51
 	 * @param integer &$status Variable which contains the HTTP status afterwards
52 52
 	 * @return string Content for response body
53 53
 	 */
54
-	public function delete( $body, array &$header, &$status )
54
+	public function delete($body, array &$header, &$status)
55 55
 	{
56
-		$header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' );
56
+		$header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"');
57 57
 		$context = $this->getContext();
58 58
 		$view = $this->getView();
59 59
 
60 60
 		try
61 61
 		{
62
-			$manager = \Aimeos\MShop\Factory::createManager( $context, $this->getPath() );
62
+			$manager = \Aimeos\MShop\Factory::createManager($context, $this->getPath());
63 63
 
64
-			if( ( $id = $view->param( 'id' ) ) == null )
64
+			if (($id = $view->param('id')) == null)
65 65
 			{
66
-				if( ( $request = json_decode( $body ) ) === null || !isset( $request->data ) || !is_array( $request->data ) ) {
67
-					throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid JSON in body' ), 400 );
66
+				if (($request = json_decode($body)) === null || !isset($request->data) || !is_array($request->data)) {
67
+					throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid JSON in body'), 400);
68 68
 				}
69 69
 
70 70
 				$ids = array();
71 71
 
72
-				foreach( $request->data as $entry )
72
+				foreach ($request->data as $entry)
73 73
 				{
74
-					if( isset( $entry->id ) ) {
74
+					if (isset($entry->id)) {
75 75
 						$ids[] = $entry->id;
76 76
 					}
77 77
 				}
78 78
 
79
-				$manager->deleteItems( $ids );
80
-				$view->total = count( $ids );
79
+				$manager->deleteItems($ids);
80
+				$view->total = count($ids);
81 81
 			}
82 82
 			else
83 83
 			{
84
-				$manager->deleteItem( $id );
84
+				$manager->deleteItem($id);
85 85
 				$view->total = 1;
86 86
 			}
87 87
 
88 88
 			$status = 200;
89 89
 		}
90
-		catch( \Aimeos\Admin\JsonAdm\Exception $e )
90
+		catch (\Aimeos\Admin\JsonAdm\Exception $e)
91 91
 		{
92 92
 			$status = $e->getCode();
93
-			$view->errors = array( array(
94
-				'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ),
93
+			$view->errors = array(array(
94
+				'title' => $context->getI18n()->dt('admin/jsonadm', $e->getMessage()),
95 95
 				'detail' => $e->getTraceAsString(),
96
-			) );
96
+			));
97 97
 		}
98
-		catch( \Aimeos\MAdmin\Exception $e )
98
+		catch (\Aimeos\MAdmin\Exception $e)
99 99
 		{
100 100
 			$status = 404;
101
-			$view->errors = array( array(
102
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
101
+			$view->errors = array(array(
102
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
103 103
 				'detail' => $e->getTraceAsString(),
104
-			) );
104
+			));
105 105
 		}
106
-		catch( \Aimeos\MShop\Exception $e )
106
+		catch (\Aimeos\MShop\Exception $e)
107 107
 		{
108 108
 			$status = 404;
109
-			$view->errors = array( array(
110
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
109
+			$view->errors = array(array(
110
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
111 111
 				'detail' => $e->getTraceAsString(),
112
-			) );
112
+			));
113 113
 		}
114
-		catch( \Exception $e )
114
+		catch (\Exception $e)
115 115
 		{
116 116
 			$status = 500;
117
-			$view->errors = array( array(
117
+			$view->errors = array(array(
118 118
 				'title' => $e->getMessage(),
119 119
 				'detail' => $e->getTraceAsString(),
120
-			) );
120
+			));
121 121
 		}
122 122
 
123 123
 		/** admin/jsonadm/standard/template-delete
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 		$tplconf = 'admin/jsonadm/standard/template-delete';
148 148
 		$default = 'delete-default.php';
149 149
 
150
-		return $view->render( $view->config( $tplconf, $default ) );
150
+		return $view->render($view->config($tplconf, $default));
151 151
 	}
152 152
 
153 153
 
@@ -159,60 +159,60 @@  discard block
 block discarded – undo
159 159
 	 * @param integer &$status Variable which contains the HTTP status afterwards
160 160
 	 * @return string Content for response body
161 161
 	 */
162
-	public function get( $body, array &$header, &$status )
162
+	public function get($body, array &$header, &$status)
163 163
 	{
164
-		$header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' );
164
+		$header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"');
165 165
 		$context = $this->getContext();
166 166
 		$view = $this->getView();
167 167
 		$total = 1;
168 168
 
169 169
 		try
170 170
 		{
171
-			$manager = \Aimeos\MShop\Factory::createManager( $context, $this->getPath() );
172
-			$include = ( ( $include = $view->param( 'include' ) ) !== null ? explode( ',', $include ) : array() );
171
+			$manager = \Aimeos\MShop\Factory::createManager($context, $this->getPath());
172
+			$include = (($include = $view->param('include')) !== null ? explode(',', $include) : array());
173 173
 
174
-			if( ( $id = $view->param( 'id' ) ) == null )
174
+			if (($id = $view->param('id')) == null)
175 175
 			{
176
-				$search = $this->initCriteria( $manager->createSearch(), $view->param() );
177
-				$view->data = $manager->searchItems( $search, array(), $total );
178
-				$view->childItems = $this->getChildItems( $view->data, $include );
179
-				$view->listItems = $this->getListItems( $view->data, $include );
176
+				$search = $this->initCriteria($manager->createSearch(), $view->param());
177
+				$view->data = $manager->searchItems($search, array(), $total);
178
+				$view->childItems = $this->getChildItems($view->data, $include);
179
+				$view->listItems = $this->getListItems($view->data, $include);
180 180
 			}
181 181
 			else
182 182
 			{
183
-				$view->data = $manager->getItem( $id, array() );
184
-				$view->childItems = $this->getChildItems( array( $id => $view->data ), $include );
185
-				$view->listItems = $this->getListItems( array( $id => $view->data ), $include );
183
+				$view->data = $manager->getItem($id, array());
184
+				$view->childItems = $this->getChildItems(array($id => $view->data), $include);
185
+				$view->listItems = $this->getListItems(array($id => $view->data), $include);
186 186
 			}
187 187
 
188
-			$view->refItems = $this->getRefItems( $view->listItems );
188
+			$view->refItems = $this->getRefItems($view->listItems);
189 189
 
190 190
 			$view->total = $total;
191 191
 			$status = 200;
192 192
 		}
193
-		catch( \Aimeos\MAdmin\Exception $e )
193
+		catch (\Aimeos\MAdmin\Exception $e)
194 194
 		{
195 195
 			$status = 404;
196
-			$view->errors = array( array(
197
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
196
+			$view->errors = array(array(
197
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
198 198
 				'detail' => $e->getTraceAsString(),
199
-			) );
199
+			));
200 200
 		}
201
-		catch( \Aimeos\MShop\Exception $e )
201
+		catch (\Aimeos\MShop\Exception $e)
202 202
 		{
203 203
 			$status = 404;
204
-			$view->errors = array( array(
205
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
204
+			$view->errors = array(array(
205
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
206 206
 				'detail' => $e->getTraceAsString(),
207
-			) );
207
+			));
208 208
 		}
209
-		catch( \Exception $e )
209
+		catch (\Exception $e)
210 210
 		{
211 211
 			$status = 500;
212
-			$view->errors = array( array(
212
+			$view->errors = array(array(
213 213
 				'title' => $e->getMessage(),
214 214
 				'detail' => $e->getTraceAsString(),
215
-			) );
215
+			));
216 216
 		}
217 217
 
218 218
 		/** admin/jsonadm/standard/template-get
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 		$tplconf = 'admin/jsonadm/standard/template-get';
243 243
 		$default = 'get-default.php';
244 244
 
245
-		return $view->render( $view->config( $tplconf, $default ) );
245
+		return $view->render($view->config($tplconf, $default));
246 246
 	}
247 247
 
248 248
 
@@ -254,54 +254,54 @@  discard block
 block discarded – undo
254 254
 	 * @param integer &$status Variable which contains the HTTP status afterwards
255 255
 	 * @return string Content for response body
256 256
 	 */
257
-	public function patch( $body, array &$header, &$status )
257
+	public function patch($body, array &$header, &$status)
258 258
 	{
259
-		$header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' );
259
+		$header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"');
260 260
 		$context = $this->getContext();
261 261
 		$view = $this->getView();
262 262
 
263 263
 		try
264 264
 		{
265
-			if( ( $request = json_decode( $body ) ) === null || !isset( $request->data ) ) {
266
-				throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid JSON in body' ), 400 );
265
+			if (($request = json_decode($body)) === null || !isset($request->data)) {
266
+				throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid JSON in body'), 400);
267 267
 			}
268 268
 
269 269
 			$data = null;
270
-			$manager = \Aimeos\MShop\Factory::createManager( $context, $this->getPath() );
270
+			$manager = \Aimeos\MShop\Factory::createManager($context, $this->getPath());
271 271
 
272
-			if( is_array( $request->data ) )
272
+			if (is_array($request->data))
273 273
 			{
274 274
 				$data = array();
275 275
 
276
-				foreach( $request->data as $entry )
276
+				foreach ($request->data as $entry)
277 277
 				{
278
-					if( isset( $entry->attributes ) && isset( $entry->id ) )
278
+					if (isset($entry->attributes) && isset($entry->id))
279 279
 					{
280
-						$item = $manager->getItem( $entry->id );
281
-						$item->fromArray( (array) $entry->attributes );
280
+						$item = $manager->getItem($entry->id);
281
+						$item->fromArray((array) $entry->attributes);
282 282
 
283
-						$manager->saveItem( $item );
284
-						$data[] = $manager->getItem( $entry->id );
283
+						$manager->saveItem($item);
284
+						$data[] = $manager->getItem($entry->id);
285 285
 					}
286 286
 				}
287 287
 
288 288
 				$view->data = $data;
289
-				$view->total = count( $data );
289
+				$view->total = count($data);
290 290
 				$header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"';
291 291
 			}
292 292
 			else
293 293
 			{
294
-				if( ( $id = $view->param( 'id' ) ) == null ) {
295
-					throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 );
294
+				if (($id = $view->param('id')) == null) {
295
+					throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('No ID given'), 400);
296 296
 				}
297 297
 
298
-				if( isset( $request->data->attributes ) )
298
+				if (isset($request->data->attributes))
299 299
 				{
300
-					$item = $manager->getItem( $id );
301
-					$item->fromArray( (array) $request->data->attributes );
300
+					$item = $manager->getItem($id);
301
+					$item->fromArray((array) $request->data->attributes);
302 302
 
303
-					$manager->saveItem( $item );
304
-					$data = $manager->getItem( $id );
303
+					$manager->saveItem($item);
304
+					$data = $manager->getItem($id);
305 305
 				}
306 306
 
307 307
 				$view->data = $data;
@@ -310,37 +310,37 @@  discard block
 block discarded – undo
310 310
 
311 311
 			$status = 200;
312 312
 		}
313
-		catch( \Aimeos\Admin\JsonAdm\Exception $e )
313
+		catch (\Aimeos\Admin\JsonAdm\Exception $e)
314 314
 		{
315 315
 			$status = $e->getCode();
316
-			$view->errors = array( array(
317
-				'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ),
316
+			$view->errors = array(array(
317
+				'title' => $context->getI18n()->dt('admin/jsonadm', $e->getMessage()),
318 318
 				'detail' => $e->getTraceAsString(),
319
-			) );
319
+			));
320 320
 		}
321
-		catch( \Aimeos\MAdmin\Exception $e )
321
+		catch (\Aimeos\MAdmin\Exception $e)
322 322
 		{
323 323
 			$status = 404;
324
-			$view->errors = array( array(
325
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
324
+			$view->errors = array(array(
325
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
326 326
 				'detail' => $e->getTraceAsString(),
327
-			) );
327
+			));
328 328
 		}
329
-		catch( \Aimeos\MShop\Exception $e )
329
+		catch (\Aimeos\MShop\Exception $e)
330 330
 		{
331 331
 			$status = 404;
332
-			$view->errors = array( array(
333
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
332
+			$view->errors = array(array(
333
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
334 334
 				'detail' => $e->getTraceAsString(),
335
-			) );
335
+			));
336 336
 		}
337
-		catch( \Aimeos\MW\Exception $e )
337
+		catch (\Aimeos\MW\Exception $e)
338 338
 		{
339 339
 			$status = 500;
340
-			$view->errors = array( array(
340
+			$view->errors = array(array(
341 341
 				'title' => $e->getMessage(),
342 342
 				'detail' => $e->getTraceAsString(),
343
-			) );
343
+			));
344 344
 		}
345 345
 
346 346
 		/** admin/jsonadm/standard/template-patch
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 		$tplconf = 'admin/jsonadm/standard/template-patch';
371 371
 		$default = 'patch-default.php';
372 372
 
373
-		return $view->render( $view->config( $tplconf, $default ) );
373
+		return $view->render($view->config($tplconf, $default));
374 374
 	}
375 375
 
376 376
 
@@ -382,54 +382,54 @@  discard block
 block discarded – undo
382 382
 	 * @param integer &$status Variable which contains the HTTP status afterwards
383 383
 	 * @return string Content for response body
384 384
 	 */
385
-	public function post( $body, array &$header, &$status )
385
+	public function post($body, array &$header, &$status)
386 386
 	{
387
-		$header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' );
387
+		$header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"');
388 388
 		$context = $this->getContext();
389 389
 		$view = $this->getView();
390 390
 
391 391
 		try
392 392
 		{
393
-			if( ( $request = json_decode( $body ) ) === null || !isset( $request->data ) ) {
394
-				throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid JSON in body' ), 400 );
393
+			if (($request = json_decode($body)) === null || !isset($request->data)) {
394
+				throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid JSON in body'), 400);
395 395
 			}
396 396
 
397
-			if( isset( $request->data->id ) || $view->param( 'id' ) != null ) {
398
-				throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Client generated IDs are not supported' ), 403 );
397
+			if (isset($request->data->id) || $view->param('id') != null) {
398
+				throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Client generated IDs are not supported'), 403);
399 399
 			}
400 400
 
401 401
 			$data = null;
402
-			$manager = \Aimeos\MShop\Factory::createManager( $context, $this->getPath() );
402
+			$manager = \Aimeos\MShop\Factory::createManager($context, $this->getPath());
403 403
 
404
-			if( is_array( $request->data ) )
404
+			if (is_array($request->data))
405 405
 			{
406 406
 				$data = array();
407 407
 
408
-				foreach( $request->data as $entry )
408
+				foreach ($request->data as $entry)
409 409
 				{
410
-					if( isset( $entry->attributes ) )
410
+					if (isset($entry->attributes))
411 411
 					{
412 412
 						$item = $manager->createItem();
413
-						$item->fromArray( (array) $entry->attributes );
413
+						$item->fromArray((array) $entry->attributes);
414 414
 
415
-						$manager->saveItem( $item );
416
-						$data[] = $manager->getItem( $item->getId() );
415
+						$manager->saveItem($item);
416
+						$data[] = $manager->getItem($item->getId());
417 417
 					}
418 418
 				}
419 419
 
420 420
 				$view->data = $data;
421
-				$view->total = count( $data );
421
+				$view->total = count($data);
422 422
 				$header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"';
423 423
 			}
424 424
 			else
425 425
 			{
426
-				if( isset( $request->data->attributes ) )
426
+				if (isset($request->data->attributes))
427 427
 				{
428 428
 					$item = $manager->createItem();
429
-					$item->fromArray( (array) $request->data->attributes );
429
+					$item->fromArray((array) $request->data->attributes);
430 430
 
431
-					$manager->saveItem( $item );
432
-					$data = $manager->getItem( $item->getId() );
431
+					$manager->saveItem($item);
432
+					$data = $manager->getItem($item->getId());
433 433
 				}
434 434
 
435 435
 				$view->data = $data;
@@ -438,37 +438,37 @@  discard block
 block discarded – undo
438 438
 
439 439
 			$status = 201;
440 440
 		}
441
-		catch( \Aimeos\Admin\JsonAdm\Exception $e )
441
+		catch (\Aimeos\Admin\JsonAdm\Exception $e)
442 442
 		{
443 443
 			$status = $e->getCode();
444
-			$view->errors = array( array(
445
-				'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ),
444
+			$view->errors = array(array(
445
+				'title' => $context->getI18n()->dt('admin/jsonadm', $e->getMessage()),
446 446
 				'detail' => $e->getTraceAsString(),
447
-			) );
447
+			));
448 448
 		}
449
-		catch( \Aimeos\MAdmin\Exception $e )
449
+		catch (\Aimeos\MAdmin\Exception $e)
450 450
 		{
451 451
 			$status = 404;
452
-			$view->errors = array( array(
453
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
452
+			$view->errors = array(array(
453
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
454 454
 				'detail' => $e->getTraceAsString(),
455
-			) );
455
+			));
456 456
 		}
457
-		catch( \Aimeos\MShop\Exception $e )
457
+		catch (\Aimeos\MShop\Exception $e)
458 458
 		{
459 459
 			$status = 404;
460
-			$view->errors = array( array(
461
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
460
+			$view->errors = array(array(
461
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
462 462
 				'detail' => $e->getTraceAsString(),
463
-			) );
463
+			));
464 464
 		}
465
-		catch( \Exception $e )
465
+		catch (\Exception $e)
466 466
 		{
467 467
 			$status = 500;
468
-			$view->errors = array( array(
468
+			$view->errors = array(array(
469 469
 				'title' => $e->getMessage(),
470 470
 				'detail' => $e->getTraceAsString(),
471
-			) );
471
+			));
472 472
 		}
473 473
 
474 474
 		/** admin/jsonadm/standard/template-post
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 		$tplconf = 'admin/jsonadm/standard/template-post';
499 499
 		$default = 'post-default.php';
500 500
 
501
-		return $view->render( $view->config( $tplconf, $default ) );
501
+		return $view->render($view->config($tplconf, $default));
502 502
 	}
503 503
 
504 504
 
@@ -510,17 +510,17 @@  discard block
 block discarded – undo
510 510
 	 * @param integer &$status Variable which contains the HTTP status afterwards
511 511
 	 * @return string Content for response body
512 512
 	 */
513
-	public function put( $body, array &$header, &$status )
513
+	public function put($body, array &$header, &$status)
514 514
 	{
515
-		$header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' );
515
+		$header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"');
516 516
 		$status = 501;
517 517
 
518 518
 		$context = $this->getContext();
519 519
 		$view = $this->getView();
520 520
 
521
-		$view->errors = array( array(
522
-			'title' => $context->getI18n()->dt( 'admin/jsonadm', 'Not implemented, use PATCH instead' ),
523
-		) );
521
+		$view->errors = array(array(
522
+			'title' => $context->getI18n()->dt('admin/jsonadm', 'Not implemented, use PATCH instead'),
523
+		));
524 524
 
525 525
 		/** admin/jsonadm/standard/template-put
526 526
 		 * Relative path to the JSON API template for PUT requests
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 		$tplconf = 'admin/jsonadm/standard/template-put';
550 550
 		$default = 'put-default.php';
551 551
 
552
-		return $view->render( $view->config( $tplconf, $default ) );
552
+		return $view->render($view->config($tplconf, $default));
553 553
 	}
554 554
 
555 555
 
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 	 * @param integer &$status Variable which contains the HTTP status afterwards
562 562
 	 * @return string Content for response body
563 563
 	 */
564
-	public function options( $body, array &$header, &$status )
564
+	public function options($body, array &$header, &$status)
565 565
 	{
566 566
 		$context = $this->getContext();
567 567
 		$view = $this->getView();
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 		{
571 571
 			$resources = $attributes = array();
572 572
 
573
-			if( ( $domains = $view->param( 'resource' ) ) == '' )
573
+			if (($domains = $view->param('resource')) == '')
574 574
 			{
575 575
 				/** admin/jsonadm/domains
576 576
 				 * A list of domain names whose clients are available for the JSON API
@@ -592,14 +592,14 @@  discard block
 block discarded – undo
592 592
 					'attribute', 'catalog', 'coupon', 'customer', 'locale', 'media',
593 593
 					'order', 'plugin', 'price', 'product', 'service', 'supplier', 'tag', 'text'
594 594
 				);
595
-				$domains = $context->getConfig()->get( 'admin/jsonadm/domains', $default );
595
+				$domains = $context->getConfig()->get('admin/jsonadm/domains', $default);
596 596
 			}
597 597
 
598
-			foreach( (array) $domains as $domain )
598
+			foreach ((array) $domains as $domain)
599 599
 			{
600
-				$manager = \Aimeos\MShop\Factory::createManager( $context, $domain );
601
-				$resources = array_merge( $resources, $manager->getResourceType( true ) );
602
-				$attributes = array_merge( $attributes, $manager->getSearchAttributes( true ) );
600
+				$manager = \Aimeos\MShop\Factory::createManager($context, $domain);
601
+				$resources = array_merge($resources, $manager->getResourceType(true));
602
+				$attributes = array_merge($attributes, $manager->getSearchAttributes(true));
603 603
 			}
604 604
 
605 605
 			$view->resources = $resources;
@@ -611,29 +611,29 @@  discard block
 block discarded – undo
611 611
 			);
612 612
 			$status = 200;
613 613
 		}
614
-		catch( \Aimeos\MAdmin\Exception $e )
614
+		catch (\Aimeos\MAdmin\Exception $e)
615 615
 		{
616 616
 			$status = 404;
617
-			$view->errors = array( array(
618
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
617
+			$view->errors = array(array(
618
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
619 619
 				'detail' => $e->getTraceAsString(),
620
-			) );
620
+			));
621 621
 		}
622
-		catch( \Aimeos\MShop\Exception $e )
622
+		catch (\Aimeos\MShop\Exception $e)
623 623
 		{
624 624
 			$status = 404;
625
-			$view->errors = array( array(
626
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
625
+			$view->errors = array(array(
626
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
627 627
 				'detail' => $e->getTraceAsString(),
628
-			) );
628
+			));
629 629
 		}
630
-		catch( \Exception $e )
630
+		catch (\Exception $e)
631 631
 		{
632 632
 			$status = 500;
633
-			$view->errors = array( array(
633
+			$view->errors = array(array(
634 634
 				'title' => $e->getMessage(),
635 635
 				'detail' => $e->getTraceAsString(),
636
-			) );
636
+			));
637 637
 		}
638 638
 
639 639
 		/** admin/jsonadm/standard/template-options
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 		$tplconf = 'admin/jsonadm/standard/template-options';
664 664
 		$default = 'options-default.php';
665 665
 
666
-		return $view->render( $view->config( $tplconf, $default ) );
666
+		return $view->render($view->config($tplconf, $default));
667 667
 	}
668 668
 
669 669
 
@@ -685,11 +685,11 @@  discard block
 block discarded – undo
685 685
 	 * @param array $params List of criteria data with condition, sorting and paging
686 686
 	 * @return \Aimeos\MW\Criteria\Iface Initialized criteria object
687 687
 	 */
688
-	protected function initCriteria( \Aimeos\MW\Criteria\Iface $criteria, array $params )
688
+	protected function initCriteria(\Aimeos\MW\Criteria\Iface $criteria, array $params)
689 689
 	{
690
-		$this->initCriteriaConditions( $criteria, $params );
691
-		$this->initCriteriaSortations( $criteria, $params );
692
-		$this->initCriteriaSlice( $criteria, $params );
690
+		$this->initCriteriaConditions($criteria, $params);
691
+		$this->initCriteriaSortations($criteria, $params);
692
+		$this->initCriteriaSlice($criteria, $params);
693 693
 
694 694
 		return $criteria;
695 695
 	}
@@ -701,15 +701,15 @@  discard block
 block discarded – undo
701 701
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
702 702
 	 * @param array $params List of criteria data with condition, sorting and paging
703 703
 	 */
704
-	private function initCriteriaConditions( \Aimeos\MW\Criteria\Iface $criteria, array $params )
704
+	private function initCriteriaConditions(\Aimeos\MW\Criteria\Iface $criteria, array $params)
705 705
 	{
706
-		if( isset( $params['filter'] ) && is_array( $params['filter'] ) )
706
+		if (isset($params['filter']) && is_array($params['filter']))
707 707
 		{
708 708
 			$existing = $criteria->getConditions();
709
-			$criteria->setConditions( $criteria->toConditions( (array) $params['filter'] ) );
709
+			$criteria->setConditions($criteria->toConditions((array) $params['filter']));
710 710
 
711
-			$expr = array( $criteria->getConditions(), $existing );
712
-			$criteria->setConditions( $criteria->combine( '&&', $expr ) );
711
+			$expr = array($criteria->getConditions(), $existing);
712
+			$criteria->setConditions($criteria->combine('&&', $expr));
713 713
 		}
714 714
 	}
715 715
 
@@ -720,12 +720,12 @@  discard block
 block discarded – undo
720 720
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
721 721
 	 * @param array $params List of criteria data with condition, sorting and paging
722 722
 	 */
723
-	private function initCriteriaSlice( \Aimeos\MW\Criteria\Iface $criteria, array $params )
723
+	private function initCriteriaSlice(\Aimeos\MW\Criteria\Iface $criteria, array $params)
724 724
 	{
725
-		$start = ( isset( $params['page']['offset'] ) ? $params['page']['offset'] : 0 );
726
-		$size = ( isset( $params['page']['limit'] ) ? $params['page']['limit'] : 25 );
725
+		$start = (isset($params['page']['offset']) ? $params['page']['offset'] : 0);
726
+		$size = (isset($params['page']['limit']) ? $params['page']['limit'] : 25);
727 727
 
728
-		$criteria->setSlice( $start, $size );
728
+		$criteria->setSlice($start, $size);
729 729
 	}
730 730
 
731 731
 
@@ -735,24 +735,24 @@  discard block
 block discarded – undo
735 735
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
736 736
 	 * @param array $params List of criteria data with condition, sorting and paging
737 737
 	 */
738
-	private function initCriteriaSortations( \Aimeos\MW\Criteria\Iface $criteria, array $params )
738
+	private function initCriteriaSortations(\Aimeos\MW\Criteria\Iface $criteria, array $params)
739 739
 	{
740
-		if( !isset( $params['sort'] ) ) {
740
+		if (!isset($params['sort'])) {
741 741
 			return;
742 742
 		}
743 743
 
744 744
 		$sortation = array();
745 745
 
746
-		foreach( explode( ',', $params['sort'] ) as $sort )
746
+		foreach (explode(',', $params['sort']) as $sort)
747 747
 		{
748
-			if( $sort[0] === '-' ) {
749
-				$sortation[] = $criteria->sort( '-', substr( $sort, 1 ) );
748
+			if ($sort[0] === '-') {
749
+				$sortation[] = $criteria->sort('-', substr($sort, 1));
750 750
 			} else {
751
-				$sortation[] = $criteria->sort( '+', $sort ); break;
751
+				$sortation[] = $criteria->sort('+', $sort); break;
752 752
 			}
753 753
 		}
754 754
 
755
-		$criteria->setSortations( $sortation );
755
+		$criteria->setSortations($sortation);
756 756
 	}
757 757
 
758 758
 
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
 	 * @param array $include List of resource types that should be fetched
764 764
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
765 765
 	 */
766
-	protected function getChildItems( array $items, array $include )
766
+	protected function getChildItems(array $items, array $include)
767 767
 	{
768 768
 		return array();
769 769
 	}
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 	 * @param array $include List of resource types that should be fetched
777 777
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
778 778
 	 */
779
-	protected function getListItems( array $items, array $include )
779
+	protected function getListItems(array $items, array $include)
780 780
 	{
781 781
 		return array();
782 782
 	}
@@ -788,22 +788,22 @@  discard block
 block discarded – undo
788 788
 	 * @param array $items List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
789 789
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
790 790
 	 */
791
-	protected function getRefItems( array $listItems )
791
+	protected function getRefItems(array $listItems)
792 792
 	{
793 793
 		$list = $map = array();
794 794
 
795
-		foreach( $listItems as $listItem ) {
795
+		foreach ($listItems as $listItem) {
796 796
 			$map[$listItem->getDomain()][] = $listItem->getRefId();
797 797
 		}
798 798
 
799
-		foreach( $map as $domain => $ids )
799
+		foreach ($map as $domain => $ids)
800 800
 		{
801
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $domain );
801
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $domain);
802 802
 
803 803
 			$search = $manager->createSearch();
804
-			$search->setConditions( $search->compare( '==', $domain . '.id', $ids ) );
804
+			$search->setConditions($search->compare('==', $domain . '.id', $ids));
805 805
 
806
-			$list = array_merge( $list, $manager->searchItems( $search ) );
806
+			$list = array_merge($list, $manager->searchItems($search));
807 807
 		}
808 808
 
809 809
 		return $list;
Please login to merge, or discard this patch.
Braces   +22 added lines, -44 removed lines patch added patch discarded remove patch
@@ -78,40 +78,35 @@  discard block
 block discarded – undo
78 78
 
79 79
 				$manager->deleteItems( $ids );
80 80
 				$view->total = count( $ids );
81
-			}
82
-			else
81
+			} else
83 82
 			{
84 83
 				$manager->deleteItem( $id );
85 84
 				$view->total = 1;
86 85
 			}
87 86
 
88 87
 			$status = 200;
89
-		}
90
-		catch( \Aimeos\Admin\JsonAdm\Exception $e )
88
+		} catch( \Aimeos\Admin\JsonAdm\Exception $e )
91 89
 		{
92 90
 			$status = $e->getCode();
93 91
 			$view->errors = array( array(
94 92
 				'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ),
95 93
 				'detail' => $e->getTraceAsString(),
96 94
 			) );
97
-		}
98
-		catch( \Aimeos\MAdmin\Exception $e )
95
+		} catch( \Aimeos\MAdmin\Exception $e )
99 96
 		{
100 97
 			$status = 404;
101 98
 			$view->errors = array( array(
102 99
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
103 100
 				'detail' => $e->getTraceAsString(),
104 101
 			) );
105
-		}
106
-		catch( \Aimeos\MShop\Exception $e )
102
+		} catch( \Aimeos\MShop\Exception $e )
107 103
 		{
108 104
 			$status = 404;
109 105
 			$view->errors = array( array(
110 106
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
111 107
 				'detail' => $e->getTraceAsString(),
112 108
 			) );
113
-		}
114
-		catch( \Exception $e )
109
+		} catch( \Exception $e )
115 110
 		{
116 111
 			$status = 500;
117 112
 			$view->errors = array( array(
@@ -177,8 +172,7 @@  discard block
 block discarded – undo
177 172
 				$view->data = $manager->searchItems( $search, array(), $total );
178 173
 				$view->childItems = $this->getChildItems( $view->data, $include );
179 174
 				$view->listItems = $this->getListItems( $view->data, $include );
180
-			}
181
-			else
175
+			} else
182 176
 			{
183 177
 				$view->data = $manager->getItem( $id, array() );
184 178
 				$view->childItems = $this->getChildItems( array( $id => $view->data ), $include );
@@ -189,24 +183,21 @@  discard block
 block discarded – undo
189 183
 
190 184
 			$view->total = $total;
191 185
 			$status = 200;
192
-		}
193
-		catch( \Aimeos\MAdmin\Exception $e )
186
+		} catch( \Aimeos\MAdmin\Exception $e )
194 187
 		{
195 188
 			$status = 404;
196 189
 			$view->errors = array( array(
197 190
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
198 191
 				'detail' => $e->getTraceAsString(),
199 192
 			) );
200
-		}
201
-		catch( \Aimeos\MShop\Exception $e )
193
+		} catch( \Aimeos\MShop\Exception $e )
202 194
 		{
203 195
 			$status = 404;
204 196
 			$view->errors = array( array(
205 197
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
206 198
 				'detail' => $e->getTraceAsString(),
207 199
 			) );
208
-		}
209
-		catch( \Exception $e )
200
+		} catch( \Exception $e )
210 201
 		{
211 202
 			$status = 500;
212 203
 			$view->errors = array( array(
@@ -288,8 +279,7 @@  discard block
 block discarded – undo
288 279
 				$view->data = $data;
289 280
 				$view->total = count( $data );
290 281
 				$header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"';
291
-			}
292
-			else
282
+			} else
293 283
 			{
294 284
 				if( ( $id = $view->param( 'id' ) ) == null ) {
295 285
 					throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 );
@@ -309,32 +299,28 @@  discard block
 block discarded – undo
309 299
 			}
310 300
 
311 301
 			$status = 200;
312
-		}
313
-		catch( \Aimeos\Admin\JsonAdm\Exception $e )
302
+		} catch( \Aimeos\Admin\JsonAdm\Exception $e )
314 303
 		{
315 304
 			$status = $e->getCode();
316 305
 			$view->errors = array( array(
317 306
 				'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ),
318 307
 				'detail' => $e->getTraceAsString(),
319 308
 			) );
320
-		}
321
-		catch( \Aimeos\MAdmin\Exception $e )
309
+		} catch( \Aimeos\MAdmin\Exception $e )
322 310
 		{
323 311
 			$status = 404;
324 312
 			$view->errors = array( array(
325 313
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
326 314
 				'detail' => $e->getTraceAsString(),
327 315
 			) );
328
-		}
329
-		catch( \Aimeos\MShop\Exception $e )
316
+		} catch( \Aimeos\MShop\Exception $e )
330 317
 		{
331 318
 			$status = 404;
332 319
 			$view->errors = array( array(
333 320
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
334 321
 				'detail' => $e->getTraceAsString(),
335 322
 			) );
336
-		}
337
-		catch( \Aimeos\MW\Exception $e )
323
+		} catch( \Aimeos\MW\Exception $e )
338 324
 		{
339 325
 			$status = 500;
340 326
 			$view->errors = array( array(
@@ -420,8 +406,7 @@  discard block
 block discarded – undo
420 406
 				$view->data = $data;
421 407
 				$view->total = count( $data );
422 408
 				$header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"';
423
-			}
424
-			else
409
+			} else
425 410
 			{
426 411
 				if( isset( $request->data->attributes ) )
427 412
 				{
@@ -437,32 +422,28 @@  discard block
 block discarded – undo
437 422
 			}
438 423
 
439 424
 			$status = 201;
440
-		}
441
-		catch( \Aimeos\Admin\JsonAdm\Exception $e )
425
+		} catch( \Aimeos\Admin\JsonAdm\Exception $e )
442 426
 		{
443 427
 			$status = $e->getCode();
444 428
 			$view->errors = array( array(
445 429
 				'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ),
446 430
 				'detail' => $e->getTraceAsString(),
447 431
 			) );
448
-		}
449
-		catch( \Aimeos\MAdmin\Exception $e )
432
+		} catch( \Aimeos\MAdmin\Exception $e )
450 433
 		{
451 434
 			$status = 404;
452 435
 			$view->errors = array( array(
453 436
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
454 437
 				'detail' => $e->getTraceAsString(),
455 438
 			) );
456
-		}
457
-		catch( \Aimeos\MShop\Exception $e )
439
+		} catch( \Aimeos\MShop\Exception $e )
458 440
 		{
459 441
 			$status = 404;
460 442
 			$view->errors = array( array(
461 443
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
462 444
 				'detail' => $e->getTraceAsString(),
463 445
 			) );
464
-		}
465
-		catch( \Exception $e )
446
+		} catch( \Exception $e )
466 447
 		{
467 448
 			$status = 500;
468 449
 			$view->errors = array( array(
@@ -610,24 +591,21 @@  discard block
 block discarded – undo
610 591
 				'Allow' => 'DELETE,GET,POST,OPTIONS'
611 592
 			);
612 593
 			$status = 200;
613
-		}
614
-		catch( \Aimeos\MAdmin\Exception $e )
594
+		} catch( \Aimeos\MAdmin\Exception $e )
615 595
 		{
616 596
 			$status = 404;
617 597
 			$view->errors = array( array(
618 598
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
619 599
 				'detail' => $e->getTraceAsString(),
620 600
 			) );
621
-		}
622
-		catch( \Aimeos\MShop\Exception $e )
601
+		} catch( \Aimeos\MShop\Exception $e )
623 602
 		{
624 603
 			$status = 404;
625 604
 			$view->errors = array( array(
626 605
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
627 606
 				'detail' => $e->getTraceAsString(),
628 607
 			) );
629
-		}
630
-		catch( \Exception $e )
608
+		} catch( \Exception $e )
631 609
 		{
632 610
 			$status = 500;
633 611
 			$view->errors = array( array(
Please login to merge, or discard this patch.
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -49,6 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @param string $body Request body
50 50
 	 * @param array &$header Variable which contains the HTTP headers and the new ones afterwards
51 51
 	 * @param integer &$status Variable which contains the HTTP status afterwards
52
+	 * @param integer $status
52 53
 	 * @return string Content for response body
53 54
 	 */
54 55
 	public function delete( $body, array &$header, &$status )
@@ -252,6 +253,7 @@  discard block
 block discarded – undo
252 253
 	 * @param string $body Request body
253 254
 	 * @param array &$header Variable which contains the HTTP headers and the new ones afterwards
254 255
 	 * @param integer &$status Variable which contains the HTTP status afterwards
256
+	 * @param integer $status
255 257
 	 * @return string Content for response body
256 258
 	 */
257 259
 	public function patch( $body, array &$header, &$status )
@@ -380,6 +382,7 @@  discard block
 block discarded – undo
380 382
 	 * @param string $body Request body
381 383
 	 * @param array &$header Variable which contains the HTTP headers and the new ones afterwards
382 384
 	 * @param integer &$status Variable which contains the HTTP status afterwards
385
+	 * @param integer $status
383 386
 	 * @return string Content for response body
384 387
 	 */
385 388
 	public function post( $body, array &$header, &$status )
@@ -508,6 +511,7 @@  discard block
 block discarded – undo
508 511
 	 * @param string $body Request body
509 512
 	 * @param array &$header Variable which contains the HTTP headers and the new ones afterwards
510 513
 	 * @param integer &$status Variable which contains the HTTP status afterwards
514
+	 * @param integer $status
511 515
 	 * @return string Content for response body
512 516
 	 */
513 517
 	public function put( $body, array &$header, &$status )
@@ -559,6 +563,7 @@  discard block
 block discarded – undo
559 563
 	 * @param string $body Request body
560 564
 	 * @param array &$header Variable which contains the HTTP headers and the new ones afterwards
561 565
 	 * @param integer &$status Variable which contains the HTTP status afterwards
566
+	 * @param integer $status
562 567
 	 * @return string Content for response body
563 568
 	 */
564 569
 	public function options( $body, array &$header, &$status )
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Attribute/Standard.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -107,17 +107,17 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Service/Standard.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -107,17 +107,17 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Media/Standard.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -107,17 +107,17 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
admin/jsonadm/src/MW/View/Helper/Jsonadmlinks/Standard.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -33,15 +33,15 @@  discard block
 block discarded – undo
33 33
 	 *
34 34
 	 * @param \Aimeos\MW\View\Iface $view View instance with registered view helpers
35 35
 	 */
36
-	public function __construct( \Aimeos\MW\View\Iface $view )
36
+	public function __construct(\Aimeos\MW\View\Iface $view)
37 37
 	{
38
-		parent::__construct( $view );
38
+		parent::__construct($view);
39 39
 
40
-		$this->target = $this->config( 'admin/jsonadm/url/target' );
41
-		$this->cntl = $this->config( 'admin/jsonadm/url/controller', 'jsonadm' );
42
-		$this->action = $this->config( 'admin/jsonadm/url/action', 'get' );
43
-		$this->config = $this->config( 'admin/jsonadm/url/config', array() );
44
-		$this->maxlimit = $this->config( 'admin/jsonadm/limit', 100 );
40
+		$this->target = $this->config('admin/jsonadm/url/target');
41
+		$this->cntl = $this->config('admin/jsonadm/url/controller', 'jsonadm');
42
+		$this->action = $this->config('admin/jsonadm/url/action', 'get');
43
+		$this->config = $this->config('admin/jsonadm/url/config', array());
44
+		$this->maxlimit = $this->config('admin/jsonadm/limit', 100);
45 45
 	}
46 46
 
47 47
 
@@ -52,46 +52,46 @@  discard block
 block discarded – undo
52 52
 	 * @param integer $total Total number of items
53 53
 	 * @return array List of pagination links
54 54
 	 */
55
-	public function transform( array $params, $total )
55
+	public function transform(array $params, $total)
56 56
 	{
57
-		$ref = array( 'id', 'resource', 'filter', 'page', 'sort', 'include', 'fields' );
58
-		$params = array_intersect_key( $params, array_flip( $ref ) );
57
+		$ref = array('id', 'resource', 'filter', 'page', 'sort', 'include', 'fields');
58
+		$params = array_intersect_key($params, array_flip($ref));
59 59
 
60 60
 		// set explicitly as workaround for the Laravel router bugs
61
-		if( !isset( $params['id'] ) ) {
61
+		if (!isset($params['id'])) {
62 62
 			$params['id'] = '';
63 63
 		}
64 64
 
65
-		$total = $this->get( 'total', 0 );
66
-		$offset = ( isset( $params['offset'] ) ? max( (int) $params['offset'], 0 ) : 0 );
67
-		$limit = ( isset( $params['limit'] ) ? max( (int) $params['limit'], 1 ) : $this->maxlimit );
65
+		$total = $this->get('total', 0);
66
+		$offset = (isset($params['offset']) ? max((int) $params['offset'], 0) : 0);
67
+		$limit = (isset($params['limit']) ? max((int) $params['limit'], 1) : $this->maxlimit);
68 68
 
69
-		if( $offset > 0 )
69
+		if ($offset > 0)
70 70
 		{
71 71
 			$params['page']['offset'] = 0;
72
-			$list['first'] = $this->url( $this->target, $this->cntl, $this->action, $params, array(), $this->config );
72
+			$list['first'] = $this->url($this->target, $this->cntl, $this->action, $params, array(), $this->config);
73 73
 		}
74 74
 
75
-		if( ( $num = $offset - $limit ) >= 0 )
75
+		if (($num = $offset - $limit) >= 0)
76 76
 		{
77 77
 			$params['page']['offset'] = $num;
78
-			$list['prev'] = $this->url( $this->target, $this->cntl, $this->action, $params, array(), $this->config );
78
+			$list['prev'] = $this->url($this->target, $this->cntl, $this->action, $params, array(), $this->config);
79 79
 		}
80 80
 
81
-		if( ( $num = $offset + $limit ) < $total )
81
+		if (($num = $offset + $limit) < $total)
82 82
 		{
83 83
 			$params['page']['offset'] = $num;
84
-			$list['next'] = $this->url( $this->target, $this->cntl, $this->action, $params, array(), $this->config );
84
+			$list['next'] = $this->url($this->target, $this->cntl, $this->action, $params, array(), $this->config);
85 85
 		}
86 86
 
87
-		if( ( $num = ((int) ($total / $limit)) * $limit ) > $offset )
87
+		if (($num = ((int) ($total / $limit)) * $limit) > $offset)
88 88
 		{
89 89
 			$params['page']['offset'] = $num;
90
-			$list['last'] = $this->url( $this->target, $this->cntl, $this->action, $params, array(), $this->config );
90
+			$list['last'] = $this->url($this->target, $this->cntl, $this->action, $params, array(), $this->config);
91 91
 		}
92 92
 
93 93
 		$params['page']['offset'] = $offset;
94
-		$list['self'] = $this->url( $this->target, $this->cntl, $this->action, $params, array(), $this->config );
94
+		$list['self'] = $this->url($this->target, $this->cntl, $this->action, $params, array(), $this->config);
95 95
 
96 96
 		return $list;
97 97
 	}
Please login to merge, or discard this patch.