You are here

class StringContainsToken in Zircon Profile 8

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

String contains token.

@author Peter Mitchell <pete@peterjmit.com>

Hierarchy

Expanded class hierarchy of StringContainsToken

File

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

Namespace

Prophecy\Argument\Token
View source
class StringContainsToken implements TokenInterface {
  private $value;

  /**
   * Initializes token.
   *
   * @param string $value
   */
  public function __construct($value) {
    $this->value = $value;
  }
  public function scoreArgument($argument) {
    return strpos($argument, $this->value) !== false ? 6 : false;
  }

  /**
   * Returns preset value against which token checks arguments.
   *
   * @return mixed
   */
  public function getValue() {
    return $this->value;
  }

  /**
   * Returns false.
   *
   * @return bool
   */
  public function isLast() {
    return false;
  }

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

}

Members

Namesort descending Modifiers Type Description Overrides
StringContainsToken::$value private property
StringContainsToken::getValue public function Returns preset value against which token checks arguments.
StringContainsToken::isLast public function Returns false. Overrides TokenInterface::isLast
StringContainsToken::scoreArgument public function Calculates token match score for provided argument. Overrides TokenInterface::scoreArgument
StringContainsToken::__construct public function Initializes token.
StringContainsToken::__toString public function Returns string representation for token. Overrides TokenInterface::__toString