<?php

namespace Tools;

/**
 * Event's parameters
 * This classe is attached to a hook when fired
**/
class HookEvent
{
    /**
     * @var \Tools\Context $context
     * /core/tools/Context.php
     * Contains website's informations
    **/
    private $context;

	/**
	 * @var string $hookName
	 * Contains hook name
	 * Can be accessed read-only
	**/
    private $hookName;

	/**
	 * @var mixed params
	 * Contains parameters that can be passed to the hook when fired
	 * Can be accessed read-only
	**/
    private $params;

	/**
	 * Constructor
	**/
    public function __construct($hookName, $context, $params)
    {
        $this->context = $context;
        $this->hookName = $hookName;
        $this->params = $params;
    }

	/**
	 * Getter
	**/
    public function __get($key)
    {
        switch ($key)
        {
            case "hookName": return $this->hookName; break;
            case "params": return $this->params; break;
        }
        throw new \Exception("Cannot access attribute {$key}");
    }
}

