getObject() public method

Returns the object.
public getObject ( ) : ClassMethod | FunctionDefinition
return PHPSA\Definition\ClassMethod | PHPSA\Definition\FunctionDefinition
Exemplo n.º 1
0
 /**
  * @param string $type
  * @param string $message
  * @param \PhpParser\NodeAbstract $expr
  * @return bool
  */
 public function notice($type, $message, \PhpParser\NodeAbstract $expr)
 {
     $filepath = $this->scope ? $this->scope->getFilepath() : $this->scopePointer->getObject()->getFilepath();
     $code = file($filepath);
     $this->output->writeln('<comment>Notice:  ' . $message . " in {$filepath} on {$expr->getLine()} [{$type}]</comment>");
     $this->output->writeln('');
     if ($this->application->getConfiguration()->valueIsTrue('blame')) {
         exec("git blame --show-email -L {$expr->getLine()},{$expr->getLine()} " . $filepath, $result);
         if ($result && isset($result[0])) {
             $result[0] = trim($result[0]);
             $this->output->writeln("<comment>\t {$result[0]}</comment>");
         }
     } else {
         $code = trim($code[$expr->getLine() - 1]);
         $this->output->writeln("<comment>\t {$code} </comment>");
     }
     $this->output->writeln('');
     unset($code);
     return true;
 }
Exemplo n.º 2
0
 /**
  * @covers \PHPSA\ScopePointer::getObject
  */
 public function testGetObject()
 {
     $object = new \stdClass();
     $scopePointer = new ScopePointer($object);
     $this->assertSame($object, $scopePointer->getObject());
 }