/** * * @param string $userId * @param NKUser $userData */ private function join_user_data($userId, NKUser $userData) { $user = qa_db_user_login_find(Q2ANKConnect::LOGIN_SOURCE, $userData->id()); if (count($user) === 0) { qa_db_user_login_add($userId, Q2ANKConnect::LOGIN_SOURCE, $userData->id()); } }
/** * */ public function testId() { $this->assertSame('person.abc', $this->object->id()); }
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; }