Improve comments and documentation - refs BT#9092

1.10.x
Daniel Barreto 11 years ago
parent 219ef5b795
commit 58d6654c64
  1. 1
      main/inc/lib/hook/HookEvent.php
  2. 10
      main/inc/lib/hook/HookNotificationContent.php
  3. 9
      main/inc/lib/hook/HookNotificationTitle.php
  4. 6
      main/inc/lib/hook/interfaces/HookNotificationContentEventInterface.php
  5. 6
      main/inc/lib/hook/interfaces/HookNotificationContentObserverInterface.php
  6. 6
      main/inc/lib/hook/interfaces/HookNotificationTitleEventInterface.php
  7. 6
      main/inc/lib/hook/interfaces/HookNotificationTitleObserverInterface.php

@ -127,6 +127,7 @@ abstract class HookEvent implements HookEventInterface
public function setEventData(array $data)
{
foreach ($data as $key => $value) {
// Assign value for each array item
$this->eventData[$key] = $value;
}
return $this;

@ -1,7 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file contains the Hook Event class for Content of Notifications
* This file contains the Hook Event class for Content format of Notifications
* @package chamilo.library.hook
*/
/**
@ -20,16 +21,21 @@ class HookNotificationContent extends HookEvent implements HookNotificationConte
/**
* @param int $type
* @return int
* @return array|null
*/
public function notifyNotificationContent($type)
{
/** @var \HookNotificationContentObserverInterface $observer */
// Check if exists data content
if (isset($this->eventData['content'])) {
// Save data type
$this->eventData['type'] = $type;
// Check for hook all registered observers
foreach ($this->observers as $observer) {
$data = $observer->hookNotificationContent($this);
// Check if isset content
if (isset($data['content'])) {
// Set data from hook observer data
$this->setEventData($data);
}
}

@ -2,6 +2,7 @@
/* For licensing terms, see /license.txt */
/**
* This file contains the Hook Event class for Title of Notifications
* @package chamilo.library.hook
*/
/**
@ -20,16 +21,22 @@ class HookNotificationTitle extends HookEvent implements HookNotificationTitleEv
/**
* @param int $type
* @return int
* @return array|null
*/
public function notifyNotificationTitle($type)
{
/** @var \HookNotificationTitleObserverInterface $observer */
// Check if exists data title
if (isset($this->eventData['title'])) {
// Save data type
$this->eventData['type'] = $type;
// Check for hook all registered observers
foreach ($this->observers as $observer) {
// Get data from hook observer
$data = $observer->hookNotificationTitle($this);
// Check if isset data title
if (isset($data['title'])) {
// Set data from hook observer data
$this->setEventData($data);
}
}

@ -1,5 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file contains Hook event interface for notification content
* @package chamilo.library.hook
*/
/**
* Interface HookNotificationContentEventInterface
@ -8,7 +12,7 @@ interface HookNotificationContentEventInterface extends HookEventInterface
{
/**
* @param int $type
* @return int
* @return array
*/
public function notifyNotificationContent($type);
}

@ -1,5 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file contains Hook observer interface for notification content
* @package chamilo.library.hook
*/
/**
* Interface HookNotificationContentObserverInterface
@ -8,7 +12,7 @@ interface HookNotificationContentObserverInterface extends HookObserverInterface
{
/**
* @param HookNotificationContentEventInterface $hook
* @return int
* @return array
*/
public function hookNotificationContent(HookNotificationContentEventInterface $hook);
}

@ -1,5 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file contains Hook event interface for notification title
* @package chamilo.library.hook
*/
/**
* Interface HookNotificationTitleEventInterface
@ -8,7 +12,7 @@ interface HookNotificationTitleEventInterface extends HookEventInterface
{
/**
* @param int $type
* @return int
* @return array
*/
public function notifyNotificationTitle($type);
}

@ -1,5 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file contains Hook observer interface for notification title
* @package chamilo.library.hook
*/
/**
* Interface HookNotificationTitleObserverInterface
@ -8,7 +12,7 @@ interface HookNotificationTitleObserverInterface extends HookObserverInterface
{
/**
* @param HookNotificationTitleEventInterface $hook
* @return int
* @return array
*/
public function hookNotificationTitle(HookNotificationTitleEventInterface $hook);
}

Loading…
Cancel
Save