You are here

class LogicalNotToken in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpspec/prophecy/src/Prophecy/Argument/Token/LogicalNotToken.php \Prophecy\Argument\Token\LogicalNotToken

Logical NOT token.

@author Boris Mikhaylov <kaguxmail@gmail.com>

Hierarchy

Expanded class hierarchy of LogicalNotToken

File

vendor/phpspec/prophecy/src/Prophecy/Argument/Token/LogicalNotToken.php, line 19

Namespace

Prophecy\Argument\Token
View source
class LogicalNotToken implements TokenInterface {

  /** @var \Prophecy\Argument\Token\TokenInterface  */
  private $token;

  /**
   * @param mixed $value exact value or token
   */
  public function __construct($value) {
    $this->token = $value instanceof TokenInterface ? $value : new ExactValueToken($value);
  }

  /**
   * Scores 4 when preset token does not match the argument.
   *
   * @param $argument
   *
   * @return bool|int
   */
  public function scoreArgument($argument) {
    return false === $this->token
      ->scoreArgument($argument) ? 4 : false;
  }

  /**
   * Returns true if preset token is last.
   *
   * @return bool|int
   */
  public function isLast() {
    return $this->token
      ->isLast();
  }

  /**
   * Returns originating token.
   *
   * @return TokenInterface
   */
  public function getOriginatingToken() {
    return $this->token;
  }

  /**
   * Returns string representation for token.
   *
   * @return string
   */
  public function __toString() {
    return sprintf('not(%s)', $this->token);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
LogicalNotToken::$token private property @var \Prophecy\Argument\Token\TokenInterface
LogicalNotToken::getOriginatingToken public function Returns originating token.
LogicalNotToken::isLast public function Returns true if preset token is last. Overrides TokenInterface::isLast
LogicalNotToken::scoreArgument public function Scores 4 when preset token does not match the argument. Overrides TokenInterface::scoreArgument
LogicalNotToken::__construct public function
LogicalNotToken::__toString public function Returns string representation for token. Overrides TokenInterface::__toString