Minor - Format code

1.10.x
Julio Montoya 11 years ago
parent 5728167447
commit 4d689bf531
  1. 9
      main/inc/lib/hook/HookAdminBlock.php
  2. 7
      main/inc/lib/hook/HookCreateUser.php
  3. 4
      main/inc/lib/hook/HookEvent.php
  4. 12
      main/inc/lib/hook/HookManagement.php
  5. 10
      main/inc/lib/hook/HookNotificationContent.php
  6. 3
      main/inc/lib/hook/HookNotificationTitle.php
  7. 3
      main/inc/lib/hook/HookObserver.php
  8. 7
      main/inc/lib/hook/HookUpdateUser.php
  9. 10
      main/inc/lib/hook/HookWSRegistration.php
  10. 1
      main/inc/lib/hook/interfaces/HookAdminBlockEventInterface.php
  11. 1
      main/inc/lib/hook/interfaces/HookAdminBlockObserverInterface.php
  12. 1
      main/inc/lib/hook/interfaces/HookCreateUserEventInterface.php
  13. 1
      main/inc/lib/hook/interfaces/HookCreateUserObserverInterface.php
  14. 1
      main/inc/lib/hook/interfaces/HookNotificationContentEventInterface.php
  15. 1
      main/inc/lib/hook/interfaces/HookNotificationContentObserverInterface.php
  16. 1
      main/inc/lib/hook/interfaces/HookNotificationTitleEventInterface.php
  17. 1
      main/inc/lib/hook/interfaces/HookNotificationTitleObserverInterface.php
  18. 1
      main/inc/lib/hook/interfaces/HookUpdateUserEventInterface.php
  19. 1
      main/inc/lib/hook/interfaces/HookUpdateUserObserverInterface.php
  20. 1
      main/inc/lib/hook/interfaces/HookWSRegistrationEventInterface.php
  21. 1
      main/inc/lib/hook/interfaces/HookWSRegistrationObserverInterface.php
  22. 6
      main/inc/lib/hook/interfaces/base/HookManagementInterface.php

@ -10,7 +10,8 @@
* This class is a Hook event implementing Admin Block Event interface.
* This class is used to modify admin block by notifying Hook Observer for Admin Block
*/
class HookAdminBlock extends HookEvent implements HookAdminBlockEventInterface {
class HookAdminBlock extends HookEvent implements HookAdminBlockEventInterface
{
/**
* Constructor
@ -22,7 +23,9 @@ class HookAdminBlock extends HookEvent implements HookAdminBlockEventInterface {
/**
* Notify Hook observers for Admin Block event
* @param int $type Set the type of hook event called. 0: HOOK_EVENT_TYPE_PRE, 1: HOOK_EVENT_TYPE_POST
* @param int $type Set the type of hook event called.
* 0: HOOK_EVENT_TYPE_PRE, 1: HOOK_EVENT_TYPE_POST
*
* @return array|int
*/
public function notifyAdminBlock($type)
@ -45,4 +48,4 @@ class HookAdminBlock extends HookEvent implements HookAdminBlockEventInterface {
return 0;
}
}
}

@ -7,6 +7,9 @@
*/
class HookCreateUser extends HookEvent implements HookCreateUserEventInterface
{
/**
* Constructor
*/
protected function __construct()
{
parent::__construct('HookCreateUser');
@ -15,6 +18,7 @@ class HookCreateUser extends HookEvent implements HookCreateUserEventInterface
/**
* Update all the observers
* @param int $type
*
* @return int
*/
public function notifyCreateUser($type)
@ -24,6 +28,7 @@ class HookCreateUser extends HookEvent implements HookCreateUserEventInterface
foreach ($this->observers as $observer) {
$observer->hookCreateUser($this);
}
return 1;
}
}
}

@ -47,6 +47,7 @@ abstract class HookEvent implements HookEventInterface
} else {
try {
$class = get_called_class();
return new $class;
} catch (Exception $e) {
return null;
@ -131,6 +132,7 @@ abstract class HookEvent implements HookEventInterface
// Assign value for each array item
$this->eventData[$key] = $value;
}
return $this;
}
@ -177,4 +179,4 @@ abstract class HookEvent implements HookEventInterface
return $this;
}
}
}

