for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @author Rafał Muszyński <[email protected]>
* @copyright 2015 Sourcefabric z.ú.
* @license http://www.gnu.org/licenses/gpl-3.0.txt
*/
namespace Newscoop\PaywallBundle\Serializer;
use JMS\Serializer\JsonSerializationVisitor;
use Newscoop\PaywallBundle\Currency\Context\CurrencyContextInterface;
use Newscoop\PaywallBundle\Entity\PriceableInterface;
use Sylius\Component\Currency\Converter\CurrencyConverterInterface;
* Currency converter handler. Handles currency conversion.
class CurrencyConverterHandler
{
private $converter;
private $context;
* Construct.
*
* @param CurrencyConverterInterface $converter
* @param CurrencyContextInterface $context
public function __construct(CurrencyConverterInterface $converter, CurrencyContextInterface $context)
$this->converter = $converter;
$this->context = $context;
}
public function serializeToJson(JsonSerializationVisitor $visitor, PriceableInterface $subscription)
$visitor
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
if (!$subscription) {
return;
return $this->converter->convert($subscription->getPrice(), $this->context->getCurrency());
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.