/** * Performs a post request. * * @param Core $solrCore * @throws \HostedSolr\ApiClient\Exception\HostedSolrApiException * @return boolean */ public function add(Core $solrCore) { $url = $this->getEndpointUrl() . '.json?solr_core[name]=' . $solrCore->getName() . '&solr_core[solr_version]=' . $solrCore->getSolrVersion() . '&solr_core[system]=' . $solrCore->getSystem() . '&solr_core[schema]=' . $solrCore->getSchema() . '&'; $url = $this->addApiSecretAndToken($url); $response = $this->httpClient->post($url); $this->throwApiExceptionWhenStatusIsUnexpected(array(201), $response, 'Unexpected API Status during post request!'); return true; }
/** * @param Core $core * @return bool */ public function has(Core $core) { $allApiCores = $this->storageBackend->findAll(); foreach ($allApiCores as $apiCore) { if ($core->getName() == $apiCore->getName()) { return true; } } return false; }