Spatie\GoogleTagManager\DataLayer::set PHP Метод

set() публичный Метод

Inspired by laravel's config repository class.
public set ( array | string $key, mixed $value = null )
$key array | string
$value mixed
    public function set($key, $value = null)
    {
        if (is_array($key)) {
            foreach ($key as $innerKey => $innerValue) {
                array_set($this->data, $innerKey, $innerValue);
            }
            return;
        }
        array_set($this->data, $key, $value);
    }

Usage Example

 /**
  * Add data to the data layer.
  *
  * @param array|string $key
  * @param mixed        $value
  */
 public function set($key, $value = null)
 {
     $this->dataLayer->set($key, $value);
 }
All Usage Examples Of Spatie\GoogleTagManager\DataLayer::set