public function register(Pusher $pusher) { // Bind the Pusher instance itself to the container $pusher->bind('Pusher\\Pusher', $pusher); // Initialise logger from log file $pusher->bind('Pusher\\Log\\Logger', function (Pusher $pusher) { $log = Logger::file(trailingslashit($pusher->pusherPath) . 'pusherlog'); return $log; }); // Use EDD for licensing $pusher->bind('Pusher\\License\\LicenseApi', 'Pusher\\License\\EddLicenseApi'); // Singletons must be last for now, since they call "make()" $pusher->singleton('Pusher\\Dashboard', 'Pusher\\Dashboard'); }
public function execute($command) { $handlerClass = str_replace('Commands', 'Handlers', get_class($command)); if (!class_exists($handlerClass)) { throw new InvalidArgumentException("Handler {$handlerClass} doesn't exist."); } $handler = $this->pusher->make($handlerClass); try { $handler->handle($command); } catch (Exception $e) { status_header(400); $this->messages[] = new WP_Error('wppusher_error', $e->getMessage()); $this->log->error($e->getMessage()); } }
/** * @param PluginWasInstalled $action */ public function handle(PluginWasInstalled $action) { $this->log->info("Plugin '{name}' was successfully installed. File: '{file}'", array('name' => $action->plugin->name, 'file' => $action->plugin->file)); }
public function handle(ThemeWasInstalled $action) { $this->log->info("Theme '{name}' was successfully installed.", array('name' => $action->theme->name)); }