Example #1
0
    /**
     * buildSetterBoolContent
     * @param Field  $field
     * @param string $content
     * @return string
     */
    protected function buildSetterBoolContent(Field $field, $content)
    {
        $content .= '		$preFilterValue = $' . $field->getShortName() . ';
        if(!is_null($preFilterValue)) {
            $' . $field->getShortName() . ' = $this->getFilter()->sanitize($' . $field->getShortName() . ', \'boolean\');
            if(is_null($' . $field->getShortName() . ')) {
                throw new \\InvalidArgumentException(\'Expected Type of boolean (1, true, on, yes, 0, false, off, no, ""), Invalid Value: \'.$preFilterValue);
            }
        } else {
            $' . $field->getShortName() . ' = $preFilterValue;
        }
';
        return $content;
    }