ÿØÿà JFIF ÿþ; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 157.90.209.209 / Your IP : 216.73.216.148 [ Web Server : Apache System : Linux hcomm124.dns-wk.info 4.18.0-553.64.1.el8_10.x86_64 #1 SMP Mon Jul 28 12:01:56 EDT 2025 x86_64 User : evidenciarevista ( 1049) PHP Version : 7.2.34 Disable Function : exec,passthru,shell_exec,system Domains : 216 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/evidenciarevista/admin/vendor/phpspec/phpspec/src/PhpSpec/Matcher/ |
Upload File : |
<?php /* * This file is part of PhpSpec, A php toolset to drive emergent * design by specification. * * (c) Marcello Duarte <marcello.duarte@gmail.com> * (c) Konstantin Kudryashov <ever.zet@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PhpSpec\Matcher; use PhpSpec\Formatter\Presenter\PresenterInterface; use PhpSpec\Exception\Example\FailureException; use PhpSpec\Exception\Fracture\MethodNotFoundException; class ObjectStateMatcher implements MatcherInterface { /** * @var string */ private static $regex = '/(be|have)(.+)/'; /** * @var PresenterInterface */ private $presenter; /** * @param PresenterInterface $presenter */ public function __construct(PresenterInterface $presenter) { $this->presenter = $presenter; } /** * @param string $name * @param mixed $subject * @param array $arguments * * @return bool */ public function supports($name, $subject, array $arguments) { return is_object($subject) && !is_callable($subject) && (0 === strpos($name, 'be') || 0 === strpos($name, 'have')) ; } /** * @param string $name * @param mixed $subject * @param array $arguments * * @throws \PhpSpec\Exception\Example\FailureException * @throws \PhpSpec\Exception\Fracture\MethodNotFoundException */ public function positiveMatch($name, $subject, array $arguments) { preg_match(self::$regex, $name, $matches); $method = ('be' === $matches[1] ? 'is' : 'has').ucfirst($matches[2]); $callable = array($subject, $method); if (!method_exists($subject, $method)) { throw new MethodNotFoundException(sprintf( 'Method %s not found.', $this->presenter->presentValue($callable) ), $subject, $method, $arguments); } if (true !== $result = call_user_func_array($callable, $arguments)) { throw $this->getFailureExceptionFor($callable, true, $result); } } /** * @param string $name * @param mixed $subject * @param array $arguments * * @throws \PhpSpec\Exception\Example\FailureException * @throws \PhpSpec\Exception\Fracture\MethodNotFoundException */ public function negativeMatch($name, $subject, array $arguments) { preg_match(self::$regex, $name, $matches); $method = ('be' === $matches[1] ? 'is' : 'has').ucfirst($matches[2]); $callable = array($subject, $method); if (!method_exists($subject, $method)) { throw new MethodNotFoundException(sprintf( 'Method %s not found.', $this->presenter->presentValue($callable) ), $subject, $method, $arguments); } if (false !== $result = call_user_func_array($callable, $arguments)) { throw $this->getFailureExceptionFor($callable, false, $result); } } /** * @return int */ public function getPriority() { return 50; } /** * @param callable $callable * @param Boolean $expectedBool * @param Boolean $result * * @return FailureException */ private function getFailureExceptionFor($callable, $expectedBool, $result) { return new FailureException(sprintf( "Expected %s to return %s, but got %s.", $this->presenter->presentValue($callable), $this->presenter->presentValue($expectedBool), $this->presenter->presentValue($result) )); } }