X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fsymfony%2Fserializer%2FAnnotation%2FGroups.php;fp=vendor%2Fsymfony%2Fserializer%2FAnnotation%2FGroups.php;h=519837a55b73ea44992ce0371b1cc9fb18cc3c44;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/vendor/symfony/serializer/Annotation/Groups.php b/vendor/symfony/serializer/Annotation/Groups.php new file mode 100644 index 000000000..519837a55 --- /dev/null +++ b/vendor/symfony/serializer/Annotation/Groups.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Serializer\Annotation; + +use Symfony\Component\Serializer\Exception\InvalidArgumentException; + +/** + * Annotation class for @Groups(). + * + * @Annotation + * @Target({"PROPERTY", "METHOD"}) + * + * @author Kévin Dunglas + */ +class Groups +{ + /** + * @var array + */ + private $groups; + + /** + * @param array $data + * + * @throws InvalidArgumentException + */ + public function __construct(array $data) + { + if (!isset($data['value']) || !$data['value']) { + throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" cannot be empty.', get_class($this))); + } + + if (!is_array($data['value'])) { + throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be an array of strings.', get_class($this))); + } + + foreach ($data['value'] as $group) { + if (!is_string($group)) { + throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be an array of strings.', get_class($this))); + } + } + + $this->groups = $data['value']; + } + + /** + * Gets groups. + * + * @return array + */ + public function getGroups() + { + return $this->groups; + } +}