Upgrade to Stratify 0.3

This commit is contained in:
Matthieu Napoli
2016-06-20 17:15:27 +02:00
parent 9c71c18c75
commit 3249f3642e
6 changed files with 1136 additions and 197 deletions

View File

@@ -1,37 +1,23 @@
#!/usr/bin/env php
<?php
use DI\ContainerBuilder;
use Maintained\Application\Application;
use Maintained\Application\Command\ClearCacheCommand;
use Maintained\Application\Command\ShowStatisticsCommand;
use Maintained\Application\Command\UpdateStatisticsCommand;
use Maintained\Application\Command\WarmupCacheCommand;
use Symfony\Component\Console\Application;
require_once __DIR__ . '/../.puli/GeneratedPuliFactory.php';
require_once __DIR__ . '/../vendor/autoload.php';
$modules = [
'error-handler',
'twig',
'app',
];
/** @var \Stratify\Framework\Application $app */
$app = new class([], $modules) extends \Stratify\Framework\Application
{
protected function createContainerBuilder(array $modules) : ContainerBuilder
{
$containerBuilder = parent::createContainerBuilder($modules);
$containerBuilder->useAnnotations(true);
return $containerBuilder;
}
};
$app = new Application;
$container = $app->getContainer();
$application = new Application('isitmaintained');
$cli = $app->cli();
$application->add($container->get(ClearCacheCommand::class));
$application->add($container->get(WarmupCacheCommand::class));
$application->add($container->get(ShowStatisticsCommand::class));
$application->add($container->get(UpdateStatisticsCommand::class));
$cli->add($container->get(ClearCacheCommand::class));
$cli->add($container->get(WarmupCacheCommand::class));
$cli->add($container->get(ShowStatisticsCommand::class));
$cli->add($container->get(UpdateStatisticsCommand::class));
$application->run();
$cli->run();

View File

@@ -19,7 +19,7 @@
"mnapoli/blackbox": "~0.4.0",
"psr/log": "~1.0",
"monolog/monolog": "~1.10",
"stratify/framework": "~0.1.2",
"stratify/framework": "~0.3.1",
"stratify/twig-module": "~0.1.1",
"doctrine/annotations": "^1.2"
},

