private static function getUserJson($user)
 {
     //TODO Data object implementation
     $userArray = array();
     $yob = $user->yearOfBirth;
     if (StubValidator::isIntegerValid($yob) && $yob > 0) {
         $userArray['yob'] = $yob;
     }
     $gender = $user->gender;
     if ($gender != null) {
         if ($gender == Gender::MALE) {
             $userArray['gender'] = 'M';
         } else {
             if ($gender == Gender::FEMALE) {
                 $userArray['gender'] = 'F';
             }
         }
     }
     return $userArray;
 }
Example #2
0
 /**
  * Use this method to check if this Object has all the required parameters
  * present, to be used to construct a JSON request. The required parameters
  * would be specific to an ad-format.
  * 
  * @return If the mandatory params are present, then true, otherwise false.
  */
 public function isValid()
 {
     if (StubValidator::isStringValid($this->carrierIP) == false) {
         return false;
     }
     if (StubValidator::isStringValid($this->userAgent) == false) {
         return false;
     }
     //put checks for device id later on..
     return true;
 }