Services_Amazon_S3
[ class tree: Services_Amazon_S3 ] [ index: Services_Amazon_S3 ] [ all elements ]

Source for file Prefix.php

Documentation is available at Prefix.php

  1. <?php
  2.  
  3. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  4.  
  5. /**
  6.  * Services_Amazon_S3_Prefix, represents a key prefix used for listing a
  7.  * subset of objects in a bucket.
  8.  *
  9.  * PHP version 5
  10.  *
  11.  * LICENSE:
  12.  *
  13.  * Copyright (c) 2008, Peytz & Co. A/S
  14.  * All rights reserved.
  15.  *
  16.  * Redistribution and use in source and binary forms, with or without
  17.  * modification, are permitted provided that the following conditions
  18.  * are met:
  19.  *
  20.  *  * Redistributions of source code must retain the above copyright
  21.  *    notice, this list of conditions and the following disclaimer.
  22.  *  * Redistributions in binary form must reproduce the above copyright
  23.  *    notice, this list of conditions and the following disclaimer in
  24.  *    the documentation and/or other materials provided with the distribution.
  25.  *  * Neither the name of the PHP_LexerGenerator nor the names of its
  26.  *    contributors may be used to endorse or promote products derived
  27.  *    from this software without specific prior written permission.
  28.  *
  29.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  30.  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  31.  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  32.  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  33.  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  34.  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  35.  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  36.  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  37.  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  38.  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  39.  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40.  *
  41.  * @category  Services
  42.  * @package   Services_Amazon_S3
  43.  * @author    Christian Schmidt <chsc@peytz.dk>
  44.  * @copyright 2008 Peytz & Co. A/S
  45.  * @license   http://www.opensource.org/licenses/bsd-license.php BSD
  46.  * @version   SVN: $Id$
  47.  * @link      http://pear.php.net/package/Services_Amazon_S3
  48.  */
  49.  
  50. /**
  51.  * All necessary classes are included from S3.php.
  52.  */
  53. require_once 'Services/Amazon/S3.php';
  54.  
  55. /**
  56.  * Services_Amazon_S3_Prefix represents a key prefix used for listing a
  57.  * subset of objects in a bucket.
  58.  *
  59.  * @category  Services
  60.  * @package   Services_Amazon_S3
  61.  * @author    Christian Schmidt <chsc@peytz.dk>
  62.  * @copyright 2008 Peytz & Co. A/S
  63.  * @license   http://www.opensource.org/licenses/bsd-license.php BSD
  64.  * @version   Release: @release-version@
  65.  * @link      http://pear.php.net/package/Services_Amazon_S3
  66.  */
  67. {
  68.     // {{{ public properties
  69.  
  70.     /**
  71.      * The bucket containing this prefix.
  72.      * @var Services_Amazon_S3 
  73.      */
  74.     public $bucket;
  75.  
  76.     /**
  77.      * This common prefix used by this
  78.      * @var string UTF-8 encoded prefix
  79.      */
  80.     public $prefix;
  81.  
  82.     /**
  83.      * This delimiter used when listing objects, or false if no delimiter is
  84.      * used.
  85.      * @var string|bool
  86.      */
  87.     public $delimiter = false;
  88.  
  89.     // }}}
  90.     // {{{ __construct()
  91.  
  92.     /**
  93.      * Constructor.
  94.      *
  95.      * @param Services_Amazon_S3_Resource_Bucket $bucket the bucket containing
  96.      *                                                    this prefix
  97.      * @param string                             $prefix the prefix string (UTF-8)
  98.      */
  99.     public function __construct(Services_Amazon_S3_Resource_Bucket $bucket,
  100.         $prefix
  101.     {
  102.         $this->bucket = $bucket;
  103.         $this->prefix = $prefix;
  104.     }
  105.  
  106.     // }}}
  107.     // {{{ getObjects()
  108.  
  109.     /**
  110.      * Returns an iterator over objects whose key starting with this common
  111.      * prefix.
  112.      *
  113.      * @return Services_Amazon_S3_ObjectIterator 
  114.      * @throws Services_Amazon_S3_Exception
  115.      */
  116.     public function getObjects()
  117.     {
  118.         return $this->bucket->getObjects($this->prefix$this->delimiter);
  119.     }
  120.  
  121.     // }}}
  122. }
  123.  
  124. ?>

Documentation generated on Wed, 15 Aug 2012 14:00:09 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.