1 | <?php |
||
45 | class MicroformatsFactory |
||
46 | { |
||
47 | /** |
||
48 | * Microformats 2 profile URI |
||
49 | * |
||
50 | * @var string |
||
51 | * @link http://microformats.org/wiki/microformats-2# |
||
52 | */ |
||
53 | const MF2_PROFILE_URI = 'http://microformats.org/profile/'; |
||
54 | |||
55 | /** |
||
56 | * Refine an item |
||
57 | * |
||
58 | * @param array $item Item |
||
59 | * |
||
60 | * @return \stdClass Refined Microformats item |
||
61 | */ |
||
62 | 4 | protected static function createItem(array $item) |
|
71 | |||
72 | /** |
||
73 | * Refine the item types |
||
74 | * |
||
75 | * @param array $types Types |
||
76 | * |
||
77 | * @return array Refined types |
||
78 | */ |
||
79 | 4 | protected static function createTypes(array $types) |
|
88 | |||
89 | /** |
||
90 | * Process the item properties |
||
91 | * |
||
92 | * @param array $item Item |
||
93 | * @param array $microformatItem Refined Microformats item |
||
94 | */ |
||
95 | 4 | protected static function processProperties(array $item, array &$microformatItem) |
|
102 | |||
103 | /** |
||
104 | * Refine the item properties |
||
105 | * |
||
106 | * @param array $properties Properties |
||
107 | * @param string $lang Item language |
||
108 | * |
||
109 | * @return array Refined properties |
||
110 | */ |
||
111 | 4 | protected static function createProperties(array $properties, &$lang) |
|
130 | |||
131 | /** |
||
132 | * Extract a language value from a value list |
||
133 | * |
||
134 | * @param array $values Value list |
||
135 | * @param string $lang Language |
||
136 | * |
||
137 | * @return array Remaining values |
||
138 | */ |
||
139 | 4 | protected static function createLanguage(array $values, &$lang) |
|
151 | |||
152 | /** |
||
153 | * Refine the item property values |
||
154 | * |
||
155 | * @param array $propertyValues Property values |
||
156 | * |
||
157 | * @return array Refined property values |
||
158 | */ |
||
159 | 4 | protected static function createProperty(array $propertyValues) |
|
173 | |||
174 | /** |
||
175 | * Tag values with a language (if possible) |
||
176 | * |
||
177 | * @param array $values Values |
||
178 | * |
||
179 | * @return array Language tagged values |
||
180 | */ |
||
181 | 2 | protected static function tagLanguage(array $values) |
|
190 | |||
191 | /** |
||
192 | * Process the item value |
||
193 | * |
||
194 | * @param array $item Item |
||
195 | * @param array $microformatItem Refined Microformats item |
||
196 | */ |
||
197 | 4 | protected static function processValue(array $item, array &$microformatItem) |
|
203 | |||
204 | /** |
||
205 | * Refine the item value |
||
206 | * |
||
207 | * @param string $value Value |
||
208 | * |
||
209 | * @return string Refined value |
||
210 | */ |
||
211 | 4 | protected static function createValue($value) |
|
215 | |||
216 | /** |
||
217 | * Process the nested item children |
||
218 | * |
||
219 | * @param array $item Item |
||
220 | * @param array $microformatItem Refined Microformats item |
||
221 | */ |
||
222 | 4 | protected static function processChildren(array $item, array &$microformatItem) |
|
228 | |||
229 | /** |
||
230 | * Refine and convert the Microformats parser result |
||
231 | * |
||
232 | * @param array $items Items |
||
233 | * |
||
234 | * @return array Refined items |
||
235 | */ |
||
236 | 4 | public static function createFromParserResult(array $items) |
|
240 | } |
||
241 |