public locateIdentifier ( BetterReflection\Reflector\Reflector $reflector, BetterReflection\Identifier\Identifier $identifier ) | ||
$reflector | BetterReflection\Reflector\Reflector | |
$identifier | BetterReflection\Identifier\Identifier |
public function locateIdentifier(Reflector $reflector, Identifier $identifier)
{
foreach ($this->sourceLocators as $sourceLocator) {
if ($located = $sourceLocator->locateIdentifier($reflector, $identifier)) {
return $located;
}
}
return null;
}
public function testTwoStringSourceLocatorsResolveCorrectly() { $identifier = new Identifier('Foo', new IdentifierType(IdentifierType::IDENTIFIER_CLASS)); $locator1 = new StringSourceLocator('<?php'); $locator2 = new StringSourceLocator('<?php class Foo {}'); $aggregate = new AggregateSourceLocator([$locator1, $locator2]); $reflection = $aggregate->locateIdentifier($this->getMockReflector(), $identifier); $this->assertSame('Foo', $reflection->getName()); }