static public function morphClass($fqn)
    {
        $namespace = "\\NEM\\Mosaics";
        $classPath = [];

        // each namespace/sub-namespace has its own folder
        if ((bool) preg_match("/([^:]+):([^:]+)$/", $fqn, $classPath)) {

            $nsParts = explode(".", $classPath[1]); // $1 is namespace (before semi-colon ':')
            $className = ucfirst($classPath[2]); // $2 is mosaic name (after semi-colon ':')

            // format class name by mosaic fully qualified name.
            /**
             * @example FQN is `evias.sdk:nem-php`, this will be 
             * represented in a PSR-4 class scheme with the following path:
             * 
             * \NEM\Mosaics\Evias\Sdk\NemPhp.php
             */

            $transReg = "/[^a-zA-Z0-9]/";

            // format class path
            $classPath = array_map(function($item) use ($transReg) {
                // transformer for PSR-4 vali^ class/namespace format.

                $norm  = preg_replace($transReg, "_", $item);
                $upper = ucwords(str_replace("_", " ", strtolower($norm)));
                return str_replace(" ", "", $upper);
            }, array_merge($nsParts, [$className]));

            $preconfigured = $namespace . "\\" . implode("\\", $classPath);
            return $preconfigured;
        }

        return false;
    }
static public function morphClass($fqn)
    {
        $namespace = "\\NEM\\Mosaics";
        $classPath = [];

        // each namespace/sub-namespace has its own folder
        if ((bool) preg_match("/([^:]+):([^:]+)$/", $fqn, $classPath)) {

            $nsParts = explode(".", $classPath[1]); // $1 is namespace (before semi-colon ':')
            $className = ucfirst($classPath[2]); // $2 is mosaic name (after semi-colon ':')

            // format class name by mosaic fully qualified name.
            /**
             * @example FQN is `evias.sdk:nem-php`, this will be 
             * represented in a PSR-4 class scheme with the following path:
             * 
             * \NEM\Mosaics\Evias\Sdk\NemPhp.php
             */

            $transReg = "/[^a-zA-Z0-9]/";

            // format class path
            $classPath = array_map(function($item) use ($transReg) {
                // transformer for PSR-4 vali^ class/namespace format.

                $norm  = preg_replace($transReg, "_", $item);
                $upper = ucwords(str_replace("_", " ", strtolower($norm)));
                return str_replace(" ", "", $upper);
            }, array_merge($nsParts, [$className]));

            $preconfigured = $namespace . "\\" . implode("\\", $classPath);
            return $preconfigured;
        }

        return false;
    }
static public function morphClass ( $ fqn ) { $ namespace = "\\NEM\\Mosaics" ; $ classPath = [ ] ; // each namespace/sub-namespace has its own folder if ( ( bool ) preg_match ( "/([^:]+):([^:]+)$/" , $ fqn , $ classPath ) ) { $ nsParts = explode ( "." , $ classPath [ 1 ] ) ; // $1 is namespace (before semi-colon ':') $ className = ucfirst ( $ classPath [ 2 ] ) ; // $2 is mosaic name (after semi-colon ':') // format class name by mosaic fully qualified name. /**
             * @example FQN is `evias.sdk:nem-php`, this will be 
             * represented in a PSR-4 class scheme with the following path:
             * 
             * \NEM\Mosaics\Evias\Sdk\NemPhp.php
             */ $ transReg = "/[^a-zA-Z0-9]/" ; // format class path $ classPath = array_map ( function ( $ item ) use ( $ transReg ) { // transformer for PSR-4 vali^ class/namespace format. $ norm = preg_replace ( $ transReg , "_" , $ item ) ; $ upper = ucwords ( str_replace ( "_" , " " , strtolower ( $ norm ) ) ) ; return str_replace ( " " , "" , $ upper ) ; } , array_merge ( $ nsParts , [ $ className ] ) ) ; $ preconfigured = $ namespace . "\\" . implode ( "\\" , $ classPath ) ; return $ preconfigured ; } return false ; }
Helper to format a fully qualified mosaic name into a PHP class
namespaced.

Some of the mosaics present on the NEM network will be represented
by pre-configured classes in the SDK as such to give an idea on how
to pre-configure mosaic definition and also to allow reducing the
amount of data that needs to be fetched over the network.

@param   string      $fqn
@return  string
@throws  \InvalidArgumentException       On invalid mosaic fully qualified name.
Helper to format a fully qualified mosaic name into a PHP class namespaced .