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