コード例 #1
0
ファイル: HookTest.php プロジェクト: JakobGM/icingaweb2
 public function testCreatesIdenticalInstancesOnlyOnce()
 {
     Hook::register('test', __FUNCTION__, $this->validHook);
     $first = Hook::createInstance('test', __FUNCTION__);
     $second = Hook::createInstance('test', __FUNCTION__);
     $this->assertSame($first, $second);
 }
コード例 #2
0
ファイル: Module.php プロジェクト: vbereza/icinga2-migration
 /**
  * Register hook
  *
  * @param string $name
  * @param string $class
  * @param string $key
  *
  * @return self
  */
 protected function registerHook($name, $class, $key = null)
 {
     if ($key === null) {
         $key = $this->name;
     }
     Hook::register($name, $key, $class);
     return $this;
 }