forked from broadway/broadway-bundle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
296 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* This file is part of the broadway/broadway-bundle package. | ||
* | ||
* (c) 2020 Broadway project | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/vendor/ | ||
composer.lock | ||
.phpunit.result.cache | ||
.php_cs.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
$config = require 'vendor/broadway/coding-standard/.php_cs.dist'; | ||
|
||
$config->setFinder( | ||
\PhpCsFixer\Finder::create() | ||
->in([ | ||
__DIR__ . '/src', | ||
__DIR__ . '/test', | ||
]) | ||
); | ||
|
||
return $config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
.DEFAULT_GOAL:=help | ||
|
||
.PHONY: dependencies | ||
dependencies: | ||
composer install --no-interaction --no-suggest --no-scripts --ansi | ||
|
||
.PHONY: test | ||
test: | ||
vendor/bin/phpunit --testdox --exclude-group=none --colors=always | ||
|
||
.PHONY: qa | ||
qa: php-cs-fixer-ci | ||
|
||
.PHONY: php-cs-fixer | ||
php-cs-fixer: | ||
vendor/bin/php-cs-fixer fix --no-interaction --allow-risky=yes --diff --verbose | ||
|
||
.PHONY: php-cs-fixer-ci | ||
php-cs-fixer-ci: | ||
vendor/bin/php-cs-fixer fix --dry-run --no-interaction --allow-risky=yes --diff --verbose | ||
|
||
.PHONY: changelog | ||
changelog: | ||
git log $$(git describe --abbrev=0 --tags)...HEAD --no-merges --pretty=format:"* [%h](http://github.com/${TRAVIS_REPO_SLUG}/commit/%H) %s (%cN)" | ||
|
||
.PHONY: license | ||
license: | ||
vendor/bin/docheader check --no-interaction --ansi -vvv {src,test,examples} | ||
|
||
# Based on https://suva.sh/posts/well-documented-makefiles/ | ||
help: ## Display this help | ||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the broadway/broadway package. | ||
* This file is part of the broadway/broadway-bundle package. | ||
* | ||
* (c) Qandidate.com <[email protected]> | ||
* (c) 2020 Broadway project | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Broadway\Bundle\BroadwayBundle; | ||
|
||
use Broadway\Bundle\BroadwayBundle\Command\SchemaEventStoreCreateCommand; | ||
use Broadway\Bundle\BroadwayBundle\Command\SchemaEventStoreDropCommand; | ||
use Broadway\Bundle\BroadwayBundle\DependencyInjection\RegisterBusSubscribersCompilerPass; | ||
use Broadway\Bundle\BroadwayBundle\DependencyInjection\RegisterEventListenerCompilerPass; | ||
use Broadway\Bundle\BroadwayBundle\DependencyInjection\RegisterEventStoreCompilerPass; | ||
|
@@ -21,14 +21,13 @@ | |
use Broadway\Bundle\BroadwayBundle\DependencyInjection\RegisterSagaCompilerPass; | ||
use Broadway\Bundle\BroadwayBundle\DependencyInjection\RegisterSagaStateRepositoryCompilerPass; | ||
use Broadway\Bundle\BroadwayBundle\DependencyInjection\RegisterSerializersCompilerPass; | ||
use Symfony\Component\Console\Application; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
||
class BroadwayBundle extends Bundle | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
* {@inheritdoc} | ||
*/ | ||
public function build(ContainerBuilder $container) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the broadway/broadway package. | ||
* This file is part of the broadway/broadway-bundle package. | ||
* | ||
* (c) Qandidate.com <[email protected]> | ||
* (c) 2020 Broadway project | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
|
@@ -23,7 +25,7 @@ class CommandMetadataEnricher implements MetadataEnricher | |
private $event; | ||
|
||
/** | ||
* {@inheritDoc} | ||
* {@inheritdoc} | ||
*/ | ||
public function enrich(Metadata $metadata): Metadata | ||
{ | ||
|
@@ -33,9 +35,9 @@ public function enrich(Metadata $metadata): Metadata | |
|
||
$data = [ | ||
'console' => [ | ||
'command' => get_class($this->event->getCommand()), | ||
'arguments' => $this->event->getInput()->__toString() | ||
] | ||
'command' => get_class($this->event->getCommand()), | ||
'arguments' => $this->event->getInput()->__toString(), | ||
], | ||
]; | ||
$newMetadata = new Metadata($data); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the broadway/broadway package. | ||
* This file is part of the broadway/broadway-bundle package. | ||
* | ||
* (c) Qandidate.com <[email protected]> | ||
* (c) 2020 Broadway project | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
|
@@ -21,11 +23,11 @@ | |
class BroadwayExtension extends ConfigurableExtension | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
* {@inheritdoc} | ||
*/ | ||
protected function loadInternal(array $mergedConfig, ContainerBuilder $container) | ||
{ | ||
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); | ||
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); | ||
$loader->load('services.xml'); | ||
|
||
if (isset($mergedConfig['event_store'])) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the broadway/broadway package. | ||
* This file is part of the broadway/broadway-bundle package. | ||
* | ||
* (c) Qandidate.com <[email protected]> | ||
* (c) 2020 Broadway project | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
|
@@ -19,36 +21,30 @@ | |
abstract class CompilerPass implements CompilerPassInterface | ||
{ | ||
/** | ||
* @param ContainerBuilder $container | ||
* @param string $definitionId | ||
* @param string $definitionId | ||
*/ | ||
protected function assertContainerHasDefinition(ContainerBuilder $container, $definitionId) | ||
{ | ||
if (!$container->hasDefinition($definitionId)) { | ||
throw new InvalidArgumentException( | ||
sprintf('Service id "%s" could not be found in container', $definitionId) | ||
); | ||
throw new InvalidArgumentException(sprintf('Service id "%s" could not be found in container', $definitionId)); | ||
} | ||
} | ||
|
||
/** | ||
* @param ContainerBuilder $container | ||
* @param string $definitionId | ||
* @param string $interface | ||
* @param string $definitionId | ||
* @param string $interface | ||
*/ | ||
protected function assertDefinitionImplementsInterface(ContainerBuilder $container, $definitionId, $interface) | ||
{ | ||
$this->assertContainerHasDefinition($container, $definitionId); | ||
|
||
$definition = $container->getDefinition($definitionId); | ||
$definition = $container->getDefinition($definitionId); | ||
$definitionClass = $container->getParameterBag()->resolveValue($definition->getClass()); | ||
|
||
$reflectionClass = new ReflectionClass($definitionClass); | ||
|
||
if (! $reflectionClass->implementsInterface($interface)) { | ||
throw new InvalidArgumentException( | ||
sprintf('Service "%s" must implement interface "%s".', $definitionClass, $interface) | ||
); | ||
if (!$reflectionClass->implementsInterface($interface)) { | ||
throw new InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $definitionClass, $interface)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the broadway/broadway package. | ||
* This file is part of the broadway/broadway-bundle package. | ||
* | ||
* (c) Qandidate.com <[email protected]> | ||
* (c) 2020 Broadway project | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
|
@@ -20,16 +22,15 @@ | |
class Configuration implements ConfigurationInterface | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
* {@inheritdoc} | ||
*/ | ||
public function getConfigTreeBuilder() | ||
{ | ||
$treeBuilder = new TreeBuilder('broadway'); | ||
|
||
if (\method_exists($treeBuilder, 'getRootNode')){ | ||
if (\method_exists($treeBuilder, 'getRootNode')) { | ||
$rootNode = $treeBuilder->getRootNode(); | ||
} | ||
else { | ||
} else { | ||
// BC layer for symfony/config 4.1 and older | ||
$rootNode = $treeBuilder->root('broadway'); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the broadway/broadway package. | ||
* This file is part of the broadway/broadway-bundle package. | ||
* | ||
* (c) Qandidate.com <[email protected]> | ||
* (c) 2020 Broadway project | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
|
@@ -13,7 +15,6 @@ | |
|
||
use InvalidArgumentException; | ||
use ReflectionClass; | ||
use RuntimeException; | ||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Reference; | ||
|
@@ -34,13 +35,13 @@ class RegisterBusSubscribersCompilerPass implements CompilerPassInterface | |
*/ | ||
public function __construct($busService, $serviceTag, $subscriberInterface) | ||
{ | ||
$this->busService = $busService; | ||
$this->serviceTag = $serviceTag; | ||
$this->busService = $busService; | ||
$this->serviceTag = $serviceTag; | ||
$this->subscriberInterface = $subscriberInterface; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
* {@inheritdoc} | ||
*/ | ||
public function process(ContainerBuilder $container) | ||
{ | ||
|
@@ -58,9 +59,7 @@ public function process(ContainerBuilder $container) | |
$refClass = new ReflectionClass($class); | ||
|
||
if (!$refClass->implementsInterface($this->subscriberInterface)) { | ||
throw new InvalidArgumentException( | ||
sprintf('Service "%s" must implement interface "%s".', $id, $this->subscriberInterface) | ||
); | ||
throw new InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, $this->subscriberInterface)); | ||
} | ||
|
||
$definition->addMethodCall('subscribe', [new Reference($id)]); | ||
|
Oops, something went wrong.