/** * @param \livetyping\hermitage\foundation\bus\commands\StoreImageCommand $command */ public function handle(StoreImageCommand $command) { $image = new Image($command->getBinary(), $command->getMimeType(), $this->generator->path()); $image = $this->processor->optimize($image); $this->storage->put($image); $command->setPath($image->getPath()); }