PhpBench\Benchmark\Metadata\Driver\AnnotationDriver::buildBenchmark PHP Метод

buildBenchmark() приватный Метод

private buildBenchmark ( BenchmarkMetadata $benchmark, ReflectionHierarchy $hierarchy )
$benchmark PhpBench\Benchmark\Metadata\BenchmarkMetadata
$hierarchy PhpBench\Benchmark\Remote\ReflectionHierarchy
    private function buildBenchmark(BenchmarkMetadata $benchmark, ReflectionHierarchy $hierarchy)
    {
        $annotations = [];
        $reflectionHierarchy = array_reverse(iterator_to_array($hierarchy));
        foreach ($reflectionHierarchy as $reflection) {
            $benchAnnotations = $this->reader->getClassAnnotations($reflection);
            $annotations = array_merge($annotations, $benchAnnotations);
            foreach ($annotations as $annotation) {
                $this->processBenchmark($benchmark, $annotation);
            }
        }
        foreach ($reflectionHierarchy as $reflection) {
            foreach ($reflection->methods as $reflectionMethod) {
                $hasPrefix = (bool) preg_match('{' . $this->subjectPattern . '}', $reflectionMethod->name);
                $hasAnnotation = false;
                $subjectAnnotations = null;
                // if the prefix is false check to see if it has a `@Subject` annotation
                if (false === $hasPrefix) {
                    $subjectAnnotations = $this->reader->getMethodAnnotations($reflectionMethod);
                    foreach ($subjectAnnotations as $annotation) {
                        if ($annotation instanceof Subject) {
                            $hasAnnotation = true;
                        }
                    }
                }
                if (false === $hasPrefix && false === $hasAnnotation) {
                    continue;
                }
                if (null === $subjectAnnotations) {
                    $subjectAnnotations = $this->reader->getMethodAnnotations($reflectionMethod);
                }
                $subject = $benchmark->getOrCreateSubject($reflectionMethod->name);
                // apply the benchmark annotations to the subject
                foreach ($annotations as $annotation) {
                    $this->processSubject($subject, $annotation);
                }
                $this->buildSubject($subject, $subjectAnnotations);
            }
        }
    }