for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is a part of Sculpin.
*
* (c) Dragonfly Development Inc.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symplify\PHP7_Sculpin\Event;
use Symplify\PHP7_Sculpin\Source\SourceInterface;
use Symfony\Component\EventDispatcher\Event;
final class ConvertEvent extends Event
{
/**
* @var SourceInterface
private $source;
* @var string
private $converter;
private $defaultFormatter;
public function __construct(SourceInterface $source, string $converter, string $defaultFormatter)
$this->source = $source;
$this->converter = $converter;
$this->defaultFormatter = $defaultFormatter;
}
public function source() : SourceInterface
return $this->source;
public function converter() : string
return $this->converter;
public function isConvertedBy(string $requestedConverter) : bool
return $requestedConverter === $this->converter;
public function isFormattedBy(string $requestedFormatter) : bool
return $requestedFormatter == $this->source->data()->get('formatter') ?: $this->defaultFormatter;
public function isHandledBy(string $requestedConverter, string $requestedFormatter) : bool
return $this->isConvertedBy($requestedConverter) && $this->isFormattedBy($requestedFormatter);