/** * @return Storage */ protected function getStorage() { if (null === $this->storage) { $this->storage = Storage::getInstance($this->settings->storage); } return $this->storage; }
/** * @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); }
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 }
public function __construct(Settings $dsn = null) { $this->storage = \Yaoi\Storage::getInstance($dsn->storage); }
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;
static function cache($identifier = Service::PRIMARY) { return Storage::getInstance($identifier); }