1178
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -16,6 +16,10 @@
"install-path": "vendor/badges/poser",
"installer": "composer"
},
"coduo/phpspec-data-provider-extension": {
"install-path": "vendor/coduo/phpspec-data-provider-extension",
"installer": "composer"
},
"container-interop/container-interop": {
"install-path": "vendor/container-interop/container-interop",
"installer": "composer"
@@ -28,6 +32,10 @@
"install-path": "vendor/doctrine/cache",
"installer": "composer"
},
"doctrine/instantiator": {
"install-path": "vendor/doctrine/instantiator",
"installer": "composer"
},
"doctrine/lexer": {
"install-path": "vendor/doctrine/lexer",
"installer": "composer"
@@ -52,14 +60,26 @@
"install-path": "vendor/mnapoli/blackbox",
"installer": "composer"
},
"mnapoli/silly": {
"install-path": "vendor/mnapoli/silly",
"installer": "composer"
},
"monolog/monolog": {
"install-path": "vendor/monolog/monolog",
"installer": "composer"
},
"paragonie/random_compat": {
"install-path": "vendor/paragonie/random_compat",
"installer": "composer"
},
"php-di/invoker": {
"install-path": "vendor/php-di/invoker",
"installer": "composer"
},
"php-di/kernel": {
"install-path": "vendor/php-di/kernel",
"installer": "composer"
},
"php-di/php-di": {
"install-path": "vendor/php-di/php-di",
"installer": "composer"
@@ -68,6 +88,30 @@
"install-path": "vendor/php-di/phpdoc-reader",
"installer": "composer"
},
"phpdocumentor/reflection-common": {
"install-path": "vendor/phpdocumentor/reflection-common",
"installer": "composer"
},
"phpdocumentor/reflection-docblock": {
"install-path": "vendor/phpdocumentor/reflection-docblock",
"installer": "composer"
},
"phpdocumentor/type-resolver": {
"install-path": "vendor/phpdocumentor/type-resolver",
"installer": "composer"
},
"phpspec/php-diff": {
"install-path": "vendor/phpspec/php-diff",
"installer": "composer"
},
"phpspec/phpspec": {
"install-path": "vendor/phpspec/phpspec",
"installer": "composer"
},
"phpspec/prophecy": {
"install-path": "vendor/phpspec/prophecy",
"installer": "composer"
},
"psr/http-message": {
"install-path": "vendor/psr/http-message",
"installer": "composer"
@@ -100,6 +144,22 @@
"install-path": "vendor/ramsey/uuid",
"installer": "composer"
},
"sebastian/comparator": {
"install-path": "vendor/sebastian/comparator",
"installer": "composer"
},
"sebastian/diff": {
"install-path": "vendor/sebastian/diff",
"installer": "composer"
},
"sebastian/exporter": {
"install-path": "vendor/sebastian/exporter",
"installer": "composer"
},
"sebastian/recursion-context": {
"install-path": "vendor/sebastian/recursion-context",
"installer": "composer"
},
"seld/jsonlint": {
"install-path": "vendor/seld/jsonlint",
"installer": "composer"
@@ -148,6 +208,10 @@
"install-path": "vendor/symfony/process",
"installer": "composer"
},
"symfony/yaml": {
"install-path": "vendor/symfony/yaml",
"installer": "composer"
},
"twig/twig": {
"install-path": "vendor/twig/twig",
"installer": "composer"

View File

@@ -0,0 +1,28 @@
<?php
declare(strict_types = 1);
namespace Maintained\Application;
use DI\ContainerBuilder;
/**
* @author Matthieu Napoli <matthieu@mnapoli.fr>
*/
class Application extends \Stratify\Framework\Application
{
public function __construct()
{
$modules = [
'error-handler',
'twig',
'app',
];
parent::__construct($modules);
}
protected function configureContainerBuilder(ContainerBuilder $containerBuilder)
{
$containerBuilder->useAnnotations(true);
}
}

View File

@@ -1,6 +1,5 @@
<?php
use DI\ContainerBuilder;
use Maintained\Application\Controller\BadgeController;
use Maintained\Application\Controller\HomeController;
use Maintained\Application\Controller\ProjectCheckController;
@@ -19,22 +18,17 @@ if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . preg_replace('#(\?.*)$
return false;
}
require_once __DIR__ . '/../.puli/GeneratedPuliFactory.php';
require __DIR__ . '/../vendor/autoload.php';
$modules = [
'error-handler',
'twig',
'app',
];
$http = pipe([
ErrorHandlerMiddleware::class,
MaintenanceMiddleware::class,
router([
'/' => route(HomeController::class, 'home'),
'/check/{user}/{repository}' => route(ProjectCheckController::class, 'check-project'),
'/project/{user}/{repository}' => route(ProjectController::class, 'project'),
'/' => route(HomeController::class, 'home'),
'/check/{user}/{repository}' => route(ProjectCheckController::class, 'check-project'),
'/project/{user}/{repository}' => route(ProjectController::class, 'project'),
'/badge/{badge}/{user}/{repository}.svg' => route(BadgeController::class, 'badge'),
]),
@@ -42,17 +36,6 @@ $http = pipe([
Error404Middleware::class,
]);
/** @var Application $app */
$app = new class($http, $modules) extends Application
{
protected function createContainerBuilder(array $modules) : ContainerBuilder
{
$containerBuilder = parent::createContainerBuilder($modules);
$containerBuilder->useAnnotations(true);
return $containerBuilder;
}
};
$app = new Application;
ErrorHandler::register($app->getContainer()->get(LoggerInterface::class));
$app->runHttp();
$app->http($http)->run();