web/lib/Zend/Service/WindowsAzure/Storage/BlobInstance.php
changeset 64 162c1de6545a
parent 19 1c2f13fd785c
child 68 ecaf28ffe26e
equal deleted inserted replaced
63:5b37998e522e 64:162c1de6545a
       
     1 <?php
       
     2 /**
       
     3  * Zend Framework
       
     4  *
       
     5  * LICENSE
       
     6  *
       
     7  * This source file is subject to the new BSD license that is bundled
       
     8  * with this package in the file LICENSE.txt.
       
     9  * It is also available through the world-wide-web at this URL:
       
    10  * http://framework.zend.com/license/new-bsd
       
    11  * If you did not receive a copy of the license and are unable to
       
    12  * obtain it through the world-wide-web, please send an email
       
    13  * to license@zend.com so we can send you a copy immediately.
       
    14  *
       
    15  * @category   Zend
       
    16  * @package    Zend_Service_WindowsAzure
       
    17  * @subpackage Storage
       
    18  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    20  * @version    $Id: BlobInstance.php 22773 2010-08-03 07:18:27Z maartenba $
       
    21  */
       
    22 
       
    23 /**
       
    24  * @see Zend_Service_WindowsAzure_Exception
       
    25  */
       
    26 require_once 'Zend/Service/WindowsAzure/Exception.php';
       
    27 
       
    28 /**
       
    29  * @see Zend_Service_WindowsAzure_Storage_StorageEntityAbstract
       
    30  */
       
    31 require_once 'Zend/Service/WindowsAzure/Storage/StorageEntityAbstract.php';
       
    32 
       
    33 /**
       
    34  * @category   Zend
       
    35  * @package    Zend_Service_WindowsAzure
       
    36  * @subpackage Storage
       
    37  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    38  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    39  * 
       
    40  * @property string  $Container       Container name
       
    41  * @property string  $Name            Name
       
    42  * @property string  $SnapshotId      Snapshot id
       
    43  * @property string  $Etag            Etag
       
    44  * @property string  $LastModified    Last modified date
       
    45  * @property string  $Url             Url
       
    46  * @property int     $Size            Size
       
    47  * @property string  $ContentType     Content Type
       
    48  * @property string  $ContentEncoding Content Encoding
       
    49  * @property string  $ContentLanguage Content Language
       
    50  * @property string  $CacheControl    Cache control
       
    51  * @property string  $BlobType        Blob type
       
    52  * @property string  $LeaseStatus     Lease status
       
    53  * @property boolean $IsPrefix        Is Prefix?
       
    54  * @property array   $Metadata        Key/value pairs of meta data
       
    55  */
       
    56 class Zend_Service_WindowsAzure_Storage_BlobInstance
       
    57 {
       
    58     /**
       
    59      * Data
       
    60      * 
       
    61      * @var array
       
    62      */
       
    63     protected $_data = null;
       
    64     
       
    65     /**
       
    66      * Constructor
       
    67      * 
       
    68      * @param string  $containerName   Container name
       
    69      * @param string  $name            Name
       
    70      * @param string  $snapshotId      Snapshot id
       
    71      * @param string  $etag            Etag
       
    72      * @param string  $lastModified    Last modified date
       
    73      * @param string  $url             Url
       
    74      * @param int     $size            Size
       
    75      * @param string  $contentType     Content Type
       
    76      * @param string  $contentEncoding Content Encoding
       
    77      * @param string  $contentLanguage Content Language
       
    78      * @param string  $cacheControl    Cache control
       
    79      * @param string  $blobType        Blob type
       
    80      * @param string  $leaseStatus     Lease status
       
    81      * @param boolean $isPrefix        Is Prefix?
       
    82      * @param array   $metadata        Key/value pairs of meta data
       
    83      */
       
    84     public function __construct($containerName, $name, $snapshotId, $etag, $lastModified, $url = '', $size = 0, $contentType = '', $contentEncoding = '', $contentLanguage = '', $cacheControl = '', $blobType = '', $leaseStatus = '', $isPrefix = false, $metadata = array()) 
       
    85     {	        
       
    86         $this->_data = array(
       
    87             'container'        => $containerName,
       
    88             'name'             => $name,
       
    89         	'snapshotid'	   => $snapshotId,
       
    90             'etag'             => $etag,
       
    91             'lastmodified'     => $lastModified,
       
    92             'url'              => $url,
       
    93             'size'             => $size,
       
    94             'contenttype'      => $contentType,
       
    95             'contentencoding'  => $contentEncoding,
       
    96             'contentlanguage'  => $contentLanguage,
       
    97             'cachecontrol'     => $cacheControl,
       
    98             'blobtype'         => $blobType,
       
    99             'leasestatus'      => $leaseStatus,
       
   100             'isprefix'         => $isPrefix,
       
   101             'metadata'         => $metadata
       
   102         );
       
   103     }
       
   104     
       
   105     /**
       
   106      * Magic overload for setting properties
       
   107      * 
       
   108      * @param string $name     Name of the property
       
   109      * @param string $value    Value to set
       
   110      */
       
   111     public function __set($name, $value) {
       
   112         if (array_key_exists(strtolower($name), $this->_data)) {
       
   113             $this->_data[strtolower($name)] = $value;
       
   114             return;
       
   115         }
       
   116 
       
   117         throw new Exception("Unknown property: " . $name);
       
   118     }
       
   119 
       
   120     /**
       
   121      * Magic overload for getting properties
       
   122      * 
       
   123      * @param string $name     Name of the property
       
   124      */
       
   125     public function __get($name) {
       
   126         if (array_key_exists(strtolower($name), $this->_data)) {
       
   127             return $this->_data[strtolower($name)];
       
   128         }
       
   129 
       
   130         throw new Exception("Unknown property: " . $name);
       
   131     }
       
   132 }