@@ -44,25 +44,125 @@ class S3
4444
4545 const STORAGE_CLASS_STANDARD = 'STANDARD ' ;
4646 const STORAGE_CLASS_RRS = 'REDUCED_REDUNDANCY ' ;
47-
48- private static $ __accessKey = null ; // AWS Access key
49- private static $ __secretKey = null ; // AWS Secret key
47+
48+ /**
49+ * The AWS Access key
50+ *
51+ * @var string
52+ * @access private
53+ * @static
54+ */
55+ private static $ __accessKey = null ;
56+
57+ /**
58+ * AWS Secret Key
59+ *
60+ * @var string
61+ * @access private
62+ * @static
63+ */
64+ private static $ __secretKey = null ;
65+
66+ /**
67+ * SSL Client key
68+ *
69+ * @var string
70+ * @access private
71+ * @static
72+ */
5073 private static $ __sslKey = null ;
51-
74+
75+ /**
76+ * AWS URI
77+ *
78+ * @var string
79+ * @acess public
80+ * @static
81+ */
5282 public static $ endpoint = 's3.amazonaws.com ' ;
83+
84+ /**
85+ * Proxy information
86+ *
87+ * @var null|array
88+ * @access public
89+ * @static
90+ */
5391 public static $ proxy = null ;
54-
92+
93+ /**
94+ * Connect using SSL?
95+ *
96+ * @var bool
97+ * @access public
98+ * @static
99+ */
55100 public static $ useSSL = false ;
101+
102+ /**
103+ * Use SSL validation?
104+ *
105+ * @var bool
106+ * @access public
107+ * @static
108+ */
56109 public static $ useSSLValidation = true ;
110+
111+ /**
112+ * Use PHP exceptions?
113+ *
114+ * @var bool
115+ * @access public
116+ * @static
117+ */
57118 public static $ useExceptions = false ;
58119
59120 // SSL CURL SSL options - only needed if you are experiencing problems with your OpenSSL configuration
121+
122+ /**
123+ * SSL client key
124+ *
125+ * @var bool
126+ * @access public
127+ * @static
128+ */
60129 public static $ sslKey = null ;
130+
131+ /**
132+ * SSL client certfificate
133+ *
134+ * @var string
135+ * @acess public
136+ * @static
137+ */
61138 public static $ sslCert = null ;
139+
140+ /**
141+ * SSL CA cert (only required if you are having problems with your system CA cert)
142+ *
143+ * @var string
144+ * @access public
145+ * @static
146+ */
62147 public static $ sslCACert = null ;
63-
64- private static $ __signingKeyPairId = null ; // AWS Key Pair ID
65- private static $ __signingKeyResource = false ; // Key resource, freeSigningKey() must be called to clear it from memory
148+
149+ /**
150+ * AWS Key Pair ID
151+ *
152+ * @var string
153+ * @access private
154+ * @static
155+ */
156+ private static $ __signingKeyPairId = null ;
157+
158+ /**
159+ * Key resource, freeSigningKey() must be called to clear it from memory
160+ *
161+ * @var bool
162+ * @access private
163+ * @static
164+ */
165+ private static $ __signingKeyResource = false ;
66166
67167
68168 /**
@@ -71,6 +171,7 @@ class S3
71171 * @param string $accessKey Access key
72172 * @param string $secretKey Secret key
73173 * @param boolean $useSSL Enable SSL
174+ * @param string $endpoint Amazon URI
74175 * @return void
75176 */
76177 public function __construct ($ accessKey = null , $ secretKey = null , $ useSSL = false , $ endpoint = 's3.amazonaws.com ' )
@@ -83,7 +184,7 @@ public function __construct($accessKey = null, $secretKey = null, $useSSL = fals
83184
84185
85186 /**
86- * Set the sertvice endpoint
187+ * Set the service endpoint
87188 *
88189 * @param string $host Hostname
89190 * @return void
@@ -262,7 +363,7 @@ public static function listBuckets($detailed = false)
262363 }
263364
264365
265- /*
366+ /**
266367 * Get contents for a bucket
267368 *
268369 * If maxKeys is null this method will loop through truncated result sets
@@ -634,8 +735,8 @@ public static function getObjectInfo($bucket, $uri, $returnInfo = true)
634735 /**
635736 * Copy an object
636737 *
637- * @param string $bucket Source bucket name
638- * @param string $uri Source object URI
738+ * @param string $srcBucket Source bucket name
739+ * @param string $srcUri Source object URI
639740 * @param string $bucket Destination bucket name
640741 * @param string $uri Destination object URI
641742 * @param constant $acl ACL constant
@@ -1039,7 +1140,7 @@ public static function getSignedPolicyURL($policy)
10391140 /**
10401141 * Get a CloudFront canned policy URL
10411142 *
1042- * @param string $string URL to sign
1143+ * @param string $url URL to sign
10431144 * @param integer $lifetime URL lifetime
10441145 * @return string
10451146 */
@@ -1430,6 +1531,7 @@ public static function invalidateDistribution($distributionId, $paths)
14301531 *
14311532 * @internal Used to create XML in invalidateDistribution()
14321533 * @param array $paths Paths to objects to invalidateDistribution
1534+ * @param int $callerReference
14331535 * @return string
14341536 */
14351537 private static function __getCloudFrontInvalidationBatchXML ($ paths , $ callerReference = '0 ' ) {
@@ -1718,13 +1820,103 @@ private static function __getHash($string)
17181820
17191821}
17201822
1823+ /**
1824+ * S3 Request class
1825+ *
1826+ * @link http://undesigned.org.za/2007/10/22/amazon-s3-php-class
1827+ * @version 0.5.0-dev
1828+ */
17211829final class S3Request
17221830{
1723- private $ endpoint , $ verb , $ bucket , $ uri , $ resource = '' , $ parameters = array (),
1724- $ amzHeaders = array (), $ headers = array (
1831+ /**
1832+ * AWS URI
1833+ *
1834+ * @var string
1835+ * @access pricate
1836+ */
1837+ private $ endpoint ;
1838+
1839+ /**
1840+ * Verb
1841+ *
1842+ * @var string
1843+ * @access private
1844+ */
1845+ private $ verb ;
1846+
1847+ /**
1848+ * S3 bucket name
1849+ *
1850+ * @var string
1851+ * @access private
1852+ */
1853+ private $ bucket ;
1854+
1855+ /**
1856+ * Object URI
1857+ *
1858+ * @var string
1859+ * @access private
1860+ */
1861+ private $ uri ;
1862+
1863+ /**
1864+ * Final object URI
1865+ *
1866+ * @var string
1867+ * @access private
1868+ */
1869+ private $ resource = '' ;
1870+
1871+ /**
1872+ * Additional request parameters
1873+ *
1874+ * @var array
1875+ * @access private
1876+ */
1877+ private $ parameters = array ();
1878+
1879+ /**
1880+ * Amazon specific request headers
1881+ *
1882+ * @var array
1883+ * @access private
1884+ */
1885+ private $ amzHeaders = array (), $ headers = array (
17251886 'Host ' => '' , 'Date ' => '' , 'Content-MD5 ' => '' , 'Content-Type ' => ''
17261887 );
1727- public $ fp = false , $ size = 0 , $ data = false , $ response ;
1888+
1889+ /**
1890+ * Use HTTP PUT?
1891+ *
1892+ * @var bool
1893+ * @access public
1894+ */
1895+ public $ fp = false ;
1896+
1897+ /**
1898+ * PUT file size
1899+ *
1900+ * @var int
1901+ * @access public
1902+ */
1903+ public $ size = 0 ;
1904+
1905+ /**
1906+ * PUT post fields
1907+ *
1908+ * @var array
1909+ * @access public
1910+ */
1911+ public $ data = false ;
1912+
1913+ /**
1914+ * S3 request respone
1915+ *
1916+ * @var object
1917+ * @access public
1918+ */
1919+ public $ response ;
17281920
17291921
17301922 /**
@@ -1733,10 +1925,12 @@ final class S3Request
17331925 * @param string $verb Verb
17341926 * @param string $bucket Bucket name
17351927 * @param string $uri Object URI
1928+ * @param string $endpoint AWS endpoint URI
17361929 * @return mixed
17371930 */
17381931 function __construct ($ verb , $ bucket = '' , $ uri = '' , $ endpoint = 's3.amazonaws.com ' )
17391932 {
1933+
17401934 $ this ->endpoint = $ endpoint ;
17411935 $ this ->verb = $ verb ;
17421936 $ this ->bucket = $ bucket ;
@@ -2065,7 +2259,22 @@ private function __responseHeaderCallback(&$curl, &$data)
20652259
20662260}
20672261
2262+ /**
2263+ * S3 exception class
2264+ *
2265+ * @link http://undesigned.org.za/2007/10/22/amazon-s3-php-class
2266+ * @version 0.5.0-dev
2267+ */
2268+
20682269class S3Exception extends Exception {
2270+ /**
2271+ * Class constructor
2272+ *
2273+ * @param string $message Exception message
2274+ * @param string $file File in which exception was created
2275+ * @param string $line Line number on which exception was created
2276+ * @param int $code Exception code
2277+ */
20692278 function __construct ($ message , $ file , $ line , $ code = 0 )
20702279 {
20712280 parent ::__construct ($ message , $ code );
0 commit comments