for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace SLLH\IsoCodesValidator\Constraints;
use SLLH\IsoCodesValidator\AbstractConstraint;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
/**
* @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
*
* @author Sullivan Senechal <[email protected]>
*/
final class Isbn extends AbstractConstraint
{
public $message = 'This value is not a valid ISBN.';
public $type = null;
* {@inheritdoc}
public function __construct($options = null)
parent::__construct($options);
if ($this->type !== null && !in_array($this->type, [10, 13])) {
throw new ConstraintDefinitionException('The option "type" must be 10 or 13');
}
public function getDefaultOption()
return 'type';
public function getIsoCodesVersion()
return '1.2.0';
public function getIsoCodesClass()
return \IsoCodes\Isbn::class;