src/Common/Person.php
public function validate()
    {
        $this->validateRequiredParameters();

        if (!is_string($this->getId())) {
            throw new InvalidPersonException("The id parameter must be a string");
        }

        if (!is_string($this->getName())) {
            throw new InvalidPersonException("The name parameter must be a string");
        }

        if ($this->hasParameter('type')) {
            if (!is_string($this->getType())) {
                throw new InvalidPersonException("The type parameter must be a string");
            }
        }

        if ($this->hasParameter('email')) {
            if (!filter_var($this->getEmail(), FILTER_VALIDATE_EMAIL)) {
                throw new InvalidPersonException("The email parameter must be a valid email");
            }
        }

        if ($this->hasParameter('phone')) {
            if (!is_string($this->getPhone())) {
                throw new InvalidPersonException("The phone parameter must be a string");
            }
        }

        if ($this->hasParameter('fax')) {
            if (!is_string($this->getFax())) {
                throw new InvalidPersonException("The fax parameter must be a string");
            }
        }

        if ($this->hasParameter('address')) {
            $address = $this->getAddress();
            if (!($address instanceof Address)) {
                throw new InvalidPersonException("The address parameter must be an Address object");
            }
            $address->validate();
        }
    }
public function validate()
    {
        $this->validateRequiredParameters();

        if (!is_string($this->getId())) {
            throw new InvalidPersonException("The id parameter must be a string");
        }

        if (!is_string($this->getName())) {
            throw new InvalidPersonException("The name parameter must be a string");
        }

        if ($this->hasParameter('type')) {
            if (!is_string($this->getType())) {
                throw new InvalidPersonException("The type parameter must be a string");
            }
        }

        if ($this->hasParameter('email')) {
            if (!filter_var($this->getEmail(), FILTER_VALIDATE_EMAIL)) {
                throw new InvalidPersonException("The email parameter must be a valid email");
            }
        }

        if ($this->hasParameter('phone')) {
            if (!is_string($this->getPhone())) {
                throw new InvalidPersonException("The phone parameter must be a string");
            }
        }

        if ($this->hasParameter('fax')) {
            if (!is_string($this->getFax())) {
                throw new InvalidPersonException("The fax parameter must be a string");
            }
        }

        if ($this->hasParameter('address')) {
            $address = $this->getAddress();
            if (!($address instanceof Address)) {
                throw new InvalidPersonException("The address parameter must be an Address object");
            }
            $address->validate();
        }
    }
public function validate ( ) { $ this -> validateRequiredParameters ( ) ; if ( ! is_string ( $ this -> getId ( ) ) ) { throw new InvalidPersonException ( "The id parameter must be a string" ) ; } if ( ! is_string ( $ this -> getName ( ) ) ) { throw new InvalidPersonException ( "The name parameter must be a string" ) ; } if ( $ this -> hasParameter ( 'type' ) ) { if ( ! is_string ( $ this -> getType ( ) ) ) { throw new InvalidPersonException ( "The type parameter must be a string" ) ; } } if ( $ this -> hasParameter ( 'email' ) ) { if ( ! filter_var ( $ this -> getEmail ( ) , FILTER_VALIDATE_EMAIL ) ) { throw new InvalidPersonException ( "The email parameter must be a valid email" ) ; } } if ( $ this -> hasParameter ( 'phone' ) ) { if ( ! is_string ( $ this -> getPhone ( ) ) ) { throw new InvalidPersonException ( "The phone parameter must be a string" ) ; } } if ( $ this -> hasParameter ( 'fax' ) ) { if ( ! is_string ( $ this -> getFax ( ) ) ) { throw new InvalidPersonException ( "The fax parameter must be a string" ) ; } } if ( $ this -> hasParameter ( 'address' ) ) { $ address = $ this -> getAddress ( ) ; if ( ! ( $ address instanceof Address ) ) { throw new InvalidPersonException ( "The address parameter must be an Address object" ) ; } $ address -> validate ( ) ; } }
Validate this person. If the person is invalid, InvalidPersonException is thrown.

@throws InvalidPersonException
@return void
Validate this person . If the person is invalid InvalidPersonException is thrown .