示例#1
0
 /**
  * @return Storage
  */
 protected function getStorage()
 {
     if (null === $this->storage) {
         $this->storage = Storage::getInstance($this->settings->storage);
     }
     return $this->storage;
 }
示例#2
0
 /**
  * @param Settings|null $dsn
  * @throws Exception
  * @throws \Yaoi\Service\Exception
  */
 public function __construct(Settings $dsn = null)
 {
     $this->settings = $dsn ? $dsn : Storage::createSettings();
     if (empty($dsn->proxyClient)) {
         throw new Exception('proxyClient required in dsn', Exception::PROXY_REQUIRED);
     }
     $this->storage = Storage::getInstance($this->settings->proxyClient);
 }
示例#3
0
    public function render()
    {
        $isDev = Auth::getInstance('dev')->isProvidedDemandOnWrong();
        ?>
<html>
<head>
    <title><?php 
        echo $this->title;
        ?>
</title>
    <link rel="stylesheet" type="text/css" href="/css/style.css" />
    <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
    <link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css" rel="stylesheet" />
    <script src="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.min.js"></script>
    <script src="/js/tag-filter.js"></script>

</head>
<body>
<div class="list">
    <?php 
        echo $this->list;
        ?>
</div>

<div class="filters">
    <?php 
        echo $this->filters;
        ?>
</div>

<div class="main">
    <?php 
        echo $this->main;
        ?>
</div>

<?php 
        if ($isDev) {
            ?>
<div class="dev-debug">
    <a href="/dev?logout">Logout debug mode</a>
    <?php 
            $debugStorage = Storage::getInstance('debug_log');
            $debugStorage->set('_SERVER', $_SERVER);
            CollapsiblePrintR::create($debugStorage->exportArray())->render();
            ?>
</div><?php 
        }
        ?>

</body>
</html>
<?php 
    }
示例#4
0
 public function __construct(Settings $dsn = null)
 {
     $this->storage = \Yaoi\Storage::getInstance($dsn->storage);
 }
示例#5
0
use Yaoi\Database;
use Yaoi\Http;
use Yaoi\Migration;
use Yaoi\Mock;
use Yaoi\Storage;
date_default_timezone_set('Asia/Bangkok');
//Storage::getInstance('mock')->deleteAll();
Client::register(function () {
    $settings = new Settings();
    $settings->username = '******';
    $settings->password = '******';
    return $settings;
});
Http\Client::register(function () {
    $client = new Http\Client();
    $client->mock(new Mock(Storage::getInstance('mock')));
    return $client;
});
Storage::register(function () {
    $settings = new Storage\Settings();
    $settings->driverClassName = Storage\Driver\SerializedFile::className();
    $settings->path = __DIR__ . '/resources/mock4.serialized';
    return $settings;
}, 'mock');
Database::register('mysqli://root:@localhost/wakabot?timezone=Asia/Jakarta');
/*
Database::register(function(){
    $settings = new Database\Settings();
    $settings->driverClassName = Database\Driver\Sqlite::className();
    $settings->path = __DIR__ . '/resources/db.sqlite';
    return $settings;
示例#6
0
文件: App.php 项目: php-yaoi/php-yaoi
 static function cache($identifier = Service::PRIMARY)
 {
     return Storage::getInstance($identifier);
 }