/**
* Method to bind data to the form.
*
* @param mixed $data An array or object of data to bind to the form.
*
* @return boolean True on success.
*
* @since 1.7.0
*/
public function bind($data)
{
// Make sure there is a valid Form XML document.
if (!$this->xml instanceof \SimpleXMLElement) {
throw new \UnexpectedValueException(sprintf('%s::%s `xml` is not an instance of SimpleXMLElement', \get_class($this), __METHOD__));
}
// The data must be an object or array.
if (!\is_object($data) && !\is_array($data)) {
return false;
}
$this->bindLevel(null, $data);
return true;
}