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 | * @return \stdClass Refined Microformats item |
||
60 | */ |
||
61 | 4 | protected static function createItem(array $item) |
|
69 | |||
70 | /** |
||
71 | * Process the item properties |
||
72 | * |
||
73 | * @param array $item Item |
||
74 | * @param array $microformatItem Refined Microformats item |
||
75 | */ |
||
76 | 4 | protected static function processProperties(array $item, array &$microformatItem) |
|
83 | |||
84 | /** |
||
85 | * Process the item value |
||
86 | * |
||
87 | * @param array $item Item |
||
88 | * @param array $microformatItem Refined Microformats item |
||
89 | */ |
||
90 | 4 | protected static function processValue(array $item, array &$microformatItem) |
|
96 | |||
97 | /** |
||
98 | * Process the nested item children |
||
99 | * |
||
100 | * @param array $item Item |
||
101 | * @param array $microformatItem Refined Microformats item |
||
102 | */ |
||
103 | 4 | protected static function processChildren(array $item, array &$microformatItem) |
|
109 | |||
110 | /** |
||
111 | * Refine the item types |
||
112 | * |
||
113 | * @param array $types Types |
||
114 | * @return array Refined types |
||
115 | */ |
||
116 | 4 | protected static function createTypes(array $types) |
|
124 | |||
125 | /** |
||
126 | * Refine the item properties |
||
127 | * |
||
128 | * @param array $properties Properties |
||
129 | * @param string $lang Item language |
||
130 | * @return array Refined properties |
||
131 | */ |
||
132 | 4 | protected static function createProperties(array $properties, &$lang) |
|
150 | |||
151 | /** |
||
152 | * Extract a language value from a value list |
||
153 | * |
||
154 | * @param array $values Value list |
||
155 | * @param string $lang Language |
||
156 | * @return array Remaining values |
||
157 | */ |
||
158 | 4 | protected static function createLanguage(array $values, &$lang) |
|
170 | |||
171 | /** |
||
172 | * Tag values with a language (if possible) |
||
173 | * |
||
174 | * @param array $values Values |
||
175 | * @return array Language tagged values |
||
176 | */ |
||
177 | 2 | protected static function tagLanguage(array $values) |
|
185 | |||
186 | /** |
||
187 | * Refine the item property values |
||
188 | * |
||
189 | * @param array $propertyValues Property values |
||
190 | * @return array Refined property values |
||
191 | */ |
||
192 | 4 | protected static function createProperty(array $propertyValues) |
|
205 | |||
206 | /** |
||
207 | * Refine the item value |
||
208 | * |
||
209 | * @param string $value Value |
||
210 | * @return string Refined value |
||
211 | */ |
||
212 | 4 | protected static function createValue($value) |
|
216 | |||
217 | /** |
||
218 | * Refine and convert the Microformats parser result |
||
219 | * |
||
220 | * @param array $items Items |
||
221 | * @return array Refined items |
||
222 | */ |
||
223 | 4 | public static function createFromParserResult(array $items) |
|
227 | } |
||
228 |