| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- /**
- * App helper file.
- *
- * Provides a helper to perform app related operations.
- *
- * @category Helper.
- */
- /**
- * Require dependent files if not present.
- */
- require_once(PATH::HELPER . "Helper.php");
- /**
- * Application helper.
- *
- * Contains app-related utilities.
- *
- * @category Helper.
- */
- final class APPLICATION extends Helper{
- /**
- * Checks if a value is a valid one in a constant class.
- *
- * It will intentionally fail when used for a non constant class.
- *
- * @param string $class Name of the class.
- * @param int $value Value to check.
- * @return bool True if the value is defined, false otherwise.
- */
- public static function valid_id($class, $value){
- if (strtoupper($class) != $class){
- return false;
- }
- if (!class_exists($class, false)){
- return false;
- }
- $reflect = new ReflectionClass($class);
- if (in_array($value, $reflect->getConstants())){
- return true;
- }
- else{
- return false;
- }
- }
- }
- ?>
|