Showing 1 of 3 files from the diff.

@@ -27,6 +27,13 @@
Loading
27 27
                throw new InvalidArgumentException('Message data must be a one-dimensional array of string(able) keys and values.');
28 28
            }
29 29
30 +
            if (self::isBinary((string) $value)) {
31 +
                throw new InvalidArgumentException(
32 +
                    "The message data field '{$key}' seems to contain binary data. As this can lead to broken messages, "
33 +
                    .'please convert it to a string representation first, e.g. with bin2hex() or base64encode().'
34 +
                );
35 +
            }
36 +
30 37
            $messageData->data[(string) $key] = (string) $value;
31 38
        }
32 39
@@ -48,4 +55,9 @@
Loading
48 55
    {
49 56
        return \is_null($value) || \is_scalar($value) || (\is_object($value) && \method_exists($value, '__toString'));
50 57
    }
58 +
59 +
    private static function isBinary(string $value): bool
60 +
    {
61 +
        return \mb_detect_encoding($value) === false;
62 +
    }
51 63
}
Files Complexity Coverage
src/Firebase 1,376 67.92%
Project Totals (146 files) 1376 67.92%
1
comment:
2
  layout: "reach,diff"
3

4
coverage:
5
  status:
6
    project:
7
      default:
8
        informational: true
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading