Skip to content

Remove limitation on closures #11

@dnaber-de

Description

@dnaber-de

The current implementation (in 2.4.0) of WordPressClient::_logError() requires callbacks to be closures or function strings. Thus it is not possible to attach a class method as callback, which would make it easier to separate the callback from a logger.

However, if the callbacks would called instead by call_user_func_array() any callable type would be possible:

    private function _logError()
    {
        $callbacks = $this->_getCallback('error');
        $event = array(
            'event'    => 'error',
            'endpoint' => $this->_endPoint,
            'request'  => $this->_request,
            'proxy'    => $this->_proxyConfig,
            'auth'     => $this->_authConfig,
        );
        foreach($callbacks as $callback)
        {
            call_user_func_array($callback, array($this->_error, $event));
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions