code: public function setVariables($variables, $overwrite = false)
      {
          if (!is_array($variables) && !$variables instanceof \Traversable) {
              throw new \InvalidArgumentException(
                  sprintf(
                      '%s: expects an array, or Traversable argument; received "%s"',
                      __METHOD__,
                      (is_object($variables) ? get_class($variables) : gettype($variables))
                  )
              );
          }
  
          if ($overwrite) {
              if (is_object($variables) && !$variables instanceof \ArrayAccess) {
                  $variables = ArrayUtils::iteratorToArray($variables);
              }
  
              $this->variables = $variables;
              return $this;
          }
  
          foreach ($variables as $key => $value) {
              $this->setVariable($key, $value);
          }
  
          return $this;
      }
docs: Set view variables en masse
  
  Can be an array or a Traversable + ArrayAccess object.
  
  @param  array|\ArrayAccess|\Traversable $variables
  @param  bool $overwrite Whether or not to overwrite the internal container with $variables
  @throws \InvalidArgumentException
  @return self