public function make(string $key = null, string $value = null): \BearFramework\App\DataItem
    {
        if ($this->newDataItemCache === null) {
            $this->newDataItemCache = new \BearFramework\App\DataItem();
        }
        $object = clone($this->newDataItemCache);
        if ($key !== null) {
            if (!$this->validate($key)) {
                throw new \InvalidArgumentException('The key provided (' . $key . ') is not valid! It may contain only the following characters: "a-z", "0-9", ".", "/", "-" and "_".');
            }
            $object->key = $key;
        }
        if ($value !== null) {
            $object->value = $value;
        }
        return $object;
    }
public function make(string $key = null, string $value = null): \BearFramework\App\DataItem
    {
        if ($this->newDataItemCache === null) {
            $this->newDataItemCache = new \BearFramework\App\DataItem();
        }
        $object = clone($this->newDataItemCache);
        if ($key !== null) {
            if (!$this->validate($key)) {
                throw new \InvalidArgumentException('The key provided (' . $key . ') is not valid! It may contain only the following characters: "a-z", "0-9", ".", "/", "-" and "_".');
            }
            $object->key = $key;
        }
        if ($value !== null) {
            $object->value = $value;
        }
        return $object;
    }
public function make ( string $ key = null , string $ value = null ) : \ BearFramework \ App \ DataItem { if ( $ this -> newDataItemCache === null ) { $ this -> newDataItemCache = new \ BearFramework \ App \ DataItem ( ) ; } $ object = clone ( $ this -> newDataItemCache ) ; if ( $ key !== null ) { if ( ! $ this -> validate ( $ key ) ) { throw new \ InvalidArgumentException ( 'The key provided (' . $ key . ') is not valid! It may contain only the following characters: "a-z", "0-9", ".", "/", "-" and "_".' ) ; } $ object -> key = $ key ; } if ( $ value !== null ) { $ object -> value = $ value ; } return $ object ; }
Constructs a new data item and returns it.

@param string|null $key The key of the data item.
@param string|null $value The value of the data item.
@return \BearFramework\App\DataItem Returns a new data item.
@throws \InvalidArgumentException
Constructs a new data item and returns it .