public static function create($term, $taxonomy = null)
    {
        // Ex: Taco\Term\Factory::create('Keyword')
        if (is_string($term) && class_exists($term)) {
            return new $term;
        }

        if (!is_object($term)) {
            $term = get_term($term, $taxonomy);
        }
        
        // TODO Refactor how this works to be more explicit and less guess
        $class = str_replace(' ', '', ucwords(str_replace(Base::SEPARATOR, ' ', $term->taxonomy)));
        if (!class_exists($class)) {
            $class = str_replace(' ', '\\', ucwords(str_replace(Base::SEPARATOR, ' ', $term->taxonomy)));
        }

        $instance = new $class;
        $instance->load($term->term_id);
        return $instance;
    }
public static function create($term, $taxonomy = null)
    {
        // Ex: Taco\Term\Factory::create('Keyword')
        if (is_string($term) && class_exists($term)) {
            return new $term;
        }

        if (!is_object($term)) {
            $term = get_term($term, $taxonomy);
        }
        
        // TODO Refactor how this works to be more explicit and less guess
        $class = str_replace(' ', '', ucwords(str_replace(Base::SEPARATOR, ' ', $term->taxonomy)));
        if (!class_exists($class)) {
            $class = str_replace(' ', '\\', ucwords(str_replace(Base::SEPARATOR, ' ', $term->taxonomy)));
        }

        $instance = new $class;
        $instance->load($term->term_id);
        return $instance;
    }
public static function create ( $ term , $ taxonomy = null ) { // Ex: Taco\Term\Factory::create('Keyword') if ( is_string ( $ term ) && class_exists ( $ term ) ) { return new $ term ; } if ( ! is_object ( $ term ) ) { $ term = get_term ( $ term , $ taxonomy ) ; } // TODO Refactor how this works to be more explicit and less guess $ class = str_replace ( ' ' , '' , ucwords ( str_replace ( Base :: SEPARATOR , ' ' , $ term -> taxonomy ) ) ) ; if ( ! class_exists ( $ class ) ) { $ class = str_replace ( ' ' , '\\' , ucwords ( str_replace ( Base :: SEPARATOR , ' ' , $ term -> taxonomy ) ) ) ; } $ instance = new $ class ; $ instance -> load ( $ term -> term_id ) ; return $ instance ; }
Create an instance based on a term object
This basically autoloads the meta data
@param mixed $term Object or term id
@param string $taxonomy
@return object
Create an instance based on a term object This basically autoloads the meta data