4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Serializer\Annotation;
14 use Symfony\Component\Serializer\Exception\InvalidArgumentException;
17 * Annotation class for @MaxDepth().
20 * @Target({"PROPERTY", "METHOD"})
22 * @author Kévin Dunglas <dunglas@gmail.com>
31 public function __construct(array $data)
33 if (!isset($data['value'])) {
34 throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" should be set.', \get_class($this)));
37 if (!\is_int($data['value']) || $data['value'] <= 0) {
38 throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a positive integer.', \get_class($this)));
41 $this->maxDepth = $data['value'];
44 public function getMaxDepth()
46 return $this->maxDepth;