src/Recipient/RecipientFactory.php
public static function createContactFromStdClass(\stdClass $stdContact): Contact
    {
        if (empty($stdContact->FirstName)) {
            throw new \InvalidArgumentException("stdClass argument must contain FirstName attribute");
        }
        if (empty($stdContact->Phone)) {
            throw new \InvalidArgumentException("stdClass argument must contain Phone attribute");
        }

        $contact = new Contact(
            $stdContact->FirstName,
            $stdContact->Phone,
            $stdContact->LastName ?? null,
            $stdContact->Title ?? null,
            $stdContact->Organization ?? null,
            $stdContact->Email ?? null,
            $stdContact->Notes ?? null
        );
        return $contact;
    }
public static function createContactFromStdClass(\stdClass $stdContact): Contact
    {
        if (empty($stdContact->FirstName)) {
            throw new \InvalidArgumentException("stdClass argument must contain FirstName attribute");
        }
        if (empty($stdContact->Phone)) {
            throw new \InvalidArgumentException("stdClass argument must contain Phone attribute");
        }

        $contact = new Contact(
            $stdContact->FirstName,
            $stdContact->Phone,
            $stdContact->LastName ?? null,
            $stdContact->Title ?? null,
            $stdContact->Organization ?? null,
            $stdContact->Email ?? null,
            $stdContact->Notes ?? null
        );
        return $contact;
    }
public static function createContactFromStdClass ( \ stdClass $ stdContact ) : Contact { if ( empty ( $ stdContact -> FirstName ) ) { throw new \ InvalidArgumentException ( "stdClass argument must contain FirstName attribute" ) ; } if ( empty ( $ stdContact -> Phone ) ) { throw new \ InvalidArgumentException ( "stdClass argument must contain Phone attribute" ) ; } $ contact = new Contact ( $ stdContact -> FirstName , $ stdContact -> Phone , $ stdContact -> LastName ?? null , $ stdContact -> Title ?? null , $ stdContact -> Organization ?? null , $ stdContact -> Email ?? null , $ stdContact -> Notes ?? null ) ; return $ contact ; }
Creates a Contact using the stdClass given.
@param \stdClass $stdContact An stdClass object matching the format of the IP1 SMS API.
@return Contact
@throws \InvalidArgumentException Thrown when required parameters in the argument is missing.
Creates a Contact using the stdClass given .