protected function defineClass($fields)
    {
        //Rule to define class instance
        $definition = $this->schema[DocumentEntity::SH_INSTANTIATION];

        if (is_string($definition)) {
            //Document has no variations
            return $definition;
        }

        if (!is_array($fields)) {
            //Unable to resolve for non array set, using same class as given
            return $this->class;
        }

        $defined = $this->class;
        foreach ($definition as $field => $child) {
            if (array_key_exists($field, $fields)) {
                //Apparently this is child
                $defined = $child;
                break;
            }
        }

        return $defined;
    }
protected function defineClass($fields)
    {
        //Rule to define class instance
        $definition = $this->schema[DocumentEntity::SH_INSTANTIATION];

        if (is_string($definition)) {
            //Document has no variations
            return $definition;
        }

        if (!is_array($fields)) {
            //Unable to resolve for non array set, using same class as given
            return $this->class;
        }

        $defined = $this->class;
        foreach ($definition as $field => $child) {
            if (array_key_exists($field, $fields)) {
                //Apparently this is child
                $defined = $child;
                break;
            }
        }

        return $defined;
    }
protected function defineClass ( $ fields ) { //Rule to define class instance $ definition = $ this -> schema [ DocumentEntity :: SH_INSTANTIATION ] ; if ( is_string ( $ definition ) ) { //Document has no variations return $ definition ; } if ( ! is_array ( $ fields ) ) { //Unable to resolve for non array set, using same class as given return $ this -> class ; } $ defined = $ this -> class ; foreach ( $ definition as $ field => $ child ) { if ( array_key_exists ( $ field , $ fields ) ) { //Apparently this is child $ defined = $ child ; break ; } } return $ defined ; }
Define document class using it's fieldset and definition.

@param \ArrayAccess|array $fields

@return string

@throws DefinitionException
Define document class using it s fieldset and definition .