« blib/lib/JMAP/Validation/Tests/String.pm
↑ Summary
blib/lib/JMAP/Validation/Generators/SetError.pm »
| 1 | package JMAP::Validation::Tests::ContactInformation; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use JMAP::Validation::Tests::Boolean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use JMAP::Validation::Tests::Object; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use JMAP::Validation::Tests::String; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | sub is_ContactInformation { | ||||||||||
| 11 | 48 | ▶ | my ($value) = @_; | ||||||||
|
Subroutine
is_ContactInformation: called CC=8 SCAR=22.1
Pod
undocumented
| |||||||||||
| 12 | |||||||||||
| 13 | 48 | ▶ | return unless JMAP::Validation::Tests::Object::is_object($value); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | |||||||||||
| 15 | 48 | ▶ | return unless JMAP::Validation::Tests::String::is_string($value->{type}); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | 48 | ▶ | return unless $value->{type} =~ qr{fax|home|mobile|other|pager|personal|uri|username|work}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | |||||||||||
| 18 | 48 | ▶ | if (defined $value->{label}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | 24 | ▶ | return unless JMAP::Validation::Tests::String::is_string($value->{label}); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | 48 | ▶ | return unless JMAP::Validation::Tests::String::is_string($value->{value}); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | 48 | ▶ | return unless JMAP::Validation::Tests::Boolean::is_boolean($value->{isDefault}); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | |||||||||||
| 25 | 48 | return 1; | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | sub is_ContactInformation_email { | ||||||||||
| 29 | 12 | ▶ | my ($value) = @_; | ||||||||
|
Subroutine
is_ContactInformation_email: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||
| 30 | |||||||||||
| 31 | 12 | ▶ | return unless is_ContactInformation($value); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 12 | ▶ | return unless $value->{type} =~ qr{personal|work|other}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | |||||||||||
| 34 | 12 | return 1; | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | sub is_ContactInformation_phone { | ||||||||||
| 38 | 24 | ▶ | my ($value) = @_; | ||||||||
|
Subroutine
is_ContactInformation_phone: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||
| 39 | |||||||||||
| 40 | 24 | ▶ | return unless is_ContactInformation($value); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 41 | 24 | ▶ | return unless $value->{type} =~ qr{home|work|mobile|fax|pager|other}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | |||||||||||
| 43 | 24 | return 1; | |||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | sub is_ContactInformation_online { | ||||||||||
| 47 | 12 | ▶ | my ($value) = @_; | ||||||||
|
Subroutine
is_ContactInformation_online: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||
| 48 | |||||||||||
| 49 | 12 | ▶ | return unless is_ContactInformation($value); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | 12 | ▶ | return unless $value->{type} =~ qr{uri|username|other}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | |||||||||||
| 52 | 12 | return 1; | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | 1 | 1; | |||||||||