当前位置: 首页>>代码示例>>PHP>>正文


PHP App::instance方法代码示例

本文整理汇总了PHP中App::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP App::instance方法的具体用法?PHP App::instance怎么用?PHP App::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在App的用法示例。


在下文中一共展示了App::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: withoutEvents

 protected function withoutEvents()
 {
     $mock = Mockery::mock('Illuminate\\Contracts\\Events\\Dispatcher');
     $mock->shouldReceive('fire');
     App::instance('events', $mock);
     return $this;
 }
开发者ID:slice-beans,项目名称:kindcosmetic,代码行数:7,代码来源:ExtendedTest.php

示例2: sendEmail

 function sendEmail($email_template, $subject = '', $additional_data = array(), $from_email = '', $from_name = '')
 {
     $config = (require APPDIR . 'config/email.php');
     $app = App::instance();
     $data = array('user' => $this);
     $data = array_merge($data, $additional_data);
     $message = $app->twig->render('emails/' . $email_template, $data);
     $this->last_email_html = $message;
     $mail = $app->email;
     foreach ($config as $key => $value) {
         $mail->{$key} = $value;
     }
     if ($from_email) {
         $mail->From = $from_email;
     }
     if ($from_name) {
         $mail->FromName = $from_name;
     }
     $mail->Subject = $subject;
     $mail->Body = $message;
     $mail->isHTML($config['isHTML']);
     $mail->addAddress($this->email);
     $mail->send();
     return $this;
 }
开发者ID:davinder17s,项目名称:turbo,代码行数:25,代码来源:models_autoload.php

示例3: getInstance

	/**
	 * 单例模式
	 * 
	 * @return obj
	 */
	public static function getInstance() {
		if(!isset(self::$instance)) {
			$class = __CLASS__;
			self::$instance = new $class();
		}
		return self::$instance;
	}
开发者ID:nopsky,项目名称:mbct,代码行数:12,代码来源:app.php

示例4: get_instance

 /**
  * Get singleton instance
  *
  * @return Event
  */
 public static function get_instance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new App();
     }
     return self::$instance;
 }
开发者ID:sook,项目名称:drumon_framework,代码行数:12,代码来源:app.php

示例5: __construct

 public function __construct($config)
 {
     $this->_objects['app'] = App::instance();
     $this->_objects['router'] = Router::instance();
     $this->_objects['inputs'] = Inputs::instance();
     $this->_objects['session'] = Session::instance();
     $this->_objects['log'] = Log::factory();
     if (!isset($this->app->config['database']['redis'][$config['serverId']])) {
         $config['serverId'] = 0;
     }
     $current = $this->app->config['database']['redis'][$config['serverId']];
     $current['serverId'] = $config['serverId'];
     $this->_objects['db'] = Db::factory($current);
     $this->_objects['infoModel'] = new Info_Model($current);
     $info = $this->db->info();
     $dbs = $this->infoModel->getDbs($info);
     if (!isset($current['max_databases'])) {
         $databasesConfig = $this->_objects['db']->config('GET', 'databases');
         $current['max_databases'] = $databasesConfig['databases'];
     }
     // Take care of invalid dbId's. If invalid, set to first available database
     if (!is_numeric($config['dbId']) || $config['dbId'] < 0 || $config['dbId'] >= $current['max_databases']) {
         $config['dbId'] = $dbs[0];
     }
     $current['newDB'] = !in_array($config['dbId'], $dbs) ? true : false;
     $current['database'] = $config['dbId'];
     // Extract number of keys
     foreach ($dbs as $i) {
         if (preg_match('/^keys=([0-9]+),expires=([0-9]+)/', $info["db{$i}"], $matches)) {
             $current['dbs'][$i] = array('id' => $i, 'keys' => $matches[1], 'name' => isset($current['dbNames'][$i]) ? $current['dbNames'][$i] : null);
         }
     }
     $this->db->select($current['database']);
     $this->app->current = $current;
 }
