Skip to content

Commit

Permalink
Rename tool String to StringNormalizer to support PHP 7
Browse files Browse the repository at this point in the history
  • Loading branch information
ch3ric committed Feb 12, 2018
1 parent cec9393 commit 29ce525
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
18 changes: 9 additions & 9 deletions Plugin/DotpayDirectPlugin.php
Expand Up @@ -19,7 +19,7 @@
use JMS\Payment\CoreBundle\Plugin\Exception\FunctionNotSupportedException;

use ETS\Payment\DotpayBundle\Client\Token;
use ETS\Payment\DotpayBundle\Tools\String;
use ETS\Payment\DotpayBundle\Tools\StringNormalizer;

/*
* Copyright 2012 ETSGlobal <ecs@etsglobal.org>
Expand Down Expand Up @@ -71,7 +71,7 @@ class DotpayDirectPlugin extends AbstractPlugin
protected $token;

/**
* @var \ETS\Payment\DotpayBundle\Tools\String
* @var \ETS\Payment\DotpayBundle\Tools\StringNormalizer
*/
protected $stringTools;

Expand All @@ -91,14 +91,14 @@ class DotpayDirectPlugin extends AbstractPlugin
protected $type;

/**
* @param Router $router The router
* @param Token $token The client token
* @param String $stringTools The String tool package
* @param string $url The urlc
* @param integer $type The type
* @param string $returnUrl The return url
* @param Router $router The router
* @param Token $token The client token
* @param StringNormalizer $stringTools The StringNormalizer tool package
* @param string $url The urlc
* @param int $type The type
* @param string $returnUrl The return url
*/
public function __construct(Router $router, Token $token, String $stringTools, $url, $type, $returnUrl)
public function __construct(Router $router, Token $token, StringNormalizer $stringTools, $url, $type, $returnUrl)
{
$this->router = $router;
$this->token = $token;
Expand Down
2 changes: 1 addition & 1 deletion Resources/config/services.xml
Expand Up @@ -8,7 +8,7 @@
<parameter key="payment.plugin.dotpay_direct.class">ETS\Payment\DotpayBundle\Plugin\DotpayDirectPlugin</parameter>
<parameter key="payment.form.dotpay_direct_type.class">ETS\Payment\DotpayBundle\Form\DirectType</parameter>
<parameter key="payment.dotpay.client.token.class">ETS\Payment\DotpayBundle\Client\Token</parameter>
<parameter key="payment.dotpay.tools.string.class">ETS\Payment\DotpayBundle\Tools\String</parameter>
<parameter key="payment.dotpay.tools.string.class">ETS\Payment\DotpayBundle\Tools\StringNormalizer</parameter>
</parameters>

<services>
Expand Down
Expand Up @@ -2,7 +2,7 @@

namespace ETS\PurchaseBundle\Tests\Tools;

use ETS\Payment\DotpayBundle\Tools\String;
use ETS\Payment\DotpayBundle\Tools\StringNormalizer;

/*
* Copyright 2012 ETSGlobal <ecs@etsglobal.org>
Expand All @@ -25,7 +25,7 @@
*
* @author ETSGlobal <ecs@etsglobal.org>
*/
class StringTest extends \PHPUnit_Framework_TestCase
class StringNormalizerTest extends \PHPUnit_Framework_TestCase
{
/**
* @return array
Expand All @@ -47,7 +47,7 @@ public function normalizeProvider()
*/
public function testNormaize($input, $expected)
{
$tool = new String();
$tool = new StringNormalizer();

$this->assertEquals($expected, $tool->normalize($input));
}
Expand Down
6 changes: 3 additions & 3 deletions Tools/String.php → Tools/StringNormalizer.php
Expand Up @@ -3,9 +3,9 @@
namespace ETS\Payment\DotpayBundle\Tools;

/**
* String tools
* StringNormalizer tools
*/
class String
class StringNormalizer
{
/**
* Remove all unwanted caracters
Expand All @@ -16,6 +16,6 @@ class String
*/
public function normalize($text)
{
return preg_replace('/\pM*/u', '', normalizer_normalize($text, \Normalizer::FORM_D));
return preg_replace('/\pM*/u', '', \Normalizer::normalize($text, \Normalizer::FORM_D));
}
}

0 comments on commit 29ce525

Please sign in to comment.