private function fill($attributes)
    {
        // json
        if (is_string($attributes)) {
            $attributes = json_decode($attributes, true);
        }

        // check if attributes are valid
        if (!is_array($attributes)) {
            throw new \InvalidArgumentException('Attributes must be of type array or a valid json string');
        }

        foreach ($attributes as $key => $value) {
            $this->setAttribute($key, $value);
        }
    }
private function fill($attributes)
    {
        // json
        if (is_string($attributes)) {
            $attributes = json_decode($attributes, true);
        }

        // check if attributes are valid
        if (!is_array($attributes)) {
            throw new \InvalidArgumentException('Attributes must be of type array or a valid json string');
        }

        foreach ($attributes as $key => $value) {
            $this->setAttribute($key, $value);
        }
    }
private function fill ( $ attributes ) { // json if ( is_string ( $ attributes ) ) { $ attributes = json_decode ( $ attributes , true ) ; } // check if attributes are valid if ( ! is_array ( $ attributes ) ) { throw new \ InvalidArgumentException ( 'Attributes must be of type array or a valid json string' ) ; } foreach ( $ attributes as $ key => $ value ) { $ this -> setAttribute ( $ key , $ value ) ; } }
Fill the attributes
@param  string|array $attributes
@return void
Fill the attributes