public function getMetadataForHierarchy(ReflectionHierarchy $hierarchy) { $primaryReflection = $hierarchy->getTop(); $benchmark = new BenchmarkMetadata($primaryReflection->path, $primaryReflection->class); $this->buildBenchmark($benchmark, $hierarchy); return $benchmark; }
private function validateMethodExists($context, ReflectionHierarchy $benchmarkReflection, $method, $isStatic = false) { if (false === $benchmarkReflection->hasMethod($method)) { throw new \InvalidArgumentException(sprintf('Unknown %s method "%s" in benchmark class "%s"', $context, $method, $benchmarkReflection->getTop()->class)); } if ($isStatic !== $benchmarkReflection->hasStaticMethod($method)) { throw new \InvalidArgumentException(sprintf('%s method "%s" must %s static in benchmark class "%s"', $context, $method, $isStatic ? 'be' : 'not be', $benchmarkReflection->getTop()->class)); } }