Hybrid_Providers_LinkedIn::getUserContacts PHP Метод

getUserContacts() публичный Метод

public getUserContacts ( )
    function getUserContacts()
    {
        try {
            $response = $this->api->profile('~/connections:(id,first-name,last-name,picture-url,public-profile-url,summary)');
        } catch (LinkedInException $e) {
            throw new Exception("User contacts request failed! {$this->providerId} returned an error: {$e->getMessage()}", 0, $e);
        }
        if (!$response || !$response['success']) {
            return array();
        }
        $connections = new SimpleXMLElement($response['linkedin']);
        $contacts = array();
        foreach ($connections->person as $connection) {
            $uc = new Hybrid_User_Contact();
            $uc->identifier = (string) $connection->id;
            $uc->displayName = (string) $connection->{'last-name'} . " " . $connection->{'first-name'};
            $uc->profileURL = (string) $connection->{'public-profile-url'};
            $uc->photoURL = (string) $connection->{'picture-url'};
            $uc->description = (string) $connection->{'summary'};
            $contacts[] = $uc;
        }
        return $contacts;
    }