1 | <?php |
||
8 | abstract class BufferBase { |
||
9 | |||
10 | |||
11 | /** |
||
12 | * The the array of buffers. |
||
13 | * |
||
14 | * @var \SplObjectStorage[] |
||
15 | */ |
||
16 | protected $buffers = []; |
||
17 | |||
18 | /** |
||
19 | * The array of result sets. |
||
20 | * |
||
21 | * @var \SplObjectStorage[] |
||
22 | */ |
||
23 | protected $results = []; |
||
24 | |||
25 | /** |
||
26 | * @param object $item |
||
27 | * The item to get the buffer id for. |
||
28 | * @return string |
||
29 | * The buffer id. |
||
30 | */ |
||
31 | protected function getBufferId($item) { |
||
34 | |||
35 | /** |
||
36 | * Helper function to create a resolver for a singular buffer. |
||
37 | * |
||
38 | * @param object $item |
||
39 | * The item to add to the buffer. |
||
40 | * |
||
41 | * @return \Closure |
||
42 | * The callback to invoke to load the result for this buffer item. |
||
43 | */ |
||
44 | protected function createBufferResolver($item) { |
||
60 | |||
61 | /** |
||
62 | * Creates a callback to invoke to load the result for this buffer item. |
||
63 | * |
||
64 | * @param object $item |
||
65 | * The item to add to create the resolver for. |
||
66 | * @param \SplObjectStorage $buffer |
||
67 | * The buffer. |
||
68 | * @param \SplObjectStorage $result |
||
69 | * The result set. |
||
70 | * |
||
71 | * @return \Closure |
||
72 | * The callback to invoke to load the result for this buffer item. |
||
73 | */ |
||
74 | protected function createResolver($item, \SplObjectStorage $buffer, \SplObjectStorage $result) { |
||
80 | |||
81 | /** |
||
82 | * Returns the result of the given item after processing the buffer if needed. |
||
83 | * |
||
84 | * @param object $item |
||
85 | * The buffer item to retrieve the result for. |
||
86 | * @param \SplObjectStorage $buffer |
||
87 | * The buffer. |
||
88 | * @param \SplObjectStorage $result |
||
89 | * The result set. |
||
90 | * |
||
91 | * @return mixed |
||
92 | * The result of resolving the given buffer item. |
||
93 | */ |
||
94 | protected function resolveItem($item, \SplObjectStorage $buffer, \SplObjectStorage $result) { |
||
109 | |||
110 | /** |
||
111 | * Resolves the given buffer wholly. |
||
112 | * |
||
113 | * @param \SplObjectStorage $buffer |
||
114 | * The buffer to be resolved wholly. |
||
115 | * |
||
116 | * @return \SplObjectStorage |
||
117 | * The resolved results for the given buffer, keyed by the corresponding |
||
118 | * buffer items. |
||
119 | */ |
||
120 | protected function resolveBuffer(\SplObjectStorage $buffer) { |
||
133 | |||
134 | /** |
||
135 | * Resolve the buffer as an array. |
||
136 | * |
||
137 | * Simplifies sub-class implementations by concealing the object storage |
||
138 | * details of the buffer object. |
||
139 | * |
||
140 | * @param array $buffer |
||
141 | * The buffer as an array. |
||
142 | * |
||
143 | * @return array |
||
144 | * The resolved results, keyed by their corresponding buffer item array key. |
||
145 | */ |
||
146 | protected function resolveBufferArray(array $buffer) { |
||
149 | } |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.