public function persister(PersisterInterface $persister = null)
    {
        if ($persister === null && $this->persister === null) {
            $class = Configure::read('AuditStash.persister') ?: ElasticSearchPersister::class;
            $index = $this->getConfig('index') ?: $this->_table->getTable();
            $type = $this->getConfig('type') ?: Inflector::singularize($index);

            $persister = new $class(compact('index', 'type'));
        }

        if ($persister === null) {
            return $this->persister;
        }

        return $this->persister = $persister;
    }
public function persister(PersisterInterface $persister = null)
    {
        if ($persister === null && $this->persister === null) {
            $class = Configure::read('AuditStash.persister') ?: ElasticSearchPersister::class;
            $index = $this->getConfig('index') ?: $this->_table->getTable();
            $type = $this->getConfig('type') ?: Inflector::singularize($index);

            $persister = new $class(compact('index', 'type'));
        }

        if ($persister === null) {
            return $this->persister;
        }

        return $this->persister = $persister;
    }
public function persister ( PersisterInterface $ persister = null ) { if ( $ persister === null && $ this -> persister === null ) { $ class = Configure :: read ( 'AuditStash.persister' ) ? : ElasticSearchPersister :: class ; $ index = $ this -> getConfig ( 'index' ) ? : $ this -> _table -> getTable ( ) ; $ type = $ this -> getConfig ( 'type' ) ? : Inflector :: singularize ( $ index ) ; $ persister = new $ class ( compact ( 'index' , 'type' ) ) ; } if ( $ persister === null ) { return $ this -> persister ; } return $ this -> persister = $ persister ; }
Sets the persister object to use for logging al audit events.
If called if no arguments, it will return the currently configured persister.

@param PersisterInterface $persister The persister object to use
@return PersisterInterface The configured persister
Sets the persister object to use for logging al audit events . If called if no arguments it will return the currently configured persister .