/** * @return Git_Mirror_Mirror * @throws Git_Mirror_MissingDataException * @throws Git_Mirror_CreateException */ public function save($url, $hostname, $ssh_key, $password, $name) { if (!$url || !$ssh_key || !$name) { throw new Git_Mirror_MissingDataException(); } $this->checkThatHostnameIsValidOnCreation($hostname); $mirror_id = $this->dao->save($url, $hostname, $name); if (!$mirror_id) { throw new Git_Mirror_CreateException(); } $user = $this->createUserForMirror($mirror_id, $password, $ssh_key); return $this->getInstanceFromRow($user, array('id' => $mirror_id, 'url' => $url, 'hostname' => $hostname, 'name' => $name)); }