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> | |
a9229942 | 11 | * @since 3.0 |
625136ac | 12 | */ |
a9229942 TD |
13 | trait TDatabaseObjectOptions |
14 | { | |
15 | /** | |
16 | * Returns true if at least one of the options required by this object is set. | |
17 | * | |
18 | * @return bool | |
19 | */ | |
20 | public function validateOptions() | |
21 | { | |
22 | if ($this->options) { | |
23 | $options = \explode(',', \strtoupper($this->options)); | |
24 | foreach ($options as $option) { | |
25 | if (\defined($option) && \constant($option)) { | |
26 | return true; | |
27 | } | |
28 | } | |
29 | ||
30 | return false; | |
31 | } | |
32 | ||
33 | return true; | |
34 | } | |
625136ac | 35 | } |