Commit | Line | Data |
---|---|---|
625136ac MS |
1 | <?php |
2 | namespace wcf\data; | |
3 | ||
4 | /** | |
5 | * Provides a method for validating database object options. | |
6 | * | |
7 | * @author Matthias Schmidt | |
8 | * @copyright 2001-2015 WoltLab GmbH | |
9 | * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> | |
10 | * @package com.woltlab.wcf | |
11 | * @subpackage data | |
12 | * @category Community Framework | |
13 | */ | |
14 | trait TDatabaseObjectOptions { | |
15 | /** | |
16 | * Returns true if at least one of the options required by this object is set. | |
17 | * | |
18 | * @return boolean | |
19 | */ | |
20 | public function validateOptions() { | |
21 | if ($this->options) { | |
22 | $options = explode(',', strtoupper($this->options)); | |
23 | foreach ($options as $option) { | |
24 | if (defined($option) && constant($option)) { | |
25 | return true; | |
26 | } | |
27 | } | |
28 | ||
29 | return false; | |
30 | } | |
31 | ||
32 | return true; | |
33 | } | |
34 | } |