| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529 | 
							- <?php
 
- namespace OSS;
 
- use OSS\Core\MimeTypes;
 
- use OSS\Core\OssException;
 
- use OSS\Http\RequestCore;
 
- use OSS\Http\RequestCore_Exception;
 
- use OSS\Http\ResponseCore;
 
- use OSS\Model\CorsConfig;
 
- use OSS\Model\CnameConfig;
 
- use OSS\Model\LoggingConfig;
 
- use OSS\Model\LiveChannelConfig;
 
- use OSS\Model\LiveChannelInfo;
 
- use OSS\Model\LiveChannelListInfo;
 
- use OSS\Model\StorageCapacityConfig;
 
- use OSS\Result\AclResult;
 
- use OSS\Result\BodyResult;
 
- use OSS\Result\GetCorsResult;
 
- use OSS\Result\GetLifecycleResult;
 
- use OSS\Result\GetLocationResult;
 
- use OSS\Result\GetLoggingResult;
 
- use OSS\Result\GetRefererResult;
 
- use OSS\Result\GetStorageCapacityResult;
 
- use OSS\Result\GetWebsiteResult;
 
- use OSS\Result\GetCnameResult;
 
- use OSS\Result\HeaderResult;
 
- use OSS\Result\InitiateMultipartUploadResult;
 
- use OSS\Result\ListBucketsResult;
 
- use OSS\Result\ListMultipartUploadResult;
 
- use OSS\Model\ListMultipartUploadInfo;
 
- use OSS\Result\ListObjectsResult;
 
- use OSS\Result\ListPartsResult;
 
- use OSS\Result\PutSetDeleteResult;
 
- use OSS\Result\DeleteObjectsResult;
 
- use OSS\Result\CopyObjectResult;
 
- use OSS\Result\CallbackResult;
 
- use OSS\Result\ExistResult;
 
- use OSS\Result\PutLiveChannelResult;
 
- use OSS\Result\GetLiveChannelHistoryResult;
 
- use OSS\Result\GetLiveChannelInfoResult;
 
- use OSS\Result\GetLiveChannelStatusResult;
 
- use OSS\Result\ListLiveChannelResult;
 
- use OSS\Result\AppendResult;
 
- use OSS\Model\ObjectListInfo;
 
- use OSS\Result\SymlinkResult;
 
- use OSS\Result\UploadPartResult;
 
- use OSS\Model\BucketListInfo;
 
- use OSS\Model\LifecycleConfig;
 
- use OSS\Model\RefererConfig;
 
- use OSS\Model\WebsiteConfig;
 
- use OSS\Core\OssUtil;
 
- use OSS\Model\ListPartsInfo;
 
- use OSS\Result\GetBucketInfoResult;
 
- use OSS\Model\BucketStat;
 
- use OSS\Result\GetBucketStatResult;
 
- use OSS\Model\ServerSideEncryptionConfig;
 
- use OSS\Result\GetBucketEncryptionResult;
 
- use OSS\Model\RequestPaymentConfig;
 
- use OSS\Result\GetBucketRequestPaymentResult;
 
- use OSS\Model\Tag;
 
- use OSS\Model\TaggingConfig;
 
- use OSS\Result\GetBucketTagsResult;
 
- use OSS\Model\VersioningConfig;
 
- use OSS\Result\GetBucketVersioningResult;
 
- use OSS\Model\InitiateWormConfig;
 
- use OSS\Result\InitiateBucketWormResult;
 
- use OSS\Model\ExtendWormConfig;
 
- use OSS\Result\GetBucketWormResult;
 
- use OSS\Model\RestoreConfig;
 
- use OSS\Model\ObjectVersionListInfo;
 
- use OSS\Result\ListObjectVersionsResult;
 
- use OSS\Model\DeleteObjectInfo;
 
- use OSS\Model\DeletedObjectInfo;
 
- use OSS\Result\DeleteObjectVersionsResult;
 
- /**
 
-  * Class OssClient
 
-  *
 
-  * Object Storage Service(OSS)'s client class, which wraps all OSS APIs user could call to talk to OSS.
 
-  * Users could do operations on bucket, object, including MultipartUpload or setting ACL via an OSSClient instance.
 
-  * For more details, please check out the OSS API document:https://www.alibabacloud.com/help/doc-detail/31947.htm
 
-  */
 
- class OssClient
 
