apiRequest('', 'GET')); if (!$data->exists('id')) { throw new Exception('User profile request failed! ModxPro returned an invalid response.'); } $userProfile = new Profile(); $userProfile->identifier = $data->get('id'); $userProfile->firstName = $data->get('real_name'); $userProfile->lastName = $data->get('family_name'); $userProfile->displayName = $data->get('display_name'); $userProfile->photoURL = 'http://upics.yandex.net/' . $userProfile->identifier . '/normal'; $userProfile->profileURL = ''; $userProfile->gender = (int)$data->get('sex') == 'female'; $userProfile->email = $userProfile->emailVerified = $data->get('default_email'); if ($dob = $data->get('birthday')) { list($userProfile->birthYear, $userProfile->birthMonth, $userProfile->birthDay) = explode('-', $dob); } return $userProfile; } }