@param bool|null $value
@param bool      $allowSerializeEmpty

@return BoolNode
327816
public static function create(bool $value = null, bool $allowSerializeEmpty = false): BoolNode
    {
        $node = new self();
        $node->value = $value;
        $node->allowSerializeEmpty = $allowSerializeEmpty;

        return $node;
    }
697063
function deserializeValue(value) {
    var num
    try {
      return value ?
        value == "true" ||
        ( value == "false" ? false :
          value == "null" ? null :
          !isNaN(num = Number(value)) ? num :
          /^[\[\{]/.test(value) ? $.parseJSON(value) :
          value )
        : value
    } catch(e) {
      return value
    }
  }
1095287
private function makeSerializable($value)
    {
        if (null === $value) {
            return $value;
        }

        if ($value instanceof Traversable || is_array($value)) {
            $value = ArrayUtils::iteratorToArray($value);

            foreach ($value as $key => $val) {
                $value[$key] = $this->makeSerializable($val);
            }

            return $value;
        }

        if (is_scalar($value)) {
            return $value;
        }

        if (is_resource($value)) {
            return 'resource';
        }

        return new ObjectStub($value);
    }
578477
public function isAccepted($value, $var = null)
    {
        if ($this->getContentInstance() instanceof ContentSet) {
            if (!($value instanceof AbstractClassContent)) {
                // ContentSet accepts only AbstractClassContent elements
                return false;
            }

            if (in_array('!' . $this->_getType($value), $this->_accept)) {
                // ContentSet can exclude content types
                return false;
            }

            $acceptArray = array_filter($this->_accept, function($item) { return '!' !== substr($item, 0, 1); });
        } else {
            if (null === $var) {
                return false;
            }

            if (!array_key_exists($var, $this->_accept)) {
                return true;
            }

            $acceptArray = $this->_accept[$var];
        }

        if (0 === count($acceptArray)) {
            return true;
        }

        return in_array($this->_getType($value), $acceptArray);
    }
180459
public static function mustBeNullableDouble($value)
    {
        if (is_double($value) === false && $value != null) {
            throw new MWrongTypeException('\$value', 'double|null', gettype($value));
        }
    }
540652
private static function hasType( $value, array $allowedTypes ) {
		// Apply strtolower because gettype returns "NULL" for null values.
		$type = strtolower( gettype( $value ) );

		if ( in_array( $type, $allowedTypes ) ) {
			return true;
		}

		if ( in_array( 'callable', $allowedTypes ) && is_callable( $value ) ) {
			return true;
		}

		if ( is_object( $value ) && self::isInstanceOf( $value, $allowedTypes ) ) {
			return true;
		}

		if ( is_array( $value ) && in_array( 'Traversable', $allowedTypes ) ) {
			return true;
		}

		return false;
	}
380342
public static function isJsonEncodable($value): bool
    {
        if ($value === null || is_scalar($value) || is_array($value)) {
            return true;
        }

        if (is_object($value) && ($value instanceof JsonSerializable)) {
            return true;
        }

        return false;
    }
879196
final protected function validateBool($value, array $allowed) : bool
    {
        if (true === in_array('bool', $allowed)) {
            if (true === is_bool($value)) {
                return true;
            }
        }

        return false;
    }
1222131
public static function boolval($value, $filterNullOnFailure = FALSE)
	{
		return filter_var($value, FILTER_VALIDATE_BOOLEAN, $filterNullOnFailure ? FILTER_NULL_ON_FAILURE : NULL);
	}
998198
public static function setType($value, $type, $nullable = TRUE)
	{
		if (!$nullable || NULL !== $value) {
			settype($value, $type);
		}

		return $value;
	}
1233391
public Serializer writeBoolean(Boolean value) throws IOException {
        if (null == value) return writeNull();

        writeRawString(value.toString());

        return this;
    }
1258745
public static function create(bool $allowSerializeEmpty = false): ArrayNode
    {
        $node = new self();
        $node->allowSerializeEmpty = $allowSerializeEmpty;

        return $node;
    }
823151
public function phpSerialize($value, $igBinary = true)
    {
        if ($igBinary && function_exists('igbinary_serialize')) {
            return igbinary_serialize($value);
        }

        return serialize($value);
    }
592945
public static function mustBeNullableLong($value)
    {
        if (is_long($value) === false && $value != null) {
            throw new MWrongTypeException('\$value', 'long|null', gettype($value));
        }
    }
605375
public static function isNullOrFile($value, $message = null)
    {
        if (!is_null($value) && !(is_string($value) && is_file($value))) {
            throw new InvalidArgumentException(sprintf(
                $message ?: 'Expected null or file, but got %s',
                Helper::valueToString($value)
            ));
        }
    }
1244568
public static function create(float $value = null, bool $allowSerializeEmpty = false): FloatNode
    {
        $node = new self();
        $node->value = $value;
        $node->allowSerializeEmpty = $allowSerializeEmpty;

        return $node;
    }
1996
public function valueObject($value, $exclude = false, $meaning = null)
    {
        switch (gettype($value)) {
            case 'boolean':
                $propertyValue = [
                    'booleanValue' => $value
                ];

                break;

            case 'integer':
                $propertyValue = [
                    'integerValue' => $value
                ];

                break;

            case 'double':
                $propertyValue = [
                    'doubleValue' => $value
                ];

                break;

            case 'string':
                $propertyValue = [
                    'stringValue' => $value
                ];

                break;

            case 'array':
                if (!empty($value) && $this->isAssoc($value)) {
                    $propertyValue = $this->convertArrayToEntityValue($value);
                } else {
                    $propertyValue = $this->convertArrayToArrayValue($value);
                }

                break;

            case 'object':
                $propertyValue = $this->objectProperty($value);
                break;

            case 'resource':
                $content = stream_get_contents($value);

                $propertyValue = [
                    'blobValue' => ($this->encode)
                        ? base64_encode($content)
                        : $content
                ];
                break;

            case 'NULL':
                $propertyValue = [
                    'nullValue' => null
                ];
                break;

            //@codeCoverageIgnoreStart
            case 'unknown type':
                throw new \InvalidArgumentException(sprintf(
                    'Unknown type for `%s',
                    $content
                ));
                break;

            default:
                throw new \InvalidArgumentException(sprintf(
                    'Invalid type for `%s',
                    $content
                ));
                break;
            //@codeCoverageIgnoreEnd
        }

        if ($exclude) {
            $propertyValue['excludeFromIndexes'] = true;
        }

        if ($meaning) {
            $propertyValue['meaning'] = $meaning;
        }

        return $propertyValue;
    }