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; $contacts = ContactFactory::getAll(); if (count($contacts)) { echo 'Test retrieved ' . count($contacts) . ' contacts.'; } else { echo 'No contacts retrieved!'; }