-
Notifications
You must be signed in to change notification settings - Fork 669
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(events): Adds static methods for returning common values
These functions are particularly useful as handlers for events/hooks.
- Loading branch information
Showing
3 changed files
with
52 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
namespace Elgg; | ||
|
||
/** | ||
* Functions for use as plugin hook/event handlers or other situations where you need a | ||
* globally accessible callable. | ||
*/ | ||
class Values { | ||
|
||
/** | ||
* Return true | ||
* | ||
* @return true | ||
* @since 1.12.0 | ||
*/ | ||
public static function getTrue() { | ||
return true; | ||
} | ||
|
||
/** | ||
* Return false | ||
* | ||
* @return false | ||
* @since 1.12.0 | ||
*/ | ||
public static function getFalse() { | ||
return false; | ||
} | ||
|
||
/** | ||
* Return null | ||
* | ||
* @return null | ||
* @since 1.12.0 | ||
*/ | ||
public static function getNull() { | ||
} | ||
|
||
/** | ||
* Return empty array | ||
* | ||
* @return array | ||
* @since 1.12.0 | ||
*/ | ||
public static function getArray() { | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters