Api\StructType\ApiShopper::setPhoneNumber PHP Method

setPhoneNumber() public method

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