Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace MyBundle\Validator;
- /**
- * Class InraConstraintClassRegistry
- * @package Inra\ScemBundle\Validator
- *
- * Based on EzSystems\EzPlatformFormBuilder\Definition\Validator\ConstraintClassRegistry
- */
- class MyConstraintClassRegistry /* extends ConstraintClassRegistry */
- {
- /**
- * @var array
- */
- protected $registry = [];
- /**
- * @param string $identifier
- *
- * @return bool
- */
- public function hasConstraintClass(string $identifier)
- {
- return isset($this->registry[$identifier]);
- }
- /**
- * @param string $identifier
- *
- * @return string|null
- */
- public function getConstraintClass(string $identifier): ?string
- {
- return $this->hasConstraintClass($identifier)
- ? $this->registry[$identifier]
- : null;
- }
- /**
- * @return array
- */
- public function getConstraintClasses(): array
- {
- return $this->registry;
- }
- /**
- * @param string $identifier
- * @param string $constraintClass
- */
- public function setConstraintClass(string $identifier, string $constraintClass): void
- {
- $this->registry[$identifier] = $constraintClass;
- }
- /**
- * @param array $constraintClasses
- */
- public function setConstraintClasses(array $constraintClasses)
- {
- $this->registry = $constraintClasses;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement