kreait / firebase-php
Showing 1 of 3 files from the diff.
Other files ignored by Codecov
CHANGELOG.md has changed.
composer.json has changed.

@@ -19,15 +19,19 @@
Loading
19 19
     */
20 20
    public function __construct(string $value)
21 21
    {
22 -
        $util = PhoneNumberUtil::getInstance();
22 +
        if (\class_exists(PhoneNumberUtil::class)) {
23 +
            $util = PhoneNumberUtil::getInstance();
23 24
24 -
        try {
25 -
            $parsed = $util->parse($value);
26 -
        } catch (NumberParseException $e) {
27 -
            throw new InvalidArgumentException('Invalid phone number: '.$e->getMessage());
25 +
            try {
26 +
                $parsed = $util->parse($value);
27 +
            } catch (NumberParseException $e) {
28 +
                throw new InvalidArgumentException('Invalid phone number: '.$e->getMessage());
29 +
            }
30 +
31 +
            $value = $util->format($parsed, PhoneNumberFormat::E164);
28 32
        }
29 33
30 -
        $this->value = $util->format($parsed, PhoneNumberFormat::E164);
34 +
        $this->value = $value;
31 35
    }
32 36
33 37
    public function __toString(): string
Files Complexity Coverage
src/Firebase 1,579 92.74%
Project Totals (150 files) 1579 92.74%
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