1: <?php
2: namespace Ctct\Components\Library;
3:
4: use Ctct\Components\Component;
5:
6: class Folder extends Component {
7: 8: 9: 10:
11: public $id;
12:
13: 14: 15: 16:
17: public $name;
18:
19: 20: 21: 22:
23: public $children;
24:
25: 26: 27: 28:
29: public $item_count;
30:
31: 32: 33: 34:
35: public $parent_id;
36:
37: 38: 39: 40:
41: public $level;
42:
43: 44: 45: 46:
47: public $created_date;
48:
49: 50: 51: 52:
53: public $modified_date;
54:
55: public static function create(array $props) {
56: $folder = new Folder();
57:
58: $folder->id = parent::getValue($props, "id");
59: $folder->name = parent::getValue($props, "name");
60: foreach ($props['children'] as $child) {
61: $folder->children[] = Folder::create($child);
62: }
63: $folder->item_count = parent::getValue($props, "item_count");
64: $folder->parent_id = parent::getValue($props, "parent_id");
65: $folder->level = parent::getValue($props, "level");
66: $folder->created_date = parent::getValue($props, "created_date");
67: $folder->modified_date = parent::getValue($props, "modified_date");
68:
69: return $folder;
70: }
71:
72: public function toJson() {
73: return json_encode($this);
74: }
75: }