Skip to content

Commit

Permalink
Remove unneeded files and use UNIX line endings (schmittjoh#178)
Browse files Browse the repository at this point in the history
* Remove uneeded files

* Use UNIX line endings in all files
  • Loading branch information
psrpinto authored Sep 9, 2016
1 parent 3692864 commit 2596d6f
Show file tree
Hide file tree
Showing 22 changed files with 2,162 additions and 2,170 deletions.
80 changes: 40 additions & 40 deletions DependencyInjection/Compiler/AddPaymentMethodFormTypesPass.php
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
<?php

namespace JMS\Payment\CoreBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;

/**
* Wires payment method types.
*
* @author Johannes M. Schmitt <[email protected]>
*/
class AddPaymentMethodFormTypesPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('payment.form.choose_payment_method_type')) {
return;
}

$paymentMethodFormTypes = array();
foreach ($container->findTaggedServiceIds('payment.method_form_type') as $id => $attributes) {
$definition = $container->getDefinition($id);

// check that this definition is also registered as a form type
$attributes = $definition->getTag('form.type');
if (!$attributes) {
throw new \RuntimeException(sprintf('The service "%s" is marked as payment method form type (tagged with "payment.method_form_type"), but is not registered as a form type with the Form Component. Please also add a "form.type" tag.', $id));
}

if (!isset($attributes[0]['alias'])) {
throw new \RuntimeException(sprintf('Please define an alias attribute for tag "form.type" of service "%s".', $id));
}

$paymentMethodFormTypes[] = $attributes[0]['alias'];
}

$container->getDefinition('payment.form.choose_payment_method_type')
->addArgument($paymentMethodFormTypes);
}
<?php

namespace JMS\Payment\CoreBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;

/**
* Wires payment method types.
*
* @author Johannes M. Schmitt <[email protected]>
*/
class AddPaymentMethodFormTypesPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('payment.form.choose_payment_method_type')) {
return;
}

$paymentMethodFormTypes = array();
foreach ($container->findTaggedServiceIds('payment.method_form_type') as $id => $attributes) {
$definition = $container->getDefinition($id);

// check that this definition is also registered as a form type
$attributes = $definition->getTag('form.type');
if (!$attributes) {
throw new \RuntimeException(sprintf('The service "%s" is marked as payment method form type (tagged with "payment.method_form_type"), but is not registered as a form type with the Form Component. Please also add a "form.type" tag.', $id));
}

if (!isset($attributes[0]['alias'])) {
throw new \RuntimeException(sprintf('Please define an alias attribute for tag "form.type" of service "%s".', $id));
}

$paymentMethodFormTypes[] = $attributes[0]['alias'];
}

$container->getDefinition('payment.form.choose_payment_method_type')
->addArgument($paymentMethodFormTypes);
}
}
Loading

0 comments on commit 2596d6f

Please sign in to comment.