admin/jsonadm/src/Admin/JsonAdm/Common/Factory/Base.php
protected static function addClientDecorators( \Aimeos\Admin\JsonAdm\Iface $client,
		\Aimeos\MShop\Context\Item\Iface $context, $path )
	{
		$config = $context->getConfig();

		/** admin/jsonadm/common/decorators/default
		 * Configures the list of decorators applied to all JSON API clients
		 *
		 * Decorators extend the functionality of a class by adding new aspects
		 * (e.g. log what is currently done), executing the methods of the underlying
		 * class only in certain conditions (e.g. only for logged in users) or
		 * modify what is returned to the caller.
		 *
		 * This option allows you to configure a list of decorator names that should
		 * be wrapped around the original instance of all created clients:
		 *
		 *  admin/jsonadm/common/decorators/default = array( 'decorator1', 'decorator2' )
		 *
		 * This would wrap the decorators named "decorator1" and "decorator2" around
		 * all client instances in that order. The decorator classes would be
		 * "\Aimeos\Admin\JsonAdm\Common\Decorator\Decorator1" and
		 * "\Aimeos\Admin\JsonAdm\Common\Decorator\Decorator2".
		 *
		 * @param array List of decorator names
		 * @since 2015.12
		 * @category Developer
		 */
		$decorators = $config->get( 'admin/jsonadm/common/decorators/default', [] );

		if( $path !== null && is_string( $path ) )
		{
			$dpath = trim( $path, '/' );
			$dpath = ( $dpath !== '' ? $dpath . '/' : $dpath );

			$excludes = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/excludes', [] );
			$localClass = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $path ) ) );

			foreach( $decorators as $key => $name )
			{
				if( in_array( $name, $excludes ) ) {
					unset( $decorators[$key] );
				}
			}

			$classprefix = '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\';
			$decorators = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/global', [] );
			$client = self::addDecorators( $client, $decorators, $classprefix, $context, $path );

			if( !empty( $path ) )
			{
				$classprefix = '\\Aimeos\\Admin\\JsonAdm\\' . ucfirst( $localClass ) . '\\Decorator\\';
				$decorators = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/local', [] );
				$client = self::addDecorators( $client, $decorators, $classprefix, $context, $path );
			}
		}
		else
		{
			$classprefix = '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\';
			$client = self::addDecorators( $client, $decorators, $classprefix, $context, $path );
		}

		return $client;
	}
protected static function addClientDecorators( \Aimeos\Admin\JsonAdm\Iface $client,
		\Aimeos\MShop\Context\Item\Iface $context, $path )
	{
		$config = $context->getConfig();

		/** admin/jsonadm/common/decorators/default
		 * Configures the list of decorators applied to all JSON API clients
		 *
		 * Decorators extend the functionality of a class by adding new aspects
		 * (e.g. log what is currently done), executing the methods of the underlying
		 * class only in certain conditions (e.g. only for logged in users) or
		 * modify what is returned to the caller.
		 *
		 * This option allows you to configure a list of decorator names that should
		 * be wrapped around the original instance of all created clients:
		 *
		 *  admin/jsonadm/common/decorators/default = array( 'decorator1', 'decorator2' )
		 *
		 * This would wrap the decorators named "decorator1" and "decorator2" around
		 * all client instances in that order. The decorator classes would be
		 * "\Aimeos\Admin\JsonAdm\Common\Decorator\Decorator1" and
		 * "\Aimeos\Admin\JsonAdm\Common\Decorator\Decorator2".
		 *
		 * @param array List of decorator names
		 * @since 2015.12
		 * @category Developer
		 */
		$decorators = $config->get( 'admin/jsonadm/common/decorators/default', [] );

		if( $path !== null && is_string( $path ) )
		{
			$dpath = trim( $path, '/' );
			$dpath = ( $dpath !== '' ? $dpath . '/' : $dpath );

			$excludes = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/excludes', [] );
			$localClass = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $path ) ) );

			foreach( $decorators as $key => $name )
			{
				if( in_array( $name, $excludes ) ) {
					unset( $decorators[$key] );
				}
			}

			$classprefix = '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\';
			$decorators = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/global', [] );
			$client = self::addDecorators( $client, $decorators, $classprefix, $context, $path );

			if( !empty( $path ) )
			{
				$classprefix = '\\Aimeos\\Admin\\JsonAdm\\' . ucfirst( $localClass ) . '\\Decorator\\';
				$decorators = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/local', [] );
				$client = self::addDecorators( $client, $decorators, $classprefix, $context, $path );
			}
		}
		else
		{
			$classprefix = '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\';
			$client = self::addDecorators( $client, $decorators, $classprefix, $context, $path );
		}

		return $client;
	}