@ -4,7 +4,6 @@
* @TODO: Improve description
* @package chamilo.hookmanagement
*/
class HookManagement implements HookManagementInterface
{
/**
@ -38,6 +37,7 @@ class HookManagement implements HookManagementInterface
* @param string $eventName
* @param string $observerClassName
* @param int $type
*
* @return int
*/
public function insertHook($eventName, $observerClassName, $type)
@ -82,6 +82,7 @@ class HookManagement implements HookManagementInterface
* @param string $eventName
* @param string $observerClassName
* @param int $type
*
* @return int
*/
public function deleteHook($eventName, $observerClassName, $type)
@ -109,6 +110,7 @@ class HookManagement implements HookManagementInterface
* @param $eventName
* @param $type
* @param $hookOrders
*
* @return int
*/
public function orderHook($eventName, $type, $hookOrders)
@ -131,13 +133,13 @@ class HookManagement implements HookManagementInterface
break;
}
}
}
}
/**
* Return a list an associative array where keys are the active hook observer class name
* @param $eventName
*
* @return array
*/
public function listHookObservers($eventName)
@ -220,6 +222,7 @@ class HookManagement implements HookManagementInterface
* Will insert them into their respective table
* @param string $eventName
* @param string $observerClassName
*
* @return int
*/
public function insertHookIfNotExist($eventName = null, $observerClassName = null)
@ -235,7 +238,9 @@ class HookManagement implements HookManagementInterface
}
// Check if exists hook observer
if (isset($observerClassName) && !isset($this->hookObservers[$observerClassName])){
if (isset($observerClassName) &&
!isset($this->hookObservers[$observerClassName])
){
$object = $observerClassName::create();
$attributes = array(
'class_name' => $observerClassName,
@ -325,6 +330,7 @@ class HookManagement implements HookManagementInterface
* @param string $eventName
* @param string $observerClassName
* @param int $type
*
* @return mixed
*/
public function getHookCallId($eventName, $observerClassName, $type)

@ -1,12 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file contains the Hook Event class for Content format of Notifications
* @package chamilo.library.hook
*/
/**
* Class HookNotificationContent
* Hook Event class for Content format of Notifications
* @package chamilo.library.hook
*
*/
class HookNotificationContent extends HookEvent implements HookNotificationContentEventInterface
{
@ -21,6 +20,7 @@ class HookNotificationContent extends HookEvent implements HookNotificationConte
/**
* @param int $type
*
* @return array|null
*/
public function notifyNotificationContent($type)
@ -45,4 +45,4 @@ class HookNotificationContent extends HookEvent implements HookNotificationConte
return null;
}
}
}

@ -21,6 +21,7 @@ class HookNotificationTitle extends HookEvent implements HookNotificationTitleEv
/**
* @param int $type
*
* @return array|null
*/
public function notifyNotificationTitle($type)
@ -46,4 +47,4 @@ class HookNotificationTitle extends HookEvent implements HookNotificationTitleEv
return null;
}
}
}

@ -46,6 +46,7 @@ abstract class HookObserver implements HookObserverInterface
try {
$class = get_called_class();
return new $class;
} catch (Exception $e) {
return null;
}
@ -69,4 +70,4 @@ abstract class HookObserver implements HookObserverInterface
{
return $this->pluginName;
}
}
}

@ -3,10 +3,14 @@
/**
* Class HookUpdateUser
*
* @var \SplObjectStorage $observers
*/
class HookUpdateUser extends HookEvent implements HookUpdateUserEventInterface
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct('HookUpdateUser');
@ -24,6 +28,7 @@ class HookUpdateUser extends HookEvent implements HookUpdateUserEventInterface
foreach ($this->observers as $observer) {
$observer->hookUpdateUser($this);
}
return 1;
}
}
}

@ -8,11 +8,11 @@
/**
* Class HookWSRegistration
* This class is a Hook event implementing Webservice Registration Event interface.
* This class is used to modify ws for registration by notifying Hook Observer for Webservice registration
* This class is used to modify ws for registration by notifying Hook Observer
* for Webservice registration
*/
class HookWSRegistration extends HookEvent implements HookWSRegistrationEventInterface
{
/**
* Construct
*/
@ -25,7 +25,9 @@ class HookWSRegistration extends HookEvent implements HookWSRegistrationEventInt
* Notify all Hook observer for WS Registration.
* This save "server" (soap server) and send to Hook observer to be modified
* (e.g. add more registration webservice)
* @param int $type Set the type of hook event called. 0: HOOK_EVENT_TYPE_PRE, 1: HOOK_EVENT_TYPE_POST
* @param int $type Set the type of hook event called.
* 0: HOOK_EVENT_TYPE_PRE, 1: HOOK_EVENT_TYPE_POST
*
* @return int
*/
public function notifyWSRegistration($type)
@ -50,4 +52,4 @@ class HookWSRegistration extends HookEvent implements HookWSRegistrationEventInt
return 1;
}
}
}

