1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Mcneely\Core\Traits; |
4
|
|
|
|
5
|
|
|
/**r |
6
|
|
|
* Trait ArrayAccessTrait |
7
|
|
|
* |
8
|
|
|
* @package Mcneely\Core\Traits |
9
|
|
|
* @method \Mcneely\Core\CoreObject getCoreObject_CoreTrait() |
10
|
|
|
* @method mixed fireEvents_CoreTrait($eventClassObject, $eventImmediateClass, $eventMethod, $eventTrait) |
11
|
|
|
*/ |
12
|
|
|
trait ArrayAccessTrait |
13
|
|
|
{ |
14
|
2 |
|
public function offsetExists($offset) |
15
|
|
|
{ |
16
|
2 |
|
$this->fireEvents_CoreTrait($this, __CLASS__, __METHOD__, __TRAIT__); |
17
|
|
|
|
18
|
2 |
|
return $this->getObject_ArrayAccessTrait() |
19
|
2 |
|
->offsetExists($offset); |
20
|
|
|
} |
21
|
|
|
|
22
|
1 |
|
public function offsetGet($offset) |
23
|
|
|
{ |
24
|
1 |
|
$this->fireEvents_CoreTrait($this, __CLASS__, __METHOD__, __TRAIT__); |
25
|
|
|
|
26
|
1 |
|
return $this->getObject_ArrayAccessTrait() |
27
|
1 |
|
->offsetGet($offset); |
28
|
|
|
} |
29
|
|
|
|
30
|
1 |
|
public function offsetSet($offset, $value) |
31
|
|
|
{ |
32
|
1 |
|
$this->fireEvents_CoreTrait($this, __CLASS__, __METHOD__, __TRAIT__); |
33
|
|
|
|
34
|
1 |
|
$this->getObject_ArrayAccessTrait() |
35
|
1 |
|
->offsetSet($offset, $value); |
36
|
|
|
|
37
|
1 |
|
return $this; |
38
|
|
|
} |
39
|
|
|
|
40
|
1 |
|
public function offsetUnset($offset) |
41
|
|
|
{ |
42
|
1 |
|
$this->fireEvents_CoreTrait($this, __CLASS__, __METHOD__, __TRAIT__); |
43
|
|
|
|
44
|
1 |
|
$this->getObject_ArrayAccessTrait() |
45
|
1 |
|
->offsetUnset($offset); |
46
|
|
|
|
47
|
1 |
|
return $this; |
48
|
|
|
} |
49
|
|
|
|
50
|
2 |
|
private function getObject_ArrayAccessTrait() { |
51
|
2 |
|
$object = $this->getCoreObject_CoreTrait() |
52
|
2 |
|
->getObject(); |
53
|
2 |
|
return ($object instanceof \Generator) ? iterator_to_array($object) : $object; |
54
|
|
|
} |
55
|
|
|
} |