![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/medad.corals.io/vendor/google/cloud-core/src/Testing/ |
<?php namespace Google\Cloud\Core\Testing; use Prophecy\Argument\Token\TokenInterface; use Prophecy\Util\StringUtil; /** * ArrayHasSameValuesToken implements TokenInterface and is used for testing * * @experimental * @internal */ class ArrayHasSameValuesToken implements TokenInterface { private $value; private $string; private $util; /** * ArrayHasSameValuesToken constructor. * @param mixed $value * @param StringUtil|null $util * * @experimental * @internal */ public function __construct($value, StringUtil $util = null) { $this->value = $value; $this->util = $util ?: new StringUtil(); } /** * @param mixed $argument * @return bool|int * * @experimental * @internal */ public function scoreArgument($argument) { return $this->compare($this->value, $argument) ? 11 : false; } private function compare(array $value, array $argument) { array_multisort($value); array_multisort($argument); return $value == $argument; } /** * @return bool * * @experimental * @internal */ public function isLast() { return false; } /** * @return string * * @experimental * @internal */ public function __toString() { if ($this->string) { $string = $this->string .': (%s)'; } else { $string = 'same(%s)'; } return sprintf($string, $this->util->stringify($this->value)); } }