for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Vanderlee\Comprehend\Match;
use Vanderlee\Comprehend\Core\Token;
/**
* Description of ParserToken
*
* @author Martijn
* @property-read bool $match Success or failure?
* @property-read int $length Length of the match
* @property-read array $results List of output results
* @property-read string|array|null $result Default output result
* @property-read Token|null $token
*/
abstract class Match
{
private $length;
* @param string $name
* @return mixed
* @throws \Exception
public function __get($name)
switch ($name) {
case 'length':
return $this->length;
case 'results':
return [];
case 'result':
return null;
case 'token':
}
throw new \InvalidArgumentException("Property name `{$name}` not recognized");
* Create a new match
* @param int $length
public function __construct(int $length = 0)
$this->length = $length;
length
Vanderlee\Comprehend\Match\Match
* Resolve any match stuff (should only ever be called from AbstractParser!
* Not for human consumption
* @return $this
public function resolve()
return $this;
* Return the result for the name specified or the default value if not set.
* @param string|null $name
* @param mixed $default
public function getResult($name = null, $default = null)
$name
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function getResult(/** @scrutinizer ignore-unused */ $name = null, $default = null)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
return $default;
* Return whether there is a result for the name specified.
* @return boolean
public function hasResult($name = null)
public function hasResult(/** @scrutinizer ignore-unused */ $name = null)
return false;