4 * This file is part of the Prophecy.
5 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
6 * Marcello Duarte <marcello.duarte@gmail.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Prophecy\PhpDocumentor;
14 use phpDocumentor\Reflection\DocBlock\Tag\MethodTag as LegacyMethodTag;
15 use phpDocumentor\Reflection\DocBlock\Tags\Method;
18 * @author Théo FIDRY <theo.fidry@gmail.com>
22 final class ClassAndInterfaceTagRetriever implements MethodTagRetrieverInterface
24 private $classRetriever;
26 public function __construct(MethodTagRetrieverInterface $classRetriever = null)
28 if (null !== $classRetriever) {
29 $this->classRetriever = $classRetriever;
34 $this->classRetriever = class_exists('phpDocumentor\Reflection\DocBlockFactory') && class_exists('phpDocumentor\Reflection\Types\ContextFactory')
35 ? new ClassTagRetriever()
36 : new LegacyClassTagRetriever()
41 * @param \ReflectionClass $reflectionClass
43 * @return LegacyMethodTag[]|Method[]
45 public function getTagList(\ReflectionClass $reflectionClass)
48 $this->classRetriever->getTagList($reflectionClass),
49 $this->getInterfacesTagList($reflectionClass)
54 * @param \ReflectionClass $reflectionClass
56 * @return LegacyMethodTag[]|Method[]
58 private function getInterfacesTagList(\ReflectionClass $reflectionClass)
60 $interfaces = $reflectionClass->getInterfaces();
63 foreach($interfaces as $interface) {
64 $tagList = array_merge($tagList, $this->classRetriever->getTagList($interface));