private function checkLogin() { $this->client->api('user')->getCurrentUser(); if ($this->client->getResponseCode() == 401) { throw new \Exception('Invalid Redmine credentials.', 401); } }
/** * Returns whether or not the last api call failed. * * @return bool */ public function lastCallFailed() { $code = $this->client->getResponseCode(); return 200 !== $code && 201 !== $code; }
/** * @covers Redmine\Client * @test */ public function testGetResponseCodeIsInitialNull() { $client = new Client('http://test.local', 'asdf'); $this->assertEquals(0, $client->getResponseCode()); }
/** * Returns whether or not the last api call failed. * @return bool */ public function lastCallFailed() { $code = $this->client->getResponseCode(); return 200 < $code || $code >= 400; }