src/API.php
public function login() {
        if ($this->isLoggedIn()) {
            throw new BadMethodCallException('Client is already logged-in.');
        }

        // Auto-connect:
        if ($this->isConnected() === false) {
            $this->connect();
        }

        $response = $this->request(
            'idoit.login'
        );

        if (!array_key_exists('session-id', $response)) {
            throw new RuntimeException('Failed to login because i-doit responded without a session ID');
        }

        $this->session = $response['session-id'];

        return $this;
    }
public function login() {
        if ($this->isLoggedIn()) {
            throw new BadMethodCallException('Client is already logged-in.');
        }

        // Auto-connect:
        if ($this->isConnected() === false) {
            $this->connect();
        }

        $response = $this->request(
            'idoit.login'
        );

        if (!array_key_exists('session-id', $response)) {
            throw new RuntimeException('Failed to login because i-doit responded without a session ID');
        }

        $this->session = $response['session-id'];

        return $this;
    }
public function login ( ) { if ( $ this -> isLoggedIn ( ) ) { throw new BadMethodCallException ( 'Client is already logged-in.' ) ; } // Auto-connect: if ( $ this -> isConnected ( ) === false ) { $ this -> connect ( ) ; } $ response = $ this -> request ( 'idoit.login' ) ; if ( ! array_key_exists ( 'session-id' , $ response ) ) { throw new RuntimeException ( 'Failed to login because i-doit responded without a session ID' ) ; } $ this -> session = $ response [ 'session-id' ] ; return $ this ; }
Logins to API

@return self Returns itself

@throws Exception on error
Logins to API