Skip to content

Commit

Permalink
Update filenames, Add files for each hook interface - refs BT#9092
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Barreto committed Feb 6, 2015
1 parent 3b36808 commit d8ee7e4
Show file tree
Hide file tree
Showing 21 changed files with 344 additions and 284 deletions.
File renamed without changes.
19 changes: 19 additions & 0 deletions main/inc/lib/hook/HookAdminBlockEventInterface.php
@@ -0,0 +1,19 @@
<?php
/* For licensing terms, see /license.txt */

This comment has been minimized.

Copy link
@jmontoyaa

jmontoyaa Feb 10, 2015

Member

Don't need to add 2 documentation blocks. Add more descriptive information. The same for all files.

This comment has been minimized.

/**
* This file contains all Hook interfaces and their relation.
* They are used for Hook classes
* @package chamilo.library.hook
*/

/**
* Interface HookAdminBlockEventInterface
*/
interface HookAdminBlockEventInterface extends HookEventInterface
{
/**
* @param int $type
* @return int
*/
public function notifyAdminBlock($type);
}
19 changes: 19 additions & 0 deletions main/inc/lib/hook/HookAdminBlockObserverInterface.php
@@ -0,0 +1,19 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file contains all Hook interfaces and their relation.
* They are used for Hook classes
* @package chamilo.library.hook
*/

/**
* Interface HookAdminBlockObserverInterface
*/
interface HookAdminBlockObserverInterface extends HookObserverInterface
{
/**
* @param HookAdminBlockEventInterface $hook
* @return int
*/
public function hookAdminBlock(HookAdminBlockEventInterface $hook);
}
File renamed without changes.
20 changes: 20 additions & 0 deletions main/inc/lib/hook/HookCreateUserEventInterface.php
@@ -0,0 +1,20 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file contains all Hook interfaces and their relation.
* They are used for Hook classes
* @package chamilo.library.hook
*/

/**
* Interface HookCreateUserEventInterface
*/
interface HookCreateUserEventInterface extends HookEventInterface
{
/**
* Update all the observers
* @param int $type
* @return int
*/
public function notifyCreateUser($type);
}
19 changes: 19 additions & 0 deletions main/inc/lib/hook/HookCreateUserObserverInterface.php
@@ -0,0 +1,19 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file contains all Hook interfaces and their relation.
* They are used for Hook classes
* @package chamilo.library.hook
*/

/**
* Interface CreateUserHookInterface
*/
interface HookCreateUserObserverInterface extends HookObserverInterface
{
/**
* @param HookCreateUserEventInterface $hook
* @return int
*/
public function hookCreateUser(HookCreateUserEventInterface $hook);
}
File renamed without changes.
72 changes: 72 additions & 0 deletions main/inc/lib/hook/HookEventInterface.php
@@ -0,0 +1,72 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file contains all Hook interfaces and their relation.
* They are used for Hook classes
* @package chamilo.library.hook
*/

/**
* Interface HookEventInterface
*/
interface HookEventInterface
{
/**
* Attach an HookObserver
* @link http://php.net/manual/en/splsubject.attach.php
* @param \HookObserverInterface| $observer <p>
* The <b>HookObserver</b> to attach.
* </p>
* @return void
*/
public function attach(HookObserverInterface $observer);

/**
* Detach an HookObserver
* @link http://php.net/manual/en/splsubject.detach.php
* @param \HookObserverInterface| $observer <p>
* The <b>HookObserver</b> to detach.
* </p>
* @return void
*/
public function detach(HookObserverInterface $observer);

/**
* Return the singleton instance of Hook event.
* @return HookEventInterface|null
*/
public static function create();


/**
* Return an array containing all data needed by the hook observer to update
* @return array
*/
public function getEventData();

/**
* Set an array with data needed by hooks
* @param array $data
* @return $this
*/
public function setEventData(array $data);

/**
* Return the event name refer to where hook is used
* @return string
*/
public function getEventName();


/**
* Clear all hookObservers without detach them
* @return mixed
*/
public function clearAttachments();

/**
* Detach all hook observers
* @return $this
*/
public function detachAll();
}

0 comments on commit d8ee7e4

Please sign in to comment.