Beispiel #1
0
 /**
  * Runs a search and returns the output
  *
  * @param RightType         $rightType
  * @param Number            $numberType
  * @param                   $number
  * @param SearchSource|null $searchSource
  *
  * @return bool|\WorkAnyWare\IPFO\IPRight
  */
 public function search(Number $numberType, $number, RightType $rightType = null, SearchSource $searchSource = null)
 {
     try {
         $uri = $this->getSearchURI($numberType, $number, $rightType, $searchSource);
         $response = $this->assembleRequest($uri)->json();
         if ($response['success']) {
             return IPFFactory::rightFromArray($response['result']);
         }
     } catch (\Exception $e) {
         echo $e->getMessage();
         //Fail Gracefully
     }
     return false;
 }
Beispiel #2
0
 /**
  * Returns the IP Rights from the parse request
  * @return IPRight[]|bool
  */
 public function getIPRights()
 {
     try {
         $response = $this->assembleRequest()->json();
         if ($response['success']) {
             $IPRights = [];
             foreach ($response['result'] as $result) {
                 $IPRights[] = IPFFactory::rightFromArray($result);
             }
             return $IPRights;
         }
     } catch (\Exception $e) {
         return false;
     }
     return false;
 }