Skip to content

Commit 25c2d55

Browse files
committed
Refactor with event-bus-bundle
1 parent 2dd2823 commit 25c2d55

File tree

68 files changed

+333
-337
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+333
-337
lines changed

app/AppKernel.php

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,31 @@
11
<?php
22

3-
use PhpGitHooks\Infrastructure\CommandBus\CommandBus\CommandBusCompilerPass;
4-
use PhpGitHooks\Infrastructure\CommandBus\QueryBus\QueryBusCompilerPass;
5-
use Symfony\Component\Config\FileLocator;
6-
use Symfony\Component\DependencyInjection\ContainerBuilder;
7-
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
3+
use Symfony\Component\HttpKernel\Kernel;
84

9-
class AppKernel
5+
/**
6+
* Class AppKernel
7+
*
8+
* @@codingStandardsIgnoreFile
9+
*/
10+
class AppKernel extends Kernel
1011
{
1112
const SERVICES_FILE = 'services.yml';
1213
const CONFIG_PATH = '/config/';
1314

14-
/**
15-
* @var ContainerBuilder
16-
*/
17-
private $container;
18-
19-
public function __construct()
20-
{
21-
$this->container = new ContainerBuilder();
22-
$this->container->addCompilerPass(new CommandBusCompilerPass());
23-
$this->container->addCompilerPass(new QueryBusCompilerPass());
24-
$this->getConfigServices();
25-
$this->container->compile();
26-
}
27-
28-
private function getConfigServices()
15+
public function registerBundles()
2916
{
30-
$loader = new YamlFileLoader($this->container, new FileLocator(__DIR__.self::CONFIG_PATH));
31-
$loader->load(self::SERVICES_FILE);
17+
return [
18+
new \Bruli\EventBusBundle\EventBusBundle(),
19+
];
3220
}
3321

3422
/**
35-
* @param string $serviceName
23+
* Loads the container configuration.
3624
*
37-
* @return object
25+
* @param \Symfony\Component\Config\Loader\LoaderInterface $loader A LoaderInterface instance
3826
*/
39-
public function get($serviceName)
27+
public function registerContainerConfiguration(\Symfony\Component\Config\Loader\LoaderInterface $loader)
4028
{
41-
return $this->container->get($serviceName);
29+
$loader->load(__DIR__.self::CONFIG_PATH.self::SERVICES_FILE);
4230
}
4331
}

app/config/services.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,3 @@ services:
1414
class: Symfony\Component\Console\Output\ConsoleOutput
1515
tool.path.finder:
1616
class: PhpGitHooks\Infrastructure\Tool\ToolPathFinder
17-
command.bus:
18-
class: PhpGitHooks\Infrastructure\CommandBus\CommandBus\CommandBus
19-
arguments:
20-
- "@service_container"
21-
- "@bus.options.resolver"
22-
bus.options.resolver:
23-
class: PhpGitHooks\Infrastructure\CommandBus\BusOptionsResolver
24-
query.bus:
25-
class: PhpGitHooks\Infrastructure\CommandBus\QueryBus\QueryBus
26-
arguments:
27-
- "@service_container"
28-
- "@bus.options.resolver"

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
"seld/jsonlint": "1.3.*",
3838
"bruli/ignore-files": "~1.0",
3939
"beberlei/assert": "^2.5",
40-
"bruli/php-value-objects": "^0.1.0"
40+
"bruli/php-value-objects": "^0.1.0",
41+
"bruli/event-bus-bundle": "^0.1.0"
4142
},
4243
"require-dev": {
4344
"composer/composer": "^1.0@dev",

composer.lock

Lines changed: 181 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/PhpGitHooks/Application/Composer/ConfiguratorScript.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
use Composer\Script\Event;
66

7+
/**
8+
* Class ConfiguratorScript.
9+
*
10+
* @codingStandardsIgnoreFile
11+
*/
712
class ConfiguratorScript
813
{
914
public static function buildConfig(Event $event)

src/PhpGitHooks/Infrastructure/CommandBus/BusOptionsResolver.php

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/PhpGitHooks/Infrastructure/CommandBus/CommandBus/CommandBus.php

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/PhpGitHooks/Infrastructure/CommandBus/CommandBus/CommandBusCompilerPass.php

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)