public function githubCallback()
    {
        $code   = $this->getParam('code', null);
        $github = $this->settings['phpci']['github'];

        if (!is_null($code)) {
            $http   = new HttpClient();
            $url    = 'https://github.com/login/oauth/access_token';
            $params = array('client_id' => $github['id'], 'client_secret' => $github['secret'], 'code' => $code);
            $resp   = $http->post($url, $params);

            if ($resp['success']) {
                parse_str($resp['body'], $resp);

                $this->settings['phpci']['github']['token'] = $resp['access_token'];
                $this->storeSettings();

                $response = new b8\Http\Response\RedirectResponse();
                $response->setHeader('Location', PHPCI_URL . 'settings?linked=1');
                return $response;
            }
        }

        $response = new b8\Http\Response\RedirectResponse();
        $response->setHeader('Location', PHPCI_URL . 'settings?linked=2');
        return $response;
    }
public function githubCallback()
    {
        $code   = $this->getParam('code', null);
        $github = $this->settings['phpci']['github'];

        if (!is_null($code)) {
            $http   = new HttpClient();
            $url    = 'https://github.com/login/oauth/access_token';
            $params = array('client_id' => $github['id'], 'client_secret' => $github['secret'], 'code' => $code);
            $resp   = $http->post($url, $params);

            if ($resp['success']) {
                parse_str($resp['body'], $resp);

                $this->settings['phpci']['github']['token'] = $resp['access_token'];
                $this->storeSettings();

                $response = new b8\Http\Response\RedirectResponse();
                $response->setHeader('Location', PHPCI_URL . 'settings?linked=1');
                return $response;
            }
        }

        $response = new b8\Http\Response\RedirectResponse();
        $response->setHeader('Location', PHPCI_URL . 'settings?linked=2');
        return $response;
    }
public function githubCallback ( ) { $ code = $ this -> getParam ( 'code' , null ) ; $ github = $ this -> settings [ 'phpci' ] [ 'github' ] ; if ( ! is_null ( $ code ) ) { $ http = new HttpClient ( ) ; $ url = 'https://github.com/login/oauth/access_token' ; $ params = array ( 'client_id' => $ github [ 'id' ] , 'client_secret' => $ github [ 'secret' ] , 'code' => $ code ) ; $ resp = $ http -> post ( $ url , $ params ) ; if ( $ resp [ 'success' ] ) { parse_str ( $ resp [ 'body' ] , $ resp ) ; $ this -> settings [ 'phpci' ] [ 'github' ] [ 'token' ] = $ resp [ 'access_token' ] ; $ this -> storeSettings ( ) ; $ response = new b8 \ Http \ Response \ RedirectResponse ( ) ; $ response -> setHeader ( 'Location' , PHPCI_URL . 'settings?linked=1' ) ; return $ response ; } } $ response = new b8 \ Http \ Response \ RedirectResponse ( ) ; $ response -> setHeader ( 'Location' , PHPCI_URL . 'settings?linked=2' ) ; return $ response ; }
Github redirects users back to this URL when t
Github redirects users back to this URL when t