@ -13,6 +13,7 @@ interface HookAdminBlockEventInterface extends HookEventInterface
{
/**
* @param int $type
*
* @return int
*/
public function notifyAdminBlock($type);

@ -13,6 +13,7 @@ interface HookAdminBlockObserverInterface extends HookObserverInterface
{
/**
* @param HookAdminBlockEventInterface $hook
*
* @return int
*/
public function hookAdminBlock(HookAdminBlockEventInterface $hook);

@ -14,6 +14,7 @@ interface HookCreateUserEventInterface extends HookEventInterface
/**
* Update all the observers
* @param int $type
*
* @return int
*/
public function notifyCreateUser($type);

@ -13,6 +13,7 @@ interface HookCreateUserObserverInterface extends HookObserverInterface
{
/**
* @param HookCreateUserEventInterface $hook
*
* @return int
*/
public function hookCreateUser(HookCreateUserEventInterface $hook);

@ -12,6 +12,7 @@ interface HookNotificationContentEventInterface extends HookEventInterface
{
/**
* @param int $type
*
* @return array
*/
public function notifyNotificationContent($type);

@ -12,6 +12,7 @@ interface HookNotificationContentObserverInterface extends HookObserverInterface
{
/**
* @param HookNotificationContentEventInterface $hook
*
* @return array
*/
public function hookNotificationContent(HookNotificationContentEventInterface $hook);

@ -12,6 +12,7 @@ interface HookNotificationTitleEventInterface extends HookEventInterface
{
/**
* @param int $type
*
* @return array
*/
public function notifyNotificationTitle($type);

@ -12,6 +12,7 @@ interface HookNotificationTitleObserverInterface extends HookObserverInterface
{
/**
* @param HookNotificationTitleEventInterface $hook
*
* @return array
*/
public function hookNotificationTitle(HookNotificationTitleEventInterface $hook);

@ -14,6 +14,7 @@ interface HookUpdateUserEventInterface extends HookEventInterface
/**
* Update all the observers
* @param int $type
*
* @return int
*/
public function notifyUpdateUser($type);

@ -13,6 +13,7 @@ interface HookUpdateUserObserverInterface extends HookObserverInterface
{
/**
* @param HookUpdateUserEventInterface $hook
*
* @return int
*/
public function hookUpdateUser(HookUpdateUserEventInterface $hook);

@ -13,6 +13,7 @@ interface HookWSRegistrationEventInterface extends HookEventInterface
{
/**
* @param int $type
*
* @return int
*/
public function notifyWSRegistration($type);

@ -13,6 +13,7 @@ interface HookWSRegistrationObserverInterface extends HookObserverInterface
{
/**
* @param HookWSRegistrationEventInterface $hook
*
* @return int
*/
public function hookWSRegistration(HookWSRegistrationEventInterface $hook);

@ -13,6 +13,7 @@ interface HookManagementInterface
* @param string $eventName
* @param string $observerClassName
* @param int $type
*
* @return int
*/
public function insertHook($eventName, $observerClassName, $type);
@ -22,6 +23,7 @@ interface HookManagementInterface
* @param string $eventName
* @param string $observerClassName
* @param int $type
*
* @return int
*/
public function deleteHook($eventName, $observerClassName, $type);
@ -31,6 +33,7 @@ interface HookManagementInterface
* @param $eventName
* @param $type
* @param $newOrder
*
* @return int
*/
public function orderHook($eventName, $type, $newOrder);
@ -38,6 +41,7 @@ interface HookManagementInterface
/**
* Return a list an associative array where keys are the hook observer class name
* @param $eventName
*
* @return array
*/
public function listHookObservers($eventName);
@ -48,6 +52,7 @@ interface HookManagementInterface
* Will insert them into their respective table
* @param string $eventName
* @param string $observerClassName
*
* @return int
*/
public function insertHookIfNotExist($eventName = null, $observerClassName = null);
@ -58,6 +63,7 @@ interface HookManagementInterface
* @param string $eventName
* @param string $observerClassName
* @param int $type
*
* @return mixed
*/
public function getHookCallId($eventName, $observerClassName, $type);

Loading…
Cancel
Save