/** * Logout method */ public function logout() { try { $this->curl->exec($this->routes->getLogoutUrl()); $this->cookieStorage->deleteCurlCookieFile(); } catch (\Exception $e) { throw new AlmAuthenticationException('Authentication error : ' . $e->getMessage()); } return $this; }
/** * @param $entityType * @param array $criteria * @param string $hydration * @return array|null|string * @throws AlmEntityManagerException * @throws Exception\AlmCurlException * @throws Exception\AlmException */ public function getBy($entityType, array $criteria, $hydration = self::HYDRATION_ENTITY) { $criteriaProcessed = array(); if (count($criteria) == 0) { throw new AlmEntityManagerException('Criteria array cannot be empty'); } foreach ($criteria as $key => $value) { array_push($criteriaProcessed, $key . '[' . $value . ']'); } $url = $this->routes->getEntityUrl($this->pluralizeEntityType($entityType)) . '?query={' . implode(';', $criteriaProcessed) . '}'; $resultRaw = $this->curl->exec($url)->getResult(); switch ($hydration) { case self::HYDRATION_ENTITY: $xml = simplexml_load_string($resultRaw); $resultArray = array(); foreach ($xml->Entity as $entity) { array_push($resultArray, $this->entityExtractor->extract($entity)); } return $resultArray; break; case self::HYDRATION_NONE: return $resultRaw; break; } throw new AlmEntityManagerException('Incorrect hydration mode specified'); }
/** * @throws AlmEntityParametersManagerException * @throws Exception\AlmCurlException * @throws Exception\AlmException */ protected function refreshLists() { $this->curl->exec($this->routes->getListsUrl()); $xml = simplexml_load_string($this->curl->getResult()); if (false === $xml) { throw new AlmEntityParametersManagerException('Cannot get lists data'); } $this->lists = $xml; }