for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* UrlConstraintBuilder class file
*/
namespace Graviton\SchemaBundle\Constraint\Builder;
use Graviton\RestBundle\Model\DocumentModel;
use Graviton\SchemaBundle\Document\Schema;
* @author List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @link http://swisscom.ch
class UrlConstraintBuilder implements ConstraintBuilderInterface
{
* if this builder supports a given constraint
*
* @param string $type Field type
* @param array $options Options
* @return bool
public function supportsConstraint($type, array $options = [])
return ($type === 'Url');
}
* Adds constraints to the property
* @param string $fieldName field name
* @param Schema $property property
* @param DocumentModel $model parent model
* @param array $options the constraint options
* @return Schema the modified property
public function buildConstraint($fieldName, Schema $property, DocumentModel $model, array $options)
$property->setFormat('uri');
return $property;