[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/zend/Zend/Service/Amazon/ -> Abstract.php (source)

   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 [email protected] so we can send you a copy immediately.
  14   *
  15   * @category   Zend
  16   * @package    Zend_Service
  17   * @subpackage Amazon
  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$
  21   */
  22  
  23  /**
  24   * @see Zend_Service_Abstract
  25   */
  26  require_once 'Zend/Service/Abstract.php';
  27  
  28  /**
  29   * Abstract Amazon class that handles the credentials for any of the Web Services that
  30   * Amazon offers
  31   *
  32   * @category   Zend
  33   * @package    Zend_Service
  34   * @subpackage Amazon
  35   * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  36   * @license    http://framework.zend.com/license/new-bsd     New BSD License
  37   */
  38  abstract class Zend_Service_Amazon_Abstract extends Zend_Service_Abstract
  39  {
  40      /**
  41       * @var string Amazon Access Key
  42       */
  43      protected static $_defaultAccessKey = null;
  44  
  45      /**
  46       * @var string Amazon Secret Key
  47       */
  48      protected static $_defaultSecretKey = null;
  49  
  50      /**
  51       * @var string Amazon Secret Key
  52       */
  53      protected $_secretKey;
  54  
  55      /**
  56       * @var string Amazon Access Key
  57       */
  58      protected $_accessKey;
  59  
  60  
  61      /**
  62       * Set the keys to use when accessing SQS.
  63       *
  64       * @param  string $access_key       Set the default Access Key
  65       * @param  string $secret_key       Set the default Secret Key
  66       * @return void
  67       */
  68      public static function setKeys($accessKey, $secretKey)
  69      {
  70          self::$_defaultAccessKey = $accessKey;
  71          self::$_defaultSecretKey = $secretKey;
  72      }
  73  
  74      /**
  75       * Create Amazon client.
  76       *
  77       * @param  string $access_key       Override the default Access Key
  78       * @param  string $secret_key       Override the default Secret Key
  79       * @return void
  80       */
  81      public function __construct($accessKey=null, $secretKey=null)
  82      {
  83          if(!$accessKey) {
  84              $accessKey = self::$_defaultAccessKey;
  85          }
  86          if(!$secretKey) {
  87              $secretKey = self::$_defaultSecretKey;
  88          }
  89  
  90          if(!$accessKey || !$secretKey) {
  91              require_once 'Zend/Service/Amazon/Exception.php';
  92              throw new Zend_Service_Amazon_Exception("AWS keys were not supplied");
  93          }
  94          $this->_accessKey = $accessKey;
  95          $this->_secretKey = $secretKey;
  96      }
  97  
  98  
  99  
 100      /**
 101       * Method to fetch the Access Key
 102       *
 103       * @return string
 104       */
 105      protected function _getAccessKey()
 106      {
 107          return $this->_accessKey;
 108      }
 109  
 110      /**
 111       * Method to fetch the Secret AWS Key
 112       *
 113       * @return string
 114       */
 115      protected function _getSecretKey()
 116      {
 117          return $this->_secretKey;
 118      }
 119  }


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1