public function registerFromConfig($xAppConfig)
    {
        // Register user functions
        $aFunctionsConfig = $xAppConfig->getOption('functions', []);
        foreach($aFunctionsConfig as $xKey => $xValue)
        {
            if(is_integer($xKey) && is_string($xValue))
            {
                // Register a function without options
                $this->register(Jaxon::USER_FUNCTION, $xValue);
            }
            elseif(is_string($xKey) && is_array($xValue))
            {
                // Register a function with options
                $this->register(Jaxon::USER_FUNCTION, $xKey, $xValue);
            }
            else
            {
                continue;
                // Todo: throw an exception
            }
        }

        // Register classes and directories
        $aClassesConfig = $xAppConfig->getOption('classes', []);
        foreach($aClassesConfig as $xKey => $xValue)
        {
            if(is_integer($xKey) && is_string($xValue))
            {
                // Register a class without options
                $this->register(Jaxon::CALLABLE_CLASS, $xValue);
            }
            elseif(is_string($xKey) && is_array($xValue))
            {
                // Register a class with options
                $this->register(Jaxon::CALLABLE_CLASS, $xKey, $xValue);
            }
            elseif(is_integer($xKey) && is_array($xValue))
            {
                // The directory path is required
                if(!key_exists('directory', $xValue))
                {
                    continue;
                    // Todo: throw an exception
                }
                // Registering a directory
                $sDirectory = $xValue['directory'];
                $aOptions = [];
                if(key_exists('options', $xValue) &&
                    (is_array($xValue['options']) || is_string($xValue['options'])))
                {
                    $aOptions = $xValue['options'];
                }
                // Setup directory options
                if(key_exists('namespace', $xValue))
                {
                    $aOptions['namespace'] = $xValue['namespace'];
                }
                if(key_exists('separator', $xValue))
                {
                    $aOptions['separator'] = $xValue['separator'];
                }
                // Register a class without options
                $this->register(Jaxon::CALLABLE_DIR, $sDirectory, $aOptions);
            }
            else
            {
                continue;
                // Todo: throw an exception
            }
        }
    }
public function registerFromConfig($xAppConfig)
    {
        // Register user functions
        $aFunctionsConfig = $xAppConfig->getOption('functions', []);
        foreach($aFunctionsConfig as $xKey => $xValue)
        {
            if(is_integer($xKey) && is_string($xValue))
            {
                // Register a function without options
                $this->register(Jaxon::USER_FUNCTION, $xValue);
            }
            elseif(is_string($xKey) && is_array($xValue))
            {
                // Register a function with options
                $this->register(Jaxon::USER_FUNCTION, $xKey, $xValue);
            }
            else
            {
                continue;
                // Todo: throw an exception
            }
        }

        // Register classes and directories
        $aClassesConfig = $xAppConfig->getOption('classes', []);
        foreach($aClassesConfig as $xKey => $xValue)
        {
            if(is_integer($xKey) && is_string($xValue))
            {
                // Register a class without options
                $this->register(Jaxon::CALLABLE_CLASS, $xValue);
            }
            elseif(is_string($xKey) && is_array($xValue))
            {
                // Register a class with options
                $this->register(Jaxon::CALLABLE_CLASS, $xKey, $xValue);
            }
            elseif(is_integer($xKey) && is_array($xValue))
            {
                // The directory path is required
                if(!key_exists('directory', $xValue))
                {
                    continue;
                    // Todo: throw an exception
                }
                // Registering a directory
                $sDirectory = $xValue['directory'];
                $aOptions = [];
                if(key_exists('options', $xValue) &&
                    (is_array($xValue['options']) || is_string($xValue['options'])))
                {
                    $aOptions = $xValue['options'];
                }
                // Setup directory options
                if(key_exists('namespace', $xValue))
                {
                    $aOptions['namespace'] = $xValue['namespace'];
                }
                if(key_exists('separator', $xValue))
                {
                    $aOptions['separator'] = $xValue['separator'];
                }
                // Register a class without options
                $this->register(Jaxon::CALLABLE_DIR, $sDirectory, $aOptions);
            }
            else
            {
                continue;
                // Todo: throw an exception
            }
        }
    }
public function registerFromConfig ( $ xAppConfig ) { // Register user functions $ aFunctionsConfig = $ xAppConfig -> getOption ( 'functions' , [ ] ) ; foreach ( $ aFunctionsConfig as $ xKey => $ xValue ) { if ( is_integer ( $ xKey ) && is_string ( $ xValue ) ) { // Register a function without options $ this -> register ( Jaxon :: USER_FUNCTION , $ xValue ) ; } elseif ( is_string ( $ xKey ) && is_array ( $ xValue ) ) { // Register a function with options $ this -> register ( Jaxon :: USER_FUNCTION , $ xKey , $ xValue ) ; } else { continue ; // Todo: throw an exception } } // Register classes and directories $ aClassesConfig = $ xAppConfig -> getOption ( 'classes' , [ ] ) ; foreach ( $ aClassesConfig as $ xKey => $ xValue ) { if ( is_integer ( $ xKey ) && is_string ( $ xValue ) ) { // Register a class without options $ this -> register ( Jaxon :: CALLABLE_CLASS , $ xValue ) ; } elseif ( is_string ( $ xKey ) && is_array ( $ xValue ) ) { // Register a class with options $ this -> register ( Jaxon :: CALLABLE_CLASS , $ xKey , $ xValue ) ; } elseif ( is_integer ( $ xKey ) && is_array ( $ xValue ) ) { // The directory path is required if ( ! key_exists ( 'directory' , $ xValue ) ) { continue ; // Todo: throw an exception } // Registering a directory $ sDirectory = $ xValue [ 'directory' ] ; $ aOptions = [ ] ; if ( key_exists ( 'options' , $ xValue ) && ( is_array ( $ xValue [ 'options' ] ) || is_string ( $ xValue [ 'options' ] ) ) ) { $ aOptions = $ xValue [ 'options' ] ; } // Setup directory options if ( key_exists ( 'namespace' , $ xValue ) ) { $ aOptions [ 'namespace' ] = $ xValue [ 'namespace' ] ; } if ( key_exists ( 'separator' , $ xValue ) ) { $ aOptions [ 'separator' ] = $ xValue [ 'separator' ] ; } // Register a class without options $ this -> register ( Jaxon :: CALLABLE_DIR , $ sDirectory , $ aOptions ) ; } else { continue ; // Todo: throw an exception } } }
Read and set Jaxon options from a JSON config file

@param Config        $xAppConfig        The config options

@return void
Read and set Jaxon options from a JSON config file