for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Galileo\SettingBundle\Lib\Model\Specification;
use Galileo\SettingBundle\Lib\Model\Exceptions\GuardException;
class AlphaNumericSpecification implements SpecificationInterface
{
/**
* {@inheritdoc}
*/
public function guard($value)
if (!$this->satisfiedBy($value)) {
throw new GuardException('Only alphanumeric values are accepted');
}
public function satisfiedBy($value)
return !is_object($value) && preg_match('#\w+#', $value);