开发者ID:BlackIkeEagle,项目名称:phpredmin,代码行数:35,代码来源:controller.php

示例6: setupTestModel

 public function setupTestModel($name)
 {
     $mock = Mockery::mock($name);
     $mock->shouldIgnoreMissing();
     \App::instance($name, $mock);
     return $mock;
 }
开发者ID:Gamespectre,项目名称:spectator-api,代码行数:7,代码来源:DatamodelTest.php

示例7: Main

 /** 
  * @static 
  * @return App 
  */
 public static function Main()
 {
     if (null === self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:0xid,项目名称:FRADOS-MVC,代码行数:11,代码来源:class.app.php

示例8: app

 public static function app()
 {
     if (is_null(App::$instance)) {
         App::$instance = new App();
     }
     return App::$instance;
 }
开发者ID:starsep,项目名称:bd,代码行数:7,代码来源:App.class.php

示例9: getInstance

 static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:romamolodyko,项目名称:gallery,代码行数:7,代码来源:App.php

示例10: setUp

 public function setUp()
 {
     $this->dbRef = new DBTest();
     $this->dbRef->setUp();
     $this->DB = $this->dbRef->DB;
     $this->Person = new PersonModelTest(\App::instance());
 }
开发者ID:discophp,项目名称:framework,代码行数:7,代码来源:ModelTest.php

示例11: start

 public static function start()
 {
     self::init();
     self::safe();
     self::checkFolders();
     return App::instance();
 }
开发者ID:vincium,项目名称:bourg-la-reine,代码行数:7,代码来源:Config.php

示例12: shouldReceive

 public static function shouldReceive()
 {
     $repo = get_called_class() . 'RepositoryInterface';
     $mock = Mockery::mock($repo);
     App::instance($repo, $mock);
     return call_user_func_array([$mock, 'shouldReceive'], func_get_args());
 }
开发者ID:dasigr,项目名称:laravelcommerce,代码行数:7,代码来源:BaseModel.php

示例13: __construct

 public function __construct()
 {
     // constructor
     $this->app = App::instance();
     // Get variables by post request
     if ($this->app->post('columns')) {
         $columns = $this->app->post()->get('columns');
         $order = $this->app->post()->get('order');
         $start = $this->app->post()->get('start');
         $length = $this->app->post()->get('length');
         $search = $this->app->post()->get('search');
         $draw = $this->app->post()->get('draw');
     } else {
         // Get variables by get request
         $columns = $this->app->get()->get('columns');
         $order = $this->app->get()->get('order');
         $start = $this->app->get()->get('start');
         $length = $this->app->get()->get('length');
         $search = $this->app->get()->get('search');
         $draw = $this->app->get()->get('draw');
     }
     // Save for later use
     $this->columns = $columns;
     $this->order = $order;
     $this->start = $start;
     $this->length = $length;
     $this->search = $search;
     $this->draw = $draw;
 }
开发者ID:davinder17s,项目名称:turbo,代码行数:29,代码来源:datatables.php

示例14: testDestroyShouldCallDestroyMethod

 public function testDestroyShouldCallDestroyMethod()
 {
     $mock = Mockery::mock('PostRepositoryInterface');
     $mock->shouldReceive('destroy')->once()->andReturn(true);
     App::instance('PostRepositoryInterface', $mock);
     $response = $this->call('DELETE', route('v1.posts.destroy', array(1)));
     $this->assertTrue(empty($response->original));
 }
开发者ID:valdinei,项目名称:nettuts-laravel4-and-backbone,代码行数:8,代码来源:PostsControllerTest.php

示例15: baseUrl

function baseUrl($path = '')
{
    $baseUrl = App::instance()->request()->getBaseUrl();
    $strippedBaseUrl = str_replace('index.php/', '', $baseUrl);
    $generated = $strippedBaseUrl . '/' . $path;
    $sanitized = str_replace('index.php/', '', $generated);
    return $sanitized;
}
开发者ID:davinder17s,项目名称:turbo,代码行数:8,代码来源:url.php


注:本文中的App::instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。