Server IP : 127.0.0.2 / Your IP : 18.117.111.63 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/guzzlehttp/guzzle/src/ |
Upload File : |
<?php namespace GuzzleHttp; /** * Represents the result of a batch operation. This result container is * iterable, countable, and you can can get a result by value using the * getResult function. * * Successful results are anything other than exceptions. Failure results are * exceptions. * * @package GuzzleHttp */ class BatchResults implements \Countable, \IteratorAggregate, \ArrayAccess { private $hash; /** * @param \SplObjectStorage $hash Hash of key objects to result values. */ public function __construct(\SplObjectStorage $hash) { $this->hash = $hash; } /** * Get the keys that are available on the batch result. * * @return array */ public function getKeys() { return iterator_to_array($this->hash); } /** * Gets a result from the container for the given object. When getting * results for a batch of requests, provide the request object. * * @param object $forObject Object to retrieve the result for. * * @return mixed|null */ public function getResult($forObject) { return isset($this->hash[$forObject]) ? $this->hash[$forObject] : null; } /** * Get an array of successful results. * * @return array */ public function getSuccessful() { $results = []; foreach ($this->hash as $key) { if (!($this->hash[$key] instanceof \Exception)) { $results[] = $this->hash[$key]; } } return $results; } /** * Get an array of failed results. * * @return array */ public function getFailures() { $results = []; foreach ($this->hash as $key) { if ($this->hash[$key] instanceof \Exception) { $results[] = $this->hash[$key]; } } return $results; } /** * Allows iteration over all batch result values. * * @return \ArrayIterator */ public function getIterator() { $results = []; foreach ($this->hash as $key) { $results[] = $this->hash[$key]; } return new \ArrayIterator($results); } /** * Counts the number of elements in the batch result. * * @return int */ public function count() { return count($this->hash); } /** * Checks if the batch contains a specific numerical array index. * * @param int $key Index to access * * @return bool */ public function offsetExists($key) { return $key < count($this->hash); } /** * Allows access of the batch using a numerical array index. * * @param int $key Index to access. * * @return mixed|null */ public function offsetGet($key) { $i = -1; foreach ($this->hash as $obj) { if ($key === ++$i) { return $this->hash[$obj]; } } return null; } public function offsetUnset($key) { throw new \RuntimeException('Not implemented'); } public function offsetSet($key, $value) { throw new \RuntimeException('Not implemented'); } }