Server IP : 127.0.0.2 / Your IP : 3.148.197.73 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/ |
Upload File : |
<?php namespace Hamcrest; /* Copyright (c) 2009 hamcrest.org */ use Hamcrest\Internal\SelfDescribingValue; /** * A {@link Hamcrest\Description} that is stored as a string. */ abstract class BaseDescription implements Description { public function appendText($text) { $this->append($text); return $this; } public function appendDescriptionOf(SelfDescribing $value) { $value->describeTo($this); return $this; } public function appendValue($value) { if (is_null($value)) { $this->append('null'); } elseif (is_string($value)) { $this->_toPhpSyntax($value); } elseif (is_float($value)) { $this->append('<'); $this->append($value); $this->append('F>'); } elseif (is_bool($value)) { $this->append('<'); $this->append($value ? 'true' : 'false'); $this->append('>'); } elseif (is_array($value) || $value instanceof \Iterator || $value instanceof \IteratorAggregate) { $this->appendValueList('[', ', ', ']', $value); } elseif (is_object($value) && !method_exists($value, '__toString')) { $this->append('<'); $this->append(get_class($value)); $this->append('>'); } else { $this->append('<'); $this->append($value); $this->append('>'); } return $this; } public function appendValueList($start, $separator, $end, $values) { $list = array(); foreach ($values as $v) { $list[] = new SelfDescribingValue($v); } $this->appendList($start, $separator, $end, $list); return $this; } public function appendList($start, $separator, $end, $values) { $this->append($start); $separate = false; foreach ($values as $value) { /*if (!($value instanceof Hamcrest\SelfDescribing)) { $value = new Hamcrest\Internal\SelfDescribingValue($value); }*/ if ($separate) { $this->append($separator); } $this->appendDescriptionOf($value); $separate = true; } $this->append($end); return $this; } // -- Protected Methods /** * Append the String <var>$str</var> to the description. */ abstract protected function append($str); // -- Private Methods private function _toPhpSyntax($value) { $str = '"'; for ($i = 0, $len = strlen($value); $i < $len; ++$i) { switch ($value[$i]) { case '"': $str .= '\\"'; break; case "\t": $str .= '\\t'; break; case "\r": $str .= '\\r'; break; case "\n": $str .= '\\n'; break; default: $str .= $value[$i]; } } $str .= '"'; $this->append($str); } }