You are here

class Groups in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/serializer/Annotation/Groups.php \Symfony\Component\Serializer\Annotation\Groups

Annotation class for @Groups().

@Target({"PROPERTY", "METHOD"})

@author Kévin Dunglas <dunglas@gmail.com>

Hierarchy

  • class \Symfony\Component\Serializer\Annotation\Groups

Expanded class hierarchy of Groups

Related topics

5 files declare their use of Groups
AnnotationLoader.php in vendor/symfony/serializer/Mapping/Loader/AnnotationLoader.php
GroupDummy.php in vendor/symfony/serializer/Tests/Fixtures/GroupDummy.php
GroupDummyInterface.php in vendor/symfony/serializer/Tests/Fixtures/GroupDummyInterface.php
GroupDummyParent.php in vendor/symfony/serializer/Tests/Fixtures/GroupDummyParent.php
GroupsTest.php in vendor/symfony/serializer/Tests/Annotation/GroupsTest.php
1 string reference to 'Groups'
views.data_types.schema.yml in core/modules/views/config/schema/views.data_types.schema.yml
core/modules/views/config/schema/views.data_types.schema.yml
5 classes are annotated with Groups
GroupDummy::getBar in vendor/symfony/serializer/Tests/Fixtures/GroupDummy.php
Plugin annotation @Groups({"c"})
GroupDummy::isFooBar in vendor/symfony/serializer/Tests/Fixtures/GroupDummy.php
Plugin annotation @Groups({"a", "b", "name_converter"})
GroupDummy::setBar in vendor/symfony/serializer/Tests/Fixtures/GroupDummy.php
Plugin annotation @Groups({"b"})
GroupDummyInterface::getSymfony in vendor/symfony/serializer/Tests/Fixtures/GroupDummyInterface.php
Plugin annotation @Groups({"a", "name_converter"})
GroupDummyParent::getCoopTilleuls in vendor/symfony/serializer/Tests/Fixtures/GroupDummyParent.php
Plugin annotation @Groups({"a", "b"})

File

vendor/symfony/serializer/Annotation/Groups.php, line 24

Namespace

Symfony\Component\Serializer\Annotation
View source
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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Groups::$groups private property
Groups::getGroups public function Gets groups.
Groups::__construct public function