1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- /**
- * This file is part of Dever.
- *
- * Licensed under The MIT License
- * For full copyright and license information, please see the MIT-LICENSE.txt
- * Redistributions of files must retain the above copyright notice.
- *
- * @author rabin<rabin@shemic.com>
- * @copyright rabin<rabin@shemic.com>
- * @link http://www.dever.cc/
- * @license http://www.opensource.org/licenses/mit-license.php MIT License
- */
- class Dever
- {
- /**
- * @var array
- */
- private static $register = array
- (
- 'load' => array('Import', 'load'),
- 'config' => array('Config', 'get'),
- 'input' => array('Route', 'input'),
- );
- /**
- * @var array
- */
- private static $define = array();
- /**
- * run
- */
- public static function run()
- {
- $data = Dever\Route::get();
- Dever\Import::load($data['l']);
- }
- /**
- * call
- * @param string $name
- * @param array $param
- * @return mixed
- */
- public static function __callStatic($name, $param = array())
- {
- if (isset(self::$register[$name])) {
- $class = 'Dever\\' . self::$register[$name][0];
- $method = self::$register[$name][1];
- return call_user_func_array(array($class, $method), $param);
- } elseif (isset(self::$define[$name])) {
- if (is_array(self::$define[$name])) {
- $class = self::$define[$name][0];
- $method = self::$define[$name][1];
- } else {
- $class = self::$define[$name];
- $method = $name;
- }
- return call_user_func_array(array($class, $method), $param);
- }
- }
- /**
- * register
- * @param string $method
- * @param array $function
- * @return mixed
- */
- public static function reg($method, $function)
- {
- self::$define[$method] = $function;
- }
- }
|