Esempio n. 1
0
 public function getGoogleContacts($opts = array())
 {
     $gcontacts = ContactFactory::getAll();
     if (!empty($opts['sort'])) {
         usort($gcontacts, function ($contact1, $contact2) {
             return strtolower($contact1->name) < strtolower($contact2->name) ? -1 : 1;
         });
     }
     return $gcontacts;
 }
<?php

require_once '../../../vendor/autoload.php';
use rapidweb\googlecontacts\factories\ContactFactory;
if (!isset($_GET['selfURL'])) {
    throw new Exception('No selfURL specified.');
}
$contact = ContactFactory::getBySelfURL($_GET['selfURL']);
var_dump($contact);
$contact->name = 'Test';
$contact->phoneNumber = '07812363789';
$contact->email = '*****@*****.**';
$contactAfterUpdate = ContactFactory::submitUpdates($contact);
var_dump($contactAfterUpdate);
<?php

require_once '../../../vendor/autoload.php';
use rapidweb\googlecontacts\factories\ContactFactory;
$contacts = ContactFactory::getAll();
if (count($contacts)) {
    echo 'Test retrieved ' . count($contacts) . ' contacts.';
} else {
    echo 'No contacts retrieved!';
}