src/ministruts/Module.php
protected function processImports(\SimpleXMLElement $xml) {
        if ($this->configured) throw new IllegalStateException('Configuration is frozen');
        $imports = $xml->xpath('/struts-config/imports/import') ?: [];

        foreach ($imports as $import) {
            $value = trim((string)$import['value']);
            $value = str_replace('/', '\\', $value);

            if (strEndsWith($value, '\\*')) {           // imported namespace
                $value = strLeft($value, -1);
                if (!$this->isValidNamespace($value)) throw new StrutsConfigException('<imports> <import value="'.$import['value'].'": Invalid value (neither a class nor a namespace).');
                if (strStartsWith($value, '\\')) $value  = substr($value, 1);
                if (!strEndsWith($value, '\\'))  $value .= '\\';
                $this->imports[strtolower($value)] = $value;
                continue;
            }

            if (is_class($value)) {                     // imported class
                if (strStartsWith($value, '\\')) $value = substr($value, 1);
                $simpleName = simpleClassName($value);
                if (isset($this->uses[$simpleName])) throw new StrutsConfigException('<imports> <import value="'.$import['value'].'": Duplicate value.');
                $this->uses[$simpleName] = $value;
                continue;
            }
            throw new StrutsConfigException('<imports> <import value="'.$import['value'].'": Invalid value (neither a class nor a namespace).');
        }
    }
protected function processImports(\SimpleXMLElement $xml) {
        if ($this->configured) throw new IllegalStateException('Configuration is frozen');
        $imports = $xml->xpath('/struts-config/imports/import') ?: [];

        foreach ($imports as $import) {
            $value = trim((string)$import['value']);
            $value = str_replace('/', '\\', $value);

            if (strEndsWith($value, '\\*')) {           // imported namespace
                $value = strLeft($value, -1);
                if (!$this->isValidNamespace($value)) throw new StrutsConfigException('<imports> <import value="'.$import['value'].'": Invalid value (neither a class nor a namespace).');
                if (strStartsWith($value, '\\')) $value  = substr($value, 1);
                if (!strEndsWith($value, '\\'))  $value .= '\\';
                $this->imports[strtolower($value)] = $value;
                continue;
            }

            if (is_class($value)) {                     // imported class
                if (strStartsWith($value, '\\')) $value = substr($value, 1);
                $simpleName = simpleClassName($value);
                if (isset($this->uses[$simpleName])) throw new StrutsConfigException('<imports> <import value="'.$import['value'].'": Duplicate value.');
                $this->uses[$simpleName] = $value;
                continue;
            }
            throw new StrutsConfigException('<imports> <import value="'.$import['value'].'": Invalid value (neither a class nor a namespace).');
        }
    }
protected function processImports ( \ SimpleXMLElement $ xml ) { if ( $ this -> configured ) throw new IllegalStateException ( 'Configuration is frozen' ) ; $ imports = $ xml -> xpath ( '/struts-config/imports/import' ) ? : [ ] ; foreach ( $ imports as $ import ) { $ value = trim ( ( string ) $ import [ 'value' ] ) ; $ value = str_replace ( '/' , '\\' , $ value ) ; if ( strEndsWith ( $ value , '\\*' ) ) { // imported namespace $ value = strLeft ( $ value , - 1 ) ; if ( ! $ this -> isValidNamespace ( $ value ) ) throw new StrutsConfigException ( '<imports> <import value="' . $ import [ 'value' ] . '": Invalid value (neither a class nor a namespace).' ) ; if ( strStartsWith ( $ value , '\\' ) ) $ value = substr ( $ value , 1 ) ; if ( ! strEndsWith ( $ value , '\\' ) ) $ value .= '\\' ; $ this -> imports [ strtolower ( $ value ) ] = $ value ; continue ; } if ( is_class ( $ value ) ) { // imported class if ( strStartsWith ( $ value , '\\' ) ) $ value = substr ( $ value , 1 ) ; $ simpleName = simpleClassName ( $ value ) ; if ( isset ( $ this -> uses [ $ simpleName ] ) ) throw new StrutsConfigException ( '<imports> <import value="' . $ import [ 'value' ] . '": Duplicate value.' ) ; $ this -> uses [ $ simpleName ] = $ value ; continue ; } throw new StrutsConfigException ( '<imports> <import value="' . $ import [ 'value' ] . '": Invalid value (neither a class nor a namespace).' ) ; } }
Process the configured import settings.

@param  \SimpleXMLElement $xml - configuration instance

@throws StrutsConfigException on configuration errors
Process the configured import settings .