1 | <?php |
||
50 | class Repository |
||
51 | { |
||
52 | /** |
||
53 | * Default object configuration |
||
54 | * |
||
55 | * @var array |
||
56 | */ |
||
57 | protected static $defaultObjectConfig = [ |
||
58 | self::COUNT => 0, |
||
59 | self::DRAFTS => false, |
||
60 | self::HIDDEN => false, |
||
61 | self::REVISIONS => 0, |
||
62 | ]; |
||
63 | /** |
||
64 | * Object count |
||
65 | * |
||
66 | * @var string |
||
67 | */ |
||
68 | const COUNT = 'count'; |
||
69 | /** |
||
70 | * Object drafts |
||
71 | * |
||
72 | * @var string |
||
73 | */ |
||
74 | const DRAFTS = 'drafts'; |
||
75 | /** |
||
76 | * Hidden objects |
||
77 | * |
||
78 | * @var string |
||
79 | */ |
||
80 | const HIDDEN = 'hidden'; |
||
81 | /** |
||
82 | * Max. string |
||
83 | * |
||
84 | * @var int |
||
85 | */ |
||
86 | const REVISIONS = 'revisions'; |
||
87 | /** |
||
88 | * Object type |
||
89 | * |
||
90 | * @var int |
||
91 | */ |
||
92 | const TYPE = 'type'; |
||
93 | /** |
||
94 | * Create empty files only |
||
95 | * |
||
96 | * @var int |
||
97 | */ |
||
98 | const FLAG_EMPTY_FILES = 1; |
||
99 | /** |
||
100 | * Create root directory if non-existent |
||
101 | * |
||
102 | * @var int |
||
103 | */ |
||
104 | const FLAG_CREATE_ROOT_DIRECTORY = 2; |
||
105 | |||
106 | /** |
||
107 | * Setup a dummy repository |
||
108 | * |
||
109 | * @param string $root Root directory |
||
110 | * @param array $config Object configuration |
||
111 | * @param int $flags Build flags |
||
112 | */ |
||
113 | public static function generate($root, array $config, $flags = 0) |
||
132 | |||
133 | /** |
||
134 | * Validate and sanitize the object configuration |
||
135 | * |
||
136 | * @param array $config Object configuration |
||
137 | * @return array Object configuration |
||
138 | */ |
||
139 | protected static function sanitizeConfigArray(array $config) |
||
159 | |||
160 | /** |
||
161 | * Validate and sanitize a single object configuration |
||
162 | * |
||
163 | * @param string $type Object type |
||
164 | * @param array $config Single object configuration |
||
165 | * @return array Single object configuration |
||
166 | */ |
||
167 | protected static function sanitizeObjectConfig($type, array $config) |
||
188 | |||
189 | /** |
||
190 | * Setup a dummy repository with validated parameters |
||
191 | * |
||
192 | * @param string $root Root directory |
||
193 | * @param array $config Object configuration |
||
194 | * @param int $flags Build flags |
||
195 | */ |
||
196 | protected static function generateValidatedParams($root, array $config, $flags) |
||
214 | } |