setName($name); $this->setText($text); $this->setIsolated($isolated); } /** * Set the Name * * @param string $name Label Name * @return \FML\Script\ScriptLabel */ public function setName($name) { $this->name = (string)$name; return $this; } /** * Set the Text * * @param string $text Script Text * @return \FML\Script\ScriptLabel */ public function setText($text) { $this->text = (string)$text; return $this; } /** * Set Isolation * * @param bool $isolated Whether the Code should be isolated in an own Block * @return \FML\Script\ScriptLabel */ public function setIsolated($isolated) { $this->isolated = (bool)$isolated; return $this; } /** * Check if the given Label is an Event Label * * @param string $label Label Name * @return bool */ public static function isEventLabel($label) { $eventLabels = self::getEventLabels(); if (in_array($label, $eventLabels)) { return true; } return false; } /** * Get the possible Event Label Names * * @return array */ public static function getEventLabels() { return array(self::ENTRYSUBMIT, self::KEYPRESS, self::MOUSECLICK, self::MOUSEOUT, self::MOUSEOVER); } /** * Build the full Script Label Text * * @return string */ public function __toString() { $scriptText = Builder::getLabelImplementationBlock($this->name, $this->text, $this->isolated); return $scriptText; } }