Overview

Namespaces

  • OpenCloud
    • Autoscale
      • Resource
    • CloudMonitoring
      • Exception
      • Resource
    • Common
      • Collection
      • Constants
      • Exceptions
      • Http
        • Message
      • Log
      • Resource
      • Service
    • Compute
      • Constants
      • Exception
      • Resource
    • Database
      • Resource
    • DNS
      • Collection
      • Resource
    • Identity
      • Constants
      • Resource
    • Image
      • Enum
      • Resource
        • JsonPatch
        • Schema
    • LoadBalancer
      • Enum
      • Resource
    • ObjectStore
      • Constants
      • Exception
      • Resource
      • Upload
    • Orchestration
    • Queues
      • Exception
      • Resource
    • Volume
      • Resource
  • PHP

Classes

  • ArrayAccess
  • Base
  • Lang
  • Metadata
  • Overview
  • Namespace
  • Class
  • Tree
  • Download
 1: <?php
 2: 
 3: namespace OpenCloud\Common;
 4: 
 5: class ArrayAccess implements \ArrayAccess
 6: {
 7:     protected $elements;
 8: 
 9:     public function __construct($data = array())
10:     {
11:         $this->elements = (array) $data;
12:     }
13: 
14:     /**
15:      * Sets a value to a particular offset.
16:      *
17:      * @param mixed $offset
18:      * @param mixed $value
19:      */
20:     public function offsetSet($offset, $value)
21:     {
22:         if ($offset === null) {
23:             $this->elements[] = $value;
24:         } else {
25:             $this->elements[$offset] = $value;
26:         }
27:     }
28: 
29:     /**
30:      * Checks to see whether a particular offset key exists.
31:      *
32:      * @param mixed $offset
33:      * @return bool
34:      */
35:     public function offsetExists($offset)
36:     {
37:         return array_key_exists($offset, $this->elements);
38:     }
39: 
40:     /**
41:      * Unset a particular key.
42:      *
43:      * @param mixed $offset
44:      */
45:     public function offsetUnset($offset)
46:     {
47:         unset($this->elements[$offset]);
48:     }
49: 
50:     /**
51:      * Get the value for a particular offset key.
52:      *
53:      * @param mixed $offset
54:      * @return mixed|null
55:      */
56:     public function offsetGet($offset)
57:     {
58:         return $this->offsetExists($offset) ? $this->elements[$offset] : null;
59:     }
60: }
61: 
PHP OpenCloud API API documentation generated by ApiGen 2.8.0