public function xType($root, $path=null)
    {

        $class = is_object($root) ? get_class($root): $root;

        $isClass = is_string($class) && class_exists($class);

        if ($isClass && $type = $this->getClassXType($root, $class, $path)) {
            return $type;
        }

        if (!$isClass) {
            $value = $path ? $this->extractor->value($root, $path) : $root;
            return $this->templateFactory->toType($value);
        }

        // If the class exists but not the path dont return fake types
        if (isset($this->classCache[$class]) && $path) {
            return null;
        }

        $nativeType = $this->extractor->type($root, $path);

        return $this->nativeToXType($nativeType);

    }
public function xType($root, $path=null)
    {

        $class = is_object($root) ? get_class($root): $root;

        $isClass = is_string($class) && class_exists($class);

        if ($isClass && $type = $this->getClassXType($root, $class, $path)) {
            return $type;
        }

        if (!$isClass) {
            $value = $path ? $this->extractor->value($root, $path) : $root;
            return $this->templateFactory->toType($value);
        }

        // If the class exists but not the path dont return fake types
        if (isset($this->classCache[$class]) && $path) {
            return null;
        }

        $nativeType = $this->extractor->type($root, $path);

        return $this->nativeToXType($nativeType);

    }
public function xType ( $ root , $ path = null ) { $ class = is_object ( $ root ) ? get_class ( $ root ) : $ root ; $ isClass = is_string ( $ class ) && class_exists ( $ class ) ; if ( $ isClass && $ type = $ this -> getClassXType ( $ root , $ class , $ path ) ) { return $ type ; } if ( ! $ isClass ) { $ value = $ path ? $ this -> extractor -> value ( $ root , $ path ) : $ root ; return $ this -> templateFactory -> toType ( $ value ) ; } // If the class exists but not the path dont return fake types if ( isset ( $ this -> classCache [ $ class ] ) && $ path ) { return null ; } $ nativeType = $ this -> extractor -> type ( $ root , $ path ) ; return $ this -> nativeToXType ( $ nativeType ) ; }
Returns a xtype object for an object property. If path is null return the
Xtype for the whole class

@param mixed   $root The resource name, class, an object of it or just some variable
@param string  $path (optional) A key name. Can be dotted like address.street.name

@return XType|null
Returns a xtype object for an object property . If path is null return the Xtype for the whole class