コード例 #1
0
 private function generateUserHandle(NKUser $userData)
 {
     $name = preg_replace('/[^a-z0-9.]/i', '', $this->remove_plchars($userData->name()));
     $check_name = true;
     while ($check_name) {
         $find = qa_db_user_find_by_handle($name);
         if (count($find) > 0) {
             $name .= mt_rand(0, 9);
         } else {
             $check_name = false;
         }
     }
     return $name;
 }
コード例 #2
0
ファイル: NKUserTest.php プロジェクト: naszaklasa/nk-php-sdk
 /**
  *
  */
 public function testBirthday()
 {
     $this->assertNull($this->object->birthday());
 }
コード例 #3
0
ファイル: NKService.php プロジェクト: naszaklasa/nk-php-sdk
 private function people()
 {
     $args = func_get_args();
     if (0 == count($args)) {
         throw new BadMethodCallException("Service 'people' require one or more person id as arguments");
     }
     $ids = array();
     foreach ($args as $user) {
         if (true === $user instanceof NKUser) {
             $ids[] = $user->id();
         } else {
             $ids[] = $user;
         }
     }
     $fields = array('id', 'age', 'name', 'currentLocation', 'displayName', 'gender', 'photos', 'profileUrl', 'thumbnailUrl', 'urls');
     if (in_array(NKPermissions::EMAIL_PROFILE, $this->getConfig()->permissions)) {
         $fields[] = 'emails';
     }
     if (in_array(NKPermissions::BIRTHDAY_PROFILE, $this->getConfig()->permissions)) {
         $fields[] = 'birthday';
     }
     if (in_array(NKPermissions::PHONE_PROFILE, $this->getConfig()->permissions)) {
         $fields[] = 'phoneNumbers';
     }
     if (in_array(NKPermissions::PERSON_FRIENDS_COUNT, $this->getConfig()->permissions)) {
         $fields[] = 'nkFriendsCount';
     }
     $data = $this->call('/people/' . implode(',', $ids), array('fields' => implode(',', $fields)));
     $result = array();
     if (1 === count($data)) {
         $user = new NKUser();
         $user->assignData($data['entry']);
         $result[$user->id()] = $user;
     } else {
         foreach ($data['entry'] as $row) {
             $user = new NKUser();
             $user->assignData($row);
             $result[$user->id()] = $user;
         }
     }
     return $result;
 }
コード例 #4
0
 /**
  *
  */
 public function testBirthday()
 {
     $this->assertSame('1991-11-24', $this->object->birthday());
 }