Api\StructType\ApiShopper::setDateOfBirth PHP Method

setDateOfBirth() public method

Set dateOfBirth value
public setDateOfBirth ( string $dateOfBirth = null ) : ApiShopper
$dateOfBirth string
return ApiShopper
    public function setDateOfBirth($dateOfBirth = null)
    {
        // validation for constraint: maxLength
        if (is_scalar($dateOfBirth) && strlen($dateOfBirth) > 10 || is_array($dateOfBirth) && count($dateOfBirth) > 10) {
            throw new \InvalidArgumentException(sprintf('Invalid length, please provide an array with 10 element(s) or a scalar of 10 character(s) at most, "%d" length given', is_scalar($dateOfBirth) ? strlen($dateOfBirth) : count($dateOfBirth)), __LINE__);
        }
        // validation for constraint: minLength
        if (is_scalar($dateOfBirth) && strlen($dateOfBirth) < 10 || is_array($dateOfBirth) && count($dateOfBirth) < 10) {
            throw new \InvalidArgumentException('Invalid length, please provide an array with 10 element(s) or a scalar of 10 character(s) at least', __LINE__);
        }
        // validation for constraint: string
        if (!is_null($dateOfBirth) && !is_string($dateOfBirth)) {
            throw new \InvalidArgumentException(sprintf('Invalid value, please provide a string, "%s" given', gettype($dateOfBirth)), __LINE__);
        }
        $this->dateOfBirth = $dateOfBirth;
        return $this;
    }