atk4\data\Reference::__construct PHP Method

__construct() public method

Default constructor. Will copy argument into properties.
public __construct ( array $defaults = [] )
$defaults array
    public function __construct($defaults = [])
    {
        if (isset($defaults[0])) {
            $this->link = $defaults[0];
            unset($defaults[0]);
        }
        foreach ($defaults as $key => $val) {
            if (is_array($val)) {
                $this->{$key} = array_merge(isset($this->{$key}) && is_array($this->{$key}) ? $this->{$key} : [], $val);
            } else {
                $this->{$key} = $val;
            }
        }
        if (!$this->model) {
            $this->model = $this->link;
        }
    }