Renders a boolean value

@param string $value the value to render
@return string the resulting html code
962231
protected function valueBool($value)
	{
		if ($value !== false && empty($value)) return Yii::$app->formatter->nullDisplay;
		return Yii::$app->formatter->asBoolean($value);
	}
221154
public static function isBooleanValue($value): bool
    {
        return is_bool($value) || self::isBooleanStringValue($value) || self::isBooleanNumericValue($value);
    }
660512
public static function parseArgValueOut(&$value)
	{
		if(isset($value[0]) && '#' === $value[0])
		{
			$value = substr($value,1);
			return true;
		}
		else
		{
			$value = '\'' . addcslashes($value,'\'') . '\'';
			return false;
		}
	}
165192
private static function getConvertedXmlValue($value)
    {
        $value = (string) $value; // convert from simplexml to string

        //handle numeric values
        if (is_numeric($value)) {
            if (ctype_digit($value)) {
                $value = intval($value);
            } else {
                $value = floatval($value);
            }
        }

        // handle booleans specially
        $lwr = strtolower($value);
        if ($lwr === "false") {
            return false;
        }
        if ($lwr === "true") {
            return true;
        }

        return $value;
    }
1102362
private function getPdoDataType($value)
	{
		$result = \PDO::PARAM_STR;

		if (is_bool($value)) {
			$result = \PDO::PARAM_BOOL;
		} elseif (is_null($value)) {
			$result = \PDO::PARAM_NULL;
		} elseif (is_int($value)) {
			$result = \PDO::PARAM_INT;
		}

		return $result;
	}
920505
protected function _value($value)
    {
        if ($value === null) {
            return 'null';
        }
        if ($value === true) {
            return 'true';
        }
        if ($value === false) {
            return 'false';
        }

        return (string)$value;
    }
1338045
private static function getStringValue($value) : string {
        if(is_bool($value)) {
            return $value === true ? 'true' : 'false';
        }
        return !is_string($value) ? strval($value) : $value;
    }
754084
public function compileString($value)
    {
        if (strpos($value, '@verbatim') !== false) {
            $value = $this->storeVerbatimBlocks($value);
        }

        $this->footer = [];

        if (strpos($value, '@php') !== false) {
            $value = $this->storePhpBlocks($value);
        }

        $result = '';

        // Here we will loop through all of the tokens returned by the Zend lexer and
        // parse each one into the corresponding valid PHP. We will then have this
        // template as the correctly rendered PHP that can be rendered natively.
        foreach (token_get_all($value) as $token) {
            $result .= is_array($token) ? $this->parseToken($token) : $token;
        }

        if (! empty($this->rawBlocks)) {
            $result = $this->restoreRawContent($result);
        }

        // If there are any footer lines that need to get added to a template we will
        // add them here at the end of the template. This gets used mainly for the
        // template inheritance via the extends keyword that should be appended.
        if (count($this->footer) > 0) {
            $result = $this->addFooters($result);
        }

        return $result;
    }
267449
protected function normalizeBoolean($value)
    {
        switch (true) {
            case $this->checkFlag(self::BOOLEAN_MODE_INTEGER):
            default:
                return (int) $value;

                break;

            case $this->checkFlag(self::BOOLEAN_MODE_BOOL_STRING):
                return $value === true ? 'true' : 'false';

                break;

            case $this->checkFlag(self::BOOLEAN_MODE_STRING):
                return $value === true ? 'On' : 'Off';

                break;
        }
    }
1208181
private function renderField(string $value): string
    {
        if (isset($this->field)) {
            $field = '';
            if (isset($this->namespace)) {
                $field = $this->namespace.'$';
            }
            $field .= $this->field;

            if (isset($this->matchType)) {
                $field .= '.'.$this->matchType;
            }
            $value .= $field.':';
        }

        return $value;
    }
449981
public static function string(&$value='', bool $flatten=false) {
		if (! $flatten && \is_array($value)) {
			foreach ($value as $k=>$v) {
				static::string($value[$k]);
			}
		}
		else {
			// Flatten single-entry arrays.
			if (\is_array($value) && (1 === \count($value))) {
				$value = data::array_pop_top($value);
			}

			if (\is_array($value)) {
				$value = '';
				return;
			}

			try {
				$value = (string) $value;
				if (
					$value &&
					(
						! \function_exists('mb_check_encoding') ||
						! \mb_check_encoding($value, 'ASCII')
					)
				) {
					sanitize::utf8($value);
				}
			} catch (\Throwable $e) {
				$value = '';
			}
		}
	}
353656
public function checkHtml($value)
    {
        if (!Type::isStringLike($value)) {
            return false;
        }

        $string = "$value";

        return $string != strip_tags($string);
    }
1230406
public function render($value, $class = 'btn-default', $style = null)
    {
        $class = trim($class);

        $extra = '';
        if ($this->isDisabled) {
            $extra .= ' disabled="disabled"';
        }
        if ($this->id !== null) {
            $extra .= ' id="'.$this->id.'"';
        }
        if ($this->name !== null) {
            $extra .= ' name="'.$this->name.'"';
        }
        if ($style !== null) {
            $extra .= ' style="'.$style.'"';
        }

        if ($this->isActive) {
            $class .= ' active';
        }
        if ($this->isBlock) {
            $class .= ' btn-block';
        }
        if ($this->size !== null) {
            $class .= ' '.$this->size;
        }

        if ($this->type == self::TYPE_ANCHOR) {
            if ($this->anchorTarget !== null) {
                $extra .= ' target="'.$this->anchorTarget.'"';
            }

            return sprintf($this->formatAnchor, $this->anchor, $class, $extra, $value);
        } elseif ($this->type == self::TYPE_INPUT) {
            return sprintf($this->formatInput, $this->inputType, $value, $class, $extra);
        } else {
            return sprintf($this->formatButton, $class, $extra, $value);
        }
    }
1085909
protected function _validate_bool($value)
    {
        if (is_bool($value)) {
            return (int)$value;
        }

        $trueValues = ['1', 'true', 'on'];
        $falseValues = ['0', 'false', 'off'];

        $value = strtolower($value);

        if (in_array($value, $trueValues, true)) {
            return 1;
        } elseif (in_array($value, $falseValues, true)) {
            return 0;
        } else {
            return null;
        }
    }
536952
public static function string($value='', bool $flatten=false) {
		ref\cast::string($value, $flatten);
		return $value;
	}
1271484
protected function castToBool($value, bool $nullable = true)
    {
        if (null === $value && $nullable) {
            return null;
        }

        return (bool) $value;
    }
458775
public function parseBoolean($value) {
    if (is_bool($value)) return $value;

    $exportValue = var_export($value, true);
    $e = new ParseException("$exportValue could not be parsed as a boolean");

    if (!is_string($value)) throw $e;

    switch (strtolower($value)) {
      case 'true':
      case 'on':
      case 'yes':
      case 'y':
        return true;
      case 'false':
      case 'off':
      case 'no':
      case 'n':
        return false;
      default:
        throw $e;
    }
  }