67304831f892287fc9ffa30ac7b6a52e3234ff85
[yaffs-website] / vendor / symfony / serializer / Tests / Fixtures / StaticConstructorNormalizer.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\Serializer\Tests\Fixtures;
13
14 use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
15
16 /**
17  * @author Guilhem N. <egetick@gmail.com>
18  */
19 class StaticConstructorNormalizer extends ObjectNormalizer
20 {
21     /**
22      * {@inheritdoc}
23      */
24     protected function getConstructor(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes)
25     {
26         if (is_a($class, StaticConstructorDummy::class, true)) {
27             return new \ReflectionMethod($class, 'create');
28         }
29
30         return parent::getConstructor($data, $class, $context, $reflectionClass, $allowedAttributes);
31     }
32 }