* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator\Mapping; use Symfony\Component\Validator\Exception\ValidatorException; /** * Stores all metadata needed for validating a class property via its getter * method. * * A property getter is any method that is equal to the property's name, * prefixed with either "get" or "is". That method will be used to access the * property's value. * * The getter will be invoked by reflection, so the access of private and * protected getters is supported. * * This class supports serialization and cloning. * * @author Bernhard Schussek * * @see PropertyMetadataInterface */ class GetterMetadata extends MemberMetadata { /** * @param string $class The class the getter is defined on * @param string $property The property which the getter returns * @param string|null $method The method that is called to retrieve the value being validated (null for auto-detection) * * @throws ValidatorException */ public function __construct($class, $property, $method = null) { if (null === $method) { $getMethod = 'get'.ucfirst($property); $isMethod = 'is'.ucfirst($property); $hasMethod = 'has'.ucfirst($property); if (method_exists($class, $getMethod)) { $method = $getMethod; } elseif (method_exists($class, $isMethod)) { $method = $isMethod; } elseif (method_exists($class, $hasMethod)) { $method = $hasMethod; } else { throw new ValidatorException(sprintf('Neither of these methods exist in class %s: %s, %s, %s', $class, $getMethod, $isMethod, $hasMethod)); } } elseif (!method_exists($class, $method)) { throw new ValidatorException(sprintf('The %s() method does not exist in class %s.', $method, $class)); } parent::__construct($class, $method, $property); } /** * {@inheritdoc} */ public function getPropertyValue($object) { return $this->newReflectionMember($object)->invoke($object); } /** * {@inheritdoc} */ protected function newReflectionMember($objectOrClassName) { return new \ReflectionMethod($objectOrClassName, $this->getName()); } } __halt_compiler();----SIGNATURE:----nTUgPzcx3b+TUgteOUlidwuHKxFoATGV9ET+hM3YIGY0I1zuz0jAVE0hpF7tOxCu0ZiHGfibv3fLg0C/B6dDghtSMFjRgrJEdtQJFbpOCxZ/vGgYxleGYhDLMvXmHZNNK174sKlxlv9JzfqMHfFy3/Pj0v9DkR6H5puvA8QVPqSNU75LWE7Kyk9CfNk86ZVGaz/RPoe/0yvUKKlnAcBuZ54GKkIf9A+zv/eGfAVLQI61IxvMP2ueXDD9Es+v2Iiu+BTuCNQTLeDl245aQZRNExjP4F6wGuA2sShme8QsQCO5hmRLOD8Ly0h2Ke7l98afkl/l1VjShPbpodgAZuq5YhJaqPx52hIg/iapfSKbIVUygpJEFE2RL5W2wyNE1EFehcaqbd4/Os0VkVZSWRq/kxn80+RuWYLSuH3vSmovAO7zUmF1U5yDuY+t3mgItiwIMdi2HBu720/yth5QUSuw18+pipw8aVkVQRQU6TrbqWqQ+X8qgxgnve7tynuWDpvX7cs0AB6GZzCAY6tTN1sr99Fre3fgB/Big4jR2mK5HLzzIG9b5vzqs4piS5gbNGBZK2g5aEL80EObwlmzbvQl1SGTk2YopnpwWIfmULusC412ukEVCXIolZDKkLXSBT/fo45ByrJLSCp0GJHdKmibEYV4iR2o1vBnZJTjMCp/d5g=----ATTACHMENT:----NTM5MDg4MDQxMzU1NDQ4NSA2MzcyNTQyMzY0ODcyNzg0IDg0ODUwNDMzNDI1OTY3MDY=