當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FactoryDefault::__construct方法代碼示例

本文整理匯總了PHP中Phalcon\DI\FactoryDefault::__construct方法的典型用法代碼示例。如果您正苦於以下問題:PHP FactoryDefault::__construct方法的具體用法?PHP FactoryDefault::__construct怎麽用?PHP FactoryDefault::__construct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Phalcon\DI\FactoryDefault的用法示例。


在下文中一共展示了FactoryDefault::__construct方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 public function __construct()
 {
     parent::__construct();
     $this->setShared(Services::REQUEST, new \PhalconRest\Http\Request());
     $this->setShared(Services::RESPONSE, new \PhalconRest\Http\Response());
     $this->setShared(Services::AUTH_MANAGER, new \PhalconRest\Auth\Manager());
     $this->setShared(Services::FRACTAL_MANAGER, function () {
         $className = '\\League\\Fractal\\Manager';
         if (!class_exists($className)) {
             throw new Exception(ErrorCodes::GEN_SYSTEM, '\\League\\Fractal\\Manager was requested, but class could not be found');
         }
         return new $className();
     });
     $this->setShared(Services::TOKEN_PARSER, function () {
         return new \PhalconRest\Auth\TokenParser\JWT('this_should_be_changed');
     });
     $this->setShared(Services::API_SERVICE, function () {
         return new \PhalconRest\Api\Service();
     });
     $this->setShared(Services::QUERY, function () {
         return new \PhalconRest\Data\Query();
     });
     $this->setShared(Services::PHQL_QUERY_PARSER, function () {
         return new \PhalconRest\Data\Query\Parser\Phql();
     });
     $this->setShared(Services::URL_QUERY_PARSER, function () {
         return new \PhalconRest\Data\Query\Parser\Url();
     });
 }
開發者ID:k0l1br1,項目名稱:phalcon-rest,代碼行數:29,代碼來源:FactoryDefault.php

示例2: __construct

 public function __construct(array $entireAppConfig)
 {
     parent::__construct();
     $this->set('config', new Config($entireAppConfig), true);
     $this->setEventsManager();
     $this->set('dispatcher', new Dispatcher($this), true);
     $this->set('view', new View());
 }
開發者ID:tmquang6805,項目名稱:phalex,代碼行數:8,代碼來源:Di.php

示例3: __construct

 /**
  * Phalcon\Di\FactoryDefault constructor
  */
 public function __construct(\swoole_http_request $swooleRequest, \swoole_http_response $swooleResponse)
 {
     parent::__construct();
     $request = new Request();
     $response = new Response();
     $request->setSwooleRequest($swooleRequest);
     $response->setSwooleResponse($swooleResponse);
     $this->setShared('request', $request);
     $this->setShared('response', $response);
     $this->_services['cookies'] = new Service('cookies', Cookies::class, true);
     $this->_services['session'] = new Service('session', SessionAdapter::class, true);
 }
開發者ID:HessianZ,項目名稱:phalcon-swoole,代碼行數:15,代碼來源:Di.php

示例4: __construct

 /**
  * Construct all of the dependencies for the API
  */
 public function __construct()
 {
     parent::__construct();
     $this->setShared('request', function () {
         return new PhrestRequest();
     });
     $this->setShared('oauth2', function () {
         return false;
     });
     $this->setShared('router', function () {
         return new Router();
     });
 }
開發者ID:phrest,項目名稱:api,代碼行數:16,代碼來源:PhrestDI.php

示例5: __construct

 /**
  * Application constructor.
  * @param null $basePath
  */
 public function __construct($basePath = null)
 {
     // INIT Phalcon's DI
     parent::__construct();
     //
     $this->registerBaseServices();
     //
     $this->registerCoreServices();
     if ($basePath) {
         $this->setBasePath($basePath);
     }
     $this->boot();
     $this->init();
 }
開發者ID:xueron,項目名稱:pails,代碼行數:18,代碼來源:Container.php

示例6: __construct

 public function __construct($config, $paths, $module)
 {
     parent::__construct();
     $this->config = $config;
     $this->paths = $paths;
     $this->module = $module;
     $class = new ReflectionClass($this);
     $methods = $class->getMethods(ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED);
     foreach ($methods as $method) {
         $methodName = $method->getName();
         if (static::SHARED_PREFIX == substr($methodName, 0, 8)) {
             $sharedName = lcfirst(substr($methodName, static::SHARED_PREFIX_LENGTH));
             $this->setShared($sharedName, $method->getClosure($this));
         }
     }
 }
開發者ID:panlatent,項目名稱:swilab,代碼行數:16,代碼來源:FactoryDefault.php

示例7: __construct

 /**
  * \Phalcon\DI\FactoryDefault\CLI constructor
  */
 public function __construct()
 {
     //@note It might be better if CLI directly extends DI,
     //since everything new from FactoryDefault gets overwritten
     parent::__construct();
     $services = array();
     /* Routing */
     $services['router'] = new Service('router', 'Phalcon\\CLI\\Router');
     $services['dispatcher'] = new Service('dispatcher', 'Phalcon\\CLI\\Dispatcher');
     /* ORM */
     $services['modelsManager'] = new Service('modelsManager', 'Phalcon\\Mvc\\Model\\Manager');
     $services['modelsMetadata'] = new Service('modelsMetadata', 'Phalcon\\Mvc\\Model\\Metadata\\Memory');
     /* Filter/Escaper */
     $services['filter'] = new Service('filter', 'Phalcon\\Filter', true);
     $services['escaper'] = new Service('escaper', 'Phalcon\\Escaper', true);
     /* Other */
     $services['annotations'] = new Service('annotations', 'Phalcon\\Annotations\\Adapter\\Memory', true);
     $services['security'] = new Service('security', 'Phalcon\\Security', true);
     /* Managers */
     $services['eventsManager'] = new Service('eventsManager', 'Phalcon\\Events\\Manager', true);
     $services['transactionManager'] = new Service('transactionManager', 'Phalcon\\Mvc\\Model\\Transaction\\Manager');
     //Update array
     $this->_services = $services;
 }
開發者ID:aisuhua,項目名稱:phalcon-php,代碼行數:27,代碼來源:CLI.php

示例8: __construct

 public function __construct()
 {
     parent::__construct();
 }
開發者ID:aciden,項目名稱:generator,代碼行數:4,代碼來源:Config.php


注:本文中的Phalcon\DI\FactoryDefault::__construct方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。