Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
5 / 5 |
CustomerIpStrategy | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
5 / 5 |
supports(OrderInterface $order) | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
autocomplete( OrderInterface $order, ConfigurationInterface $configuration ) | |
100.00% |
1 / 1 |
1 | |
100.00% |
4 / 4 |
<?php | |
/** | |
* @author Krzysztof Gzocha <krzysztof.gzocha@xsolve.pl> | |
*/ | |
namespace Team3\PayU\Order\Autocomplete\Strategy; | |
use Team3\PayU\Configuration\ConfigurationInterface; | |
use Team3\PayU\Order\Model\OrderInterface; | |
class CustomerIpStrategy implements AutocompleteStrategyInterface | |
{ | |
/** | |
* @param OrderInterface $order | |
* | |
* @return bool | |
*/ | |
public function supports(OrderInterface $order) | |
{ | |
return null === $order->getCustomerIp(); | |
} | |
/** | |
* @param OrderInterface $order | |
* @param ConfigurationInterface $configuration | |
*/ | |
public function autocomplete( | |
OrderInterface $order, | |
ConfigurationInterface $configuration | |
) { | |
$order->setCustomerIp( | |
getenv('REMOTE_ADDR') | |
); | |
} | |
} |