Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
chamilo-lms/main/inc/lib/hook/HookObserver.class.php

59 lines
1.3 KiB

<?php
/* For licensing terms, see /license.txt */
abstract class HookObserver implements HookObserverInterface
{
public $path;
public $pluginName;
/**
* Construct method
* @param string $path
* @param string $pluginName
*/
protected function __construct($path, $pluginName)
{
$this->path = $path;
$this->pluginName = $pluginName;
}
/**
* Return the singleton instance of Hook observer.
* If Hook Management plugin is not enabled, will return NULL
* @return HookEventInterface|null
*/
public static function create()
{
static $result = null;
if ($result) {
return $result;
} else {
try {
$class = get_called_class();
return new $class;
} catch (Exception $e) {
return null;
}
}
}
/**
* Return the path from the class, needed to store location or autoload later.
* @return string
*/
public function getPath()
{
return $this->path;
}
/**
* Return the plugin name where is the Hook Observer.
* @return string
*/
public function getPluginName()
{
return $this->pluginName;
}
}