code: public static function parseBooleanValue($value): bool
      {
          if (\is_bool($value)) {
              return $value;
          }
  
          if (\is_string($value)) {
              $value = \strtolower($value);
              return 'true' === $value;
          }
  
          if (\is_object($value) || \is_array($value) || \is_callable($value)) {
              return false;
          }
  
          // anything else is simply casted to bool
          return (bool) $value;
      }
docs: Helper function to cast any value to a boolean representation.
  
  @param mixed $value
  @return bool