"Fossies" - the Fresh Open Source Software Archive

Member "icinga-web-1.14.1/lib/doctrine/lib/Doctrine/Access.php" (19 Dec 2017, 5174 Bytes) of package /linux/misc/old/icinga-web-1.14.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "Access.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 /*
    3  *  $Id: Access.php 7490 2010-03-29 19:53:27Z jwage $
    4  *
    5  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    6  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    7  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    8  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    9  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   10  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   11  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   12  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   13  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   14  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   15  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   16  *
   17  * This software consists of voluntary contributions made by many individuals
   18  * and is licensed under the LGPL. For more information, see
   19  * <http://www.doctrine-project.org>.
   20  */
   21 
   22 /**
   23  * Provides array access and property overload interface for Doctrine subclasses
   24  *
   25  * @package     Doctrine
   26  * @subpackage  Access
   27  * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
   28  * @link        www.doctrine-project.org
   29  * @since       1.0
   30  * @version     $Revision: 7490 $
   31  * @author      Konsta Vesterinen <kvesteri@cc.hut.fi>
   32  */
   33 abstract class Doctrine_Access extends Doctrine_Locator_Injectable implements ArrayAccess
   34 {
   35     /**
   36      * Set an entire aray to the data
   37      *
   38      * @param   array $array An array of key => value pairs
   39      * @return  Doctrine_Access
   40      */
   41     public function setArray(array $array)
   42     {
   43         foreach ($array as $k => $v) {
   44             $this->set($k, $v);
   45         }
   46 
   47         return $this;
   48     }
   49 
   50     /**
   51      * Set key and value to data
   52      *
   53      * @see     set, offsetSet
   54      * @param   $name
   55      * @param   $value
   56      * @return  void
   57      */
   58     public function __set($name, $value)
   59     {
   60         $this->set($name, $value);
   61     }
   62 
   63     /**
   64      * Get key from data
   65      *
   66      * @see     get, offsetGet
   67      * @param   mixed $name
   68      * @return  mixed
   69      */
   70     public function __get($name)
   71     {
   72         return $this->get($name);
   73     }
   74 
   75     /**
   76      * Check if key exists in data
   77      *
   78      * @param   string $name
   79      * @return  boolean whether or not this object contains $name
   80      */
   81     public function __isset($name)
   82     {
   83         return $this->contains($name);
   84     }
   85 
   86     /**
   87      * Remove key from data
   88      *
   89      * @param   string $name
   90      * @return  void
   91      */
   92     public function __unset($name)
   93     {
   94         return $this->remove($name);
   95     }
   96 
   97     /**
   98      * Check if an offset axists
   99      *
  100      * @param   mixed $offset
  101      * @return  boolean Whether or not this object contains $offset
  102      */
  103     public function offsetExists($offset)
  104     {
  105         return $this->contains($offset);
  106     }
  107 
  108     /**
  109      * An alias of get()
  110      *
  111      * @see     get, __get
  112      * @param   mixed $offset
  113      * @return  mixed
  114      */
  115     public function offsetGet($offset)
  116     {
  117         return $this->get($offset);
  118     }
  119 
  120     /**
  121      * Sets $offset to $value
  122      *
  123      * @see     set, __set
  124      * @param   mixed $offset
  125      * @param   mixed $value
  126      * @return  void
  127      */
  128     public function offsetSet($offset, $value)
  129     {
  130         if ( ! isset($offset)) {
  131             $this->add($value);
  132         } else {
  133             $this->set($offset, $value);
  134         }
  135     }
  136 
  137     /**
  138      * Unset a given offset
  139      *
  140      * @see   set, offsetSet, __set
  141      * @param mixed $offset
  142      */
  143     public function offsetUnset($offset)
  144     {
  145         return $this->remove($offset);
  146     }
  147 
  148     /**
  149      * Remove the element with the specified offset
  150      *
  151      * @param mixed $offset The offset to remove
  152      * @return boolean True if removed otherwise false
  153      */
  154     public function remove($offset)
  155     {
  156         throw new Doctrine_Exception('Remove is not supported for ' . get_class($this));
  157     }
  158 
  159     /**
  160      * Return the element with the specified offset
  161      *
  162      * @param mixed $offset     The offset to return
  163      * @return mixed
  164      */
  165     public function get($offset)
  166     {
  167         throw new Doctrine_Exception('Get is not supported for ' . get_class($this));
  168     }
  169 
  170     /**
  171      * Set the offset to the value
  172      *
  173      * @param mixed $offset The offset to set
  174      * @param mixed $value The value to set the offset to
  175      *
  176      */
  177     public function set($offset, $value)
  178     {
  179         throw new Doctrine_Exception('Set is not supported for ' . get_class($this));
  180     }
  181 
  182     /**
  183      * Check if the specified offset exists 
  184      * 
  185      * @param mixed $offset The offset to check
  186      * @return boolean True if exists otherwise false
  187      */
  188     public function contains($offset)
  189     {
  190         throw new Doctrine_Exception('Contains is not supported for ' . get_class($this));
  191     }
  192 
  193     /**
  194      * Add the value  
  195      * 
  196      * @param mixed $value The value to add 
  197      * @return void
  198      */
  199     public function add($value)
  200     {
  201         throw new Doctrine_Exception('Add is not supported for ' . get_class($this));
  202     }
  203 }