isSelected($checked); } /** * @inheritdoc */ public function isVisible($visible = true) { return $this->parents()->query('tag:label')->one(false)->isVisible($visible); } /** * Set checkbox state. * * @param boolean $checked checked or not * * @return $this */ public function set($checked) { if ($checked !== $this->isSelected()) { $this->click(true); } return $this; } /** * @inheritdoc */ public function getValue() { return $this->isChecked(); } /** * Set checkbox state to checked. * * @return $this */ public function check() { return $this->set(true); } /** * Set checkbox state to not checked. * * @return $this */ public function uncheck() { return $this->set(false); } /** * Get label element. * * @return CElement|CNullElement */ public function getLabel() { return $this->query('xpath:../label')->one(false); } /** * Get label text. * * @return string|null */ public function getText() { $label = $this->getLabel(); if ($label->isValid()) { return $label->getText(); } return null; } /** * Alias for set. * @see self::set * * @param boolean $checked checked or not * * @return $this */ public function fill($checked) { return $this->set($checked); } }