lib/Benchmark/Metadata/MetadataFactory.php
public function getMetadataForFile(string $file): ?BenchmarkMetadata
    {
        $hierarchy = $this->reflector->reflect($file);

        if ($hierarchy->isEmpty()) {
            return null;
        }

        try {
            $top = $hierarchy->getTop();
        } catch (\InvalidArgumentException $exception) {
            return null;
        }

        if (true === $top->abstract) {
            return null;
        }

        $metadata = $this->driver->getMetadataForHierarchy($hierarchy);
        $this->validateBenchmark($hierarchy, $metadata);

        // validate the subject and load the parameter sets
        foreach ($metadata->getSubjects() as $subject) {
            $this->validateSubject($hierarchy, $subject);
            $paramProviders = $subject->getParamProviders();
            $parameterSets = $this->reflector->getParameterSets($metadata->getPath(), $paramProviders);

            foreach ($parameterSets as $parameterSet) {
                if (!is_array($parameterSet)) {
                    throw new \InvalidArgumentException(sprintf(
                        'Each parameter set must be an array, got "%s" for %s::%s',
                        gettype($parameterSet),
                        $metadata->getClass(),
                        $subject->getName()
                    ));
                }
            }
            $subject->setParameterSets($parameterSets);
        }

        return $metadata;
    }
public function getMetadataForFile(string $file): ?BenchmarkMetadata
    {
        $hierarchy = $this->reflector->reflect($file);

        if ($hierarchy->isEmpty()) {
            return null;
        }

        try {
            $top = $hierarchy->getTop();
        } catch (\InvalidArgumentException $exception) {
            return null;
        }

        if (true === $top->abstract) {
            return null;
        }

        $metadata = $this->driver->getMetadataForHierarchy($hierarchy);
        $this->validateBenchmark($hierarchy, $metadata);

        // validate the subject and load the parameter sets
        foreach ($metadata->getSubjects() as $subject) {
            $this->validateSubject($hierarchy, $subject);
            $paramProviders = $subject->getParamProviders();
            $parameterSets = $this->reflector->getParameterSets($metadata->getPath(), $paramProviders);

            foreach ($parameterSets as $parameterSet) {
                if (!is_array($parameterSet)) {
                    throw new \InvalidArgumentException(sprintf(
                        'Each parameter set must be an array, got "%s" for %s::%s',
                        gettype($parameterSet),
                        $metadata->getClass(),
                        $subject->getName()
                    ));
                }
            }
            $subject->setParameterSets($parameterSets);
        }

        return $metadata;
    }
public function getMetadataForFile ( string $ file ) : ? BenchmarkMetadata { $ hierarchy = $ this -> reflector -> reflect ( $ file ) ; if ( $ hierarchy -> isEmpty ( ) ) { return null ; } try { $ top = $ hierarchy -> getTop ( ) ; } catch ( \ InvalidArgumentException $ exception ) { return null ; } if ( true === $ top -> abstract ) { return null ; } $ metadata = $ this -> driver -> getMetadataForHierarchy ( $ hierarchy ) ; $ this -> validateBenchmark ( $ hierarchy , $ metadata ) ; // validate the subject and load the parameter sets foreach ( $ metadata -> getSubjects ( ) as $ subject ) { $ this -> validateSubject ( $ hierarchy , $ subject ) ; $ paramProviders = $ subject -> getParamProviders ( ) ; $ parameterSets = $ this -> reflector -> getParameterSets ( $ metadata -> getPath ( ) , $ paramProviders ) ; foreach ( $ parameterSets as $ parameterSet ) { if ( ! is_array ( $ parameterSet ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Each parameter set must be an array, got "%s" for %s::%s' , gettype ( $ parameterSet ) , $ metadata -> getClass ( ) , $ subject -> getName ( ) ) ) ; } } $ subject -> setParameterSets ( $ parameterSets ) ; } return $ metadata ; }
Return a Benchmark instance for the given file or NULL if the
given file contains no classes, or the class in the given file is
abstract.
Return a Benchmark instance for the given file or NULL if the given file contains no classes or the class in the given file is abstract .