public function setCollection($name) : void
    {
        if (is_array($name)) {
            if (! isset($name['name'])) {
                throw new InvalidArgumentException('A name key is required when passing an array to setCollection()');
            }
            $this->collectionCapped = $name['capped'] ?? false;
            $this->collectionSize   = $name['size'] ?? 0;
            $this->collectionMax    = $name['max'] ?? 0;
            $this->collection       = $name['name'];
        } else {
            $this->collection = $name;
        }
    }
public function setCollection($name) : void
    {
        if (is_array($name)) {
            if (! isset($name['name'])) {
                throw new InvalidArgumentException('A name key is required when passing an array to setCollection()');
            }
            $this->collectionCapped = $name['capped'] ?? false;
            $this->collectionSize   = $name['size'] ?? 0;
            $this->collectionMax    = $name['max'] ?? 0;
            $this->collection       = $name['name'];
        } else {
            $this->collection = $name;
        }
    }
public function setCollection ( $ name ) : void { if ( is_array ( $ name ) ) { if ( ! isset ( $ name [ 'name' ] ) ) { throw new InvalidArgumentException ( 'A name key is required when passing an array to setCollection()' ) ; } $ this -> collectionCapped = $ name [ 'capped' ] ?? false ; $ this -> collectionSize = $ name [ 'size' ] ?? 0 ; $ this -> collectionMax = $ name [ 'max' ] ?? 0 ; $ this -> collection = $ name [ 'name' ] ; } else { $ this -> collection = $ name ; } }
Sets the collection this Document is mapped to.

@param array|string $name

@throws InvalidArgumentException
Sets the collection this Document is mapped to .