public function __invoke() { $configuration = $this->configuration->toDiArray(); $configuration[EntityManager::class] = \DI\factory(function () { $isDevMode = \DI\link('doctrine.debug'); $metadataConfiguration = \DI\link('doctrine.metadata.configuration'); $paths = $metadataConfiguration['paths']; switch ($metadataConfiguration['type']) { case 'xml': $metadata = Setup::createXMLMetadataConfiguration($paths, $isDevMode); break; case 'yml': $metadata = Setup::createYAMLMetadataConfiguration($paths, $isDevMode); break; case 'annotations': $metadata = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode); break; default: throw new \InvalidArgumentException('Doctrine can only load its configuration using "xml", "yml" or "annotations" but "' . $metadataConfiguration['type'] . '" was provided as a means.'); } return EntityManager::create(\DI\link('doctrine.connection'), $metadata); }); return $configuration; }
<?php $repository = $config['repository']; return ['dependencies' => ['repository' => $config['repository'], 'EntityManager' => DI\factory([FNBr\Infrastructure\Persistence\Doctrine\EntityManagerFactory::class, 'build']), '*Repository' => DI\factory("FNBr\\Infrastructure\\Persistence\\RepositoryFactory"), 'ColorQueryService' => DI\object(FNBr\Application\Service\Color\QueryService::class)->constructor(DI\get('ColorRepository')), 'ColorSaveService' => DI\object(FNBr\Application\Service\Color\SaveService::class)->constructor(DI\get('ColorRepository'))]];
<?php use DI\Container; use Psr\Log\LoggerInterface; use Symfony\Component\Config\FileLocator; use Symfony\Component\EventDispatcher\EventDispatcher; return [EventDispatcher::class => DI\object(), FileLocator::class => DI\object()->constructor(APP_HOME), 'logger.level' => Monolog\Logger::DEBUG, 'logger.file' => APP_HOME . '/var/log/homeservice.log', LoggerInterface::class => DI\factory(function (Container $c) { return new Monolog\Logger('logger', [new Monolog\Handler\ChromePHPHandler($c->get('logger.level')), new Monolog\Handler\StreamHandler($c->get('logger.file'), $c->get('logger.level')), new Monolog\Handler\RavenHandler($c->get(Raven_Client::class))]); }), Raven_Client::class => DI\object()->constructor('https://*****:*****@app.getsentry.com/43338')];
<?php use App\Resources\MySql\ConfigProxies\VXhostRead; use App\Resources\Redis\Redis; use App\Resources\Redis\RedisNonPrefixed; use CBase\DB\Mysql\ServerConnection; use DI\Container; return ['redis.scheme' => 'tcp', 'redis.host' => 'localhost', 'redis.port' => 6379, 'redis.database' => 3, 'redis.options' => ['prefix' => 'homeservice:'], Redis::class => DI\factory(function (Container $c) { return new Redis(['scheme' => $c->get('redis.scheme'), 'host' => $c->get('redis.host'), 'port' => $c->get('redis.port'), 'database' => $c->get('redis.database')], $c->get('redis.options')); }), RedisNonPrefixed::class => DI\factory(function (Container $c) { return new RedisNonPrefixed(['scheme' => $c->get('redis.scheme'), 'host' => $c->get('redis.host'), 'port' => $c->get('redis.port'), 'database' => $c->get('redis.database')], $c->get('redis.options')); }), 'mongo.uri' => 'mongodb://localhost', 'mongo.db' => 'homeservice', 'mongo.options' => ['connectTimeoutMS' => 30000], MongoClient::class => DI\object()->constructor(DI\link('mongo.uri'), DI\link('mongo.options')), MongoDB::class => DI\factory(function (Container $c) { /** @var MongoClient $client */ $client = $c->get(MongoClient::class); $db = $client->selectDB($c->get('mongo.db')); return $db; })];
<?php use Monolog\Logger; return [Psr\Log\LoggerInterface::class => DI\factory(function () { $logger = new Logger('completer'); $logger->pushHandler(new \Monolog\Handler\StreamHandler("php://stdout")); return $logger; })];
<?php use Interop\Container\ContainerInterface; use JayaCode\Framework\Core\Application\Application; use JayaCode\Framework\Core\Http\Request; use JayaCode\Framework\Core\Route; return [Application::class => DI\object()->constructorParameter("routeDispatcher", Route\dispatcherBasic(config("routes"))), Request::class => DI\factory([Request::class, 'createFromSymfonyGlobal'])];
<?php use function DI\object; use function DI\get; use Interop\Container\ContainerInterface; use Piita\Support\API\QiitaAPIV2; use Piita\Support\API\QiitaAPIInterface; use Piita\Config\ConfigInterface; use Piita\Support\HttpClient\HttpClientInterface; use DI\Scope; return ['config' => object(\Piita\Config\Config::class), ConfigInterface::class => get('config'), 'http_client' => object(\Piita\Support\HttpClient\HttpClientGuzzle::class), HttpClientInterface::class => get('http_client'), QiitaAPIInterface::class => DI\factory([Piita\Support\API\APIFactory::class, 'create']), 'items' => object(\Piita\Item\Items::class)->scope(Scope::PROTOTYPE), 'itemId' => object(\Piita\Item\ValueObject\ItemId::class)->scope(Scope::PROTOTYPE), 'item' => object(\Piita\Item\Item::class)->scope(Scope::PROTOTYPE), 'tag.items' => object(\Piita\Item\TagItems::class)->scope(Scope::PROTOTYPE), 'user.items' => object(\Piita\Item\UserItems::class)->scope(Scope::PROTOTYPE), 'user.stocks' => object(\Piita\Item\UserItems::class)->scope(Scope::PROTOTYPE), 'authuser.items' => object(\Piita\Item\AuthenticatedUserItems::class)->scope(Scope::PROTOTYPE), 'likes' => object(\Piita\Like\Likes::class)->scope(Scope::PROTOTYPE), 'like' => object(\Piita\Like\Like::class)->scope(Scope::PROTOTYPE), 'tags' => object(\Piita\Tag\Tags::class)->scope(Scope::PROTOTYPE), 'tag' => object(\Piita\Tag\Tag::class)->scope(Scope::PROTOTYPE), 'tagId' => object(\Piita\Tag\ValueObject\TagId::class)->scope(Scope::PROTOTYPE), 'user.tags' => object(\Piita\Tag\UserTags::class)->scope(Scope::PROTOTYPE), 'comments' => object(\Piita\Comment\Comments::class)->scope(Scope::PROTOTYPE), 'comment' => object(\Piita\Comment\Comment::class)->scope(Scope::PROTOTYPE), 'commentId' => object(\Piita\Comment\ValueObject\CommentId::class)->scope(Scope::PROTOTYPE), 'users' => object(\Piita\User\Users::class)->scope(Scope::PROTOTYPE), 'user' => object(\Piita\User\User::class)->scope(Scope::PROTOTYPE), 'userId' => object(\Piita\User\ValueObject\UserId::class)->scope(Scope::PROTOTYPE), 'user.followees' => object(\Piita\User\Followees::class)->scope(Scope::PROTOTYPE), 'user.followers' => object(\Piita\User\Followers::class)->scope(Scope::PROTOTYPE), 'user.stockers' => object(\Piita\User\Stockers::class)->scope(Scope::PROTOTYPE), 'teams' => object(\Piita\Team\Teams::class)->scope(Scope::PROTOTYPE), 'team' => object(\Piita\Team\Team::class)->scope(Scope::PROTOTYPE), 'teamId' => object(\Piita\Team\ValueObject\TeamId::class)->scope(Scope::PROTOTYPE), 'templates' => object(\Piita\Template\Templates::class)->scope(Scope::PROTOTYPE), 'template' => object(\Piita\Template\Template::class)->scope(Scope::PROTOTYPE), 'templateId' => object(\Piita\Template\ValueObject\TemplateId::class)->scope(Scope::PROTOTYPE), 'template.preview' => object(\Piita\Template\Preview::class)->scope(Scope::PROTOTYPE), 'projects' => object(\Piita\Project\Projects::class)->scope(Scope::PROTOTYPE), 'project' => object(\Piita\Project\Project::class)->scope(Scope::PROTOTYPE), 'projectId' => object(\Piita\Project\ValueObject\ProjectId::class)->scope(Scope::PROTOTYPE)];
$level = strtoupper($c->get('ini.log.log_level')); if (!empty($level) && defined('Piwik\\Log::' . strtoupper($level))) { return Log::getMonologLevel(constant('Piwik\\Log::' . strtoupper($level))); } } return Logger::WARNING; }), 'log.file.filename' => DI\factory(function (ContainerInterface $c) { $logPath = $c->get('ini.log.logger_file_path'); // Absolute path if (strpos($logPath, '/') === 0) { return $logPath; } // Remove 'tmp/' at the beginning if (strpos($logPath, 'tmp/') === 0) { $logPath = substr($logPath, strlen('tmp')); } if (empty($logPath)) { // Default log file $logPath = '/logs/piwik.log'; } $logPath = $c->get('path.tmp') . $logPath; if (is_dir($logPath)) { $logPath .= '/piwik.log'; } return $logPath; }), 'Piwik\\Plugins\\Monolog\\Formatter\\LineMessageFormatter' => DI\object()->constructor(DI\get('log.format')), 'log.format' => DI\factory(function (ContainerInterface $c) { if ($c->has('ini.log.string_message_format')) { return $c->get('ini.log.string_message_format'); } return '%level% %tag%[%datetime%] %message%'; }));
<?php use App\App; use App\MVC\ControllerResolver; use App\MVC\Response\RestResponse; use App\MVC\Response\TwigResponse; use App\Routing\Loader\ArrayFileLoader; use DI\Container; use Psr\Log\LoggerInterface; use Symfony\Component\Config\FileLocator; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpKernel\EventListener\RouterListener; use Symfony\Component\HttpKernel\HttpKernel; use Symfony\Component\Routing\Loader\PhpFileLoader; use Symfony\Component\Routing\Matcher\UrlMatcher; use Symfony\Component\Routing\RequestContext; use Symfony\Component\Routing\RouteCollection; return ['routes.config' => './conf/routes.php', Request::class => DI\factory(function () { return Request::createFromGlobals(); }), RouteCollection::class => DI\factory(function (Container $c) { $locator = $c->get(FileLocator::class); $phpFileLoader = new ArrayFileLoader($locator); $routes = $phpFileLoader->load($c->get('routes.config')); return $routes; }), RequestContext::class => DI\object()->method('fromRequest', DI\link(Request::class)), RequestStack::class => DI\object()->method('push', DI\link(Request::class)), UrlMatcher::class => DI\object()->constructor(DI\link(RouteCollection::class), DI\link(RequestContext::class)), RouterListener::class => DI\object()->constructor(DI\link(UrlMatcher::class), DI\link(RequestContext::class), DI\link(LoggerInterface::class), DI\link(RequestStack::class)), HttpKernel::class => DI\object()->constructor(DI\link(EventDispatcher::class), DI\link(ControllerResolver::class), DI\link(RequestStack::class)), TwigResponse::class => DI\object()->property('twig', DI\link(Twig_Environment::class)), RestResponse::class => DI\object(), ControllerResolver::class => DI\object()->property('container', DI\link(Container::class))->property('logger', DI\link(LoggerInterface::class)), App::class => DI\object()];
} else { return $x; } }; return $aToO(array_merge_recursive($parentConfig, $childConfig)); }, IContainer::class => DI\factory(function (IContainer $c) { return $c; }), IServerRequest::class => DI\factory(function () { return R::fromGlobals(); }), Session::class => DI\factory(function (IContainer $c) { $session = (new SessionFactory())->newInstance($c->get(IServerRequest::class)->getCookieParams()); $session->setName($c->get('config')->session->name); $session->setCookieParams((array) $c->get('config')->session->cookie); return $session; }), ISession::class => DI\factory(function (IContainer $c) { return $c->get(Session::class)->getSegment($c->get('config')->session->name); }), IRouteCollection::class => DI\factory(function (IContainer $c) { return (new Services\RouteCollection($c))->setStrategy((new ParamStrategy())->setContainer($c)); }), IView::class => DI\factory(function (IContainer $c) { $childViews = $c->get('config')->paths->theme->child->views; $parentViews = $c->get('config')->paths->theme->parent->views; if ($childViews == $parentViews) { $folders = [$parentViews]; } else { $folders = [$childViews, $parentViews]; } $config = ['folders' => $folders, 'autoescape' => false]; $engine = Foil::boot($config)->engine(); $engine->useData(['config' => $c->get('config'), 'request' => $c->get(IServerRequest::class)]); return $engine; }), IResponse::class => DI\object(Response::class), IEmitter::class => DI\object(SapiEmitter::class), IFinderFactory::class => DI\object(FinderFactory::class), Contracts\IMiddleware::class => DI\object(Services\Middleware::class), Contracts\IRouter::class => DI\object(Services\Router::class), Contracts\IKernel::class => DI\object(Services\Kernel::class)];
public function __invoke() { return [\Phly\Http\ServerRequest::class => \DI\factory(function () { return \Phly\Http\ServerRequestFactory::fromGlobals(); })]; }
<?php return ['Pimcore\\Model\\Document\\*' => DI\object('Pimcore\\Model\\Document\\*'), 'Pimcore\\Model\\Asset\\*' => DI\object('Pimcore\\Model\\Asset\\*'), 'Pimcore\\Model\\Object\\*\\Listing' => DI\object('Pimcore\\Model\\Object\\*\\Listing'), 'Pimcore\\Model\\Object\\Data\\*' => DI\object('Pimcore\\Model\\Object\\Data\\*'), 'Pimcore\\Model\\Object\\*' => DI\object('Pimcore\\Model\\Object\\*'), \Pimcore\Image\Adapter::class => DI\factory([\Pimcore\Image::class, 'create'])];
<?php use Zend\Expressive\Application; use Zend\Expressive\Container\ApplicationFactory; use Zend\Expressive\Helper; return ['dependencies' => [Helper\ServerUrlHelper::class => DI\object(Helper\ServerUrlHelper::class), Application::class => DI\factory(ApplicationFactory::class), Helper\UrlHelper::class => DI\factory(Helper\UrlHelperFactory::class)]];
<?php use DI\Container; return ['twig.templates' => APP_HOME . '/app/gui/twig', 'twig.options.cache' => APP_HOME . '/var/cache/twig', 'twig.options.debug' => true, Twig_Loader_Filesystem::class => DI\object()->constructor(DI\link('twig.templates')), Twig_Environment::class => DI\factory(function (Container $c) { $twig = new Twig_Environment($c->get(Twig_Loader_Filesystem::class), ['cache' => $c->get('twig.options.cache'), 'debug' => $c->get('twig.options.debug')]); $twig->addExtension(new Twig_Extension_Debug()); return $twig; })];
<?php return ['dependencies' => ['Zend\\Expressive\\Whoops' => DI\object(Whoops\Run::class), 'Zend\\Expressive\\WhoopsPageHandler' => DI\object(Whoops\Handler\PrettyPageHandler::class), 'Zend\\Expressive\\FinalHandler' => DI\factory(Zend\Expressive\Container\WhoopsErrorHandlerFactory::class)], 'whoops' => ['json_exceptions' => ['display' => true, 'show_trace' => true, 'ajax_only' => true]]];
<?php use Zend\Expressive\Container\ApplicationFactory; use Zend\Expressive\Helper; return ['dependencies' => [Helper\ServerUrlMiddleware::class => DI\factory(Helper\ServerUrlMiddlewareFactory::class), Helper\UrlHelperMiddleware::class => DI\factory(Helper\UrlHelperMiddlewareFactory::class)], 'middleware_pipeline' => ['always' => ['middleware' => [Helper\ServerUrlMiddleware::class], 'priority' => 10000], 'routing' => ['middleware' => [ApplicationFactory::ROUTING_MIDDLEWARE, Helper\UrlHelperMiddleware::class, ApplicationFactory::DISPATCH_MIDDLEWARE], 'priority' => 1], 'error' => ['middleware' => [], 'error' => true, 'priority' => -10000]]];
$loader = new Twig_Loader_Filesystem([$twigBridgeViews, './app/Resources/view']); $twig = new Twig_Environment($loader, $c->get('parameters')['twig']['loader_options']); $twig->addGlobal('show_exception_backtrace', $c->get('parameters')['twig']['show_exception_backtrace']); $twig->addGlobal('session', $c->get('session')); $formEngine = new \Symfony\Bridge\Twig\Form\TwigRendererEngine(['bootstrap_3_layout.html.twig']); $formEngine->setEnvironment($twig); $formExt = new \Symfony\Bridge\Twig\Extension\FormExtension(new \Symfony\Bridge\Twig\Form\TwigRenderer($formEngine)); $twig->addExtension($formExt); $transExt = new \Symfony\Bridge\Twig\Extension\TranslationExtension($c->get('translator')); $twig->addExtension($transExt); return $twig; }), 'router' => function () { return \FastRoute\simpleDispatcher(function (\FastRoute\RouteCollector $r) { $r->addRoute('GET', '/', ['ClassicApp\\Controller\\IndexController', 'index']); $r->addRoute('GET', '/book', ['ClassicApp\\Controller\\BookController', 'index']); $r->addRoute('GET', '/book/new', ['ClassicApp\\Controller\\BookController', 'create']); $r->addRoute('POST', '/book/new', ['ClassicApp\\Controller\\BookController', 'create']); }); }, 'redis' => \DI\factory(function (\DI\Container $c) { $redis = new Redis(); $redis->connect($c->get('parameters')['redis']['host'], $c->get('parameters')['redis']['port']); return $redis; }), 'doctrine.dbal' => \DI\factory(function (\DI\Container $c) { return Doctrine\DBAL\DriverManager::getConnection($c->get('parameters')['doctrine']['conn']); }), 'doctrine.em' => \DI\factory(function (\DI\Container $c) { $cacheDriver = new \Doctrine\Common\Cache\RedisCache(); $cacheDriver->setRedis($c->get('redis')); $config = \Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration($c->get('parameters')['doctrine']['orm']['entityPaths'], $c->get('parameters')['doctrine']['orm']['devMode'], $c->get('parameters')['doctrine']['orm']['proxyDir'], $cacheDriver, false); $dbal = $c->get('doctrine.dbal'); return \Doctrine\ORM\EntityManager::create($dbal, $config); })];
<?php use Evan\Structs\ArrayCollection; return array('ElggSite' => DI\factory(function () { return elgg_get_site_entity(); }), 'Evan\\Email\\Sender' => DI\object('Evan\\Email\\ElggSender'), 'Evan\\I18n\\Translator' => DI\object('Evan\\I18n\\ElggTranslator'), 'Evan\\Storage\\Db' => DI\object('Evan\\Storage\\MysqlDb'), 'Evan\\Time\\Clock' => DI\object('Evan\\Time\\SystemClock'));
<?php return array('AnonymousPiwikUsageMeasurement.piwikVersion' => '2.14.3', 'AnonymousPiwikUsageMeasurement.phpVersion' => '5.5.27', 'Piwik\\Plugins\\AnonymousPiwikUsageMeasurement\\SystemSettings' => DI\factory(function () { // we cannot decorate here as we need to create an instance of settings as super user, the permissions // for writing / reading are detected on settings creation, not each time it is executed $settings = null; \Piwik\Access::doAsSuperUser(function () use(&$settings) { $settings = new Piwik\Plugins\AnonymousPiwikUsageMeasurement\SystemSettings(); // make sure no tracking is enabled when running tests, especially on travis and during ui tests $settings->trackToPiwik->setValue(false); $settings->ownPiwikSiteId->setValue(0); $settings->customPiwikSiteId->setValue(0); }); return $settings; }));
<?php return ['dependencies' => [Zend\Expressive\Router\RouterInterface::class => DI\object(Zend\Expressive\Router\FastRouteRouter::class), Maestro\Action\PingAction::class => DI\object(Maestro\Action\PingAction::class), Maestro\Action\HomePageAction::class => DI\factory(Maestro\Action\HomePageFactory::class), Maestro\Action\MaestroAction::class => DI\factory(Maestro\Action\MaestroFactory::class)], 'routes' => [['name' => 'home', 'path' => '/expressive/home', 'middleware' => Maestro\Action\HomePageAction::class, 'allowed_methods' => ['GET']], ['name' => 'api.ping', 'path' => '/expressive/api/ping', 'middleware' => Maestro\Action\PingAction::class, 'allowed_methods' => ['GET']], ['name' => 'hello', 'path' => '/expressive/hello', 'middleware' => Maestro\Action\HelloAction::class, 'allowed_methods' => ['GET']], ['name' => 'maestro', 'path' => '/expressive/{part1}[/{part2}[/{part3}[/{part4}[/{part5}]]]]', 'middleware' => Maestro\Action\MaestroAction::class, 'allowed_methods' => ['GET', 'POST']]]];