Api\StructType\ApiShopper::setId PHP Method

setId() public method

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