<repo_name>zyimm/Api-Manager-Plus<file_sep>/framework/Db.php
<?php
namespace framework;

class Db
{
    
}<file_sep>/framework/Log.php
<?php 
namespace framework;

class Log
{
    
}<file_sep>/framework/Error.php
<?php
/**
 * Exception
 * 
 */
namespace framework;

use Exception;
use TypeError;

class Error
{

    public static function register()
    {
        error_reporting(E_ALL);
        set_error_handler([
            __CLASS__,
            'error'
        ]);
        set_exception_handler([
            __CLASS__,
            'exception'
        ]);
        register_shutdown_function([
            __CLASS__,
            'shutdown'
        ]);
    }

    public static function error($errno, $errstr, $errfile = '', $errline = 0, $errcontext = [])
    {
        $exception = new Exception($errno, $errstr, $errfile, $errline, $errcontext);
        throw self;
    }

    public static function exception($error)
    {
        $error = new TypeError($error);
    }

    public static function shutdown()
    {
        if ($error = error_get_last()) {
            $exception = new Exception($error['type'], $error['message'], $error['file'], $error['line']);
            $this->exception($exception);
        }
    }  
}<file_sep>/framework/Application.php
<?php
/**
 * Application
 * 
 * @author zhouyangyang 2017年7月13日上午11:51:39
 */
namespace framework;

use ArrayAccess;

class Application extends Bootstrap implements ArrayAccess
{

    public static $app;
    
    public static $starRunTime;

    public static $endRunTime;
    
    public function bootstrap()
    {
        self::$starRunTime = microtime(true);   
        self::$app = new self;
        self::$app->run();
        self::$endRunTime = microtime(true);  
    }
    
    public function offsetGet($offset)
    {}

    public function offsetExists($offset)
    {}

    public function offsetUnset($offset)
    {}

    public function offsetSet($offset, $value)
    {} 

}<file_sep>/framework/Environment.php
<?php
namespace framework;

class Environment extends ServiceLocator
{
    const VERSION = '1.0.1';
    
    protected static function getVersion()
    {
        return self::VERSION;
    }
  
    public static function check()
    {
        
    }
    
    
}

<file_sep>/framework/ServiceLocator.php
<?php
namespace framework;

class ServiceLocator extends Component
{
    public function has()
    {}
    
    public function set()
    {}
    
    public function get()
    {}
    
    public function bulid()
    {}
}<file_sep>/framework/Cache.php
<?php
namespace framework;

class Cache
{
    
}<file_sep>/framework/Controller.php
<?php
namespace framework;

class Controller
{
}

<file_sep>/index.php
<?php
/**
 * 入口文件
 */
defined('FRAMEWORK_PATH') || define('FRAMEWORK_PATH', dirname(__FILE__) . DS . 'framework' . DS);

defined('API_DEBUG') || define('API_DEBUG', true);

defined('DS') || define('DS', DIRECTORY_SEPARATOR);

defined('APP_PATH') || define('APP_PATH', dirname(__FILE__) . DS . 'Api' . DS);

defined('WEB_PATH') || define('WEB_PATH', dirname(__FILE__) . DS);
//load 
require (FRAMEWORK_PATH . 'Loader.php');
//register
\framework\Loader::register();
//run framework
(new \framework\Application())->bootstrap();<file_sep>/framework/Request.php
<?php
namespace framework;

class Request
{
    
}<file_sep>/framework/Response.php
<?php
namespace framework;

class Response
{
    
}<file_sep>/framework/Object.php
<?php
namespace framework;


class Object{
    
}<file_sep>/framework/Helper.php
<?php
namespace framework;

class Helper
{
    
}<file_sep>/framework/Bootstrap.php
<?php
namespace framework;


class Bootstrap extends Environment
{
    public  function run()
    {
        Environment::check();
        $this->start()->end();  
    }
    
    public function start()
    {
        return $this;
    }
    
    public function end()
    {
        
    }
    
    
}<file_sep>/framework/Component.php
<?php
namespace framework;

class Component extends Object
{
    // 用于保存单例Singleton对象，以对象类型为键
    private $_singletons = [];
    
    // 用于保存依赖的定义，以对象类型为键
    private $_definitions = [];
    
    // 用于保存构造函数的参数，以对象类型为键
    private $_params = [];
    
    // 用于缓存ReflectionClass对象，以类名或接口名为键
    private $_reflections = [];
    
    // 用于缓存依赖信息，以类名或接口名为键
    private $_dependencies = [];
}<file_sep>/framework/Model.php
<?php
namespace framework;

class Model
{
    
}<file_sep>/framework/Loader.php
<?php
namespace framework;

class Loader
{
    // 自动加载的文件
    private static $autoloadFiles = [];
    // 映射文件
    private static $mapFiles = [];
    
    public static $namespaceAlias;
    
    public static $isWin;
    // 自动加载
    public static function autoload($class)
    {
        // 检测命名空间别名
        if (!empty(self::$namespaceAlias)) {
            $namespace = dirname($class);
            if (isset(self::$namespaceAlias[$namespace])) {
                $original = self::$namespaceAlias[$namespace] . '\\' . basename($class);
                if (class_exists($original)) {
                    return class_alias($original, $class, false);
                }
            }
        }
    
        if ($file = self::includeFile($class)) {
            // Win环境严格区分大小写
            if (self::$isWin && pathinfo($file, PATHINFO_FILENAME) != pathinfo(realpath($file), PATHINFO_FILENAME)) {
                return false;
            }
            include $file;
            return true;
        }
    }
    
    public static function register($autoload = '')
    {
        self::$isWin = (strpos(PHP_OS, 'WIN') !== false)?true:false;
        // 注册系统自动加载
        spl_autoload_register($autoload ?: 'framework\\Loader::autoload', true, true);
        Error::register();
    }
    
    private static function includeFile($class)
    { 
        if (!empty(self::$mapFiles[$class])) {
            return self::$mapFiles[$class];
        }
        $class = strtr($class, '\\',DS).'.php';
        if(current(explode(DS, $class)) == 'framework'){
            return include dirname(FRAMEWORK_PATH).DS.$class;
        }else{
            return include APP_PATH.$class;
        }
    }

}<file_sep>/README.md
# Api-Manager-Plus
PHP 接口文档管理；PHP Api Document Management
# 特点