public function save(array $options = [])
    {
        $options = array_merge(
            [
                'file'              => null,
                'writerOptions'     => []
            ],
            $options
        );

        // Simple shortcut
        $options['writerOptions']['file'] = $options['file'];

        /** @var Callable $callable */
        $callable = $this->getOption('onBeforeSave');

        if (!is_callable($callable)) {
            throw new \RuntimeException('Option "onBeforeSave" must be a callable.');
        }

        call_user_func_array($callable, [$this, $options]);

        $this->getWriter()->write($this->getData(), $options['writerOptions']);

        return $this;
    }
public function save(array $options = [])
    {
        $options = array_merge(
            [
                'file'              => null,
                'writerOptions'     => []
            ],
            $options
        );

        // Simple shortcut
        $options['writerOptions']['file'] = $options['file'];

        /** @var Callable $callable */
        $callable = $this->getOption('onBeforeSave');

        if (!is_callable($callable)) {
            throw new \RuntimeException('Option "onBeforeSave" must be a callable.');
        }

        call_user_func_array($callable, [$this, $options]);

        $this->getWriter()->write($this->getData(), $options['writerOptions']);

        return $this;
    }
public function save ( array $ options = [ ] ) { $ options = array_merge ( [ 'file' => null , 'writerOptions' => [ ] ] , $ options ) ; // Simple shortcut $ options [ 'writerOptions' ] [ 'file' ] = $ options [ 'file' ] ; /** @var Callable $callable */ $ callable = $ this -> getOption ( 'onBeforeSave' ) ; if ( ! is_callable ( $ callable ) ) { throw new \ RuntimeException ( 'Option "onBeforeSave" must be a callable.' ) ; } call_user_func_array ( $ callable , [ $ this , $ options ] ) ; $ this -> getWriter ( ) -> write ( $ this -> getData ( ) , $ options [ 'writerOptions' ] ) ; return $ this ; }
Saves the configuration with the writer instance.

@param array $options - Options.

@return $this
Saves the configuration with the writer instance .