| 1 | <?php |
| 2 | |
| 3 | namespace 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 | * @package WoltLabSuite\Core\Data |
| 12 | * @since 3.0 |
| 13 | */ |
| 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 | } |
| 36 | } |