Source
xxxxxxxxxx
<?php
/*
** Zabbix
** Copyright (C) 2001-2022 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/**
* Trait for objects that can be casted to web elements.
*/
trait CastableTrait {
/**
* Cast object to base Element.
*
* @param array $options additional casting options
*
* @return CElement
*/
public function asElement($options = []) {
return $this->cast(CElement::class, $options);
}
/**
* Cast object to Checkbox element.
*
* @param array $options additional casting options
*
* @return CCheckboxElement
*/
public function asCheckbox($options = []) {
return $this->cast(CCheckboxElement::class, $options);
}
/**
* Cast object to CheckboxList element.
*
* @param array $options additional casting options
*
* @return CCheckboxElement
*/
public function asCheckboxList($options = []) {
return $this->cast(CCheckboxListElement::class, $options);
}
/**
* Cast object to Dashboard element.
*
* @param array $options additional casting options
*
* @return CDashboardElement
*/
public function asDashboard($options = []) {
return $this->cast(CDashboardElement::class, $options);
}
/**
* Cast object to List element.
*
* @deprecated List element is present only in IPMI tab of host configuration form.
*
* @param array $options additional casting options
*
* @return CListElement
*/
public function asList($options = []) {
return $this->cast(CListElement::class, $options);
}
/**
* Cast object to Dropdown element.
*
* @param array $options additional casting options
*
* @return CDropdownElement
*/
public function asDropdown($options = []) {
return $this->cast(CDropdownElement::class, $options);