client/jsonapi/src/Client/JsonApi.php
public static function create( \Aimeos\MShop\Context\Item\Iface $context, $path, $name = null )
	{
		$path = trim( $path, '/' );

		if( empty( $path ) ) {
			return self::createRoot( $context, $path, $name );
		}

		$parts = explode( '/', $path );

		foreach( $parts as $key => $part )
		{
			if( ctype_alnum( $part ) === false )
			{
				$msg = sprintf( 'Invalid client "%1$s"', $path );
				throw new \Aimeos\Client\JsonApi\Exception( $msg, 400 );
			}

			$parts[$key] = ucfirst( $part );
		}

		$factory = '\\Aimeos\\Client\\JsonApi\\' . join( '\\', $parts ) . '\\Factory';

		if( class_exists( $factory ) === true )
		{
			if( ( $client = @call_user_func_array( [$factory, 'create'], [$context, $path, $name] ) ) === false ) {
				throw new \Aimeos\Client\JsonApi\Exception( sprintf( 'Invalid factory "%1$s"', $factory ), 400 );
			}
		}
		else
		{
			$client = self::createRoot( $context, $path, $name );
		}

		return $client;
	}
public static function create( \Aimeos\MShop\Context\Item\Iface $context, $path, $name = null )
	{
		$path = trim( $path, '/' );

		if( empty( $path ) ) {
			return self::createRoot( $context, $path, $name );
		}

		$parts = explode( '/', $path );

		foreach( $parts as $key => $part )
		{
			if( ctype_alnum( $part ) === false )
			{
				$msg = sprintf( 'Invalid client "%1$s"', $path );
				throw new \Aimeos\Client\JsonApi\Exception( $msg, 400 );
			}

			$parts[$key] = ucfirst( $part );
		}

		$factory = '\\Aimeos\\Client\\JsonApi\\' . join( '\\', $parts ) . '\\Factory';

		if( class_exists( $factory ) === true )
		{
			if( ( $client = @call_user_func_array( [$factory, 'create'], [$context, $path, $name] ) ) === false ) {
				throw new \Aimeos\Client\JsonApi\Exception( sprintf( 'Invalid factory "%1$s"', $factory ), 400 );
			}
		}
		else
		{
			$client = self::createRoot( $context, $path, $name );
		}

		return $client;
	}
public static function create ( \ Aimeos \ MShop \ Context \ Item \ Iface $ context , $ path , $ name = null ) { $ path = trim ( $ path , '/' ) ; if ( empty ( $ path ) ) { return self :: createRoot ( $ context , $ path , $ name ) ; } $ parts = explode ( '/' , $ path ) ; foreach ( $ parts as $ key => $ part ) { if ( ctype_alnum ( $ part ) === false ) { $ msg = sprintf ( 'Invalid client "%1$s"' , $ path ) ; throw new \ Aimeos \ Client \ JsonApi \ Exception ( $ msg , 400 ) ; } $ parts [ $ key ] = ucfirst ( $ part ) ; } $ factory = '\\Aimeos\\Client\\JsonApi\\' . join ( '\\' , $ parts ) . '\\Factory' ; if ( class_exists ( $ factory ) === true ) { if ( ( $ client = @ call_user_func_array ( [ $ factory , 'create' ] , [ $ context , $ path , $ name ] ) ) === false ) { throw new \ Aimeos \ Client \ JsonApi \ Exception ( sprintf ( 'Invalid factory "%1$s"' , $ factory ) , 400 ) ; } } else { $ client = self :: createRoot ( $ context , $ path , $ name ) ; } return $ client ; }
Creates the required client specified by the given path of client names

Clients are created by providing only the domain name, e.g. "product"
for the \Aimeos\Client\JsonApi\Product\Standard or a path of names to
retrieve a specific sub-client, e.g. "product/type" for the
\Aimeos\Client\JsonApi\Product\Type\Standard client.

@param \Aimeos\MShop\Context\Item\Iface $context Context object required by clients
@param string $path Name of the client separated by slashes, e.g "order/base"
@param string|null $name Name of the client implementation ("Standard" if null)
@return \Aimeos\Client\JsonApi\Iface JSON client instance
@throws \Aimeos\Client\JsonApi\Exception If the given path is invalid
Creates the required client specified by the given path of client names