hendrikmaus/spas

View on GitHub
src/Hook/HelloWorld.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php
/**
 * Hello World Hook
 *
 * A simple hook example, logs a message before all requests execute.
 */

namespace Hmaus\Spas\Hook;

use Hmaus\Spas\Event\BeforeAll;

class HelloWorld extends Hook
{
    public function setup()
    {
        $this->dispatcher->addListener(BeforeAll::NAME, function(BeforeAll $event) {
            $this->onBeforeAll($event);
        });
    }

    private function onBeforeAll(BeforeAll $event)
    {
        $this->log('Hello World');
    }
}