/** * Constructs the full url request and forwards it to the Client * @param string $method calling __METHOD__ * @param array $defaults * @param array $params * @return \SimpleXmlElement */ protected function get($method, array $defaults = null, array $params = null) { if (null === $defaults || null === $params) { return $this->client->get('/' . $this->section . '/' . explode('::', $method, 2)[1]); } $params = array_filter(array_merge($defaults, $params), array($this, 'isNotNull')); return $this->client->get('/' . $this->section . '/' . explode('::', $method, 2)[1] . '?' . http_build_query($params)); }
/** * @test * @dataProvider getApiClassesProvider */ public function shouldGetApiInstance($apiName, $class) { $client = new Client('http://test.local'); $this->assertInstanceOf($class, $client->api($apiName)); }