protected static function addClientDecorators ( \ Aimeos \ Admin \ JsonAdm \ Iface $ client , \ Aimeos \ MShop \ Context \ Item \ Iface $ context , $ path ) { $ config = $ context -> getConfig ( ) ; /** admin/jsonadm/common/decorators/default
		 * Configures the list of decorators applied to all JSON API clients
		 *
		 * Decorators extend the functionality of a class by adding new aspects
		 * (e.g. log what is currently done), executing the methods of the underlying
		 * class only in certain conditions (e.g. only for logged in users) or
		 * modify what is returned to the caller.
		 *
		 * This option allows you to configure a list of decorator names that should
		 * be wrapped around the original instance of all created clients:
		 *
		 *  admin/jsonadm/common/decorators/default = array( 'decorator1', 'decorator2' )
		 *
		 * This would wrap the decorators named "decorator1" and "decorator2" around
		 * all client instances in that order. The decorator classes would be
		 * "\Aimeos\Admin\JsonAdm\Common\Decorator\Decorator1" and
		 * "\Aimeos\Admin\JsonAdm\Common\Decorator\Decorator2".
		 *
		 * @param array List of decorator names
		 * @since 2015.12
		 * @category Developer
		 */ $ decorators = $ config -> get ( 'admin/jsonadm/common/decorators/default' , [ ] ) ; if ( $ path !== null && is_string ( $ path ) ) { $ dpath = trim ( $ path , '/' ) ; $ dpath = ( $ dpath !== '' ? $ dpath . '/' : $ dpath ) ; $ excludes = $ config -> get ( 'admin/jsonadm/' . $ dpath . 'decorators/excludes' , [ ] ) ; $ localClass = str_replace ( ' ' , '\\' , ucwords ( str_replace ( '/' , ' ' , $ path ) ) ) ; foreach ( $ decorators as $ key => $ name ) { if ( in_array ( $ name , $ excludes ) ) { unset ( $ decorators [ $ key ] ) ; } } $ classprefix = '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\' ; $ decorators = $ config -> get ( 'admin/jsonadm/' . $ dpath . 'decorators/global' , [ ] ) ; $ client = self :: addDecorators ( $ client , $ decorators , $ classprefix , $ context , $ path ) ; if ( ! empty ( $ path ) ) { $ classprefix = '\\Aimeos\\Admin\\JsonAdm\\' . ucfirst ( $ localClass ) . '\\Decorator\\' ; $ decorators = $ config -> get ( 'admin/jsonadm/' . $ dpath . 'decorators/local' , [ ] ) ; $ client = self :: addDecorators ( $ client , $ decorators , $ classprefix , $ context , $ path ) ; } } else { $ classprefix = '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\' ; $ client = self :: addDecorators ( $ client , $ decorators , $ classprefix , $ context , $ path ) ; } return $ client ; }
Adds the decorators to the JSON API client object

@param \Aimeos\Admin\JsonAdm\Common\Iface $client Client object
@param \Aimeos\MShop\Context\Item\Iface $context Context instance with necessary objects
@param string $path Name of the client separated by slashes, e.g "product/property"
@return \Aimeos\Admin\JsonAdm\Common\Iface Client object
Adds the decorators to the JSON API client object