Server IP : 127.0.0.2 / Your IP : 3.147.80.203 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest/Core/ |
Upload File : |
<?php namespace Hamcrest\Core; /* Copyright (c) 2009 hamcrest.org */ use Hamcrest\BaseMatcher; use Hamcrest\Description; use Hamcrest\Matcher; /** * Provides a custom description to another matcher. */ class DescribedAs extends BaseMatcher { private $_descriptionTemplate; private $_matcher; private $_values; const ARG_PATTERN = '/%([0-9]+)/'; public function __construct($descriptionTemplate, Matcher $matcher, array $values) { $this->_descriptionTemplate = $descriptionTemplate; $this->_matcher = $matcher; $this->_values = $values; } public function matches($item) { return $this->_matcher->matches($item); } public function describeTo(Description $description) { $textStart = 0; while (preg_match(self::ARG_PATTERN, $this->_descriptionTemplate, $matches, PREG_OFFSET_CAPTURE, $textStart)) { $text = $matches[0][0]; $index = $matches[1][0]; $offset = $matches[0][1]; $description->appendText(substr($this->_descriptionTemplate, $textStart, $offset - $textStart)); $description->appendValue($this->_values[$index]); $textStart = $offset + strlen($text); } if ($textStart < strlen($this->_descriptionTemplate)) { $description->appendText(substr($this->_descriptionTemplate, $textStart)); } } /** * Wraps an existing matcher and overrides the description when it fails. * * @factory ... */ public static function describedAs(/* $description, Hamcrest\Matcher $matcher, $values... */) { $args = func_get_args(); $description = array_shift($args); $matcher = array_shift($args); $values = $args; return new self($description, $matcher, $values); } }