1 | <?php |
||
19 | class IdentityMap |
||
20 | { |
||
21 | /** |
||
22 | * @var \ArrayObject |
||
23 | */ |
||
24 | protected $idToObject; |
||
25 | |||
26 | /** |
||
27 | * @var \SplObjectStorage |
||
28 | */ |
||
29 | protected $objectToId; |
||
30 | |||
31 | public function __construct() |
||
36 | |||
37 | /** |
||
38 | * @param integer $key |
||
39 | * @param mixed $object |
||
40 | */ |
||
41 | public function set($key, $object) |
||
46 | |||
47 | /** |
||
48 | * @param mixed $object |
||
49 | * |
||
50 | * @throws \OutOfBoundsException |
||
51 | * @return integer |
||
52 | */ |
||
53 | public function getId($object) |
||
61 | |||
62 | /** |
||
63 | * @param integer $key |
||
64 | * |
||
65 | * @return boolean |
||
66 | */ |
||
67 | public function hasId($key) |
||
71 | |||
72 | /** |
||
73 | * @param mixed $object |
||
74 | * |
||
75 | * @return boolean |
||
76 | */ |
||
77 | public function hasObject($object) |
||
81 | |||
82 | /** |
||
83 | * @param integer $key |
||
84 | * |
||
85 | * @throws \OutOfBoundsException |
||
86 | * @return object |
||
87 | */ |
||
88 | public function getObject($key) |
||
96 | } |
||
97 |