Overview

Namespaces

  • OpenCloud
    • Autoscale
      • Resource
    • CloudMonitoring
      • Exception
      • Resource
    • Common
      • Collection
      • Constants
      • Exceptions
      • Http
        • Message
      • Identity
      • Log
      • Service
    • Compute
      • Constants
      • Exception
      • Resource
    • Database
      • Resource
    • DNS
      • Resource
    • LoadBalancer
      • Resource
    • ObjectStore
      • Constants
      • Exception
      • Resource
      • Upload
    • Orchestration
    • Queues
      • Exception
      • Resource
    • Volume
      • Resource
  • PHP

Classes

  • AbstractTransfer
  • ConcurrentTransfer
  • ConsecutiveTransfer
  • TransferBuilder
  • TransferPart
  • TransferState
  • Overview
  • Namespace
  • Class
  • Tree
  • Download
 1: <?php
 2: /**
 3:  * PHP OpenCloud library.
 4:  * 
 5:  * @copyright 2013 Rackspace Hosting, Inc. See LICENSE for information.
 6:  * @license   https://www.apache.org/licenses/LICENSE-2.0
 7:  * @author    Glen Campbell <glen.campbell@rackspace.com>
 8:  * @author    Jamie Hannaford <jamie.hannaford@rackspace.com>
 9:  */
10: 
11: namespace OpenCloud\ObjectStore\Upload;
12: 
13: /**
14:  * Represents the current state of the Transfer.
15:  *
16:  * @codeCoverageIgnore
17:  */
18: class TransferState
19: {
20:     /**
21:      * @var array Holds all of the parts which have been transferred.
22:      */
23:     protected $completedParts = array();
24: 
25:     /**
26:      * @var bool
27:      */
28:     protected $running;
29: 
30:     /**
31:      * @return $this
32:      */
33:     public static function factory()
34:     {
35:         $self = new self();
36:         return $self->init();
37:     }
38: 
39:     /**
40:      * @param TransferPart $part
41:      */
42:     public function addPart(TransferPart $part)
43:     {
44:         $this->completedParts[] = $part;
45:     }
46: 
47:     /**
48:      * @return int
49:      */
50:     public function count()
51:     {
52:         return count($this->completedParts);
53:     }
54: 
55:     /**
56:      * @return bool
57:      */
58:     public function isRunning()
59:     {
60:         return $this->running;
61:     }
62: 
63:     /**
64:      * @return $this
65:      */
66:     public function init()
67:     {
68:         $this->running = true;
69:         
70:         return $this;
71:     }
72: 
73:     /**
74:      * @return $this
75:      */
76:     public function cancel()
77:     {
78:         $this->running = false;
79:         
80:         return $this;
81:     }
82:     
83: }
PHP OpenCloud API API documentation generated by ApiGen 2.8.0