Completed
Push — master ( 38c658...e8462d )
by Aimeos
01:48
created
admin/jsonadm/src/Admin/JsonAdm/Coupon/Config/Standard.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -110,30 +110,30 @@  discard block
 block discarded – undo
110 110
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
111 111
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
112 112
 	 */
113
-	public function get( ServerRequestInterface $request, ResponseInterface $response )
113
+	public function get(ServerRequestInterface $request, ResponseInterface $response)
114 114
 	{
115 115
 		$view = $this->getView();
116 116
 
117 117
 		try
118 118
 		{
119
-			$response = $this->getItems( $view, $request, $response );
119
+			$response = $this->getItems($view, $request, $response);
120 120
 			$status = 200;
121 121
 		}
122
-		catch( \Aimeos\MShop\Exception $e )
122
+		catch (\Aimeos\MShop\Exception $e)
123 123
 		{
124 124
 			$status = 404;
125
-			$view->errors = array( array(
126
-				'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ),
125
+			$view->errors = array(array(
126
+				'title' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage()),
127 127
 				'detail' => $e->getTraceAsString(),
128
-			) );
128
+			));
129 129
 		}
130
-		catch( \Exception $e )
130
+		catch (\Exception $e)
131 131
 		{
132 132
 			$status = 500;
133
-			$view->errors = array( array(
133
+			$view->errors = array(array(
134 134
 				'title' => $e->getMessage(),
135 135
 				'detail' => $e->getTraceAsString(),
136
-			) );
136
+			));
137 137
 		}
138 138
 
139 139
 		/** admin/jsonadm/coupon/config/template-get
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
 		$tplconf = 'admin/jsonadm/coupon/config/template-get';
159 159
 		$default = 'config-standard';
160 160
 
161
-		$body = $view->render( $view->config( $tplconf, $default ) );
161
+		$body = $view->render($view->config($tplconf, $default));
162 162
 
163
-		return $response->withHeader( 'Content-Type', 'application/vnd.api+json; supported-ext="bulk"' )
164
-			->withBody( $view->response()->createStreamFromString( $body ) )
165
-			->withStatus( $status );
163
+		return $response->withHeader('Content-Type', 'application/vnd.api+json; supported-ext="bulk"')
164
+			->withBody($view->response()->createStreamFromString($body))
165
+			->withStatus($status);
166 166
 	}
167 167
 
168 168
 
@@ -174,18 +174,18 @@  discard block
 block discarded – undo
174 174
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
175 175
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
176 176
 	 */
177
-	protected function getItems( \Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response )
177
+	protected function getItems(\Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response)
178 178
 	{
179
-		if( ( $id = $view->param( 'id' ) ) == null ) {
180
-			throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 );
179
+		if (($id = $view->param('id')) == null) {
180
+			throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('No ID given'), 400);
181 181
 		}
182 182
 
183
-		$manager = \Aimeos\MShop::create( $this->getContext(), 'coupon' );
183
+		$manager = \Aimeos\MShop::create($this->getContext(), 'coupon');
184 184
 
185 185
 		$item = $manager->createItem();
186
-		$item->setProvider( $id );
186
+		$item->setProvider($id);
187 187
 
188
-		$view->configItems = $manager->getProvider( $item, null )->getConfigBE();
188
+		$view->configItems = $manager->getProvider($item, null)->getConfigBE();
189 189
 
190 190
 		return $response;
191 191
 	}
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Coupon/Standard.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -107,20 +107,20 @@
 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\Iface
109 109
 	 */
110
-	protected function getChildItems( array $items, array $include )
110
+	protected function getChildItems(array $items, array $include)
111 111
 	{
112 112
 		$list = [];
113
-		$ids = array_keys( $items );
114
-		$include = array_intersect( $include, array( 'coupon/code' ) );
113
+		$ids = array_keys($items);
114
+		$include = array_intersect($include, array('coupon/code'));
115 115
 
116
-		foreach( $include as $type )
116
+		foreach ($include as $type)
117 117
 		{
118
-			$manager = \Aimeos\MShop::create( $this->getContext(), $type );
118
+			$manager = \Aimeos\MShop::create($this->getContext(), $type);
119 119
 
120 120
 			$search = $manager->createSearch();
121
-			$search->setConditions( $search->compare( '==', str_replace( '/', '.', $type ) . '.parentid', $ids ) );
121
+			$search->setConditions($search->compare('==', str_replace('/', '.', $type) . '.parentid', $ids));
122 122
 
123
-			$list = array_merge( $list, $manager->searchItems( $search ) );
123
+			$list = array_merge($list, $manager->searchItems($search));
124 124
 		}
125 125
 
126 126
 		return $list;
Please login to merge, or discard this patch.