initial checkin
[m6w6/hikke] / lib / hikke / Event / Bucket.php
1 <?php
2
3 /**
4 * Hikke
5 *
6 * @author Michael Wallner <mike@php.net>
7 */
8 namespace hikke\Event;
9
10 use hikke\Event\Priority;
11
12 /**
13 * Bucket
14 *
15 * @package hikke\Event
16 */
17 class Bucket extends Priority
18 {
19 /**
20 * @var object
21 */
22 private $object;
23
24 /**
25 * @var float
26 */
27 private $priority;
28
29 /**
30 * @var string
31 */
32 private $hash;
33
34 /**
35 * Create a new storage bucket
36 * @param object $object
37 * @param float $priority
38 */
39 public function __construct($object, $priority) {
40 $this->object = $object;
41 $this->priority = $priority;
42 }
43
44 /**
45 * Get the priority of the object in the bucket
46 * @return float
47 */
48 public function getPriority() {
49 return $this->priority;
50 }
51
52 /**
53 * Get the object contained in this bucket
54 * @return object
55 */
56 public function getObject() {
57 return $this->object;
58 }
59
60 /**
61 * Get the hash of the object contained in this bucket
62 * @return string
63 */
64 public function getHash() {
65 if (!isset($this->hash)) {
66 $this->hash = spl_object_hash($this->object);
67 }
68 return $this->hash;
69 }
70 }