public function hasValue()
{
// don't send a value for unchecked checkboxes
- if (in_array($this->type, array('checkbox', 'radio')) && null === $this->value) {
+ if (\in_array($this->type, array('checkbox', 'radio')) && null === $this->value) {
return false;
}
/**
* Sets the value of the field.
*
- * @param string $value The value of the field
+ * @param string|array $value The value of the field
*/
public function select($value)
{
}
/**
- * Ticks a checkbox.
+ * Unticks a checkbox.
*
* @throws \LogicException When the type provided is not correct
*/
public function untick()
{
if ('checkbox' !== $this->type) {
- throw new \LogicException(sprintf('You cannot tick "%s" as it is not a checkbox (%s).', $this->name, $this->type));
+ throw new \LogicException(sprintf('You cannot untick "%s" as it is not a checkbox (%s).', $this->name, $this->type));
}
$this->setValue(false);
/**
* Sets the value of the field.
*
- * @param string $value The value of the field
+ * @param string|array $value The value of the field
*
* @throws \InvalidArgumentException When value type provided is not correct
*/
// check
$this->value = $this->options[0]['value'];
} else {
- if (is_array($value)) {
+ if (\is_array($value)) {
if (!$this->multiple) {
throw new \InvalidArgumentException(sprintf('The value for "%s" cannot be an array.', $this->name));
}
$value = (array) $value;
}
- if (is_array($value)) {
+ if (\is_array($value)) {
$this->value = $value;
} else {
parent::setValue($value);