Created
April 3, 2015 20:10
-
-
Save eXeDK/304f6c5824f21b082aa4 to your computer and use it in GitHub Desktop.
Event class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Class Event | |
*/ | |
class Event { | |
/** | |
* Contains the function of the Event | |
* | |
* @var callable | |
*/ | |
private $eventFunction; | |
/** | |
* Default constructor | |
* | |
* @param callable $function The function to be called | |
*/ | |
public function __construct(callable $function) { | |
$this->eventFunction = $function; | |
} | |
/** | |
* Run the function in the Event | |
*/ | |
public function run() { | |
call_user_func($this->eventFunction); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment