Merge pull request #5989 from WoltLab/wsc-rpc-api-const
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / data / TDatabaseObjectOptions.class.php
... / ...
CommitLineData
1<?php
2
3namespace wcf\data;
4
5/**
6 * Provides a method for validating database object options.
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 * @since 3.0
12 */
13trait 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 }
35}