/** * @param string $name * @param bool $includeMemoryStatistics * * @return array * @throws Exception * @throws \Retrinko\Scylla\Exceptions\Exception * @throws \Retrinko\UrlComposer\Exceptions\UrlException */ public function getNode($name, $includeMemoryStatistics = false) { // Build URL: /nodes[?memory=true] $url = new UrlComposer($this->apiUrl); $url->addToPath('nodes')->addToPath($name); if ($includeMemoryStatistics) { $url->addToQuery('memory', 'true'); } // Build request $request = new JsonRequest($url->__toString(), RequestInterface::REQUEST_METHOD_GET); $request->setAuth($this->user, $this->pass); // Execute request $response = $this->executeRequest($request); return $response->getDecodedContent(); }
/** * @expectedException \Retrinko\UrlComposer\Exceptions\UrlException */ public function test_addToQuery_withEmptyQueyKey_thrownsUrlException() { $baseUlr = 'http://my-url.com/'; $badQueKey = ''; $url = new UrlComposer($baseUlr); $url->addToQuery($badQueKey, 'value'); }