| @@ -7,15 +7,15 @@ | ||
| 7 | 7 | |
| 8 | 8 | |
| 9 | 9 | error_reporting( -1 ); | 
| 10 | -ini_set( 'display_errors', '1' ); | |
| 10 | +ini_set('display_errors', '1'); | |
| 11 | 11 | |
| 12 | -date_default_timezone_set( 'UTC' ); | |
| 12 | +date_default_timezone_set('UTC'); | |
| 13 | 13 | |
| 14 | 14 | // Set locale settings to reasonable defaults | 
| 15 | -setlocale( LC_ALL, 'en_US.UTF-8' ); | |
| 16 | -setlocale( LC_NUMERIC, 'POSIX' ); | |
| 17 | -setlocale( LC_CTYPE, 'en_US.UTF-8' ); | |
| 18 | -setlocale( LC_TIME, 'POSIX' ); | |
| 15 | +setlocale(LC_ALL, 'en_US.UTF-8'); | |
| 16 | +setlocale(LC_NUMERIC, 'POSIX'); | |
| 17 | +setlocale(LC_CTYPE, 'en_US.UTF-8'); | |
| 18 | +setlocale(LC_TIME, 'POSIX'); | |
| 19 | 19 | |
| 20 | 20 | require_once 'TestHelperJadm.php'; | 
| 21 | 21 | \TestHelperJadm::bootstrap(); | 
| @@ -107,20 +107,20 @@ | ||
| 107 | 107 | * @param array $include List of resource types that should be fetched | 
| 108 | 108 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface | 
| 109 | 109 | */ | 
| 110 | - protected function getChildItems( array $items, array $include ) | |
| 110 | + protected function getChildItems(array $items, array $include) | |
| 111 | 111 |  	{ | 
| 112 | 112 | $list = array(); | 
| 113 | - $ids = array_keys( $items ); | |
| 114 | - $include = array_intersect( $include, array( 'coupon/code' ) ); | |
| 113 | + $ids = array_keys($items); | |
| 114 | +		$include = array_intersect($include, array('coupon/code')); | |
| 115 | 115 | |
| 116 | - foreach( $include as $type ) | |
| 116 | + foreach ($include as $type) | |
| 117 | 117 |  		{ | 
| 118 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $type ); | |
| 118 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $type); | |
| 119 | 119 | |
| 120 | 120 | $search = $manager->createSearch(); | 
| 121 | - $search->setConditions( $search->compare( '==', str_replace( '/', '.', $type ) . '.parentid', $ids ) ); | |
| 121 | +			$search->setConditions($search->compare('==', str_replace('/', '.', $type) . '.parentid', $ids)); | |
| 122 | 122 | |
| 123 | - $list = array_merge( $list, $manager->searchItems( $search ) ); | |
| 123 | + $list = array_merge($list, $manager->searchItems($search)); | |
| 124 | 124 | } | 
| 125 | 125 | |
| 126 | 126 | return $list; | 
| @@ -107,20 +107,20 @@ discard block | ||
| 107 | 107 | * @param array $include List of resource types that should be fetched | 
| 108 | 108 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface | 
| 109 | 109 | */ | 
| 110 | - protected function getChildItems( array $items, array $include ) | |
| 110 | + protected function getChildItems(array $items, array $include) | |
| 111 | 111 |  	{ | 
| 112 | 112 | $list = array(); | 
| 113 | - $refIds = array_keys( $items ); | |
| 114 | - $include = array_intersect( $include, array( 'customer/address' ) ); | |
| 113 | + $refIds = array_keys($items); | |
| 114 | +		$include = array_intersect($include, array('customer/address')); | |
| 115 | 115 | |
| 116 | - foreach( $include as $type ) | |
| 116 | + foreach ($include as $type) | |
| 117 | 117 |  		{ | 
| 118 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $type ); | |
| 118 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $type); | |
| 119 | 119 | |
| 120 | 120 | $search = $manager->createSearch(); | 
| 121 | - $search->setConditions( $search->compare( '==', str_replace( '/', '.', $type ) . '.parentid', $refIds ) ); | |
| 121 | +			$search->setConditions($search->compare('==', str_replace('/', '.', $type) . '.parentid', $refIds)); | |
| 122 | 122 | |
| 123 | - $list = array_merge( $list, $manager->searchItems( $search ) ); | |
| 123 | + $list = array_merge($list, $manager->searchItems($search)); | |
| 124 | 124 | } | 
| 125 | 125 | |
| 126 | 126 | return $list; | 
| @@ -134,17 +134,17 @@ discard block | ||
| 134 | 134 | * @param array $include List of resource types that should be fetched | 
| 135 | 135 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface | 
| 136 | 136 | */ | 
| 137 | - protected function getListItems( array $items, array $include ) | |
| 137 | + protected function getListItems(array $items, array $include) | |
| 138 | 138 |  	{ | 
| 139 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' ); | |
| 139 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists'); | |
| 140 | 140 | |
| 141 | 141 | $search = $manager->createSearch(); | 
| 142 | 142 | $expr = array( | 
| 143 | - $search->compare( '==', 'customer.lists.parentid', array_keys( $items ) ), | |
| 144 | - $search->compare( '==', 'customer.lists.domain', $include ), | |
| 143 | +			$search->compare('==', 'customer.lists.parentid', array_keys($items)), | |
| 144 | +			$search->compare('==', 'customer.lists.domain', $include), | |
| 145 | 145 | ); | 
| 146 | - $search->setConditions( $search->combine( '&&', $expr ) ); | |
| 146 | +		$search->setConditions($search->combine('&&', $expr)); | |
| 147 | 147 | |
| 148 | - return $manager->searchItems( $search ); | |
| 148 | + return $manager->searchItems($search); | |
| 149 | 149 | } | 
| 150 | 150 | } | 
| @@ -107,20 +107,20 @@ discard block | ||
| 107 | 107 | * @param array $include List of resource types that should be fetched | 
| 108 | 108 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface | 
| 109 | 109 | */ | 
| 110 | - protected function getChildItems( array $items, array $include ) | |
| 110 | + protected function getChildItems(array $items, array $include) | |
| 111 | 111 |  	{ | 
| 112 | 112 | $list = array(); | 
| 113 | - $refIds = array_keys( $items ); | |
| 114 | - $include = array_intersect( $include, array( 'supplier/address' ) ); | |
| 113 | + $refIds = array_keys($items); | |
| 114 | +		$include = array_intersect($include, array('supplier/address')); | |
| 115 | 115 | |
| 116 | - foreach( $include as $type ) | |
| 116 | + foreach ($include as $type) | |
| 117 | 117 |  		{ | 
| 118 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $type ); | |
| 118 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $type); | |
| 119 | 119 | |
| 120 | 120 | $search = $manager->createSearch(); | 
| 121 | - $search->setConditions( $search->compare( '==', str_replace( '/', '.', $type ) . '.parentid', $refIds ) ); | |
| 121 | +			$search->setConditions($search->compare('==', str_replace('/', '.', $type) . '.parentid', $refIds)); | |
| 122 | 122 | |
| 123 | - $list = array_merge( $list, $manager->searchItems( $search ) ); | |
| 123 | + $list = array_merge($list, $manager->searchItems($search)); | |
| 124 | 124 | } | 
| 125 | 125 | |
| 126 | 126 | return $list; | 
| @@ -134,17 +134,17 @@ discard block | ||
| 134 | 134 | * @param array $include List of resource types that should be fetched | 
| 135 | 135 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface | 
| 136 | 136 | */ | 
| 137 | - protected function getListItems( array $items, array $include ) | |
| 137 | + protected function getListItems(array $items, array $include) | |
| 138 | 138 |  	{ | 
| 139 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'supplier/lists' ); | |
| 139 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'supplier/lists'); | |
| 140 | 140 | |
| 141 | 141 | $search = $manager->createSearch(); | 
| 142 | 142 | $expr = array( | 
| 143 | - $search->compare( '==', 'supplier.lists.parentid', array_keys( $items ) ), | |
| 144 | - $search->compare( '==', 'supplier.lists.domain', $include ), | |
| 143 | +			$search->compare('==', 'supplier.lists.parentid', array_keys($items)), | |
| 144 | +			$search->compare('==', 'supplier.lists.domain', $include), | |
| 145 | 145 | ); | 
| 146 | - $search->setConditions( $search->combine( '&&', $expr ) ); | |
| 146 | +		$search->setConditions($search->combine('&&', $expr)); | |
| 147 | 147 | |
| 148 | - return $manager->searchItems( $search ); | |
| 148 | + return $manager->searchItems($search); | |
| 149 | 149 | } | 
| 150 | 150 | } | 
| @@ -29,6 +29,6 @@ | ||
| 29 | 29 | * @param string $path Name of the client separated by slashes, e.g "product/stock" | 
| 30 | 30 | * @return void | 
| 31 | 31 | */ | 
| 32 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, | |
| 33 | - array $templatePaths, $path ); | |
| 32 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, | |
| 33 | + array $templatePaths, $path); | |
| 34 | 34 | } | 
| @@ -28,5 +28,5 @@ | ||
| 28 | 28 |  	 * @param string|null $name Name of the client implementation ("Standard" if null) | 
| 29 | 29 | * @return Aimeos\Admin\JsonAdm\Iface Client Interface | 
| 30 | 30 | */ | 
| 31 | - public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $path, $name = null ); | |
| 31 | + public static function createClient(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $path, $name = null); | |
| 32 | 32 | } | 
| 33 | 33 | \ No newline at end of file | 
| @@ -31,7 +31,7 @@ discard block | ||
| 31 | 31 | * @param string $classname Full name of the class for which the object should be returned | 
| 32 | 32 | * @param \Aimeos\Admin\JsonAdm\Iface|null $client JSON API client object | 
| 33 | 33 | */ | 
| 34 | - public static function injectClient( $classname, \Aimeos\Admin\JsonAdm\Iface $client = null ) | |
| 34 | + public static function injectClient($classname, \Aimeos\Admin\JsonAdm\Iface $client = null) | |
| 35 | 35 |  	{ | 
| 36 | 36 | self::$objects[$classname] = $client; | 
| 37 | 37 | } | 
| @@ -47,8 +47,8 @@ discard block | ||
| 47 | 47 | * @param string $path Name of the client separated by slashes, e.g "product/stock" | 
| 48 | 48 | * @return \Aimeos\Admin\JsonAdm\Common\Iface Client object | 
| 49 | 49 | */ | 
| 50 | - protected static function addClientDecorators( \Aimeos\Admin\JsonAdm\Iface $client, | |
| 51 | - \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path ) | |
| 50 | + protected static function addClientDecorators(\Aimeos\Admin\JsonAdm\Iface $client, | |
| 51 | + \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path) | |
| 52 | 52 |  	{ | 
| 53 | 53 | $config = $context->getConfig(); | 
| 54 | 54 | |
| @@ -74,35 +74,35 @@ discard block | ||
| 74 | 74 | * @since 2015.12 | 
| 75 | 75 | * @category Developer | 
| 76 | 76 | */ | 
| 77 | - $decorators = $config->get( 'admin/jsonadm/common/decorators/default', array() ); | |
| 77 | +		$decorators = $config->get('admin/jsonadm/common/decorators/default', array()); | |
| 78 | 78 | |
| 79 | 79 | $classprefix = '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\'; | 
| 80 | - $client = self::addDecorators( $client, $decorators, $classprefix, $context, $view, $templatePaths, $path ); | |
| 80 | + $client = self::addDecorators($client, $decorators, $classprefix, $context, $view, $templatePaths, $path); | |
| 81 | 81 | |
| 82 | - if( $path !== null && is_string( $path ) ) | |
| 82 | + if ($path !== null && is_string($path)) | |
| 83 | 83 |  		{ | 
| 84 | - $dpath = trim( $path, '/' ); | |
| 85 | - $dpath = ( $dpath !== '' ? $dpath . '/' : $dpath ); | |
| 84 | + $dpath = trim($path, '/'); | |
| 85 | + $dpath = ($dpath !== '' ? $dpath . '/' : $dpath); | |
| 86 | 86 | |
| 87 | - $excludes = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/excludes', array() ); | |
| 88 | - $localClass = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $path ) ) ); | |
| 87 | +			$excludes = $config->get('admin/jsonadm/' . $dpath . 'decorators/excludes', array()); | |
| 88 | +			$localClass = str_replace(' ', '\\', ucwords(str_replace('/', ' ', $path))); | |
| 89 | 89 | |
| 90 | - foreach( $decorators as $key => $name ) | |
| 90 | + foreach ($decorators as $key => $name) | |
| 91 | 91 |  			{ | 
| 92 | -				if( in_array( $name, $excludes ) ) { | |
| 93 | - unset( $decorators[$key] ); | |
| 92 | +				if (in_array($name, $excludes)) { | |
| 93 | + unset($decorators[$key]); | |
| 94 | 94 | } | 
| 95 | 95 | } | 
| 96 | 96 | |
| 97 | 97 | $classprefix = '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\'; | 
| 98 | - $decorators = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/global', array() ); | |
| 99 | - $client = self::addDecorators( $client, $decorators, $classprefix, $context, $view, $templatePaths, $path ); | |
| 98 | +			$decorators = $config->get('admin/jsonadm/' . $dpath . 'decorators/global', array()); | |
| 99 | + $client = self::addDecorators($client, $decorators, $classprefix, $context, $view, $templatePaths, $path); | |
| 100 | 100 | |
| 101 | - if( !empty( $path ) ) | |
| 101 | + if (!empty($path)) | |
| 102 | 102 |  			{ | 
| 103 | - $classprefix = '\\Aimeos\\Admin\\JsonAdm\\' . ucfirst( $localClass ) . '\\Decorator\\'; | |
| 104 | - $decorators = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/local', array() ); | |
| 105 | - $client = self::addDecorators( $client, $decorators, $classprefix, $context, $view, $templatePaths, $path ); | |
| 103 | + $classprefix = '\\Aimeos\\Admin\\JsonAdm\\' . ucfirst($localClass) . '\\Decorator\\'; | |
| 104 | +				$decorators = $config->get('admin/jsonadm/' . $dpath . 'decorators/local', array()); | |
| 105 | + $client = self::addDecorators($client, $decorators, $classprefix, $context, $view, $templatePaths, $path); | |
| 106 | 106 | } | 
| 107 | 107 | } | 
| 108 | 108 | |
| @@ -122,29 +122,29 @@ discard block | ||
| 122 | 122 | * @param string $path Name of the client separated by slashes, e.g "product/stock" | 
| 123 | 123 | * @return \Aimeos\Admin\JsonAdm\Common\Iface Client object | 
| 124 | 124 | */ | 
| 125 | - protected static function addDecorators( \Aimeos\Admin\JsonAdm\Iface $client, array $decorators, $classprefix, | |
| 126 | - \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, $templatePaths, $path ) | |
| 125 | + protected static function addDecorators(\Aimeos\Admin\JsonAdm\Iface $client, array $decorators, $classprefix, | |
| 126 | + \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, $templatePaths, $path) | |
| 127 | 127 |  	{ | 
| 128 | 128 | $iface = '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\Iface'; | 
| 129 | 129 | |
| 130 | - foreach( $decorators as $name ) | |
| 130 | + foreach ($decorators as $name) | |
| 131 | 131 |  		{ | 
| 132 | - if( ctype_alnum( $name ) === false ) | |
| 132 | + if (ctype_alnum($name) === false) | |
| 133 | 133 |  			{ | 
| 134 | - $classname = is_string( $name ) ? $classprefix . $name : '<not a string>'; | |
| 135 | - throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid class name "%1$s"', $classname ), 404 ); | |
| 134 | + $classname = is_string($name) ? $classprefix . $name : '<not a string>'; | |
| 135 | +				throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid class name "%1$s"', $classname), 404); | |
| 136 | 136 | } | 
| 137 | 137 | |
| 138 | 138 | $classname = $classprefix . $name; | 
| 139 | 139 | |
| 140 | -			if( class_exists( $classname ) === false ) { | |
| 141 | - throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Class "%1$s" not found', $classname ), 404 ); | |
| 140 | +			if (class_exists($classname) === false) { | |
| 141 | +				throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Class "%1$s" not found', $classname), 404); | |
| 142 | 142 | } | 
| 143 | 143 | |
| 144 | - $client = new $classname( $client, $context, $view, $templatePaths, $path ); | |
| 144 | + $client = new $classname($client, $context, $view, $templatePaths, $path); | |
| 145 | 145 | |
| 146 | -			if( !( $client instanceof $iface ) ) { | |
| 147 | - throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Class "%1$s" does not implement "%2$s"', $classname, $iface ), 404 ); | |
| 146 | +			if (!($client instanceof $iface)) { | |
| 147 | +				throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Class "%1$s" does not implement "%2$s"', $classname, $iface), 404); | |
| 148 | 148 | } | 
| 149 | 149 | } | 
| 150 | 150 | |
| @@ -163,21 +163,21 @@ discard block | ||
| 163 | 163 | * @param string $path Name of the client separated by slashes, e.g "product/stock" | 
| 164 | 164 | * @return \Aimeos\Admin\JsonAdm\Common\Iface Client object | 
| 165 | 165 | */ | 
| 166 | - protected static function createClientBase( $classname, $interface, \Aimeos\MShop\Context\Item\Iface $context, | |
| 167 | - \Aimeos\MW\View\Iface $view, array $templatePaths, $path ) | |
| 166 | + protected static function createClientBase($classname, $interface, \Aimeos\MShop\Context\Item\Iface $context, | |
| 167 | + \Aimeos\MW\View\Iface $view, array $templatePaths, $path) | |
| 168 | 168 |  	{ | 
| 169 | -		if( isset( self::$objects[$classname] ) ) { | |
| 169 | +		if (isset(self::$objects[$classname])) { | |
| 170 | 170 | return self::$objects[$classname]; | 
| 171 | 171 | } | 
| 172 | 172 | |
| 173 | -		if( class_exists( $classname ) === false ) { | |
| 174 | - throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Class "%1$s" not found', $classname ), 404 ); | |
| 173 | +		if (class_exists($classname) === false) { | |
| 174 | +			throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Class "%1$s" not found', $classname), 404); | |
| 175 | 175 | } | 
| 176 | 176 | |
| 177 | - $client = new $classname( $context, $view, $templatePaths, $path ); | |
| 177 | + $client = new $classname($context, $view, $templatePaths, $path); | |
| 178 | 178 | |
| 179 | -		if( !( $client instanceof $interface ) ) { | |
| 180 | - throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Class "%1$s" does not implement "%2$s"', $classname, $interface ), 500 ); | |
| 179 | +		if (!($client instanceof $interface)) { | |
| 180 | +			throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Class "%1$s" does not implement "%2$s"', $classname, $interface), 500); | |
| 181 | 181 | } | 
| 182 | 182 | |
| 183 | 183 | return $client; | 
| @@ -30,6 +30,6 @@ | ||
| 30 | 30 | * @param string $path Name of the client separated by slashes, e.g "product/stock" | 
| 31 | 31 | * @return void | 
| 32 | 32 | */ | 
| 33 | - public function __construct( \Aimeos\Admin\JsonAdm\Iface $client, | |
| 34 | - \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path ); | |
| 33 | + public function __construct(\Aimeos\Admin\JsonAdm\Iface $client, | |
| 34 | + \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path); | |
| 35 | 35 | } | 
| 36 | 36 | \ No newline at end of file | 
| @@ -107,17 +107,17 @@ | ||
| 107 | 107 | * @param array $include List of resource types that should be fetched | 
| 108 | 108 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface | 
| 109 | 109 | */ | 
| 110 | - protected function getListItems( array $items, array $include ) | |
| 110 | + protected function getListItems(array $items, array $include) | |
| 111 | 111 |  	{ | 
| 112 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'text/lists' ); | |
| 112 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'text/lists'); | |
| 113 | 113 | |
| 114 | 114 | $search = $manager->createSearch(); | 
| 115 | 115 | $expr = array( | 
| 116 | - $search->compare( '==', 'text.lists.parentid', array_keys( $items ) ), | |
| 117 | - $search->compare( '==', 'text.lists.domain', $include ), | |
| 116 | +			$search->compare('==', 'text.lists.parentid', array_keys($items)), | |
| 117 | +			$search->compare('==', 'text.lists.domain', $include), | |
| 118 | 118 | ); | 
| 119 | - $search->setConditions( $search->combine( '&&', $expr ) ); | |
| 119 | +		$search->setConditions($search->combine('&&', $expr)); | |
| 120 | 120 | |
| 121 | - return $manager->searchItems( $search ); | |
| 121 | + return $manager->searchItems($search); | |
| 122 | 122 | } | 
| 123 | 123 | } |