Overview

Namespaces

  • Contrib
    • Bundle
      • CoverallsBundle
        • Console
        • Entity
      • CoverallsV1Bundle
        • Api
        • Collector
        • Command
        • Config
        • Entity
          • Git
    • Component
      • File
      • Log
      • System
        • Git
  • Guzzle
    • Batch
      • Exception
    • Cache
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
      • QueryAggregator
    • Inflection
    • Iterator
    • Log
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Async
      • Backoff
      • Cache
      • Cookie
        • CookieJar
        • Exception
      • CurlAuth
      • ErrorResponse
        • Exception
      • History
      • Log
      • Md5
      • Mock
      • Oauth
    • Service
      • Builder
      • Command
        • Factory
        • LocationVisitor
          • Request
          • Response
      • Description
      • Exception
      • Resource
    • Stream
  • PHP
  • Psr
    • Log
  • Symfony
    • Component
      • Config
        • Definition
          • Builder
          • Exception
        • Exception
        • Loader
        • Resource
        • Util
      • Console
        • Command
        • Formatter
        • Helper
        • Input
        • Output
        • Tester
      • EventDispatcher
        • Debug
      • Finder
        • Adapter
        • Comparator
        • Exception
        • Expression
        • Iterator
        • Shell
      • Stopwatch
      • Yaml
        • Exception

Exceptions

  • CommandException
  • CommandTransferException
  • DescriptionBuilderException
  • InconsistentClientTransferException
  • ResponseClassException
  • ServiceBuilderException
  • ServiceNotFoundException
  • ValidationException
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo
 1: <?php
 2: 
 3: namespace Guzzle\Service\Exception;
 4: 
 5: use Guzzle\Http\Exception\MultiTransferException;
 6: use Guzzle\Service\Command\CommandInterface;
 7: 
 8: /**
 9:  * Exception thrown when transferring commands in parallel
10:  */
11: class CommandTransferException extends MultiTransferException
12: {
13:     protected $successfulCommands = array();
14:     protected $failedCommands = array();
15: 
16:     /**
17:      * Creates a new CommandTransferException from a MultiTransferException
18:      *
19:      * @param MultiTransferException $e Exception to base a new exception on
20:      *
21:      * @return self
22:      */
23:     public static function fromMultiTransferException(MultiTransferException $e)
24:     {
25:         $ce = new self($e->getMessage(), $e->getCode(), $e->getPrevious());
26: 
27:         return $ce->setExceptions($e->getIterator()->getArrayCopy())
28:             ->setSuccessfulRequests($e->getSuccessfulRequests())
29:             ->setFailedRequests($e->getFailedRequests());
30:     }
31: 
32:     /**
33:      * Get all of the commands in the transfer
34:      *
35:      * @return array
36:      */
37:     public function getAllCommands()
38:     {
39:         return array_merge($this->successfulCommands, $this->failedCommands);
40:     }
41: 
42:     /**
43:      * Add to the array of successful commands
44:      *
45:      * @param CommandInterface $command Successful command
46:      *
47:      * @return self
48:      */
49:     public function addSuccessfulCommand(CommandInterface $command)
50:     {
51:         $this->successfulCommands[] = $command;
52: 
53:         return $this;
54:     }
55: 
56:     /**
57:      * Add to the array of failed commands
58:      *
59:      * @param CommandInterface $command Failed command
60:      *
61:      * @return self
62:      */
63:     public function addFailedCommand(CommandInterface $command)
64:     {
65:         $this->failedCommands[] = $command;
66: 
67:         return $this;
68:     }
69: 
70:     /**
71:      * Get an array of successful commands
72:      *
73:      * @return array
74:      */
75:     public function getSuccessfulCommands()
76:     {
77:         return $this->successfulCommands;
78:     }
79: 
80:     /**
81:      * Get an array of failed commands
82:      *
83:      * @return array
84:      */
85:     public function getFailedCommands()
86:     {
87:         return $this->failedCommands;
88:     }
89: }
90: 
php-coveralls API documentation generated by ApiGen 2.8.0