public function offsetSet($index, $newval)
    {
        if (!$newval instanceof WriterAbstract) {
            throw new \InvalidArgumentException(
                'The Writer Collection may only contain objects descending from WriterAbstract'
            );
        }

        if (!preg_match('/^[a-zA-Z0-9\-\_\/]{3,}$/', $index)) {
            throw new \InvalidArgumentException(
                'The name of a Writer may only contain alphanumeric characters, one or more hyphens, underscores and '
                . 'forward slashes and must be at least three characters wide'
            );
        }

        // if the writer supports routes, provide them with the router queue
        if ($newval instanceof Routable) {
            $newval->setRouters($this->routers);
        }

        parent::offsetSet($index, $newval);
    }
public function offsetSet($index, $newval)
    {
        if (!$newval instanceof WriterAbstract) {
            throw new \InvalidArgumentException(
                'The Writer Collection may only contain objects descending from WriterAbstract'
            );
        }

        if (!preg_match('/^[a-zA-Z0-9\-\_\/]{3,}$/', $index)) {
            throw new \InvalidArgumentException(
                'The name of a Writer may only contain alphanumeric characters, one or more hyphens, underscores and '
                . 'forward slashes and must be at least three characters wide'
            );
        }

        // if the writer supports routes, provide them with the router queue
        if ($newval instanceof Routable) {
            $newval->setRouters($this->routers);
        }

        parent::offsetSet($index, $newval);
    }
public function offsetSet ( $ index , $ newval ) { if ( ! $ newval instanceof WriterAbstract ) { throw new \ InvalidArgumentException ( 'The Writer Collection may only contain objects descending from WriterAbstract' ) ; } if ( ! preg_match ( '/^[a-zA-Z0-9\-\_\/]{3,}$/' , $ index ) ) { throw new \ InvalidArgumentException ( 'The name of a Writer may only contain alphanumeric characters, one or more hyphens, underscores and ' . 'forward slashes and must be at least three characters wide' ) ; } // if the writer supports routes, provide them with the router queue if ( $ newval instanceof Routable ) { $ newval -> setRouters ( $ this -> routers ) ; } parent :: offsetSet ( $ index , $ newval ) ; }
Registers a writer with a given name.

@param string         $index a Writer's name, must be at least 3
characters, alphanumeric and/or contain one or more hyphens,
underscores and forward slashes.
@param WriterAbstract $newval The Writer object to register to this name.

@throws \InvalidArgumentException if either of the above restrictions is
not met.
Registers a writer with a given name .