Browse Source

Improve comments and documentation - refs BT#9092

Daniel Barreto 10 years ago
parent
commit
58d6654c64

+ 1 - 0
main/inc/lib/hook/HookEvent.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;

+ 8 - 2
main/inc/lib/hook/HookNotificationContent.php

@@ -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);
                 }
             }

+ 8 - 1
main/inc/lib/hook/HookNotificationTitle.php

@@ -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);
                 }
             }

+ 5 - 1
main/inc/lib/hook/interfaces/HookNotificationContentEventInterface.php

@@ -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);
 }

+ 5 - 1
main/inc/lib/hook/interfaces/HookNotificationContentObserverInterface.php

@@ -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);
 }

+ 5 - 1
main/inc/lib/hook/interfaces/HookNotificationTitleEventInterface.php

@@ -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);
 }

+ 5 - 1
main/inc/lib/hook/interfaces/HookNotificationTitleObserverInterface.php

@@ -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);
 }