instance() public static method

public static instance ( )
Esempio n. 1
0
 public function setUp()
 {
     parent::setUp();
     $di = Xhgui_ServiceContainer::instance();
     $this->watch = $di['watchFunctions'];
     $this->watch->truncate();
 }
Esempio n. 2
0
 public function setUp()
 {
     parent::setUp();
     Environment::mock(array('SCRIPT_NAME' => 'index.php', 'PATH_INFO' => '/'));
     $di = Xhgui_ServiceContainer::instance();
     $mock = $this->getMock('Slim\\Slim', array('redirect', 'render', 'urlFor'), array($di['config']));
     $di['app'] = $di->share(function ($c) use($mock) {
         return $mock;
     });
     $this->runs = $di['runController'];
     $this->app = $di['app'];
     $this->profiles = $di['profiles'];
     $this->profiles->truncate();
 }
Esempio n. 3
0
    // since we're delaying that a bit by dealing with the xhprof stuff, we'll do it now to avoid making the user wait.
    ignore_user_abort(true);
    flush();
    if (!defined('XHGUI_ROOT_DIR')) {
        require dirname(dirname(__FILE__)) . '/src/bootstrap.php';
    }
    $uri = array_key_exists('REQUEST_URI', $_SERVER) ? $_SERVER['REQUEST_URI'] : null;
    if (empty($uri) && isset($_SERVER['argv'])) {
        $cmd = basename($_SERVER['argv'][0]);
        $uri = $cmd . ' ' . implode(' ', array_slice($_SERVER['argv'], 1));
    }
    $time = array_key_exists('REQUEST_TIME', $_SERVER) ? $_SERVER['REQUEST_TIME'] : time();
    $requestTimeFloat = explode('.', $_SERVER['REQUEST_TIME_FLOAT']);
    if (!isset($requestTimeFloat[1])) {
        $requestTimeFloat[1] = 0;
    }
    if (Xhgui_Config::read('save.handler') === 'file') {
        $requestTs = array('sec' => $time, 'usec' => 0);
        $requestTsMicro = array('sec' => $requestTimeFloat[0], 'usec' => $requestTimeFloat[1]);
    } else {
        $requestTs = new MongoDate($time);
        $requestTsMicro = new MongoDate($requestTimeFloat[0], $requestTimeFloat[1]);
    }
    $data['meta'] = array('url' => $uri, 'SERVER' => $_SERVER, 'get' => $_GET, 'env' => $_ENV, 'simple_url' => Xhgui_Util::simpleUrl($uri), 'request_ts' => $requestTs, 'request_ts_micro' => $requestTsMicro, 'request_date' => date('Y-m-d', $time));
    try {
        $container = Xhgui_ServiceContainer::instance();
        $container['saver']->save($data);
    } catch (Exception $e) {
        error_log('xhgui - ' . $e->getMessage());
    }
});
Esempio n. 4
0
 public function setUp()
 {
     $di = Xhgui_ServiceContainer::instance();
     $this->profiles = $di['profiles'];
     loadFixture($this->profiles, 'tests/fixtures/results.json');
 }