public function api($name)
    {
        $classes = array(
            'Bartlett\Reflect\Api\\' => array(
                'Analyser',
                'Cache',
                'Config',
                'Diagnose',
                'Diagram',
                'Plugin',
                'Reflection',
            ),
            'Bartlett\CompatInfo\Api\\' => array(
                'Reference'
            ),
        );

        $class = false;

        foreach ($classes as $ns => $basename) {
            if (in_array(ucfirst($name), $basename)) {
                $class = $ns . ucfirst($name);
                break;
            }
        }

        if (!$class || !class_exists($class)) {
            throw new \InvalidArgumentException(
                sprintf('Unknown Api "%s" requested', $name)
            );
        }
        if ($this->client instanceof LocalClient) {
            $this->client->setNamespace($ns . 'V3');
        }
        return new $class($this->client, $this->token);
    }
public function api($name)
    {
        $classes = array(
            'Bartlett\Reflect\Api\\' => array(
                'Analyser',
                'Cache',
                'Config',
                'Diagnose',
                'Diagram',
                'Plugin',
                'Reflection',
            ),
            'Bartlett\CompatInfo\Api\\' => array(
                'Reference'
            ),
        );

        $class = false;

        foreach ($classes as $ns => $basename) {
            if (in_array(ucfirst($name), $basename)) {
                $class = $ns . ucfirst($name);
                break;
            }
        }

        if (!$class || !class_exists($class)) {
            throw new \InvalidArgumentException(
                sprintf('Unknown Api "%s" requested', $name)
            );
        }
        if ($this->client instanceof LocalClient) {
            $this->client->setNamespace($ns . 'V3');
        }
        return new $class($this->client, $this->token);
    }
public function api ( $ name ) { $ classes = array ( 'Bartlett\Reflect\Api\\' => array ( 'Analyser' , 'Cache' , 'Config' , 'Diagnose' , 'Diagram' , 'Plugin' , 'Reflection' , ) , 'Bartlett\CompatInfo\Api\\' => array ( 'Reference' ) , ) ; $ class = false ; foreach ( $ classes as $ ns => $ basename ) { if ( in_array ( ucfirst ( $ name ) , $ basename ) ) { $ class = $ ns . ucfirst ( $ name ) ; break ; } } if ( ! $ class || ! class_exists ( $ class ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Unknown Api "%s" requested' , $ name ) ) ; } if ( $ this -> client instanceof LocalClient ) { $ this -> client -> setNamespace ( $ ns . 'V3' ) ; } return new $ class ( $ this -> client , $ this -> token ) ; }
Returns an Api

@param string $name Api method to perform

@return Api
@throws \InvalidArgumentException
Returns an Api