本文整理汇总了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();
});
}
示例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());
}
示例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);
}
示例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();
});
}
示例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();
}
示例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));
}
}
}
示例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;
}
示例8: __construct
public function __construct()
{
parent::__construct();
}