/** * Can be used to create a new core by passing some required scalar values. * * @param string $name * @param string $system * @param string $solrVersion * @param string $schema * * @throws \InvalidArgumentException * @return boolean */ public function createNewCore($name, $system = 'typo3', $solrVersion = '4.8', $schema = 'english') { if (trim($name) === '') { throw new \InvalidArgumentException('Can not create a core without passing a name'); } $coreToCreate = CoreBuilder::buildFromScalarValues($name, $system, $schema, $solrVersion); return $this->coreRepository->add($coreToCreate); }
/** * Performs a get request. * * @return Core[] */ public function findAll() { $cores = array(); $url = $this->getEndpointUrl() . '.json?'; $url = $this->addApiSecretAndToken($url); $response = $this->httpClient->get($url); $this->throwApiExceptionWhenStatusIsUnexpected(array(200), $response, 'Unexpected API Status during get request '); $jsonResponse = $response->getBody(); $apiCores = json_decode($jsonResponse); foreach ($apiCores as $apiCore) { $core = CoreBuilder::buildFromScalarValues($apiCore->name, $apiCore->system, $apiCore->schema, $apiCore->solr_version, $apiCore->id, $apiCore->created_at, $apiCore->updated_at, $apiCore->user_id, $apiCore->is_activated, $apiCore->internal_name, $apiCore->password); $cores[] = $core; } return $cores; }