-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathBugzilla.class.php
40 lines (33 loc) · 1.15 KB
/
Bugzilla.class.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
35
36
37
38
39
40
<?php
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
$dir = dirname(__FILE__);
require_once ($dir . '/BugzillaOutput.class.php');
// Factory
class Bugzilla {
public static function create($config=array(), $opts=array(), $title='') {
// Default configuration
// FIXME: This should be in the main configuration
$theconfig = array(
'type' => 'bug',
'display' => 'table',
'stats' => 'show',
);
// Overlay user's desired configuration
foreach( $config as $key => $value ) {
$theconfig[$key] = $value;
}
$classes = [
'list' => 'List',
'number' => 'Number',
'inline' => 'Inline',
'table' => 'Table',
];
if (!array_key_exists($theconfig['display'], $classes)) {
$theconfig['display'] = 'table';
}
$class = 'Bugzilla'.$classes[$theconfig['display']];
return new $class($theconfig, $opts, $title);
}
}