Overview

Namespaces

  • Knot
    • Dict
      • Helpers
    • Exceptions
  • None

Classes

  • Knot\Dict
  • Knot\Dict\AbstractDictBody
  • Knot\Dict\ChildDict
  • Knot\Dict\HelperManager
  • Knot\Dict\Helpers\AbstractPHPArrayHelper
  • Knot\Dict\Helpers\PHPArrayChangerHelper
  • Knot\Dict\Helpers\PHPArrayEqualizerHelper
  • Knot\Dict\Helpers\UnderscoreHelper
  • Knot\Dict\ParentDict

Interfaces

  • Knot\Dict\Helpers\HelperInterface

Traits

  • Knot\Dict\ArrayAccessTrait
  • Knot\Dict\CountableTrait
  • Knot\Dict\IteratorAggregateTrait
  • Knot\Dict\PathOperationsTrait

Exceptions

  • Knot\Exceptions\FunctionExecuteException
  • Knot\Exceptions\WrongArrayPathException
  • Knot\Exceptions\WrongFunctionException

Functions

  • ar
  • arr
  • arrRef
  • is_dict
  • Overview
  • Namespace
  • Class
 1: <?php namespace Knot\Dict;
 2: 
 3: trait ArrayAccessTrait {
 4: 
 5:     protected $data = [ ];
 6: 
 7: 
 8:     abstract public function __unset($index);
 9: 
10: 
11:     abstract public function __isset($index);
12: 
13: 
14:     abstract public function lastKey();
15: 
16: 
17:     /**
18:      * @param mixed $offset
19:      *
20:      * @return boolean
21:      */
22:     public function offsetExists($offset)
23:     {
24:         return $this->__isset($offset);
25:     }
26: 
27: 
28:     /**
29:      * @param mixed $offset
30:      *
31:      * @return mixed
32:      */
33:     public function &offsetGet($offset = null)
34:     {
35:         if ( is_null($offset) )
36:         {
37:             $this->data[] = [ ];
38: 
39:             return $this->data[$this->lastKey()];
40:         }
41: 
42:         return $this->data[$offset];
43:     }
44: 
45: 
46:     /**
47:      * @param mixed $offset
48:      * @param mixed $value
49:      *
50:      * @return void
51:      */
52:     public function offsetSet($offset, $value)
53:     {
54:         if ( is_null($offset) )
55:         {
56:             $this->data[] = $value;
57:         }
58:         else
59:         {
60:             $this->data[$offset] = $value;
61:         }
62:     }
63: 
64: 
65:     /**
66:      * @param mixed $offset
67:      *
68:      * @return void
69:      */
70:     public function offsetUnset($offset)
71:     {
72:         $this->__unset($offset);
73:     }
74: }
API documentation generated by ApiGen