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 | |
7b7b9764 | 8 | * @copyright 2001-2019 WoltLab GmbH |
625136ac | 9 | * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> |
e71525e4 MW |
10 | * @package WoltLabSuite\Core\Data |
11 | * @since 3.0 | |
625136ac MS |
12 | */ |
13 | trait TDatabaseObjectOptions { | |
14 | /** | |
15 | * Returns true if at least one of the options required by this object is set. | |
16 | * | |
1524f8c0 | 17 | * @return bool |
625136ac MS |
18 | */ |
19 | public function validateOptions() { | |
20 | if ($this->options) { | |
21 | $options = explode(',', strtoupper($this->options)); | |
22 | foreach ($options as $option) { | |
23 | if (defined($option) && constant($option)) { | |
24 | return true; | |
25 | } | |
26 | } | |
27 | ||
28 | return false; | |
29 | } | |
30 | ||
31 | return true; | |
32 | } | |
33 | } |