for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PHPSemVerChecker\Operation;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\ClassMethod;
use PHPSemVerChecker\Node\Statement\ClassMethod as PClassMethod;
abstract class ClassMethodOperationUnary extends Operation {
/**
* @var string
*/
protected $context;
* @var int
protected $visibility;
protected $file;
* @var \PhpParser\Node\Stmt
protected $contextValue;
* @var \PhpParser\Node\Stmt\ClassMethod
protected $classMethod;
* @param string $context
* @param string $file
* @param \PhpParser\Node\Stmt $contextValue
* @param \PhpParser\Node\Stmt\ClassMethod $classMethod
public function __construct($context, $file, Stmt $contextValue, ClassMethod $classMethod)
{
$this->context = $context;
$this->visibility = $this->getVisibility($classMethod);
$this->file = $file;
$this->contextValue = $contextValue;
$this->classMethod = $classMethod;
}
* @return string
public function getLocation()
return $this->file;
* @return int
public function getLine()
return $this->classMethod->getLine();
public function getTarget()
return PClassMethod::getFullyQualifiedName($this->contextValue, $this->classMethod);
public function getCode()
return $this->code[$this->context][Visibility::get($this->visibility)];
public function getReason()
return '[' . Visibility::toString($this->visibility) . '] ' . $this->reason;
protected function getVisibility($context)
return Visibility::getForContext($context);