File indexing completed on 2024-12-22 05:36:31

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Cloud
0017  * @subpackage DocumentService
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0020  */
0021 
0022 // require_once 'Zend/Cloud/AbstractFactory.php';
0023 
0024 /**
0025  * Class implementing working with Azure queries in a structured way
0026  *
0027  * TODO Look into preventing a query injection attack.
0028  *
0029  * @category   Zend
0030  * @package    Zend_Cloud
0031  * @subpackage DocumentService
0032  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0033  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0034  */
0035 class Zend_Cloud_DocumentService_Factory extends Zend_Cloud_AbstractFactory
0036 {
0037     const DOCUMENT_ADAPTER_KEY = 'document_adapter';
0038 
0039     /**
0040      * @var string Interface which adapter must implement to be considered valid
0041      */
0042     protected static $_adapterInterface = 'Zend_Cloud_DocumentService_Adapter';
0043 
0044     /**
0045      * Constructor
0046      *
0047      * @return void
0048      */
0049     private function __construct()
0050     {
0051         // private ctor - should not be used
0052     }
0053 
0054     /**
0055      * Retrieve an adapter instance
0056      *
0057      * @param array $options
0058      * @return void
0059      */
0060     public static function getAdapter($options = array())
0061     {
0062         $adapter = parent::_getAdapter(self::DOCUMENT_ADAPTER_KEY, $options);
0063         if (!$adapter) {
0064             // require_once 'Zend/Cloud/DocumentService/Exception.php';
0065             throw new Zend_Cloud_DocumentService_Exception(
0066                 'Class must be specified using the \''
0067                 . self::DOCUMENT_ADAPTER_KEY . '\' key'
0068             );
0069         } elseif (!$adapter instanceof self::$_adapterInterface) {
0070             // require_once 'Zend/Cloud/DocumentService/Exception.php';
0071             throw new Zend_Cloud_DocumentService_Exception(
0072                 'Adapter must implement \'' . self::$_adapterInterface . '\''
0073             );
0074         }
0075         return $adapter;
0076     }
0077 }