Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Func {
- public static $methods = Array();
- public static function __call($name, $arguments=Array())
- {
- $dir = DIR_F;
- $file = $dir . $name . '.php';
- if(is_dir($dir) && is_file($file)):
- if(!isset($this->methods) || !isset($this->methods[$name]))
- require_once($file);
- $this->methods[$name] = true;
- return call_user_func_array($name, $arguments);
- else:
- die('Function <b>['.$name.']</b> was not found');
- return null;
- endif;
- }
- public static function __callStatic($name, $arguments=Array())
- {
- $dir = DIR_F;
- $file = $dir . $name . '.php';
- if(is_dir($dir) && is_file($file)):
- if(!isset(self::$methods) || !isset(self::$methods[$name]))
- require_once($file);
- self::$methods[$name] = true;
- return call_user_func_array($name, $arguments);
- else:
- die('Function <b>['.$name.']</b> was not found');
- return null;
- endif;
- }
- public static function object_to_array($object)
- {
- if(is_array($object) || is_object($object))
- {
- $array = array();
- foreach($object as $key => $value)
- {
- $array[$key] = object_to_array($value);
- }
- return $array;
- }
- return $object;
- }
- // Funcion de Array a Objeto
- public static function array_to_object($array = array())
- {
- return (object) $array;
- }
- }
- ?>
Add Comment
Please, Sign In to add comment