public function contact($nameOrEmail)
    {
        if ($this->contacts === null) {
            $this->getContacts();
        }

        foreach ($this->contacts as $c) {
            if ($c->name == $nameOrEmail || $c->email == $nameOrEmail) {
                return $c;
            }
        }

        throw new Exceptions\NotFoundException("Contact not found.");
    }
public function contact($nameOrEmail)
    {
        if ($this->contacts === null) {
            $this->getContacts();
        }

        foreach ($this->contacts as $c) {
            if ($c->name == $nameOrEmail || $c->email == $nameOrEmail) {
                return $c;
            }
        }

        throw new Exceptions\NotFoundException("Contact not found.");
    }
public function contact ( $ nameOrEmail ) { if ( $ this -> contacts === null ) { $ this -> getContacts ( ) ; } foreach ( $ this -> contacts as $ c ) { if ( $ c -> name == $ nameOrEmail || $ c -> email == $ nameOrEmail ) { return $ c ; } } throw new Exceptions \ NotFoundException ( "Contact not found." ) ; }
Target a contact by its name or email.

@param string $nameOrEmail Name or email of the contact.

@return Contact The contact.
@throws Exceptions\ConnectionException
@throws Exceptions\InvalidTokenException
@throws Exceptions\NotFoundException
Target a contact by its name or email .