- {
 
-     /**
 
-      * Constructor
 
-      *
 
-      * There're a few different ways to create an OssClient object:
 
-      * 1. Most common one from access Id, access Key and the endpoint: $ossClient = new OssClient($id, $key, $endpoint)
 
-      * 2. If the endpoint is the CName (such as www.testoss.com, make sure it's CName binded in the OSS console), 
 
-      *    uses $ossClient = new OssClient($id, $key, $endpoint, true)
 
-      * 3. If using Alicloud's security token service (STS), then the AccessKeyId, AccessKeySecret and STS token are all got from STS.
 
-      * Use this: $ossClient = new OssClient($id, $key, $endpoint, false, $token)
 
-      * 4. If the endpoint is in IP format, you could use this: $ossClient = new OssClient($id, $key, “1.2.3.4:8900”)
 
-      *
 
-      * @param string $accessKeyId The AccessKeyId from OSS or STS
 
-      * @param string $accessKeySecret The AccessKeySecret from OSS or STS
 
-      * @param string $endpoint The domain name of the datacenter,For example: oss-cn-hangzhou.aliyuncs.com
 
-      * @param boolean $isCName If this is the CName and binded in the bucket.
 
-      * @param string $securityToken from STS.
 
-      * @param string $requestProxy
 
-      * @throws OssException
 
-      */
 
-     public function __construct($accessKeyId, $accessKeySecret, $endpoint, $isCName = false, $securityToken = NULL, $requestProxy = NULL)
 
-     {
 
-         $accessKeyId = trim($accessKeyId);
 
-         $accessKeySecret = trim($accessKeySecret);
 
-         $endpoint = trim(trim($endpoint), "/");
 
-         if (empty($accessKeyId)) {
 
-             throw new OssException("access key id is empty");
 
-         }
 
-         if (empty($accessKeySecret)) {
 
-             throw new OssException("access key secret is empty");
 
-         }
 
-         if (empty($endpoint)) {
 
-             throw new OssException("endpoint is empty");
 
-         }
 
-         $this->hostname = $this->checkEndpoint($endpoint, $isCName);
 
-         $this->accessKeyId = $accessKeyId;
 
-         $this->accessKeySecret = $accessKeySecret;
 
-         $this->securityToken = $securityToken;
 
-         $this->requestProxy = $requestProxy;
 
-         self::checkEnv();
 
-     }
 
-     /**
 
-      * Lists the Bucket [GetService]. Not applicable if the endpoint is CName (because CName must be binded to a specific bucket).
 
-      *
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return BucketListInfo
 
-      */
 
-     public function listBuckets($options = NULL)
 
-     {
 
-         if ($this->hostType === self::OSS_HOST_TYPE_CNAME) {
 
-             throw new OssException("operation is not permitted with CName host");
 
-         }
 
-         $this->precheckOptions($options);
 
-         $options[self::OSS_BUCKET] = '';
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $response = $this->auth($options);
 
-         $result = new ListBucketsResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Creates bucket,The ACL of the bucket created by default is OssClient::OSS_ACL_TYPE_PRIVATE
 
-      *
 
-      * @param string $bucket
 
-      * @param string $acl
 
-      * @param array $options
 
-      * @param string $storageType
 
-      * @return null
 
-      */
 
-     public function createBucket($bucket, $acl = self::OSS_ACL_TYPE_PRIVATE, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_HEADERS] = array(self::OSS_ACL => $acl);
 
-         if (isset($options[self::OSS_STORAGE])) {
 
-             $this->precheckStorage($options[self::OSS_STORAGE]);
 
-             $options[self::OSS_CONTENT] = OssUtil::createBucketXmlBody($options[self::OSS_STORAGE]);
 
-             unset($options[self::OSS_STORAGE]);
 
-         }
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Deletes bucket
 
-      * The deletion will not succeed if the bucket is not empty (either has objects or parts)
 
-      * To delete a bucket, all its objects and parts must be deleted first.
 
-      *
 
-      * @param string $bucket
 
-      * @param array $options
 
-      * @return null
 
-      */
 
-     public function deleteBucket($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_DELETE;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Checks if a bucket exists
 
-      *
 
-      * @param string $bucket
 
-      * @return bool
 
-      * @throws OssException
 
-      */
 
-     public function doesBucketExist($bucket)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'acl';
 
-         $response = $this->auth($options);
 
-         $result = new ExistResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Get the data center location information for the bucket
 
-      *
 
-      * @param string $bucket
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return string
 
-      */
 
-     public function getBucketLocation($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'location';
 
-         $response = $this->auth($options);
 
-         $result = new GetLocationResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Get the Meta information for the Bucket
 
-      *
 
-      * @param string $bucket
 
-      * @param array $options  Refer to the SDK documentation
 
-      * @return array
 
-      */
 
-     public function getBucketMeta($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_HEAD;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $response = $this->auth($options);
 
-         $result = new HeaderResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Gets the bucket ACL
 
-      *
 
-      * @param string $bucket
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return string
 
-      */
 
-     public function getBucketAcl($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'acl';
 
-         $response = $this->auth($options);
 
-         $result = new AclResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Sets the bucket ACL
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $acl access permissions, valid values are ['private', 'public-read', 'public-read-write']
 
-      * @param array $options by default is empty
 
-      * @throws OssException
 
-      * @return null
 
-      */
 
-     public function putBucketAcl($bucket, $acl, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_HEADERS] = array(self::OSS_ACL => $acl);
 
-         $options[self::OSS_SUB_RESOURCE] = 'acl';
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Gets object ACL
 
-      *
 
-      * @param string $bucket
 
-      * @param string $object
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return string
 
-      */
 
-     public function getObjectAcl($bucket, $object, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options, true);
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         $options[self::OSS_SUB_RESOURCE] = 'acl';
 
-         $response = $this->auth($options);
 
-         $result = new AclResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Sets the object ACL
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $object object name
 
-      * @param string $acl access permissions, valid values are ['default', 'private', 'public-read', 'public-read-write']
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return null
 
-      */
 
-     public function putObjectAcl($bucket, $object, $acl, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options, true);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         $options[self::OSS_HEADERS] = array(self::OSS_OBJECT_ACL => $acl);
 
-         $options[self::OSS_SUB_RESOURCE] = 'acl';
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Gets the bucket logging config
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $options by default is empty
 
-      * @throws OssException
 
-      * @return LoggingConfig
 
-      */
 
-     public function getBucketLogging($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'logging';
 
-         $response = $this->auth($options);
 
-         $result = new GetLoggingResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Sets the bycket logging config. Only owner can call this API.
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $targetBucket The logging file's bucket
 
-      * @param string $targetPrefix The logging file's prefix
 
-      * @param array $options By default is empty.
 
-      * @throws OssException
 
-      * @return null
 
-      */
 
-     public function putBucketLogging($bucket, $targetBucket, $targetPrefix, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $this->precheckBucket($targetBucket, 'targetbucket is not allowed empty');
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'logging';
 
-         $options[self::OSS_CONTENT_TYPE] = 'application/xml';
 
-         $loggingConfig = new LoggingConfig($targetBucket, $targetPrefix);
 
-         $options[self::OSS_CONTENT] = $loggingConfig->serializeToXml();
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Deletes the bucket logging config
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return null
 
-      */
 
-     public function deleteBucketLogging($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_DELETE;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'logging';
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Sets the website config in bucket---that is could make the bucket as a static website once the CName is binded.
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param WebsiteConfig $websiteConfig
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return null
 
-      */
 
-     public function putBucketWebsite($bucket, $websiteConfig, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'website';
 
-         $options[self::OSS_CONTENT_TYPE] = 'application/xml';
 
-         $options[self::OSS_CONTENT] = $websiteConfig->serializeToXml();
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Gets the website config in the bucket
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return WebsiteConfig
 
-      */
 
-     public function getBucketWebsite($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'website';
 
-         $response = $this->auth($options);
 
-         $result = new GetWebsiteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Deletes the website config in the bucket
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return null
 
-      */
 
-     public function deleteBucketWebsite($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_DELETE;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'website';
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Sets the cross-origin-resource-sharing (CORS) rule. It would overwrite the originl one.
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param CorsConfig $corsConfig CORS config. Check out the details from OSS API document
 
-      * @param array $options array
 
-      * @throws OssException
 
-      * @return null
 
-      */
 
-     public function putBucketCors($bucket, $corsConfig, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'cors';
 
-         $options[self::OSS_CONTENT_TYPE] = 'application/xml';
 
-         $options[self::OSS_CONTENT] = $corsConfig->serializeToXml();
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Gets the bucket CORS config
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return CorsConfig
 
-      */
 
-     public function getBucketCors($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'cors';
 
-         $response = $this->auth($options);
 
-         $result = new GetCorsResult($response, __FUNCTION__);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Deletes the bucket's CORS config and disable the CORS on the bucket.
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return null
 
-      */
 
-     public function deleteBucketCors($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_DELETE;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'cors';
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Bind a CName for the bucket
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $cname
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return null
 
-      */
 
-     public function addBucketCname($bucket, $cname, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_POST;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'cname';
 
-         $options[self::OSS_CONTENT_TYPE] = 'application/xml';
 
-         $cnameConfig = new CnameConfig();
 
-         $cnameConfig->addCname($cname);
 
-         $options[self::OSS_CONTENT] = $cnameConfig->serializeToXml();
 
-         $options[self::OSS_COMP] = 'add';
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Gets the binded CName list of the bucket
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return CnameConfig
 
-      */
 
-     public function getBucketCname($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'cname';
 
-         $response = $this->auth($options);
 
-         $result = new GetCnameResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Remove a CName binding from the bucket
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param CnameConfig $cnameConfig
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return null
 
-      */
 
-     public function deleteBucketCname($bucket, $cname, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_POST;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'cname';
 
-         $options[self::OSS_CONTENT_TYPE] = 'application/xml';
 
-         $cnameConfig = new CnameConfig();
 
-         $cnameConfig->addCname($cname);
 
-         $options[self::OSS_CONTENT] = $cnameConfig->serializeToXml();
 
-         $options[self::OSS_COMP] = 'delete';
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Creates a Live Channel under a bucket
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string channelName  $channelName
 
-      * @param LiveChannelConfig $channelConfig
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return LiveChannelInfo
 
-      */
 
-     public function putBucketLiveChannel($bucket, $channelName, $channelConfig, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_OBJECT] = $channelName;
 
-         $options[self::OSS_SUB_RESOURCE] = 'live';
 
-         $options[self::OSS_CONTENT_TYPE] = 'application/xml';
 
-         $options[self::OSS_CONTENT] = $channelConfig->serializeToXml();
 
-         $response = $this->auth($options);
 
-         $result = new PutLiveChannelResult($response);
 
-         $info = $result->getData();
 
-         $info->setName($channelName);
 
-         $info->setDescription($channelConfig->getDescription());
 
-         
 
-         return $info;
 
-     }
 
-     /**
 
-      * Sets the LiveChannel status
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string channelName $channelName
 
-      * @param string channelStatus $channelStatus enabled or disabled
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return null 
 
-      */
 
-     public function putLiveChannelStatus($bucket, $channelName, $channelStatus, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_OBJECT] = $channelName;
 
-         $options[self::OSS_SUB_RESOURCE] = 'live';
 
-         $options[self::OSS_LIVE_CHANNEL_STATUS] = $channelStatus;
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Gets the LiveChannel information by the channel name
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string channelName $channelName
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return GetLiveChannelInfo
 
-      */
 
-     public function getLiveChannelInfo($bucket, $channelName, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = $channelName;
 
-         $options[self::OSS_SUB_RESOURCE] = 'live';
 
-         $response = $this->auth($options);
 
-         $result = new GetLiveChannelInfoResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Gets the status of LiveChannel
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string channelName $channelName
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return GetLiveChannelStatus
 
-      */
 
-     public function getLiveChannelStatus($bucket, $channelName, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = $channelName;
 
-         $options[self::OSS_SUB_RESOURCE] = 'live';
 
-         $options[self::OSS_COMP] = 'stat';
 
-       
 
-         $response = $this->auth($options);
 
-         $result = new GetLiveChannelStatusResult($response);
 
-         return $result->getData();
 
-     }
 
-      /**
 
-      * Gets the LiveChannel pushing streaming record
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string channelName $channelName
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return GetLiveChannelHistory
 
-      */
 
-     public function getLiveChannelHistory($bucket, $channelName, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = $channelName;
 
-         $options[self::OSS_SUB_RESOURCE] = 'live';
 
-         $options[self::OSS_COMP] = 'history';
 
-         $response = $this->auth($options);
 
-         $result = new GetLiveChannelHistoryResult($response);
 
-         return $result->getData();
 
-     }
 
-   
 
-     /**
 
-      *Gets the live channel list under a bucket.
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return LiveChannelListInfo
 
-      */
 
-     public function listBucketLiveChannels($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'live';
 
-         $options[self::OSS_QUERY_STRING] = array(
 
-             'prefix' => isset($options['prefix']) ? $options['prefix'] : '',
 
-             'marker' => isset($options['marker']) ? $options['marker'] : '',
 
-             'max-keys' => isset($options['max-keys']) ? $options['max-keys'] : '',
 
-         );
 
-         $response = $this->auth($options);
 
-         $result = new ListLiveChannelResult($response);
 
-         $list = $result->getData();
 
-         $list->setBucketName($bucket);
 
-         return $list;
 
-     }
 
-     /**
 
-      * Creates a play list file for the LiveChannel
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string channelName $channelName 
 
-      * @param string $playlistName The playlist name, must end with ".m3u8".
 
-      * @param array $setTime  startTime and EndTime in unix time. No more than 1 day.
 
-      * @throws OssException
 
-      * @return null
 
-      */
 
-     public function postVodPlaylist($bucket, $channelName, $playlistName, $setTime)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_POST;
 
-         $options[self::OSS_OBJECT] = $channelName . '/' . $playlistName;
 
-         $options[self::OSS_SUB_RESOURCE] = 'vod';
 
-         $options[self::OSS_LIVE_CHANNEL_END_TIME] = $setTime['EndTime'];
 
-         $options[self::OSS_LIVE_CHANNEL_START_TIME] = $setTime['StartTime'];
 
-        
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Deletes the Bucket LiveChannel
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string channelName $channelName
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return null
 
-      */
 
-     public function deleteBucketLiveChannel($bucket, $channelName, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_DELETE;
 
-         $options[self::OSS_OBJECT] = $channelName;
 
-         $options[self::OSS_SUB_RESOURCE] = 'live';
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Generates the signed pushing streaming url
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string channelName $channelName
 
-      * @param int timeout timeout value in seconds
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return The signed pushing streaming url
 
-      */
 
-     public function signRtmpUrl($bucket, $channelName, $timeout = 60, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $channelName, $options, false);
 
-         $expires = time() + $timeout;
 
-         $proto = 'rtmp://';
 
-         $hostname = $this->generateHostname($bucket);
 
-         $cano_params = '';
 
-         $query_items = array();
 
-         $params = isset($options['params']) ? $options['params'] : array();
 
-         uksort($params, 'strnatcasecmp');
 
-         foreach ($params as $key => $value) {
 
-             $cano_params = $cano_params . $key . ':' . $value . "\n";
 
-             $query_items[] = rawurlencode($key) . '=' . rawurlencode($value);
 
-         }
 
-         $resource = '/' . $bucket . '/' . $channelName;
 
-         $string_to_sign = $expires . "\n" . $cano_params . $resource;
 
-         $signature = base64_encode(hash_hmac('sha1', $string_to_sign, $this->accessKeySecret, true));
 
-         $query_items[] = 'OSSAccessKeyId=' . rawurlencode($this->accessKeyId);
 
-         $query_items[] = 'Expires=' . rawurlencode($expires);
 
-         $query_items[] = 'Signature=' . rawurlencode($signature);
 
-         return $proto . $hostname . '/live/' . $channelName . '?' . implode('&', $query_items);
 
-     }
 
-     /**
 
-      * Generates the signed pushing streaming url
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $channelName channel name
 
-      * @param int $expiration expiration time of the Url, unix epoch, since 1970.1.1 00.00.00 UTC
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return The signed pushing streaming url
 
-      */
 
-     public function generatePresignedRtmpUrl($bucket, $channelName, $expiration, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $channelName, $options, false);
 
-         $proto = 'rtmp://';
 
-         $hostname = $this->generateHostname($bucket);
 
-         $cano_params = '';
 
-         $query_items = array();
 
-         $params = isset($options['params']) ? $options['params'] : array();
 
-         uksort($params, 'strnatcasecmp');
 
-         foreach ($params as $key => $value) {
 
-             $cano_params = $cano_params . $key . ':' . $value . "\n";
 
-             $query_items[] = rawurlencode($key) . '=' . rawurlencode($value);
 
-         }
 
-         $resource = '/' . $bucket . '/' . $channelName;
 
-         $string_to_sign = $expiration . "\n" . $cano_params . $resource;
 
-         $signature = base64_encode(hash_hmac('sha1', $string_to_sign, $this->accessKeySecret, true));
 
-         $query_items[] = 'OSSAccessKeyId=' . rawurlencode($this->accessKeyId);
 
-         $query_items[] = 'Expires=' . rawurlencode($expiration);
 
-         $query_items[] = 'Signature=' . rawurlencode($signature);
 
-         return $proto . $hostname . '/live/' . $channelName . '?' . implode('&', $query_items);
 
-     }
 
-     /**
 
-      * Precheck the CORS request. Before sending a CORS request, a preflight request (OPTIONS) is sent with the specific origin.
 
-      * HTTP METHOD and headers information are sent to OSS as well for evaluating if the CORS request is allowed. 
 
-      * 
 
-      * Note: OSS could enable the CORS on the bucket by calling putBucketCors. Once CORS is enabled, the OSS could evaluate accordingto the preflight request.
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $object object name
 
-      * @param string $origin the origin of the request
 
-      * @param string $request_method The actual HTTP method which will be used in CORS request
 
-      * @param string $request_headers The actual HTTP headers which will be used in CORS request
 
-      * @param array $options
 
-      * @return array
 
-      * @throws OssException
 
-      * @link http://help.aliyun.com/document_detail/oss/api-reference/cors/OptionObject.html
 
-      */
 
-     public function optionsObject($bucket, $object, $origin, $request_method, $request_headers, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_OPTIONS;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         $options[self::OSS_HEADERS] = array(
 
-             self::OSS_OPTIONS_ORIGIN => $origin,
 
-             self::OSS_OPTIONS_REQUEST_HEADERS => $request_headers,
 
-             self::OSS_OPTIONS_REQUEST_METHOD => $request_method
 
-         );
 
-         $response = $this->auth($options);
 
-         $result = new HeaderResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Sets the bucket's lifecycle config
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param LifecycleConfig $lifecycleConfig LifecycleConfig instance
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return null
 
-      */
 
-     public function putBucketLifecycle($bucket, $lifecycleConfig, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'lifecycle';
 
-         $options[self::OSS_CONTENT_TYPE] = 'application/xml';
 
-         $options[self::OSS_CONTENT] = $lifecycleConfig->serializeToXml();
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Gets bucket's lifecycle config
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return LifecycleConfig
 
-      */
 
-     public function getBucketLifecycle($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'lifecycle';
 
-         $response = $this->auth($options);
 
-         $result = new GetLifecycleResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Deletes the bucket's lifecycle config
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return null
 
-      */
 
-     public function deleteBucketLifecycle($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_DELETE;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'lifecycle';
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Sets a bucket's referer, which has a whitelist of referrer and specifies if empty referer is allowed.
 
-      * Checks out API document for more details about "Bucket Referer" 
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param RefererConfig $refererConfig
 
-      * @param array $options
 
-      * @return ResponseCore
 
-      * @throws null
 
-      */
 
-     public function putBucketReferer($bucket, $refererConfig, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'referer';
 
-         $options[self::OSS_CONTENT_TYPE] = 'application/xml';
 
-         $options[self::OSS_CONTENT] = $refererConfig->serializeToXml();
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Gets the bucket's Referer
 
-      * Checks out API document for more details about "Bucket Referer" 
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return RefererConfig
 
-      */
 
-     public function getBucketReferer($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'referer';
 
-         $response = $this->auth($options);
 
-         $result = new GetRefererResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Set the size of the bucket,the unit is GB
 
-      * When the capacity of the bucket is bigger than the set, it's forbidden to continue writing
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param int $storageCapacity
 
-      * @param array $options
 
-      * @return ResponseCore
 
-      * @throws null
 
-      */
 
-     public function putBucketStorageCapacity($bucket, $storageCapacity, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'qos';
 
-         $options[self::OSS_CONTENT_TYPE] = 'application/xml';
 
-         $storageCapacityConfig = new StorageCapacityConfig($storageCapacity);
 
-         $options[self::OSS_CONTENT] = $storageCapacityConfig->serializeToXml();
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Get the capacity of the bucket, the unit is GB
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return int
 
-      */
 
-     public function getBucketStorageCapacity($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'qos';
 
-         $response = $this->auth($options);
 
-         $result = new GetStorageCapacityResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Get the information of the bucket
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return BucketInfo
 
-      */
 
-     public function getBucketInfo($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'bucketInfo';
 
-         $response = $this->auth($options);
 
-         $result = new GetBucketInfoResult($response);
 
-         return $result->getData();
 
-     }
 
-      /**
 
-      * Get the stat of the bucket
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return BucketStat
 
-      */
 
-     public function getBucketStat($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'stat';
 
-         $response = $this->auth($options);
 
-         $result = new GetBucketStatResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Sets the bucket's policy
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $policy policy json format content
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return null
 
-      */
 
-     public function putBucketPolicy($bucket, $policy, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'policy';
 
-         $options[self::OSS_CONTENT_TYPE] = 'application/json';
 
-         $options[self::OSS_CONTENT] = $policy;
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Gets bucket's policy
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return string policy json content
 
-      */
 
-     public function getBucketPolicy($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'policy';
 
-         $response = $this->auth($options);
 
-         $result = new BodyResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Deletes the bucket's policy
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return null
 
-      */
 
-     public function deleteBucketPolicy($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_DELETE;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'policy';
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Sets the bucket's encryption
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param ServerSideEncryptionConfig $sseConfig
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return null
 
-      */
 
-     public function putBucketEncryption($bucket, $sseConfig, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'encryption';
 
-         $options[self::OSS_CONTENT_TYPE] = 'application/xml';
 
-         $options[self::OSS_CONTENT] = $sseConfig->serializeToXml();
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Gets bucket's encryption
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return ServerSideEncryptionConfig
 
-      */
 
-     public function getBucketEncryption($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'encryption';
 
-         $response = $this->auth($options);
 
-         $result = new GetBucketEncryptionResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Deletes the bucket's encryption
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return null
 
-      */
 
-     public function deleteBucketEncryption($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_DELETE;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'encryption';
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Set the request playment of the bucket, Can be BucketOwner and Requester
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $payer
 
-      * @param array $options
 
-      * @return ResponseCore
 
-      * @throws null
 
-      */
 
-     public function putBucketRequestPayment($bucket, $payer, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'requestPayment';
 
-         $options[self::OSS_CONTENT_TYPE] = 'application/xml';
 
-         $config = new RequestPaymentConfig($payer);
 
-         $options[self::OSS_CONTENT] = $config->serializeToXml();
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Get the request playment of the bucket
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return string
 
-      */
 
-     public function getBucketRequestPayment($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'requestPayment';
 
-         $response = $this->auth($options);
 
-         $result = new GetBucketRequestPaymentResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Sets the bucket's tags
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param TaggingConfig $taggingConfig
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return null
 
-      */
 
-     public function putBucketTags($bucket, $taggingConfig, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = self::OSS_TAGGING;
 
-         $options[self::OSS_CONTENT_TYPE] = 'application/xml';
 
-         $options[self::OSS_CONTENT] = $taggingConfig->serializeToXml();
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Gets bucket's tags
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return TaggingConfig
 
-      */
 
-     public function getBucketTags($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = self::OSS_TAGGING;
 
-         $response = $this->auth($options);
 
-         $result = new GetBucketTagsResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Deletes the bucket's tags
 
-      * If want to delete specified tags for a bucket, please set the $tags
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param tag[] $tags (optional)
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return null
 
-      */
 
-     public function deleteBucketTags($bucket, $tags = NULL, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_DELETE;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         if (empty($tags)) {
 
-             $options[self::OSS_SUB_RESOURCE] = self::OSS_TAGGING;
 
-         } else {
 
-             $value = '';
 
-             foreach ($tags as $tag ) {
 
-                 $value .= $tag->getKey().',';
 
-             }
 
-             $value = rtrim($value, ',');
 
-             $options[self::OSS_TAGGING] = $value;
 
-         }
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Set the versioning of the bucket, Can be BucketOwner and Requester
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $status
 
-      * @param array $options
 
-      * @return ResponseCore
 
-      * @throws null
 
-      */
 
-     public function putBucketVersioning($bucket, $status, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'versioning';
 
-         $options[self::OSS_CONTENT_TYPE] = 'application/xml';
 
-         $config = new VersioningConfig($status);
 
-         $options[self::OSS_CONTENT] = $config->serializeToXml();
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Get the versioning of the bucket
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return string
 
-      */
 
-     public function getBucketVersioning($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'versioning';
 
-         $response = $this->auth($options);
 
-         $result = new GetBucketVersioningResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Initialize a bucket's worm
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param int $day
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return string returns uploadid
 
-      */
 
-     public function initiateBucketWorm($bucket, $day, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_POST;
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'worm';
 
-         $options[self::OSS_CONTENT_TYPE] = 'application/xml';
 
-         $config = new InitiateWormConfig($day);
 
-         $options[self::OSS_CONTENT] = $config->serializeToXml();
 
-         $response = $this->auth($options);
 
-         $result = new InitiateBucketWormResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Aborts the bucket's worm
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return null
 
-      */
 
-     public function abortBucketWorm($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_DELETE;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'worm';
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-      /**
 
-      * Complete a bucket's worm
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $wormId
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return string returns uploadid
 
-      */
 
-     public function completeBucketWorm($bucket, $wormId, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_POST;
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_WORM_ID] = $wormId;
 
-         $options[self::OSS_CONTENT] = '';
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Extend a bucket's worm
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $wormId
 
-      * @param int $day
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return string returns uploadid
 
-      */
 
-     public function extendBucketWorm($bucket, $wormId, $day, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_POST;
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_WORM_ID] = $wormId;
 
-         $options[self::OSS_SUB_RESOURCE] = 'wormExtend';
 
-         $options[self::OSS_CONTENT_TYPE] = 'application/xml';
 
-         $config = new ExtendWormConfig($day);
 
-         $options[self::OSS_CONTENT] = $config->serializeToXml();
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Get a bucket's worm
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $options
 
-      * @throws OssException
 
-      * @return string
 
-      */
 
-     public function getBucketWorm($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'worm';
 
-         $response = $this->auth($options);
 
-         $result = new GetBucketWormResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Lists the bucket's object list (in ObjectListInfo)
 
-      *
 
-      * @param string $bucket
 
-      * @param array $options are defined below:
 
-      * $options = array(
 
-      *      'max-keys'  => specifies max object count to return. By default is 100 and max value could be 1000.
 
-      *      'prefix'    => specifies the key prefix the returned objects must have. Note that the returned keys still contain the prefix.
 
-      *      'delimiter' => The delimiter of object name for grouping object. When it's specified, listObjects will differeniate the object and folder. And it will return subfolder's objects.
 
-      *      'marker'    => The key of returned object must be greater than the 'marker'.
 
-      *)
 
-      * Prefix and marker are for filtering and paging. Their length must be less than 256 bytes
 
-      * @throws OssException
 
-      * @return ObjectListInfo
 
-      */
 
-     public function listObjects($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $query = isset($options[self::OSS_QUERY_STRING]) ? $options[self::OSS_QUERY_STRING] : array();
 
-         $options[self::OSS_QUERY_STRING] = array_merge(
 
-             $query,
 
-             array(self::OSS_ENCODING_TYPE => self::OSS_ENCODING_TYPE_URL,
 
-                   self::OSS_DELIMITER => isset($options[self::OSS_DELIMITER]) ? $options[self::OSS_DELIMITER] : '/',
 
-                   self::OSS_PREFIX => isset($options[self::OSS_PREFIX]) ? $options[self::OSS_PREFIX] : '',
 
-                   self::OSS_MAX_KEYS => isset($options[self::OSS_MAX_KEYS]) ? $options[self::OSS_MAX_KEYS] : self::OSS_MAX_KEYS_VALUE,
 
-                   self::OSS_MARKER => isset($options[self::OSS_MARKER]) ? $options[self::OSS_MARKER] : '')
 
-         );
 
-         $response = $this->auth($options);
 
-         $result = new ListObjectsResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Lists the bucket's object with version information (in ObjectListInfo)
 
-      *
 
-      * @param string $bucket
 
-      * @param array $options are defined below:
 
-      * $options = array(
 
-      *      'max-keys'   => specifies max object count to return. By default is 100 and max value could be 1000.
 
-      *      'prefix'     => specifies the key prefix the returned objects must have. Note that the returned keys still contain the prefix.
 
-      *      'delimiter'  => The delimiter of object name for grouping object. When it's specified, listObjectVersions will differeniate the object and folder. And it will return subfolder's objects.
 
-      *      'key-marker' => The key of returned object must be greater than the 'key-marker'.
 
-      *      'version-id-marker' => The version id of returned object must be greater than the 'version-id-marker'.
 
-      *)
 
-      * Prefix and marker are for filtering and paging. Their length must be less than 256 bytes
 
-      * @throws OssException
 
-      * @return ObjectListInfo
 
-      */
 
-     public function listObjectVersions($bucket, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'versions';
 
-         $query = isset($options[self::OSS_QUERY_STRING]) ? $options[self::OSS_QUERY_STRING] : array();
 
-         $options[self::OSS_QUERY_STRING] = array_merge(
 
-             $query,
 
-             array(self::OSS_ENCODING_TYPE => self::OSS_ENCODING_TYPE_URL,
 
-                   self::OSS_DELIMITER => isset($options[self::OSS_DELIMITER]) ? $options[self::OSS_DELIMITER] : '/',
 
-                   self::OSS_PREFIX => isset($options[self::OSS_PREFIX]) ? $options[self::OSS_PREFIX] : '',
 
-                   self::OSS_MAX_KEYS => isset($options[self::OSS_MAX_KEYS]) ? $options[self::OSS_MAX_KEYS] : self::OSS_MAX_KEYS_VALUE,
 
-                   self::OSS_KEY_MARKER => isset($options[self::OSS_KEY_MARKER]) ? $options[self::OSS_KEY_MARKER] : '',
 
-                   self::OSS_VERSION_ID_MARKER => isset($options[self::OSS_VERSION_ID_MARKER]) ? $options[self::OSS_VERSION_ID_MARKER] : '')
 
-         );
 
-         $response = $this->auth($options);
 
-         $result = new ListObjectVersionsResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Creates a virtual 'folder' in OSS. The name should not end with '/' because the method will append the name with a '/' anyway.
 
-      *
 
-      * Internal use only.
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $object object name
 
-      * @param array $options
 
-      * @return null
 
-      */
 
-     public function createObjectDir($bucket, $object, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_OBJECT] = $object . '/';
 
-         $options[self::OSS_CONTENT_LENGTH] = array(self::OSS_CONTENT_LENGTH => 0);
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Uploads the $content object to OSS.
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $object objcet name
 
-      * @param string $content The content object
 
-      * @param array $options
 
-      * @return null
 
-      */
 
-     public function putObject($bucket, $object, $content, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options);
 
-         $options[self::OSS_CONTENT] = $content;
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         if (!isset($options[self::OSS_LENGTH])) {
 
-             $options[self::OSS_CONTENT_LENGTH] = strlen($options[self::OSS_CONTENT]);
 
-         } else {
 
-             $options[self::OSS_CONTENT_LENGTH] = $options[self::OSS_LENGTH];
 
-         }
 
-         $is_check_md5 = $this->isCheckMD5($options);
 
-         if ($is_check_md5) {
 
-         	$content_md5 = base64_encode(md5($content, true));
 
-         	$options[self::OSS_CONTENT_MD5] = $content_md5;
 
-         }
 
-         
 
-         if (!isset($options[self::OSS_CONTENT_TYPE])) {
 
-             $options[self::OSS_CONTENT_TYPE] = $this->getMimeType($object);
 
-         }
 
-         $response = $this->auth($options);
 
-         
 
-         if (isset($options[self::OSS_CALLBACK]) && !empty($options[self::OSS_CALLBACK])) {
 
-             $result = new CallbackResult($response);
 
-         } else {
 
-             $result = new PutSetDeleteResult($response);
 
-         }
 
-             
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * creates symlink
 
-      * @param string $bucket bucket name
 
-      * @param string $symlink symlink name
 
-      * @param string $targetObject targetObject name
 
-      * @param array $options
 
-      * @return null
 
-      */
 
-     public function putSymlink($bucket, $symlink ,$targetObject, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $symlink, $options);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_OBJECT] = $symlink;
 
-         $options[self::OSS_SUB_RESOURCE] = self::OSS_SYMLINK;
 
-         $options[self::OSS_HEADERS][self::OSS_SYMLINK_TARGET] = rawurlencode($targetObject);
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * gets symlink
 
-      * @param string $bucket bucket name
 
-      * @param string $symlink symlink name
 
-      * @param array $options
 
-      * @return null
 
-      */
 
-     public function getSymlink($bucket, $symlink, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $symlink, $options);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = $symlink;
 
-         $options[self::OSS_SUB_RESOURCE] = self::OSS_SYMLINK;
 
-         $response = $this->auth($options);
 
-         $result = new SymlinkResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Uploads a local file
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $object object name
 
-      * @param string $file local file path
 
-      * @param array $options
 
-      * @return null
 
-      * @throws OssException
 
-      */
 
-     public function uploadFile($bucket, $object, $file, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options);
 
-         OssUtil::throwOssExceptionWithMessageIfEmpty($file, "file path is invalid");
 
-         $file = OssUtil::encodePath($file);
 
-         if (!file_exists($file)) {
 
-             throw new OssException($file . " file does not exist");
 
-         }
 
-         $options[self::OSS_FILE_UPLOAD] = $file;
 
-         $file_size = filesize($options[self::OSS_FILE_UPLOAD]);
 
-         $is_check_md5 = $this->isCheckMD5($options);
 
-         if ($is_check_md5) {
 
-             $content_md5 = base64_encode(md5_file($options[self::OSS_FILE_UPLOAD], true));
 
-             $options[self::OSS_CONTENT_MD5] = $content_md5;
 
-         }
 
-         if (!isset($options[self::OSS_CONTENT_TYPE])) {
 
-             $options[self::OSS_CONTENT_TYPE] = $this->getMimeType($object, $file);
 
-         }
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         $options[self::OSS_CONTENT_LENGTH] = $file_size;
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Uploads object from file handle
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $object object name
 
-      * @param resource $handle file handle
 
-      * @param array $options
 
-      * @return null
 
-      * @throws OssException
 
-      */
 
-     public function uploadStream($bucket, $object, $handle, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options);
 
-         if (!is_resource($handle)) {
 
-             throw new OssException("The handle must be an opened stream");
 
-         }
 
-         $options[self::OSS_FILE_UPLOAD] = $handle;
 
-         if ($this->isCheckMD5($options)) {
 
-             rewind($handle);
 
-             $ctx = hash_init('md5');
 
-             hash_update_stream($ctx, $handle);
 
-             $content_md5 = base64_encode(hash_final($ctx, true));
 
-             rewind($handle);
 
-             $options[self::OSS_CONTENT_MD5] = $content_md5;
 
-         }
 
-         if (!isset($options[self::OSS_CONTENT_TYPE])) {
 
-             $options[self::OSS_CONTENT_TYPE] = $this->getMimeType($object);
 
-         }
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         if (!isset($options[self::OSS_CONTENT_LENGTH])) {
 
-             $options[self::OSS_CONTENT_LENGTH] = fstat($handle)[self::OSS_SIZE];
 
-         }
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Append the object with the content at the specified position.
 
-      * The specified position is typically the lengh of the current file.
 
-      * @param string $bucket bucket name
 
-      * @param string $object objcet name
 
-      * @param string $content content to append
 
-      * @param array $options
 
-      * @return int next append position
 
-      * @throws OssException
 
-      */
 
-     public function appendObject($bucket, $object, $content, $position, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options);
 
-         $options[self::OSS_CONTENT] = $content;
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_POST;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         $options[self::OSS_SUB_RESOURCE] = 'append';
 
-         $options[self::OSS_POSITION] = strval($position);
 
-         if (!isset($options[self::OSS_LENGTH])) {
 
-             $options[self::OSS_CONTENT_LENGTH] = strlen($options[self::OSS_CONTENT]);
 
-         } else {
 
-             $options[self::OSS_CONTENT_LENGTH] = $options[self::OSS_LENGTH];
 
-         }
 
-         
 
-         $is_check_md5 = $this->isCheckMD5($options);
 
-         if ($is_check_md5) {
 
-         	$content_md5 = base64_encode(md5($content, true));
 
-         	$options[self::OSS_CONTENT_MD5] = $content_md5;
 
-         }
 
-         if (!isset($options[self::OSS_CONTENT_TYPE])) {
 
-             $options[self::OSS_CONTENT_TYPE] = $this->getMimeType($object);
 
-         }
 
-         $response = $this->auth($options);
 
-         $result = new AppendResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Append the object with a local file
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $object object name
 
-      * @param string $file The local file path to append with
 
-      * @param array $options
 
-      * @return int next append position
 
-      * @throws OssException
 
-      */
 
-     public function appendFile($bucket, $object, $file, $position, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options);
 
-         OssUtil::throwOssExceptionWithMessageIfEmpty($file, "file path is invalid");
 
-         $file = OssUtil::encodePath($file);
 
-         if (!file_exists($file)) {
 
-             throw new OssException($file . " file does not exist");
 
-         }
 
-         $options[self::OSS_FILE_UPLOAD] = $file;
 
-         $file_size = filesize($options[self::OSS_FILE_UPLOAD]);
 
-         $is_check_md5 = $this->isCheckMD5($options);
 
-         if ($is_check_md5) {
 
-             $content_md5 = base64_encode(md5_file($options[self::OSS_FILE_UPLOAD], true));
 
-             $options[self::OSS_CONTENT_MD5] = $content_md5;
 
-         }
 
-         if (!isset($options[self::OSS_CONTENT_TYPE])) {
 
-             $options[self::OSS_CONTENT_TYPE] = $this->getMimeType($object, $file);
 
-         }
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_POST;
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         $options[self::OSS_CONTENT_LENGTH] = $file_size;
 
-         $options[self::OSS_SUB_RESOURCE] = 'append';
 
-         $options[self::OSS_POSITION] = strval($position);
 
-         $response = $this->auth($options);
 
-         $result = new AppendResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Copy from an existing OSS object to another OSS object. If the target object exists already, it will be overwritten.
 
-      *
 
-      * @param string $fromBucket Source bucket name
 
-      * @param string $fromObject Source object name
 
-      * @param string $toBucket Target bucket name
 
-      * @param string $toObject Target object name
 
-      * @param array $options
 
-      * @return null
 
-      * @throws OssException
 
-      */
 
-     public function copyObject($fromBucket, $fromObject, $toBucket, $toObject, $options = NULL)
 
-     {
 
-         $this->precheckCommon($fromBucket, $fromObject, $options);
 
-         $this->precheckCommon($toBucket, $toObject, $options);
 
-         $options[self::OSS_BUCKET] = $toBucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_OBJECT] = $toObject;
 
-         $param = '/' . $fromBucket . '/' . rawurlencode($fromObject);
 
-         if (isset($options[self::OSS_VERSION_ID])) {
 
-             $param = $param . '?versionId='.$options[self::OSS_VERSION_ID];
 
-             unset($options[self::OSS_VERSION_ID]);
 
-         }
 
-         if (isset($options[self::OSS_HEADERS])) {
 
-             $options[self::OSS_HEADERS][self::OSS_OBJECT_COPY_SOURCE] = $param;
 
-         } else {
 
-             $options[self::OSS_HEADERS] = array(self::OSS_OBJECT_COPY_SOURCE => $param);
 
-         }
 
-         $response = $this->auth($options);
 
-         $result = new CopyObjectResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Gets Object metadata
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $object object name
 
-      * @param string $options Checks out the SDK document for the detail
 
-      * @return array
 
-      */
 
-     public function getObjectMeta($bucket, $object, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_HEAD;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         $response = $this->auth($options);
 
-         $result = new HeaderResult($response);
 
-         return $result->getData();
 
-     }
 
-      /**
 
-      * Gets the simplified metadata of a object. 
 
-      * Simplified metadata includes ETag, Size, LastModified.
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $object object name
 
-      * @param string $options Checks out the SDK document for the detail
 
-      * @return array
 
-      */
 
-     public function getSimplifiedObjectMeta($bucket, $object, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_HEAD;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         $options[self::OSS_SUB_RESOURCE] = 'objectMeta';
 
-         $response = $this->auth($options);
 
-         $result = new HeaderResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Deletes a object
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $object object name
 
-      * @param array $options
 
-      * @return null
 
-      */
 
-     public function deleteObject($bucket, $object, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_DELETE;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Deletes multiple objects in a bucket
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $objects object list
 
-      * @param array $options
 
-      * @return ResponseCore
 
-      * @throws null
 
-      */
 
-     public function deleteObjects($bucket, $objects, $options = null)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         if (!is_array($objects) || !$objects) {
 
-             throw new OssException('objects must be array');
 
-         }
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_POST;
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'delete';
 
-         $options[self::OSS_CONTENT_TYPE] = 'application/xml';
 
-         $quiet = 'false';
 
-         if (isset($options['quiet'])) {
 
-             if (is_bool($options['quiet'])) { //Boolean
 
-                 $quiet = $options['quiet'] ? 'true' : 'false';
 
-             } elseif (is_string($options['quiet'])) { // string
 
-                 $quiet = ($options['quiet'] === 'true') ? 'true' : 'false';
 
-             }
 
-         }
 
-         $xmlBody = OssUtil::createDeleteObjectsXmlBody($objects, $quiet);
 
-         $options[self::OSS_CONTENT] = $xmlBody;
 
-         $response = $this->auth($options);
 
-         $result = new DeleteObjectsResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Deletes multiple objects with version id in a bucket
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param array $objects DeleteObjectInfo list
 
-      * @param array $options
 
-      * @return ResponseCore
 
-      * @throws null
 
-      */
 
-     public function deleteObjectVersions($bucket, $objects, $options = null)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         if (!is_array($objects) || !$objects) {
 
-             throw new OssException('objects must be array');
 
-         }
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_POST;
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'delete';
 
-         $options[self::OSS_CONTENT_TYPE] = 'application/xml';
 
-         $quiet = 'false';
 
-         if (isset($options['quiet'])) {
 
-             if (is_bool($options['quiet'])) { //Boolean
 
-                 $quiet = $options['quiet'] ? 'true' : 'false';
 
-             } elseif (is_string($options['quiet'])) { // string
 
-                 $quiet = ($options['quiet'] === 'true') ? 'true' : 'false';
 
-             }
 
-         }
 
-         $xmlBody = OssUtil::createDeleteObjectVersionsXmlBody($objects, $quiet);
 
-         $options[self::OSS_CONTENT] = $xmlBody;
 
-         $response = $this->auth($options);
 
-         $result = new DeleteObjectVersionsResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Gets Object content
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $object object name
 
-      * @param array $options It must contain ALIOSS::OSS_FILE_DOWNLOAD. And ALIOSS::OSS_RANGE is optional and empty means to download the whole file.
 
-      * @return string
 
-      */
 
-     public function getObject($bucket, $object, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         if (isset($options[self::OSS_LAST_MODIFIED])) {
 
-             $options[self::OSS_HEADERS][self::OSS_IF_MODIFIED_SINCE] = $options[self::OSS_LAST_MODIFIED];
 
-             unset($options[self::OSS_LAST_MODIFIED]);
 
-         }
 
-         if (isset($options[self::OSS_ETAG])) {
 
-             $options[self::OSS_HEADERS][self::OSS_IF_NONE_MATCH] = $options[self::OSS_ETAG];
 
-             unset($options[self::OSS_ETAG]);
 
-         }
 
-         if (isset($options[self::OSS_RANGE])) {
 
-             $range = $options[self::OSS_RANGE];
 
-             $options[self::OSS_HEADERS][self::OSS_RANGE] = "bytes=$range";
 
-             unset($options[self::OSS_RANGE]);
 
-         }
 
-         $response = $this->auth($options);
 
-         $result = new BodyResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Checks if the object exists
 
-      * It's implemented by getObjectMeta().
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $object object name
 
-      * @param array $options
 
-      * @return bool True:object exists; False:object does not exist
 
-      */
 
-     public function doesObjectExist($bucket, $object, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_HEAD;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         $response = $this->auth($options);
 
-         $result = new ExistResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Object reading for Archive type
 
-      * Use Restore to enable the server to perform the thawing task
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $object object name
 
-      * @return null
 
-      * @throws OssException
 
-      */
 
-     public function restoreObject($bucket, $object, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_POST;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         $options[self::OSS_SUB_RESOURCE] = self::OSS_RESTORE;
 
-         if (isset($options[self::OSS_RESTORE_CONFIG])) {
 
-             $config = $options[self::OSS_RESTORE_CONFIG];
 
-             $options[self::OSS_CONTENT_TYPE] = 'application/xml';
 
-             $options[self::OSS_CONTENT] = $config->serializeToXml();
 
-         }
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Sets the object tagging
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $object object name
 
-      * @param TaggingConfig $taggingConfig
 
-      * @throws OssException
 
-      * @return null
 
-      */
 
-     public function putObjectTagging($bucket, $object, $taggingConfig, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options, true);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         $options[self::OSS_SUB_RESOURCE] = self::OSS_TAGGING;
 
-         $options[self::OSS_CONTENT_TYPE] = 'application/xml';
 
-         $options[self::OSS_CONTENT] = $taggingConfig->serializeToXml();
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Gets the object tagging
 
-      *
 
-      * @param string $bucket
 
-      * @param string $object
 
-      * @throws OssException
 
-      * @return TaggingConfig
 
-      */
 
-     public function getObjectTagging($bucket, $object, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options, true);
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         $options[self::OSS_SUB_RESOURCE] = self::OSS_TAGGING;
 
-         $response = $this->auth($options);
 
-         $result = new GetBucketTagsResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Deletes the object tagging
 
-      *
 
-      * @param string $bucket
 
-      * @param string $object
 
-      * @throws OssException
 
-      * @return TaggingConfig
 
-      */
 
-     public function deleteObjectTagging($bucket, $object, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options, true);
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_DELETE;
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         $options[self::OSS_SUB_RESOURCE] = self::OSS_TAGGING;
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Processes the object
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $object object name
 
-      * @param string $process process script
 
-      * @return string process result, json format
 
-      */
 
-     public function processObject($bucket, $object, $process, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options);
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_POST;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         $options[self::OSS_SUB_RESOURCE] = 'x-oss-process';
 
-         $options[self::OSS_CONTENT_TYPE] = 'application/octet-stream';
 
-         $options[self::OSS_CONTENT] = 'x-oss-process='.$process;
 
-         $response = $this->auth($options);
 
-         $result = new BodyResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Gets the part size according to the preferred part size.
 
-      * If the specified part size is too small or too big, it will return a min part or max part size instead.
 
-      * Otherwise returns the specified part size.
 
-      * @param int $partSize
 
-      * @return int
 
-      */
 
-     private function computePartSize($partSize)
 
-     {
 
-         $partSize = (integer)$partSize;
 
-         if ($partSize <= self::OSS_MIN_PART_SIZE) {
 
-             $partSize = self::OSS_MIN_PART_SIZE;
 
-         } elseif ($partSize > self::OSS_MAX_PART_SIZE) {
 
-             $partSize = self::OSS_MAX_PART_SIZE;
 
-         }
 
-         return $partSize;
 
-     }
 
-     /**
 
-      * Computes the parts count, size and start position according to the file size and the part size.
 
-      * It must be only called by upload_Part().
 
-      *
 
-      * @param integer $file_size File size
 
-      * @param integer $partSize part大小,part size. Default is 5MB
 
-      * @return array An array contains key-value pairs--the key is `seekTo`and value is `length`.
 
-      */
 
-     public function generateMultiuploadParts($file_size, $partSize = 5242880)
 
-     {
 
-         $i = 0;
 
-         $size_count = $file_size;
 
-         $values = array();
 
-         $partSize = $this->computePartSize($partSize);
 
-         while ($size_count > 0) {
 
-             $size_count -= $partSize;
 
-             $values[] = array(
 
-                 self::OSS_SEEK_TO => ($partSize * $i),
 
-                 self::OSS_LENGTH => (($size_count > 0) ? $partSize : ($size_count + $partSize)),
 
-             );
 
-             $i++;
 
-         }
 
-         return $values;
 
-     }
 
-     /**
 
-      * Initialize a multi-part upload
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $object object name
 
-      * @param array $options Key-Value array
 
-      * @throws OssException
 
-      * @return string returns uploadid
 
-      */
 
-     public function initiateMultipartUpload($bucket, $object, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options);
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_POST;
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         $options[self::OSS_SUB_RESOURCE] = 'uploads';
 
-         $options[self::OSS_CONTENT] = '';
 
-         if (!isset($options[self::OSS_CONTENT_TYPE])) {
 
-             $options[self::OSS_CONTENT_TYPE] = $this->getMimeType($object);
 
-         }
 
-         if (!isset($options[self::OSS_HEADERS])) {
 
-             $options[self::OSS_HEADERS] = array();
 
-         }
 
-         $response = $this->auth($options);
 
-         $result = new InitiateMultipartUploadResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Upload a part in a multiparts upload.
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $object object name
 
-      * @param string $uploadId
 
-      * @param array $options Key-Value array
 
-      * @return string eTag
 
-      * @throws OssException
 
-      */
 
-     public function uploadPart($bucket, $object, $uploadId, $options = null)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options);
 
-         $this->precheckParam($options, self::OSS_FILE_UPLOAD, __FUNCTION__);
 
-         $this->precheckParam($options, self::OSS_PART_NUM, __FUNCTION__);
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         $options[self::OSS_UPLOAD_ID] = $uploadId;
 
-         if (isset($options[self::OSS_LENGTH])) {
 
-             $options[self::OSS_CONTENT_LENGTH] = $options[self::OSS_LENGTH];
 
-         }
 
-         $response = $this->auth($options);
 
-         $result = new UploadPartResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Gets the uploaded parts.
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $object object name
 
-      * @param string $uploadId uploadId
 
-      * @param array $options Key-Value array
 
-      * @return ListPartsInfo
 
-      * @throws OssException
 
-      */
 
-     public function listParts($bucket, $object, $uploadId, $options = null)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options);
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         $options[self::OSS_UPLOAD_ID] = $uploadId;
 
-         $options[self::OSS_QUERY_STRING] = array();
 
-         foreach (array('max-parts', 'part-number-marker') as $param) {
 
-             if (isset($options[$param])) {
 
-                 $options[self::OSS_QUERY_STRING][$param] = $options[$param];
 
-                 unset($options[$param]);
 
-             }
 
-         }
 
-         $response = $this->auth($options);
 
-         $result = new ListPartsResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Abort a multiparts upload
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $object object name
 
-      * @param string $uploadId uploadId
 
-      * @param array $options Key-Value name
 
-      * @return null
 
-      * @throws OssException
 
-      */
 
-     public function abortMultipartUpload($bucket, $object, $uploadId, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options);
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_DELETE;
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         $options[self::OSS_UPLOAD_ID] = $uploadId;
 
-         $response = $this->auth($options);
 
-         $result = new PutSetDeleteResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Completes a multiparts upload, after all parts are uploaded.
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $object object name
 
-      * @param string $uploadId uploadId
 
-      * @param array $listParts array( array("PartNumber"=> int, "ETag"=>string))
 
-      * @param array $options Key-Value array
 
-      * @throws OssException
 
-      * @return null
 
-      */
 
-     public function completeMultipartUpload($bucket, $object, $uploadId, $listParts, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options);
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_POST;
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         $options[self::OSS_UPLOAD_ID] = $uploadId;
 
-         $options[self::OSS_CONTENT_TYPE] = 'application/xml';
 
-         if (!is_array($listParts)) {
 
-             throw new OssException("listParts must be array type");
 
-         }
 
-         $options[self::OSS_CONTENT] = OssUtil::createCompleteMultipartUploadXmlBody($listParts);
 
-         $response = $this->auth($options);
 
-         if (isset($options[self::OSS_CALLBACK]) && !empty($options[self::OSS_CALLBACK])) {
 
-             $result = new CallbackResult($response);
 
-         } else {
 
-             $result = new PutSetDeleteResult($response);
 
-         }
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Lists all ongoing multipart upload events, which means all initialized but not completed or aborted multipart uploads.
 
-      *
 
-      * @param string $bucket bucket
 
-      * @param array $options key-value array--expected keys are 'delimiter', 'key-marker', 'max-uploads', 'prefix', 'upload-id-marker'
 
-      * @throws OssException
 
-      * @return ListMultipartUploadInfo
 
-      */
 
-     public function listMultipartUploads($bucket, $options = null)
 
-     {
 
-         $this->precheckCommon($bucket, NULL, $options, false);
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_GET;
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_OBJECT] = '/';
 
-         $options[self::OSS_SUB_RESOURCE] = 'uploads';
 
-         foreach (array('delimiter', 'key-marker', 'max-uploads', 'prefix', 'upload-id-marker') as $param) {
 
-             if (isset($options[$param])) {
 
-                 $options[self::OSS_QUERY_STRING][$param] = $options[$param];
 
-                 unset($options[$param]);
 
-             }
 
-         }
 
-         $query = isset($options[self::OSS_QUERY_STRING]) ? $options[self::OSS_QUERY_STRING] : array();
 
-         $options[self::OSS_QUERY_STRING] = array_merge(
 
-             $query,
 
-             array(self::OSS_ENCODING_TYPE => self::OSS_ENCODING_TYPE_URL)
 
-         );
 
-         $response = $this->auth($options);
 
-         $result = new ListMultipartUploadResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * Copy an existing file as a part
 
-      *
 
-      * @param string $fromBucket source bucket name
 
-      * @param string $fromObject source object name
 
-      * @param string $toBucket target bucket name
 
-      * @param string $toObject target object name
 
-      * @param int $partNumber Part number
 
-      * @param string $uploadId Upload Id
 
-      * @param array $options Key-Value array---it should have 'start' or 'end' key to specify the range of the source object to copy. If it's not specifed, the whole object is copied.
 
-      * @return null
 
-      * @throws OssException
 
-      */
 
-     public function uploadPartCopy($fromBucket, $fromObject, $toBucket, $toObject, $partNumber, $uploadId, $options = NULL)
 
-     {
 
-         $this->precheckCommon($fromBucket, $fromObject, $options);
 
-         $this->precheckCommon($toBucket, $toObject, $options);
 
-         //If $options['isFullCopy'] is not set, copy from the beginning
 
-         $start_range = "0";
 
-         if (isset($options['start'])) {
 
-             $start_range = $options['start'];
 
-         }
 
-         $end_range = "";
 
-         if (isset($options['end'])) {
 
-             $end_range = $options['end'];
 
-         }
 
-         $options[self::OSS_METHOD] = self::OSS_HTTP_PUT;
 
-         $options[self::OSS_BUCKET] = $toBucket;
 
-         $options[self::OSS_OBJECT] = $toObject;
 
-         $options[self::OSS_PART_NUM] = $partNumber;
 
-         $options[self::OSS_UPLOAD_ID] = $uploadId;
 
-         if (!isset($options[self::OSS_HEADERS])) {
 
-             $options[self::OSS_HEADERS] = array();
 
-         }
 
-         $param = '/' . $fromBucket . '/' . rawurlencode($fromObject);
 
-         if (isset($options[self::OSS_VERSION_ID])) {
 
-             $param = $param . '?versionId='.$options[self::OSS_VERSION_ID];
 
-             unset($options[self::OSS_VERSION_ID]);
 
-         }
 
-         $options[self::OSS_HEADERS][self::OSS_OBJECT_COPY_SOURCE] = $param;
 
-         $options[self::OSS_HEADERS][self::OSS_OBJECT_COPY_SOURCE_RANGE] = "bytes=" . $start_range . "-" . $end_range;
 
-         $response = $this->auth($options);
 
-         $result = new UploadPartResult($response);
 
-         return $result->getData();
 
-     }
 
-     /**
 
-      * A higher level API for uploading a file with multipart upload. It consists of initialization, parts upload and completion.
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $object object name
 
-      * @param string $file The local file to upload
 
-      * @param array $options Key-Value array
 
-      * @return null
 
-      * @throws OssException
 
-      */
 
-     public function multiuploadFile($bucket, $object, $file, $options = null)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options);
 
-         if (isset($options[self::OSS_LENGTH])) {
 
-             $options[self::OSS_CONTENT_LENGTH] = $options[self::OSS_LENGTH];
 
-             unset($options[self::OSS_LENGTH]);
 
-         }
 
-         if (empty($file)) {
 
-             throw new OssException("parameter invalid, file is empty");
 
-         }
 
-         $uploadFile = OssUtil::encodePath($file);
 
-         if (!isset($options[self::OSS_CONTENT_TYPE])) {
 
-             $options[self::OSS_CONTENT_TYPE] = $this->getMimeType($object, $uploadFile);
 
-         }
 
-         $upload_position = isset($options[self::OSS_SEEK_TO]) ? (integer)$options[self::OSS_SEEK_TO] : 0;
 
-         if (isset($options[self::OSS_CONTENT_LENGTH])) {
 
-             $upload_file_size = (integer)$options[self::OSS_CONTENT_LENGTH];
 
-         } else {
 
-             $upload_file_size = filesize($uploadFile);
 
-             if ($upload_file_size !== false) {
 
-                 $upload_file_size -= $upload_position;  
 
-             }
 
-         }
 
-         if ($upload_position === false || !isset($upload_file_size) || $upload_file_size === false || $upload_file_size < 0) {
 
-             throw new OssException('The size of `fileUpload` cannot be determined in ' . __FUNCTION__ . '().');
 
-         }
 
-         // Computes the part size and assign it to options.
 
-         if (isset($options[self::OSS_PART_SIZE])) {
 
-             $options[self::OSS_PART_SIZE] = $this->computePartSize($options[self::OSS_PART_SIZE]);
 
-         } else {
 
-             $options[self::OSS_PART_SIZE] = self::OSS_MID_PART_SIZE;
 
-         }
 
-         $is_check_md5 = $this->isCheckMD5($options);
 
-         // if the file size is less than part size, use simple file upload.
 
-         if ($upload_file_size < $options[self::OSS_PART_SIZE] && !isset($options[self::OSS_UPLOAD_ID])) {
 
-             return $this->uploadFile($bucket, $object, $uploadFile, $options);
 
-         }
 
-         // Using multipart upload, initialize if no OSS_UPLOAD_ID is specified in options.
 
-         if (isset($options[self::OSS_UPLOAD_ID])) {
 
-             $uploadId = $options[self::OSS_UPLOAD_ID];
 
-         } else {
 
-             // initialize
 
-             $uploadId = $this->initiateMultipartUpload($bucket, $object, $options);
 
-         }
 
-         // generates the parts information and upload them one by one
 
-         $pieces = $this->generateMultiuploadParts($upload_file_size, (integer)$options[self::OSS_PART_SIZE]);
 
-         $response_upload_part = array();
 
-         foreach ($pieces as $i => $piece) {
 
-             $from_pos = $upload_position + (integer)$piece[self::OSS_SEEK_TO];
 
-             $to_pos = (integer)$piece[self::OSS_LENGTH] + $from_pos - 1;
 
-             $up_options = array(
 
-                 self::OSS_FILE_UPLOAD => $uploadFile,
 
-                 self::OSS_PART_NUM => ($i + 1),
 
-                 self::OSS_SEEK_TO => $from_pos,
 
-                 self::OSS_LENGTH => $to_pos - $from_pos + 1,
 
-                 self::OSS_CHECK_MD5 => $is_check_md5,
 
-             );
 
-             if ($is_check_md5) {
 
-                 $content_md5 = OssUtil::getMd5SumForFile($uploadFile, $from_pos, $to_pos);
 
-                 $up_options[self::OSS_CONTENT_MD5] = $content_md5;
 
-             }
 
-             $response_upload_part[] = $this->uploadPart($bucket, $object, $uploadId, $up_options);
 
-         }
 
-         $uploadParts = array();
 
-         foreach ($response_upload_part as $i => $etag) {
 
-             $uploadParts[] = array(
 
-                 'PartNumber' => ($i + 1),
 
-                 'ETag' => $etag,
 
-             );
 
-         }
 
-         //build complete options
 
-         $cmp_options = null;
 
-         if (isset($options[self::OSS_HEADERS]) && isset($options[self::OSS_HEADERS][self::OSS_REQUEST_PAYER])) {
 
-             $cmp_options = array(
 
-                 OssClient::OSS_HEADERS => array(
 
-                     OssClient::OSS_REQUEST_PAYER => $options[self::OSS_HEADERS][self::OSS_REQUEST_PAYER],
 
-             ));
 
-         }
 
-         return $this->completeMultipartUpload($bucket, $object, $uploadId, $uploadParts, $cmp_options);
 
-     }
 
-     /**
 
-      * Uploads the local directory to the specified bucket into specified folder (prefix)
 
-      *
 
-      * @param string $bucket bucket name
 
-      * @param string $prefix The object key prefix. Typically it's folder name. The name should not end with '/' as the API appends it automatically.
 
-      * @param string $localDirectory The local directory to upload
 
-      * @param string $exclude To excluded directories
 
-      * @param bool $recursive Recursive flag. True: Recursively upload all datas under the local directory; False: only upload first layer's files.
 
-      * @param bool $checkMd5
 
-      * @return array Returns two list: array("succeededList" => array("object"), "failedList" => array("object"=>"errorMessage"))
 
-      * @throws OssException
 
-      */
 
-     public function uploadDir($bucket, $prefix, $localDirectory, $exclude = '.|..|.svn|.git', $recursive = false, $checkMd5 = true)
 
-     {
 
-         $retArray = array("succeededList" => array(), "failedList" => array());
 
-         if (empty($bucket)) throw new OssException("parameter error, bucket is empty");
 
-         if (!is_string($prefix)) throw new OssException("parameter error, prefix is not string");
 
-         if (empty($localDirectory)) throw new OssException("parameter error, localDirectory is empty");
 
-         $directory = $localDirectory;
 
-         $directory = OssUtil::encodePath($directory);
 
-         //If it's not the local directory, throw OSSException.
 
-         if (!is_dir($directory)) {
 
-             throw new OssException('parameter error: ' . $directory . ' is not a directory, please check it');
 
-         }
 
-         //read directory
 
-         $file_list_array = OssUtil::readDir($directory, $exclude, $recursive);
 
-         if (!$file_list_array) {
 
-             throw new OssException($directory . ' is empty...');
 
-         }
 
-         foreach ($file_list_array as $k => $item) {
 
-             if (is_dir($item['path'])) {
 
-                 continue;
 
-             }
 
-             $options = array(
 
-                 self::OSS_PART_SIZE => self::OSS_MIN_PART_SIZE,
 
-                 self::OSS_CHECK_MD5 => $checkMd5,
 
-             );
 
-             $realObject = (!empty($prefix) ? $prefix . '/' : '') . $item['file'];
 
-             try {
 
-                 $this->multiuploadFile($bucket, $realObject, $item['path'], $options);
 
-                 $retArray["succeededList"][] = $realObject;
 
-             } catch (OssException $e) {
 
-                 $retArray["failedList"][$realObject] = $e->getMessage();
 
-             }
 
-         }
 
-         return $retArray;
 
-     }
 
-     /**
 
-      * Sign URL with specified expiration time in seconds (timeout) and HTTP method.
 
-      * The signed URL could be used to access the object directly.
 
-      *
 
-      * @param string $bucket
 
-      * @param string $object
 
-      * @param int $timeout expiration time in seconds.
 
-      * @param string $method
 
-      * @param array $options Key-Value array
 
-      * @return string
 
-      * @throws OssException
 
-      */
 
-     public function signUrl($bucket, $object, $timeout = 60, $method = self::OSS_HTTP_GET, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options);
 
-         //method
 
-         if (self::OSS_HTTP_GET !== $method && self::OSS_HTTP_PUT !== $method) {
 
-             throw new OssException("method is invalid");
 
-         }
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         $options[self::OSS_METHOD] = $method;
 
-         if (!isset($options[self::OSS_CONTENT_TYPE])) {
 
-             $options[self::OSS_CONTENT_TYPE] = '';
 
-         }
 
-         $timeout = time() + $timeout;
 
-         $options[self::OSS_PREAUTH] = $timeout;
 
-         $options[self::OSS_DATE] = $timeout;
 
-         $this->setSignStsInUrl(true);
 
-         return $this->auth($options);
 
-     }
 
-     /**
 
-      * Sign URL with specified expiration time in seconds and HTTP method.
 
-      * The signed URL could be used to access the object directly.
 
-      *
 
-      * @param string $bucket
 
-      * @param string $object
 
-      * @param int $expiration expiration time of the Url, unix epoch, since 1970.1.1 00.00.00 UTC
 
-      * @param string $method
 
-      * @param array $options Key-Value array
 
-      * @return string
 
-      * @throws OssException
 
-      */
 
-     public function generatePresignedUrl($bucket, $object, $expiration, $method = self::OSS_HTTP_GET, $options = NULL)
 
-     {
 
-         $this->precheckCommon($bucket, $object, $options);
 
-         //method
 
-         if (self::OSS_HTTP_GET !== $method && self::OSS_HTTP_PUT !== $method) {
 
-             throw new OssException("method is invalid");
 
-         }
 
-         $options[self::OSS_BUCKET] = $bucket;
 
-         $options[self::OSS_OBJECT] = $object;
 
-         $options[self::OSS_METHOD] = $method;
 
-         if (!isset($options[self::OSS_CONTENT_TYPE])) {
 
-             $options[self::OSS_CONTENT_TYPE] = '';
 
-         }
 
-         $options[self::OSS_PREAUTH] = $expiration;
 
-         $options[self::OSS_DATE] = $expiration;
 
-         $this->setSignStsInUrl(true);
 
-         return $this->auth($options);
 
-     }
 
-     /**
 
-      * validates options. Create a empty array if it's NULL.
 
-      *
 
-      * @param array $options
 
-      * @throws OssException
 
-      */
 
-     private function precheckOptions(&$options)
 
-     {
 
-         OssUtil::validateOptions($options);
 
-         if (!$options) {
 
-             $options = array();
 
-         }
 
-     }
 
-     /**
 
-      * Validates bucket parameter
 
-      *
 
-      * @param string $bucket
 
-      * @param string $errMsg
 
-      * @throws OssException
 
-      */
 
-     private function precheckBucket($bucket, $errMsg = 'bucket is not allowed empty')
 
-     {
 
-         OssUtil::throwOssExceptionWithMessageIfEmpty($bucket, $errMsg);
 
-     }
 
-     /**
 
-      * validates object parameter
 
-      *
 
-      * @param string $object
 
-      * @throws OssException
 
-      */
 
-     private function precheckObject($object)
 
-     {
 
-         OssUtil::throwOssExceptionWithMessageIfEmpty($object, "object name is empty");
 
-     }
 
-     /**
 
-      * 校验option restore
 
-      *
 
-      * @param string $restore
 
-      * @throws OssException
 
-      */
 
-     private function precheckStorage($storage)
 
-     {
 
-         if (is_string($storage)) {
 
-             switch ($storage) {
 
-                 case self::OSS_STORAGE_ARCHIVE:
 
-                     return;
 
-                 case self::OSS_STORAGE_IA:
 
-                     return;
 
-                 case self::OSS_STORAGE_STANDARD:
 
-                     return;
 
-                 case self::OSS_STORAGE_COLDARCHIVE:
 
-                     return;
 
-                 default:
 
-                     break;
 
-             }
 
-         }
 
-         throw new OssException('storage name is invalid');
 
-     }
 
-     /**
 
-      * Validates bucket,options parameters and optionally validate object parameter.
 
-      *
 
-      * @param string $bucket
 
-      * @param string $object
 
-      * @param array $options
 
-      * @param bool $isCheckObject
 
-      */
 
-     private function precheckCommon($bucket, $object, &$options, $isCheckObject = true)
 
-     {
 
-         if ($isCheckObject) {
 
-             $this->precheckObject($object);
 
-         }
 
-         $this->precheckOptions($options);
 
-         $this->precheckBucket($bucket);
 
-     }
 
-     /**
 
-      * checks parameters
 
-      *
 
-      * @param array $options
 
-      * @param string $param
 
-      * @param string $funcName
 
-      * @throws OssException
 
-      */
 
-     private function precheckParam($options, $param, $funcName)
 
-     {
 
-         if (!isset($options[$param])) {
 
-             throw new OssException('The `' . $param . '` options is required in ' . $funcName . '().');
 
-         }
 
-     }
 
-     /**
 
-      * Checks md5
 
-      *
 
-      * @param array $options
 
-      * @return bool|null
 
-      */
 
-     private function isCheckMD5($options)
 
-     {
 
-         return $this->getValue($options, self::OSS_CHECK_MD5, false, true, true);
 
-     }
 
-     /**
 
-      * Gets value of the specified key from the options 
 
-      *
 
-      * @param array $options
 
-      * @param string $key
 
-      * @param string $default
 
-      * @param bool $isCheckEmpty
 
-      * @param bool $isCheckBool
 
-      * @return bool|null
 
-      */
 
-     private function getValue($options, $key, $default = NULL, $isCheckEmpty = false, $isCheckBool = false)
 
-     {
 
-         $value = $default;
 
-         if (isset($options[$key])) {
 
-             if ($isCheckEmpty) {
 
-                 if (!empty($options[$key])) {
 
-                     $value = $options[$key];
 
-                 }
 
-             } else {
 
-                 $value = $options[$key];
 
-             }
 
-             unset($options[$key]);
 
-         }
 
-         if ($isCheckBool) {
 
-             if ($value !== true && $value !== false) {
 
-                 $value = false;
 
-             }
 
-         }
 
-         return $value;
 
-     }
 
-     /**
 
-      * Gets mimetype
 
-      *
 
-      * @param string $object
 
-      * @return string
 
-      */
 
-     private function getMimeType($object, $file = null)
 
-     {
 
-         if (!is_null($file)) {
 
-             $type = MimeTypes::getMimetype($file);
 
-             if (!is_null($type)) {
 
-                 return $type;
 
-             }
 
-         }
 
-         $type = MimeTypes::getMimetype($object);
 
-         if (!is_null($type)) {
 
-             return $type;
 
-         }
 
-         return self::DEFAULT_CONTENT_TYPE;
 
-     }
 
-     /**
 
-      * Validates and executes the request according to OSS API protocol.
 
-      *
 
-      * @param array $options
 
-      * @return ResponseCore
 
-      * @throws OssException
 
-      * @throws RequestCore_Exception
 
-      */
 
-     private function auth($options)
 
-     {
 
-         OssUtil::validateOptions($options);
 
-         //Validates bucket, not required for list_bucket
 
-         $this->authPrecheckBucket($options);
 
-         //Validates object
 
-         $this->authPrecheckObject($options);
 
-         //object name encoding must be UTF-8
 
-         $this->authPrecheckObjectEncoding($options);
 
-         //Validates ACL
 
-         $this->authPrecheckAcl($options);
 
-         // Should https or http be used?
 
-         $scheme = $this->useSSL ? 'https://' : 'http://';
 
-         // gets the host name. If the host name is public domain or private domain, form a third level domain by prefixing the bucket name on the domain name.
 
-         $hostname = $this->generateHostname($options[self::OSS_BUCKET]);
 
-         $string_to_sign = '';
 
-         $headers = $this->generateHeaders($options, $hostname);
 
-         $signable_query_string_params = $this->generateSignableQueryStringParam($options);
 
-         $signable_query_string = OssUtil::toQueryString($signable_query_string_params);
 
-         $resource_uri = $this->generateResourceUri($options);
 
-         //Generates the URL (add query parameters)
 
-         $conjunction = '?';
 
-         $non_signable_resource = '';
 
-         if (isset($options[self::OSS_SUB_RESOURCE])) {
 
-             $conjunction = '&';
 
-         }
 
-         if ($signable_query_string !== '') {
 
-             $signable_query_string = $conjunction . $signable_query_string;
 
-             $conjunction = '&';
 
-         }
 
-         $query_string = $this->generateQueryString($options);
 
-         if ($query_string !== '') {
 
-             $non_signable_resource .= $conjunction . $query_string;
 
-             $conjunction = '&';
 
-         }
 
-         $this->requestUrl = $scheme . $hostname . $resource_uri . $signable_query_string . $non_signable_resource;
 
-         //Creates the request
 
-         $request = new RequestCore($this->requestUrl, $this->requestProxy);
 
-         $request->set_useragent($this->generateUserAgent());
 
-         // Streaming uploads
 
-         if (isset($options[self::OSS_FILE_UPLOAD])) {
 
-             if (is_resource($options[self::OSS_FILE_UPLOAD])) {
 
-                 $length = null;
 
-                 if (isset($options[self::OSS_CONTENT_LENGTH])) {
 
-                     $length = $options[self::OSS_CONTENT_LENGTH];
 
-                 } elseif (isset($options[self::OSS_SEEK_TO])) {
 
-                     $stats = fstat($options[self::OSS_FILE_UPLOAD]);
 
-                     if ($stats && $stats[self::OSS_SIZE] >= 0) {
 
-                         $length = $stats[self::OSS_SIZE] - (integer)$options[self::OSS_SEEK_TO];
 
-                     }
 
-                 }
 
-                 $request->set_read_stream($options[self::OSS_FILE_UPLOAD], $length);
 
-             } else {
 
-                 $request->set_read_file($options[self::OSS_FILE_UPLOAD]);
 
-                 $length = $request->read_stream_size;
 
-                 if (isset($options[self::OSS_CONTENT_LENGTH])) {
 
-                     $length = $options[self::OSS_CONTENT_LENGTH];
 
-                 } elseif (isset($options[self::OSS_SEEK_TO]) && isset($length)) {
 
-                     $length -= (integer)$options[self::OSS_SEEK_TO];
 
-                 }
 
-                 $request->set_read_stream_size($length);
 
-             }
 
-         }
 
-         if (isset($options[self::OSS_SEEK_TO])) {
 
-             $request->set_seek_position((integer)$options[self::OSS_SEEK_TO]);
 
-         }
 
-         if (isset($options[self::OSS_FILE_DOWNLOAD])) {
 
-             if (is_resource($options[self::OSS_FILE_DOWNLOAD])) {
 
-                 $request->set_write_stream($options[self::OSS_FILE_DOWNLOAD]);
 
-             } else {
 
-                 $request->set_write_file($options[self::OSS_FILE_DOWNLOAD]);
 
-             }
 
-         }
 
-         if (isset($options[self::OSS_METHOD])) {
 
-             $request->set_method($options[self::OSS_METHOD]);
 
-             $string_to_sign .= $options[self::OSS_METHOD] . "\n";
 
-         }
 
-         if (isset($options[self::OSS_CONTENT])) {
 
-             $request->set_body($options[self::OSS_CONTENT]);
 
-             if ($headers[self::OSS_CONTENT_TYPE] === 'application/x-www-form-urlencoded') {
 
-                 $headers[self::OSS_CONTENT_TYPE] = 'application/octet-stream';
 
-             }
 
-             $headers[self::OSS_CONTENT_LENGTH] = strlen($options[self::OSS_CONTENT]);
 
-             $headers[self::OSS_CONTENT_MD5] = base64_encode(md5($options[self::OSS_CONTENT], true));
 
-         }
 
-         if (isset($options[self::OSS_CALLBACK])) {
 
-             $headers[self::OSS_CALLBACK] = base64_encode($options[self::OSS_CALLBACK]);
 
-         }
 
-         if (isset($options[self::OSS_CALLBACK_VAR])) {
 
-             $headers[self::OSS_CALLBACK_VAR] = base64_encode($options[self::OSS_CALLBACK_VAR]);
 
-         }
 
-         if (!isset($headers[self::OSS_ACCEPT_ENCODING])) {
 
-             $headers[self::OSS_ACCEPT_ENCODING] = '';
 
-         }
 
-         uksort($headers, 'strnatcasecmp');
 
-         foreach ($headers as $header_key => $header_value) {
 
-             $header_value = str_replace(array("\r", "\n"), '', $header_value);
 
-             if ($header_value !== '' || $header_key === self::OSS_ACCEPT_ENCODING) {
 
-                 $request->add_header($header_key, $header_value);
 
-             }
 
-             if (
 
-                 strtolower($header_key) === 'content-md5' ||
 
-                 strtolower($header_key) === 'content-type' ||
 
-                 strtolower($header_key) === 'date' ||
 
-                 (isset($options['self::OSS_PREAUTH']) && (integer)$options['self::OSS_PREAUTH'] > 0)
 
-             ) {
 
-                 $string_to_sign .= $header_value . "\n";
 
-             } elseif (substr(strtolower($header_key), 0, 6) === self::OSS_DEFAULT_PREFIX) {
 
-                 $string_to_sign .= strtolower($header_key) . ':' . $header_value . "\n";
 
-             }
 
-         }
 
-         // Generates the signable_resource
 
-         $signable_resource = $this->generateSignableResource($options);
 
-         $signable_resource = rawurldecode($signable_resource) . urldecode($signable_query_string);
 
-         $string_to_sign_ordered = $string_to_sign;
 
-         $string_to_sign .= $signable_resource;
 
-         // Sort the strings to be signed.
 
-         $string_to_sign_ordered .= $this->stringToSignSorted($signable_resource);
 
-         $signature = base64_encode(hash_hmac('sha1', $string_to_sign_ordered, $this->accessKeySecret, true));
 
-         $request->add_header('Authorization', 'OSS ' . $this->accessKeyId . ':' . $signature);
 
-         if (isset($options[self::OSS_PREAUTH]) && (integer)$options[self::OSS_PREAUTH] > 0) {
 
-             $signed_url = $this->requestUrl . $conjunction . self::OSS_URL_ACCESS_KEY_ID . '=' . rawurlencode($this->accessKeyId) . '&' . self::OSS_URL_EXPIRES . '=' . $options[self::OSS_PREAUTH] . '&' . self::OSS_URL_SIGNATURE . '=' . rawurlencode($signature);
 
-             return $signed_url;
 
-         } elseif (isset($options[self::OSS_PREAUTH])) {
 
-             return $this->requestUrl;
 
-         }
 
-         if ($this->timeout !== 0) {
 
-             $request->timeout = $this->timeout;
 
-         }
 
-         if ($this->connectTimeout !== 0) {
 
-             $request->connect_timeout = $this->connectTimeout;
 
-         }
 
-         try {
 
-             $request->send_request();
 
-         } catch (RequestCore_Exception $e) {
 
-             throw(new OssException('RequestCoreException: ' . $e->getMessage()));
 
-         }
 
-         $response_header = $request->get_response_header();
 
-         $response_header['oss-request-url'] = $this->requestUrl;
 
-         $response_header['oss-redirects'] = $this->redirects;
 
-         $response_header['oss-stringtosign'] = $string_to_sign;
 
-         $response_header['oss-requestheaders'] = $request->request_headers;
 
-         $data = new ResponseCore($response_header, $request->get_response_body(), $request->get_response_code());
 
-         //retry if OSS Internal Error
 
-         if ((integer)$request->get_response_code() === 500) {
 
-             if ($this->redirects <= $this->maxRetries) {
 
-                 //Sets the sleep time betwen each retry.
 
-                 $delay = (integer)(pow(4, $this->redirects) * 100000);
 
-                 usleep($delay);
 
-                 $this->redirects++;
 
-                 $data = $this->auth($options);
 
-             }
 
-         }
 
-         
 
-         $this->redirects = 0;
 
-         return $data;
 
-     }
 
-     /**
 
-      * Sets the max retry count
 
-      *
 
-      * @param int $maxRetries
 
-      * @return void
 
-      */
 
-     public function setMaxTries($maxRetries = 3)
 
-     {
 
-         $this->maxRetries = $maxRetries;
 
-     }
 
-     /**
 
-      * Gets the max retry count
 
-      *
 
-      * @return int
 
-      */
 
-     public function getMaxRetries()
 
-     {
 
-         return $this->maxRetries;
 
-     }
 
-     /**
 
-      * Enaable/disable STS in the URL. This is to determine the $sts value passed from constructor take effect or not.
 
-      *
 
-      * @param boolean $enable
 
-      */
 
-     public function setSignStsInUrl($enable)
 
-     {
 
-         $this->enableStsInUrl = $enable;
 
-     }
 
-     /**
 
-      * @return boolean
 
-      */
 
-     public function isUseSSL()
 
-     {
 
-         return $this->useSSL;
 
-     }
 
-     /**
 
-      * @param boolean $useSSL
 
-      */
 
-     public function setUseSSL($useSSL)
 
-     {
 
-         $this->useSSL = $useSSL;
 
-     }
 
-     /**
 
-      * Validates bucket name--throw OssException if it's invalid
 
-      *
 
-      * @param $options
 
-      * @throws OssException
 
-      */
 
-     private function authPrecheckBucket($options)
 
-     {
 
-         if (!(('/' == $options[self::OSS_OBJECT]) && ('' == $options[self::OSS_BUCKET]) && ('GET' == $options[self::OSS_METHOD])) && !OssUtil::validateBucket($options[self::OSS_BUCKET])) {
 
-             throw new OssException('"' . $options[self::OSS_BUCKET] . '"' . 'bucket name is invalid');
 
-         }
 
-     }
 
-     /**
 
-      *
 
-      * Validates the object name--throw OssException if it's invalid.
 
-      *
 
-      * @param $options
 
-      * @throws OssException
 
-      */
 
-     private function authPrecheckObject($options)
 
-     {
 
-         if (isset($options[self::OSS_OBJECT]) && $options[self::OSS_OBJECT] === '/') {
 
-             return;
 
-         }
 
-         if (isset($options[self::OSS_OBJECT]) && !OssUtil::validateObject($options[self::OSS_OBJECT])) {
 
-             throw new OssException('"' . $options[self::OSS_OBJECT] . '"' . ' object name is invalid');
 
-         }
 
-     }
 
-     /**
 
-      * Checks the object's encoding. Convert it to UTF8 if it's in GBK or GB2312
 
-      *
 
-      * @param mixed $options parameter
 
-      */
 
-     private function authPrecheckObjectEncoding(&$options)
 
-     {
 
-         $tmp_object = $options[self::OSS_OBJECT];
 
-         try {
 
-             if (OssUtil::isGb2312($options[self::OSS_OBJECT])) {
 
-                 $options[self::OSS_OBJECT] = iconv('GB2312', "UTF-8//IGNORE", $options[self::OSS_OBJECT]);
 
-             } elseif (OssUtil::checkChar($options[self::OSS_OBJECT], true)) {
 
-                 $options[self::OSS_OBJECT] = iconv('GBK', "UTF-8//IGNORE", $options[self::OSS_OBJECT]);
 
-             }
 
-         } catch (\Exception $e) {
 
-             try {
 
-                 $tmp_object = iconv(mb_detect_encoding($tmp_object), "UTF-8", $tmp_object);
 
-             } catch (\Exception $e) {
 
-             }
 
-         }
 
-         $options[self::OSS_OBJECT] = $tmp_object;
 
-     }
 
-     /**
 
-      * Checks if the ACL is one of the 3 predefined one. Throw OSSException if not.
 
-      *
 
-      * @param $options
 
-      * @throws OssException
 
-      */
 
-     private function authPrecheckAcl($options)
 
-     {
 
-         if (isset($options[self::OSS_HEADERS][self::OSS_ACL]) && !empty($options[self::OSS_HEADERS][self::OSS_ACL])) {
 
-             if (!in_array(strtolower($options[self::OSS_HEADERS][self::OSS_ACL]), self::$OSS_ACL_TYPES)) {
 
-                 throw new OssException($options[self::OSS_HEADERS][self::OSS_ACL] . ':' . 'acl is invalid(private,public-read,public-read-write)');
 
-             }
 
-         }
 
-     }
 
-     /**
 
-      * Gets the host name for the current request.
 
-      * It could be either a third level domain (prefixed by bucket name) or second level domain if it's CName or IP
 
-      *
 
-      * @param $bucket
 
-      * @return string The host name without the protocol scheem (e.g. https://)
 
-      */
 
-     private function generateHostname($bucket)
 
-     {
 
-         if ($this->hostType === self::OSS_HOST_TYPE_IP) {
 
-             $hostname = $this->hostname;
 
-         } elseif ($this->hostType === self::OSS_HOST_TYPE_CNAME) {
 
-             $hostname = $this->hostname;
 
-         } else {
 
-             // Private domain or public domain
 
-             $hostname = ($bucket == '') ? $this->hostname : ($bucket . '.') . $this->hostname;
 
-         }
 
-         return $hostname;
 
-     }
 
-     /**
 
-      * Gets the resource Uri in the current request
 
-      *
 
-      * @param $options
 
-      * @return string return the resource uri.
 
-      */
 
-     private function generateResourceUri($options)
 
-     {
 
-         $resource_uri = "";
 
-         // resource_uri + bucket
 
-         if (isset($options[self::OSS_BUCKET]) && '' !== $options[self::OSS_BUCKET]) {
 
-             if ($this->hostType === self::OSS_HOST_TYPE_IP) {
 
-                 $resource_uri = '/' . $options[self::OSS_BUCKET];
 
-             }
 
-         }
 
-         // resource_uri + object
 
-         if (isset($options[self::OSS_OBJECT]) && '/' !== $options[self::OSS_OBJECT]) {
 
-             $resource_uri .= '/' . str_replace(array('%2F', '%25'), array('/', '%'), rawurlencode($options[self::OSS_OBJECT]));
 
-         }
 
-         // resource_uri + sub_resource
 
-         $conjunction = '?';
 
-         if (isset($options[self::OSS_SUB_RESOURCE])) {
 
-             $resource_uri .= $conjunction . $options[self::OSS_SUB_RESOURCE];
 
-         }
 
-         return $resource_uri;
 
-     }
 
-     /**
 
-      * Generates the signalbe query string parameters in array type
 
-      *
 
-      * @param array $options
 
-      * @return array
 
-      */
 
-     private function generateSignableQueryStringParam($options)
 
-     {
 
-         $signableQueryStringParams = array();
 
-         $signableList = array(
 
-             self::OSS_PART_NUM,
 
-             'response-content-type',
 
-             'response-content-language',
 
-             'response-cache-control',
 
-             'response-content-encoding',
 
-             'response-expires',
 
-             'response-content-disposition',
 
-             self::OSS_UPLOAD_ID,
 
-             self::OSS_COMP,
 
-             self::OSS_LIVE_CHANNEL_STATUS,
 
-             self::OSS_LIVE_CHANNEL_START_TIME,
 
-             self::OSS_LIVE_CHANNEL_END_TIME,
 
-             self::OSS_PROCESS,
 
-             self::OSS_POSITION,
 
-             self::OSS_SYMLINK,
 
-             self::OSS_RESTORE,
 
-             self::OSS_TAGGING,
 
-             self::OSS_WORM_ID,
 
-             self::OSS_TRAFFIC_LIMIT,
 
-             self::OSS_VERSION_ID,
 
-         );
 
-         foreach ($signableList as $item) {
 
-             if (isset($options[$item])) {
 
-                 $signableQueryStringParams[$item] = $options[$item];
 
-             }
 
-         }
 
-         if ($this->enableStsInUrl && (!is_null($this->securityToken))) {
 
-             $signableQueryStringParams["security-token"] = $this->securityToken;
 
-         }
 
-         return $signableQueryStringParams;
 
-     }
 
-     /**
 
-      *  Generates the resource uri for signing
 
-      *
 
-      * @param mixed $options
 
-      * @return string
 
-      */
 
-     private function generateSignableResource($options)
 
-     {
 
-         $signableResource = "";
 
-         $signableResource .= '/';
 
-         if (isset($options[self::OSS_BUCKET]) && '' !== $options[self::OSS_BUCKET]) {
 
-             $signableResource .= $options[self::OSS_BUCKET];
 
-             // if there's no object in options, adding a '/' if the host type is not IP.\
 
-             if ($options[self::OSS_OBJECT] == '/') {
 
-                 if ($this->hostType !== self::OSS_HOST_TYPE_IP) {
 
-                     $signableResource .= "/";
 
-                 }
 
-             }
 
-         }
 
-         //signable_resource + object
 
-         if (isset($options[self::OSS_OBJECT]) && '/' !== $options[self::OSS_OBJECT]) {
 
-             $signableResource .= '/' . str_replace(array('%2F', '%25'), array('/', '%'), rawurlencode($options[self::OSS_OBJECT]));
 
-         }
 
-         if (isset($options[self::OSS_SUB_RESOURCE])) {
 
-             $signableResource .= '?' . $options[self::OSS_SUB_RESOURCE];
 
-         }
 
-         return $signableResource;
 
-     }
 
-     /**
 
-      * generates query string
 
-      *
 
-      * @param mixed $options
 
-      * @return string
 
-      */
 
-     private function generateQueryString($options)
 
-     {
 
-         //query parameters
 
-         $queryStringParams = array();
 
-         if (isset($options[self::OSS_QUERY_STRING])) {
 
-             $queryStringParams = array_merge($queryStringParams, $options[self::OSS_QUERY_STRING]);
 
-         }
 
-         return OssUtil::toQueryString($queryStringParams);
 
-     }
 
-     private function stringToSignSorted($string_to_sign)
 
-     {
 
-         $queryStringSorted = '';
 
-         $explodeResult = explode('?', $string_to_sign);
 
-         $index = count($explodeResult);
 
-         if ($index === 1)
 
-             return $string_to_sign;
 
-         $queryStringParams = explode('&', $explodeResult[$index - 1]);
 
-         sort($queryStringParams);
 
-         foreach($queryStringParams as $params)
 
-         {
 
-              $queryStringSorted .= $params . '&';    
 
-         }
 
-         $queryStringSorted = substr($queryStringSorted, 0, -1);
 
-         return $explodeResult[0] . '?' . $queryStringSorted;
 
-     }
 
-     /**
 
-      * Initialize headers
 
-      *
 
-      * @param mixed $options
 
-      * @param string $hostname hostname
 
-      * @return array
 
-      */
 
-     private function generateHeaders($options, $hostname)
 
-     {
 
-         $headers = array(
 
-             self::OSS_CONTENT_MD5 => '',
 
-             self::OSS_CONTENT_TYPE => isset($options[self::OSS_CONTENT_TYPE]) ? $options[self::OSS_CONTENT_TYPE] : self::DEFAULT_CONTENT_TYPE,
 
-             self::OSS_DATE => isset($options[self::OSS_DATE]) ? $options[self::OSS_DATE] : gmdate('D, d M Y H:i:s \G\M\T'),
 
-             self::OSS_HOST => $hostname,
 
-         );
 
-         if (isset($options[self::OSS_CONTENT_MD5])) {
 
-             $headers[self::OSS_CONTENT_MD5] = $options[self::OSS_CONTENT_MD5];
 
-         }
 
-         //Add stsSecurityToken
 
-         if ((!is_null($this->securityToken)) && (!$this->enableStsInUrl)) {
 
-             $headers[self::OSS_SECURITY_TOKEN] = $this->securityToken;
 
-         }
 
-         //Merge HTTP headers
 
-         if (isset($options[self::OSS_HEADERS])) {
 
-             $headers = array_merge($headers, $options[self::OSS_HEADERS]);
 
-         }
 
-         return $headers;
 
-     }
 
-     /**
 
-      * Generates UserAgent
 
-      *
 
-      * @return string
 
-      */
 
-     private function generateUserAgent()
 
-     {
 
-         return self::OSS_NAME . "/" . self::OSS_VERSION . " (" . php_uname('s') . "/" . php_uname('r') . "/" . php_uname('m') . ";" . PHP_VERSION . ")";
 
-     }
 
-     /**
 
-      * Checks endpoint type and returns the endpoint without the protocol schema.
 
-      * Figures out the domain's type (ip, cname or private/public domain).
 
-      *
 
-      * @param string $endpoint
 
-      * @param boolean $isCName
 
-      * @return string The domain name without the protocol schema.
 
-      */
 
-     private function checkEndpoint($endpoint, $isCName)
 
-     {
 
-         $ret_endpoint = null;
 
-         if (strpos($endpoint, 'http://') === 0) {
 
-             $ret_endpoint = substr($endpoint, strlen('http://'));
 
-         } elseif (strpos($endpoint, 'https://') === 0) {
 
-             $ret_endpoint = substr($endpoint, strlen('https://'));
 
-             $this->useSSL = true;
 
-         } else {
 
-             $ret_endpoint = $endpoint;
 
-         }
 
-         $ret_endpoint = OssUtil::getHostPortFromEndpoint($ret_endpoint);
 
-         if ($isCName) {
 
-             $this->hostType = self::OSS_HOST_TYPE_CNAME;
 
-         } elseif (OssUtil::isIPFormat($ret_endpoint)) {
 
-             $this->hostType = self::OSS_HOST_TYPE_IP;
 
-         } else {
 
-             $this->hostType = self::OSS_HOST_TYPE_NORMAL;
 
-         }
 
-         return $ret_endpoint;
 
-     }
 
-     /**
 
-      * Check if all dependent extensions are installed correctly.
 
-      * For now only "curl" is needed.
 
-      * @throws OssException
 
-      */
 
-     public static function checkEnv()
 
-     {
 
-         if (function_exists('get_loaded_extensions')) {
 
-             //Test curl extension
 
-             $enabled_extension = array("curl");
 
-             $extensions = get_loaded_extensions();
 
-             if ($extensions) {
 
-                 foreach ($enabled_extension as $item) {
 
-                     if (!in_array($item, $extensions)) {
 
-                         throw new OssException("Extension {" . $item . "} is not installed or not enabled, please check your php env.");
 
-                     }
 
-                 }
 
-             } else {
 
-                 throw new OssException("function get_loaded_extensions not found.");
 
-             }
 
-         } else {
 
-             throw new OssException('Function get_loaded_extensions has been disabled, please check php config.');
 
-         }
 
-     }
 
-     /**
 
-      * Sets the http's timeout (in seconds)
 
-      *
 
-      * @param int $timeout
 
-      */
 
-     public function setTimeout($timeout)
 
-     {
 
-         $this->timeout = $timeout;
 
-     }
 
-     /**
 
-      * Sets the http's connection timeout (in seconds)
 
-      *
 
-      * @param int $connectTimeout
 
-      */
 
-     public function setConnectTimeout($connectTimeout)
 
-     {
 
-         $this->connectTimeout = $connectTimeout;
 
-     }
 
-     // Constants for Life cycle
 
-     const OSS_LIFECYCLE_EXPIRATION = "Expiration";
 
-     const OSS_LIFECYCLE_TIMING_DAYS = "Days";
 
-     const OSS_LIFECYCLE_TIMING_DATE = "Date";
 
-     //OSS Internal constants
 
-     const OSS_BUCKET = 'bucket';
 
-     const OSS_OBJECT = 'object';
 
-     const OSS_HEADERS = OssUtil::OSS_HEADERS;
 
-     const OSS_METHOD = 'method';
 
-     const OSS_QUERY = 'query';
 
-     const OSS_BASENAME = 'basename';
 
-     const OSS_MAX_KEYS = 'max-keys';
 
-     const OSS_UPLOAD_ID = 'uploadId';
 
-     const OSS_PART_NUM = 'partNumber';
 
-     const OSS_COMP = 'comp';
 
-     const OSS_LIVE_CHANNEL_STATUS = 'status';
 
-     const OSS_LIVE_CHANNEL_START_TIME = 'startTime';
 
-     const OSS_LIVE_CHANNEL_END_TIME = 'endTime';
 
-     const OSS_POSITION = 'position';
 
-     const OSS_MAX_KEYS_VALUE = 100;
 
-     const OSS_MAX_OBJECT_GROUP_VALUE = OssUtil::OSS_MAX_OBJECT_GROUP_VALUE;
 
-     const OSS_MAX_PART_SIZE = OssUtil::OSS_MAX_PART_SIZE;
 
-     const OSS_MID_PART_SIZE = OssUtil::OSS_MID_PART_SIZE;
 
-     const OSS_MIN_PART_SIZE = OssUtil::OSS_MIN_PART_SIZE;
 
-     const OSS_FILE_SLICE_SIZE = 8192;
 
-     const OSS_PREFIX = 'prefix';
 
-     const OSS_DELIMITER = 'delimiter';
 
-     const OSS_MARKER = 'marker';
 
-     const OSS_ACCEPT_ENCODING = 'Accept-Encoding';
 
-     const OSS_CONTENT_MD5 = 'Content-Md5';
 
-     const OSS_SELF_CONTENT_MD5 = 'x-oss-meta-md5';
 
-     const OSS_CONTENT_TYPE = 'Content-Type';
 
-     const OSS_CONTENT_LENGTH = 'Content-Length';
 
-     const OSS_IF_MODIFIED_SINCE = 'If-Modified-Since';
 
-     const OSS_IF_UNMODIFIED_SINCE = 'If-Unmodified-Since';
 
-     const OSS_IF_MATCH = 'If-Match';
 
-     const OSS_IF_NONE_MATCH = 'If-None-Match';
 
-     const OSS_CACHE_CONTROL = 'Cache-Control';
 
-     const OSS_EXPIRES = 'Expires';
 
-     const OSS_PREAUTH = 'preauth';
 
-     const OSS_CONTENT_COING = 'Content-Coding';
 
-     const OSS_CONTENT_DISPOSTION = 'Content-Disposition';
 
-     const OSS_RANGE = 'range';
 
-     const OSS_ETAG = 'etag';
 
-     const OSS_LAST_MODIFIED = 'lastmodified';
 
-     const OS_CONTENT_RANGE = 'Content-Range';
 
-     const OSS_CONTENT = OssUtil::OSS_CONTENT;
 
-     const OSS_BODY = 'body';
 
-     const OSS_LENGTH = OssUtil::OSS_LENGTH;
 
-     const OSS_HOST = 'Host';
 
-     const OSS_DATE = 'Date';
 
-     const OSS_AUTHORIZATION = 'Authorization';
 
-     const OSS_FILE_DOWNLOAD = 'fileDownload';
 
-     const OSS_FILE_UPLOAD = 'fileUpload';
 
-     const OSS_PART_SIZE = 'partSize';
 
-     const OSS_SEEK_TO = 'seekTo';
 
-     const OSS_SIZE = 'size';
 
-     const OSS_QUERY_STRING = 'query_string';
 
-     const OSS_SUB_RESOURCE = 'sub_resource';
 
-     const OSS_DEFAULT_PREFIX = 'x-oss-';
 
-     const OSS_CHECK_MD5 = 'checkmd5';
 
-     const DEFAULT_CONTENT_TYPE = 'application/octet-stream';
 
-     const OSS_SYMLINK_TARGET = 'x-oss-symlink-target';
 
-     const OSS_SYMLINK = 'symlink';
 
-     const OSS_HTTP_CODE = 'http_code';
 
-     const OSS_REQUEST_ID = 'x-oss-request-id';
 
-     const OSS_INFO = 'info';
 
-     const OSS_STORAGE = 'storage';
 
-     const OSS_RESTORE = 'restore';
 
-     const OSS_STORAGE_STANDARD = 'Standard';
 
-     const OSS_STORAGE_IA = 'IA';
 
-     const OSS_STORAGE_ARCHIVE = 'Archive';
 
-     const OSS_STORAGE_COLDARCHIVE = 'ColdArchive';
 
-     const OSS_TAGGING = 'tagging';
 
-     const OSS_WORM_ID = 'wormId';
 
-     const OSS_RESTORE_CONFIG = 'restore-config';
 
-     const OSS_KEY_MARKER = 'key-marker';
 
-     const OSS_VERSION_ID_MARKER = 'version-id-marker';
 
-     const OSS_VERSION_ID = 'versionId';
 
-     const OSS_HEADER_VERSION_ID = 'x-oss-version-id';
 
-     //private URLs
 
-     const OSS_URL_ACCESS_KEY_ID = 'OSSAccessKeyId';
 
-     const OSS_URL_EXPIRES = 'Expires';
 
-     const OSS_URL_SIGNATURE = 'Signature';
 
-     //HTTP METHOD
 
-     const OSS_HTTP_GET = 'GET';
 
-     const OSS_HTTP_PUT = 'PUT';
 
-     const OSS_HTTP_HEAD = 'HEAD';
 
-     const OSS_HTTP_POST = 'POST';
 
-     const OSS_HTTP_DELETE = 'DELETE';
 
-     const OSS_HTTP_OPTIONS = 'OPTIONS';
 
-     //Others
 
-     const OSS_ACL = 'x-oss-acl';
 
-     const OSS_OBJECT_ACL = 'x-oss-object-acl';
 
-     const OSS_OBJECT_GROUP = 'x-oss-file-group';
 
-     const OSS_MULTI_PART = 'uploads';
 
-     const OSS_MULTI_DELETE = 'delete';
 
-     const OSS_OBJECT_COPY_SOURCE = 'x-oss-copy-source';
 
-     const OSS_OBJECT_COPY_SOURCE_RANGE = "x-oss-copy-source-range";
 
-     const OSS_PROCESS = "x-oss-process";
 
-     const OSS_CALLBACK = "x-oss-callback";
 
-     const OSS_CALLBACK_VAR = "x-oss-callback-var";
 
-     const OSS_REQUEST_PAYER = "x-oss-request-payer";
 
-     const OSS_TRAFFIC_LIMIT = "x-oss-traffic-limit";
 
-     //Constants for STS SecurityToken
 
-     const OSS_SECURITY_TOKEN = "x-oss-security-token";
 
-     const OSS_ACL_TYPE_PRIVATE = 'private';
 
-     const OSS_ACL_TYPE_PUBLIC_READ = 'public-read';
 
-     const OSS_ACL_TYPE_PUBLIC_READ_WRITE = 'public-read-write';
 
-     const OSS_ENCODING_TYPE = "encoding-type";
 
-     const OSS_ENCODING_TYPE_URL = "url";
 
-     // Domain Types
 
-     const OSS_HOST_TYPE_NORMAL = "normal";//http://bucket.oss-cn-hangzhou.aliyuncs.com/object
 
-     const OSS_HOST_TYPE_IP = "ip";  //http://1.1.1.1/bucket/object
 
-     const OSS_HOST_TYPE_SPECIAL = 'special'; //http://bucket.guizhou.gov/object
 
-     const OSS_HOST_TYPE_CNAME = "cname";  //http://mydomain.com/object
 
-     //OSS ACL array
 
-     static $OSS_ACL_TYPES = array(
 
-         self::OSS_ACL_TYPE_PRIVATE,
 
-         self::OSS_ACL_TYPE_PUBLIC_READ,
 
-         self::OSS_ACL_TYPE_PUBLIC_READ_WRITE
 
-     );
 
-     // OssClient version information
 
-     const OSS_NAME = "aliyun-sdk-php";
 
-     const OSS_VERSION = "2.4.1";
 
-     const OSS_BUILD = "20200929";
 
-     const OSS_AUTHOR = "";
 
-     const OSS_OPTIONS_ORIGIN = 'Origin';
 
-     const OSS_OPTIONS_REQUEST_METHOD = 'Access-Control-Request-Method';
 
-     const OSS_OPTIONS_REQUEST_HEADERS = 'Access-Control-Request-Headers';
 
-     //use ssl flag
 
-     private $useSSL = false;
 
-     private $maxRetries = 3;
 
-     private $redirects = 0;
 
-     // user's domain type. It could be one of the four: OSS_HOST_TYPE_NORMAL, OSS_HOST_TYPE_IP, OSS_HOST_TYPE_SPECIAL, OSS_HOST_TYPE_CNAME
 
-     private $hostType = self::OSS_HOST_TYPE_NORMAL;
 
-     private $requestUrl;
 
-     private $requestProxy = null;
 
-     private $accessKeyId;
 
-     private $accessKeySecret;
 
-     private $hostname;
 
-     private $securityToken;
 
-     private $enableStsInUrl = false;
 
-     private $timeout = 0;
 
-     private $connectTimeout = 0;
 
- }
 
 
  |