public function vocabulary($key)
    {
        if (is_numeric($key)) {
            return $this->vocabularyById[$key]->machine_name;
        }

        return $this->vocabularyByName[$key]->id;
    }
public function vocabulary($key)
    {
        if (is_numeric($key)) {
            return $this->vocabularyById[$key]->machine_name;
        }

        return $this->vocabularyByName[$key]->id;
    }
public function vocabulary ( $ key ) { if ( is_numeric ( $ key ) ) { return $ this -> vocabularyById [ $ key ] -> machine_name ; } return $ this -> vocabularyByName [ $ key ] -> id ; }
Get a vocabulary by name or ID

Taxonomy::vocabulary(1);
returns 'tags'

Taxonomy::vocabulary('tags');
returns 1

@param int|string $key
@return mixed
Get a vocabulary by name or ID