Swat/SwatUI.php
private function parseObject($node)
    {
        // class is required in the schema
        $class = $node->getAttribute('class');

        if (!class_exists($class)) {
            throw new SwatClassNotFoundException(
                "Class '{$class}' is not defined.",
                0,
                $class
            );
        }

        // NOTE: this works because SwatUIObject is abstract
        if (!is_subclass_of($class, 'SwatUIObject')) {
            throw new SwatInvalidClassException(
                "Class '{$class}' is not a a descendant of SwatUIObject and " .
                    'cannot be added to the widget tree.'
            );
        }

        $object = new $class();

        // id is optional in the schema
        if ($node->hasAttribute('id')) {
            $object->id = $node->getAttribute('id');
        }

        return $object;
    }
private function parseObject($node)
    {
        // class is required in the schema
        $class = $node->getAttribute('class');

        if (!class_exists($class)) {
            throw new SwatClassNotFoundException(
                "Class '{$class}' is not defined.",
                0,
                $class
            );
        }

        // NOTE: this works because SwatUIObject is abstract
        if (!is_subclass_of($class, 'SwatUIObject')) {
            throw new SwatInvalidClassException(
                "Class '{$class}' is not a a descendant of SwatUIObject and " .
                    'cannot be added to the widget tree.'
            );
        }

        $object = new $class();

        // id is optional in the schema
        if ($node->hasAttribute('id')) {
            $object->id = $node->getAttribute('id');
        }

        return $object;
    }
private function parseObject ( $ node ) { // class is required in the schema $ class = $ node -> getAttribute ( 'class' ) ; if ( ! class_exists ( $ class ) ) { throw new SwatClassNotFoundException ( "Class '{$class}' is not defined." , 0 , $ class ) ; } // NOTE: this works because SwatUIObject is abstract if ( ! is_subclass_of ( $ class , 'SwatUIObject' ) ) { throw new SwatInvalidClassException ( "Class '{$class}' is not a a descendant of SwatUIObject and " . 'cannot be added to the widget tree.' ) ; } $ object = new $ class ( ) ; // id is optional in the schema if ( $ node -> hasAttribute ( 'id' ) ) { $ object -> id = $ node -> getAttribute ( 'id' ) ; } return $ object ; }
Parses an XML object or widget element node into a PHP object

@param array $node the XML element node to parse.

@return SwatUIObject a reference to the object created.

@throws SwatClassNotFoundException
Parses an XML object or widget element node into a PHP object