X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fsymfony%2Fserializer%2FAnnotation%2FMaxDepth.php;fp=vendor%2Fsymfony%2Fserializer%2FAnnotation%2FMaxDepth.php;h=1f41948d6da25996e12821322fee63a0a11d95bb;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=0000000000000000000000000000000000000000;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/vendor/symfony/serializer/Annotation/MaxDepth.php b/vendor/symfony/serializer/Annotation/MaxDepth.php new file mode 100644 index 000000000..1f41948d6 --- /dev/null +++ b/vendor/symfony/serializer/Annotation/MaxDepth.php @@ -0,0 +1,48 @@ + + * + * 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 @MaxDepth(). + * + * @Annotation + * @Target({"PROPERTY", "METHOD"}) + * + * @author Kévin Dunglas + */ +class MaxDepth +{ + /** + * @var int + */ + private $maxDepth; + + public function __construct(array $data) + { + if (!isset($data['value'])) { + throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" should be set.', get_class($this))); + } + + if (!is_int($data['value']) || $data['value'] <= 0) { + throw new InvalidArgumentException(sprintf('Parameter of annotation "%s" must be a positive integer.', get_class($this))); + } + + $this->maxDepth = $data['value']; + } + + public function getMaxDepth() + { + return $this->maxDepth; + } +}