BetterReflection\SourceLocator\Type\AbstractSourceLocator::__construct PHP Method

__construct() public method

public __construct ( Locator $astLocator = null )
$astLocator BetterReflection\SourceLocator\Ast\Locator
    public function __construct(AstLocator $astLocator = null)
    {
        $this->astLocator = null !== $astLocator ? $astLocator : new AstLocator();
    }

Usage Example

 /**
  * @param string $source
  */
 public function __construct($source)
 {
     parent::__construct();
     $this->source = (string) $source;
     if (empty($this->source)) {
         // Whilst an empty string is still "valid" PHP code, there is no
         // point in us even trying to parse it because we won't find what
         // we are looking for, therefore this throws an exception
         throw new EmptyPhpSourceCode('Source code string was empty');
     }
 }
All Usage Examples Of BetterReflection\SourceLocator\Type\AbstractSourceLocator::__construct