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