src/WidgetOption.php
public function addData(string $key, $value, bool $push = false) : self
    {
        if ($push == false && isset($this->data[$key]) && is_array($value)) {
            $this->data[$key] = array_replace_recursive(
                is_array($this->data[$key]) ? $this->data[$key] : [$this->data[$key]],
                $value
            );
        } else if ($push) {
            if (!isset($this->data[$key])) {
                $this->data[$key] = [];
            }

            $this->data[$key][] = $value;
        } else {
            $this->data[$key] = $value;
        }

        return $this;
    }
public function addData(string $key, $value, bool $push = false) : self
    {
        if ($push == false && isset($this->data[$key]) && is_array($value)) {
            $this->data[$key] = array_replace_recursive(
                is_array($this->data[$key]) ? $this->data[$key] : [$this->data[$key]],
                $value
            );
        } else if ($push) {
            if (!isset($this->data[$key])) {
                $this->data[$key] = [];
            }

            $this->data[$key][] = $value;
        } else {
            $this->data[$key] = $value;
        }

        return $this;
    }
public function addData ( string $ key , $ value , bool $ push = false ) : self { if ( $ push == false && isset ( $ this -> data [ $ key ] ) && is_array ( $ value ) ) { $ this -> data [ $ key ] = array_replace_recursive ( is_array ( $ this -> data [ $ key ] ) ? $ this -> data [ $ key ] : [ $ this -> data [ $ key ] ] , $ value ) ; } else if ( $ push ) { if ( ! isset ( $ this -> data [ $ key ] ) ) { $ this -> data [ $ key ] = [ ] ; } $ this -> data [ $ key ] [ ] = $ value ; } else { $ this -> data [ $ key ] = $ value ; } return $ this ; }
@param string $key
@param mixed $value
@param bool $push

@return $this|self
@param string $key @param mixed $value @param bool $push