/** * @param $service * @return Service */ private function makeService($service) { $serviceObject = new Service($service['name'], $service['credentials'], $service['label']); unset($service['name']); unset($service['credentials']); unset($service['label']); $serviceObject->addDatas($service); $this->services[$serviceObject->getName()] = $serviceObject; return $serviceObject; }
public function parseFromService(Service $service) { $url = $service->getValue('(uri|url)'); if (!empty($url)) { $toReturn['url'] = $url; return $this->parseUrl($url); } $host = $service->getValue('.*host.*'); $port = $service->getValue('.*port.*'); $user = $service->getValue('.*(user|login).*'); $password = $service->getValue('.*pass.*'); $toReturn['user'] = $user; $toReturn['pass'] = $password; $toReturn['host'] = $host; $toReturn['port'] = $port; return $toReturn; }