CloneableFinalInstantiable
Constants
public Monolog\Utils::DEFAULT_JSON_FLAGS = 1344
Methods
public static getClass( $object) : string
 


  • internal
public static handleJsonError(int $code, $data, ?int $encodeFlags = NULL) : string
 
Handle a json_encode failure.

If the failure is due to invalid string encoding, try to clean the
input and encode again. If the second encoding attempt fails, the
inital error is not encoding related or the input can't be cleaned then
raise a descriptive exception.

  • throws RuntimeException if failure can't be corrected
  • return string JSON encoded data after error correction
public static jsonEncode( $data, ?int $encodeFlags = NULL, bool $ignoreErrors = false) : string
 
Return the JSON representation of a value

  • throws RuntimeException if encoding fails and errors are not ignored
  • return string when errors are ignored and the encoding fails, "null" is returned which is valid json for null
public static substr(string $string, int $start, ?int $length = NULL)
Methods
private static detectAndCleanUtf8( $data)
 
Detect invalid UTF-8 string characters and convert to valid UTF-8.

Valid UTF-8 input will be left unmodified, but strings containing
invalid UTF-8 codepoints will be reencoded as UTF-8 with an assumed
original encoding of ISO-8859-15. This conversion may result in
incorrect output if the actual encoding was not ISO-8859-15, but it
will be clean UTF-8 output and will not rely on expensive and fragile
detection algorithms.

Function converts the input in place in the passed variable so that it
can be used as a callback for array_walk_recursive.

    private static throwEncodeError(int $code, $data)
     
    Throws an exception according to a given code with a customized message

    • throws RuntimeException
    Methods
    private static detectAndCleanUtf8( $data)
     
    Detect invalid UTF-8 string characters and convert to valid UTF-8.

    Valid UTF-8 input will be left unmodified, but strings containing
    invalid UTF-8 codepoints will be reencoded as UTF-8 with an assumed
    original encoding of ISO-8859-15. This conversion may result in
    incorrect output if the actual encoding was not ISO-8859-15, but it
    will be clean UTF-8 output and will not rely on expensive and fragile
    detection algorithms.

    Function converts the input in place in the passed variable so that it
    can be used as a callback for array_walk_recursive.

      public static getClass( $object) : string
       


      • internal
      public static handleJsonError(int $code, $data, ?int $encodeFlags = NULL) : string
       
      Handle a json_encode failure.

      If the failure is due to invalid string encoding, try to clean the
      input and encode again. If the second encoding attempt fails, the
      inital error is not encoding related or the input can't be cleaned then
      raise a descriptive exception.

      • throws RuntimeException if failure can't be corrected
      • return string JSON encoded data after error correction
      public static jsonEncode( $data, ?int $encodeFlags = NULL, bool $ignoreErrors = false) : string
       
      Return the JSON representation of a value

      • throws RuntimeException if encoding fails and errors are not ignored
      • return string when errors are ignored and the encoding fails, "null" is returned which is valid json for null
      public static substr(string $string, int $start, ?int $length = NULL)
      private static throwEncodeError(int $code, $data)
       
      Throws an exception according to a given code with a customized message

      • throws RuntimeException
      © 2020 Bruce Wells
      Search Namespaces \ Classes
      ConfigurationNumbers (0-9.) only