/** * @param bool $arrayFormat * * @return Party */ public function getClients($arrayFormat = false) { if ($arrayFormat) { $arrayToReturn = []; /** @var Inventor $client */ foreach ($this->clients->getMembers() as $client) { $arrayToReturn[] = $client->toArray(); } return $arrayToReturn; } return $this->inventors; }
/** * Creates an IPRight From an associative array * * @param array $details * * @return IPRight */ public static function rightFromArray(array $details) { $IPRight = new IPRight(); $IPRight->setSource(SearchSource::fromString($details['source'])); $IPRight->setRightType(RightType::fromString($details['type'])); $IPRight->setLanguageOfFiling($details['languageOfFiling']); $IPRight->setLanguageOfFiling($details['languageOfFiling']); $IPRight->setDesignatedStates($details['designatedStates']); $IPRight->setStatus($details['status']); //Titles $IPRight->setEnglishTitle($details['titles']['english']); $IPRight->setFrenchTitle($details['titles']['french']); $IPRight->setGermanTitle($details['titles']['german']); //Application Details $IPRight->setApplicationCountry($details['application']['country']); $IPRight->setApplicationDate($details['application']['date']); $IPRight->setApplicationNumber($details['application']['number']); //Publication Details $IPRight->setPublicationCountry($details['publication']['country']); $IPRight->setPublicationDate($details['publication']['date']); $IPRight->setPublicationNumber($details['publication']['number']); //Grant Details $IPRight->setGrantCountry($details['grant']['country']); $IPRight->setGrantDate($details['grant']['date']); $IPRight->setGrantNumber($details['grant']['number']); if (is_array($details['priorities'])) { foreach ($details['priorities'] as $priorityArray) { $priority = Priority::fromNumber($priorityArray['number']); $priority->setDate($priorityArray['date']); $priority->setCountry($priorityArray['country']); $priority->setKind($priorityArray['kind']); $IPRight->addPriority($priority); } } //Applicants $applicantParty = new Party(); if (isset($details['applicants']) && is_array($details['applicants'])) { foreach ($details['applicants'] as $applicantArray) { $applicantParty->addMember(self::partyMemberToObject(new Applicant(), $applicantArray)); } } $IPRight->setApplicants($applicantParty); //Inventors $inventorParty = new Party(); if (isset($details['inventors']) && is_array($details['inventors'])) { foreach ($details['inventors'] as $inventorArray) { $inventorParty->addMember(self::partyMemberToObject(new Inventor(), $inventorArray)); } } $IPRight->setInventors($inventorParty); //Agents $agentParty = new Party(); if (isset($details['agents']) && is_array($details['agents'])) { foreach ($details['agents'] as $agentArray) { $agentParty->addMember(self::partyMemberToObject(new Agent(), $agentArray)); } } $IPRight->setAgents($agentParty); //Clients $clientParty = new Party(); if (isset($details['clients']) && is_array($details['clients'])) { foreach ($details['clients'] as $clientArray) { $clientParty->addMember(self::partyMemberToObject(new Client(), $clientArray)); } } $IPRight->setClients($clientParty); //Documents if (isset($details['documents']) && is_array($details['documents'])) { foreach ($details['documents'] as $document) { $doc = new Document(); $doc->setFileName($document['filename']); $doc->setDescription($document['description']); if (isset($document['content'])) { $doc->setContentFromString($document['content']); } $IPRight->documents()->add($doc); } } //Custom fields if (isset($details['custom']) && is_array($details['custom'])) { foreach ($details['custom'] as $name => $value) { $IPRight->addCustom($name, $value); } } //Citations if (isset($details['citations']) && is_array($details['citations'])) { foreach ($details['citations'] as $citationArray) { if ($citationArray['type'] == Citation::PATENT) { $citation = Citation::patent($citationArray['number'], $citationArray['country'], $citationArray['cited-by'], $citationArray['date']); } else { $citation = Citation::nonPatentLiterature($citationArray['text'], $citationArray['cited-by'], $citationArray['country'], $citationArray['date']); } $IPRight->addCitation($citation); } } return $IPRight; }