admin/jsonadm/src/Admin/JsonAdm.php
protected static function createNew( \Aimeos\MShop\Context\Item\Iface $context,
		\Aimeos\Bootstrap $aimeos, $path, $name )
	{
		$pname = $name;
		$parts = explode( '/', $path );

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

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

		if( $pname === null ) {
			$pname = $context->getConfig()->get( 'admin/jsonadm/' . $path . '/name', 'Standard' );
		}

		$view = $context->getView();
		$config = $context->getConfig();

		if( $view->access( $config->get( 'admin/jsonadm/resource/' . $path . '/groups', [] ) ) !== true ) {
			throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Not allowed to access JsonAdm "%1$s" client', $path ) );
		}


		$view = $context->getView();
		$iface = \Aimeos\Admin\JsonAdm\Iface::class;
		$classname = '\\Aimeos\\Admin\\JsonAdm\\' . join( '\\', $parts ) . '\\' . $pname;

		if( ctype_alnum( $pname ) === false )
		{
			$classname = is_string( $pname ) ? $classname : '<not a string>';
			throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid class name "%1$s"', $classname ) );
		}

		if( class_exists( $classname ) === false ) {
			return self::createRoot( $context, $aimeos, $path, $name );
		}

		$client = self::createAdmin( $classname, $iface, $context, $path );
		$client = self::addClientDecorators( $client, $context, $path );

		return $client->setAimeos( $aimeos )->setView( $view );
	}
protected static function createNew( \Aimeos\MShop\Context\Item\Iface $context,
		\Aimeos\Bootstrap $aimeos, $path, $name )
	{
		$pname = $name;
		$parts = explode( '/', $path );

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

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

		if( $pname === null ) {
			$pname = $context->getConfig()->get( 'admin/jsonadm/' . $path . '/name', 'Standard' );
		}

		$view = $context->getView();
		$config = $context->getConfig();

		if( $view->access( $config->get( 'admin/jsonadm/resource/' . $path . '/groups', [] ) ) !== true ) {
			throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Not allowed to access JsonAdm "%1$s" client', $path ) );
		}


		$view = $context->getView();
		$iface = \Aimeos\Admin\JsonAdm\Iface::class;
		$classname = '\\Aimeos\\Admin\\JsonAdm\\' . join( '\\', $parts ) . '\\' . $pname;

		if( ctype_alnum( $pname ) === false )
		{
			$classname = is_string( $pname ) ? $classname : '<not a string>';
			throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid class name "%1$s"', $classname ) );
		}

		if( class_exists( $classname ) === false ) {
			return self::createRoot( $context, $aimeos, $path, $name );
		}

		$client = self::createAdmin( $classname, $iface, $context, $path );
		$client = self::addClientDecorators( $client, $context, $path );

		return $client->setAimeos( $aimeos )->setView( $view );
	}
protected static function createNew ( \ Aimeos \ MShop \ Context \ Item \ Iface $ context , \ Aimeos \ Bootstrap $ aimeos , $ path , $ name ) { $ pname = $ name ; $ parts = explode ( '/' , $ path ) ; foreach ( $ parts as $ key => $ part ) { if ( ctype_alnum ( $ part ) === false ) { $ msg = sprintf ( 'Invalid client "%1$s"' , $ path ) ; throw new \ Aimeos \ Admin \ JsonAdm \ Exception ( $ msg , 400 ) ; } $ parts [ $ key ] = ucwords ( $ part ) ; } if ( $ pname === null ) { $ pname = $ context -> getConfig ( ) -> get ( 'admin/jsonadm/' . $ path . '/name' , 'Standard' ) ; } $ view = $ context -> getView ( ) ; $ config = $ context -> getConfig ( ) ; if ( $ view -> access ( $ config -> get ( 'admin/jsonadm/resource/' . $ path . '/groups' , [ ] ) ) !== true ) { throw new \ Aimeos \ Admin \ JQAdm \ Exception ( sprintf ( 'Not allowed to access JsonAdm "%1$s" client' , $ path ) ) ; } $ view = $ context -> getView ( ) ; $ iface = \ Aimeos \ Admin \ JsonAdm \ Iface :: class ; $ classname = '\\Aimeos\\Admin\\JsonAdm\\' . join ( '\\' , $ parts ) . '\\' . $ pname ; if ( ctype_alnum ( $ pname ) === false ) { $ classname = is_string ( $ pname ) ? $ classname : '<not a string>' ; throw new \ Aimeos \ Admin \ JsonAdm \ Exception ( sprintf ( 'Invalid class name "%1$s"' , $ classname ) ) ; } if ( class_exists ( $ classname ) === false ) { return self :: createRoot ( $ context , $ aimeos , $ path , $ name ) ; } $ client = self :: createAdmin ( $ classname , $ iface , $ context , $ path ) ; $ client = self :: addClientDecorators ( $ client , $ context , $ path ) ; return $ client -> setAimeos ( $ aimeos ) -> setView ( $ view ) ; }
Creates a new client specified by the given path of client names.

@param \Aimeos\MShop\Context\Item\Iface $context Context object required by clients
@param \Aimeos\Bootstrap $aimeos Aimeos Bootstrap object
@param string $path Name of the client separated by slashes, e.g "product/stock"
@param string|null $name Name of the client implementation ("Standard" if null)
@return \Aimeos\Admin\JsonAdm\Iface JSON admin instance
@throws \Aimeos\Admin\JsonAdm\Exception If the given path is invalid
Creates a new client specified by the given path of client names .