-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate.php
34 lines (29 loc) · 1.14 KB
/
create.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
namespace oohtml;
//if (!class_exists("Create", false)) {
class Create {
private static function applyOptions ($item, $elementOptions) {
foreach ($elementOptions as $element => $options) {
foreach ($options as $option => $value) {
if ($option == "class") {
$item->$element->$option = "{$item->$element->$option} $value";
} else {
$item->$element->$option = $value;
}
}
}
}
private static function addToParent ($parent, $item) {
if (!is_null($parent)) {
$parent->addContent($item);
}
}
public static function __callStatic ($func, $args) {
list($parent, $child, $item, $options) = call_user_func_array("static::$func", $args);
self::applyOptions($item, $options);
self::addToParent($parent, $child);
return $item;
}
}
//}
?>