4 * This file is part of the Prophecy.
5 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
6 * Marcello Duarte <marcello.duarte@gmail.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Prophecy\Argument\Token;
14 use Prophecy\Util\StringUtil;
17 * Identical value token.
19 * @author Florian Voutzinos <florian@voutzinos.com>
21 class IdenticalValueToken implements TokenInterface
31 * @param StringUtil $util
33 public function __construct($value, StringUtil $util = null)
35 $this->value = $value;
36 $this->util = $util ?: new StringUtil();
40 * Scores 11 if argument matches preset value.
46 public function scoreArgument($argument)
48 return $argument === $this->value ? 11 : false;
56 public function isLast()
62 * Returns string representation for token.
66 public function __toString()
68 if (null === $this->string) {
69 $this->string = sprintf('identical(%s)', $this->util->stringify($this->value));