Merge pull request #15850 from civicrm/5.20
[civicrm-core.git] / CRM / Case / XMLProcessor / Settings.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
bc77d7c0 4 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 5 | |
bc77d7c0
TO
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 |
6a488035 9 +--------------------------------------------------------------------+
d25dd0ee 10 */
6a488035
TO
11
12/**
13 *
14 * @package CRM
ca5cec67 15 * @copyright CiviCRM LLC https://civicrm.org/licensing
6a488035
TO
16 */
17class CRM_Case_XMLProcessor_Settings extends CRM_Case_XMLProcessor {
18
be2fb01f 19 private $_settings = [];
6a488035 20
4c6ce474 21 /**
67d19299 22 * Run.
23 *
4c6ce474 24 * @param string $filename
67d19299 25 * The base filename without the .xml extension
4c6ce474
EM
26 *
27 * @return array
67d19299 28 * An array of settings.
4c6ce474 29 */
00be9182 30 public function run($filename = 'settings') {
6a488035
TO
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 }
96025800 47
6a488035 48}