Merge pull request #16566 from eileenmcnaughton/setting_fix
[civicrm-core.git] / CRM / Case / XMLProcessor / Settings.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 */
17 class CRM_Case_XMLProcessor_Settings extends CRM_Case_XMLProcessor {
18
19 private $_settings = [];
20
21 /**
22 * Run.
23 *
24 * @param string $filename
25 * The base filename without the .xml extension
26 *
27 * @return array
28 * An array of settings.
29 */
30 public function run($filename = 'settings') {
31 $xml = $this->retrieve($filename);
32
33 // For now it's not an error. In the future it might be a required file.
34 if ($xml !== FALSE) {
35 // There's only one setting right now, and only one value.
36 if ($xml->group[0]) {
37 if ($xml->group[0]->attributes()) {
38 $groupName = (string) $xml->group[0]->attributes()->name;
39 if ($groupName) {
40 $this->_settings['groupname'] = $groupName;
41 }
42 }
43 }
44 }
45 return $this->_settings;
46 }
47
48 }