Вход Регистрация
Файл: gapps/vendor/phpspec/prophecy/src/Prophecy/PhpDocumentor/ClassAndInterfaceTagRetriever.php
Строк: 61
<?php

/*
 * This file is part of the Prophecy.
 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
 *     Marcello Duarte <marcello.duarte@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace ProphecyPhpDocumentor;

use 
phpDocumentorReflectionDocBlockTagMethodTag as LegacyMethodTag;
use 
phpDocumentorReflectionDocBlockTagsMethod;

/**
 * @author Théo FIDRY <theo.fidry@gmail.com>
 *
 * @internal
 */
final class ClassAndInterfaceTagRetriever implements MethodTagRetrieverInterface
{
    private 
$classRetriever;

    public function 
__construct(MethodTagRetrieverInterface $classRetriever null)
    {
        if (
null !== $classRetriever) {
            
$this->classRetriever $classRetriever;

            return;
        }

        
$this->classRetriever class_exists('phpDocumentorReflectionDocBlockFactory') && class_exists('phpDocumentorReflectionTypesContextFactory')
            ? new 
ClassTagRetriever()
            : new 
LegacyClassTagRetriever()
        ;
    }

    
/**
     * @param ReflectionClass $reflectionClass
     *
     * @return LegacyMethodTag[]|Method[]
     */
    
public function getTagList(ReflectionClass $reflectionClass)
    {
        return 
array_merge(
            
$this->classRetriever->getTagList($reflectionClass),
            
$this->getInterfacesTagList($reflectionClass)
        );
    }

    
/**
     * @param ReflectionClass $reflectionClass
     *
     * @return LegacyMethodTag[]|Method[]
     */
    
private function getInterfacesTagList(ReflectionClass $reflectionClass)
    {
        
$interfaces $reflectionClass->getInterfaces();
        
$tagList = array();

        foreach(
$interfaces as $interface) {
            
$tagList array_merge($tagList$this->classRetriever->getTagList($interface));
        }

        return 
$tagList;
    }
}
Онлайн: 1
Реклама