PHP Class Spatie\GoogleTagManager\DataLayer

Show file Open project: spatie/laravel-googletagmanager Class Usage Examples

Protected Properties

Property Type Description
$data array

Public Methods

Method Description
__construct ( $data = [] )
clear ( ) Empty the data layer.
set ( array | string $key, mixed $value = null ) Add data to the data layer. Supports dot notation.
toArray ( ) : array Return an array representation of the data layer.
toJson ( ) : string Return a json representation of the data layer.

Method Details

__construct() public method

public __construct ( $data = [] )

clear() public method

Empty the data layer.
public clear ( )

set() public method

Inspired by laravel's config repository class.
public set ( array | string $key, mixed $value = null )
$key array | string
$value mixed

toArray() public method

Return an array representation of the data layer.
public toArray ( ) : array
return array

toJson() public method

Return a json representation of the data layer.
public toJson ( ) : string
return string

Property Details

$data protected property

protected array $data
return array