| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package JMAP::Validation::Tests::Contact; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 4 |  |  | 4 |  | 13 | use strict; | 
|  | 4 |  |  |  |  | 4 |  | 
|  | 4 |  |  |  |  | 131 |  | 
| 4 | 4 |  |  | 4 |  | 12 | use warnings; | 
|  | 4 |  |  |  |  | 4 |  | 
|  | 4 |  |  |  |  | 69 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 4 |  |  | 4 |  | 1189 | use JMAP::Validation::Tests::Address; | 
|  | 4 |  |  |  |  | 6 |  | 
|  | 4 |  |  |  |  | 81 |  | 
| 7 | 4 |  |  | 4 |  | 16 | use JMAP::Validation::Tests::Array; | 
|  | 4 |  |  |  |  | 4 |  | 
|  | 4 |  |  |  |  | 51 |  | 
| 8 | 4 |  |  | 4 |  | 11 | use JMAP::Validation::Tests::Boolean; | 
|  | 4 |  |  |  |  | 4 |  | 
|  | 4 |  |  |  |  | 42 |  | 
| 9 | 4 |  |  | 4 |  | 9 | use JMAP::Validation::Tests::ContactInformation; | 
|  | 4 |  |  |  |  | 4 |  | 
|  | 4 |  |  |  |  | 132 |  | 
| 10 | 4 |  |  | 4 |  | 1164 | use JMAP::Validation::Tests::File; | 
|  | 4 |  |  |  |  | 4 |  | 
|  | 4 |  |  |  |  | 76 |  | 
| 11 | 4 |  |  | 4 |  | 14 | use JMAP::Validation::Tests::Object; | 
|  | 4 |  |  |  |  | 4 |  | 
|  | 4 |  |  |  |  | 42 |  | 
| 12 | 4 |  |  | 4 |  | 11 | use JMAP::Validation::Tests::String; | 
|  | 4 |  |  |  |  | 3 |  | 
|  | 4 |  |  |  |  | 572 |  | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | sub is_Contact { | 
| 15 | 248832 |  |  | 248832 | 0 | 193570 | my ($value) = @_; | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 248832 | 50 |  |  |  | 351927 | return unless JMAP::Validation::Tests::Object::is_object($value); | 
| 18 | 248832 | 50 |  |  |  | 472867 | return unless JMAP::Validation::Tests::String::is_id($value->{id}); | 
| 19 | 248832 | 50 |  |  |  | 1298707 | return unless JMAP::Validation::Tests::Boolean::is_boolean($value->{isFlagged}); | 
| 20 |  |  |  |  |  |  |  | 
| 21 | 248832 | 100 |  |  |  | 383886 | if (defined $value->{avatar}) { | 
| 22 | 221184 | 50 |  |  |  | 347121 | return unless JMAP::Validation::Tests::File::is_File($value->{avatar}); | 
| 23 |  |  |  |  |  |  | } | 
| 24 |  |  |  |  |  |  |  | 
| 25 | 248832 |  |  |  |  | 430016 | my @string_types = qw{ | 
| 26 |  |  |  |  |  |  | prefix | 
| 27 |  |  |  |  |  |  | firstName | 
| 28 |  |  |  |  |  |  | lastName | 
| 29 |  |  |  |  |  |  | suffix | 
| 30 |  |  |  |  |  |  | nickname | 
| 31 |  |  |  |  |  |  | company | 
| 32 |  |  |  |  |  |  | department | 
| 33 |  |  |  |  |  |  | jobTitle | 
| 34 |  |  |  |  |  |  | notes | 
| 35 |  |  |  |  |  |  | }; | 
| 36 |  |  |  |  |  |  |  | 
| 37 | 248832 |  |  |  |  | 213330 | foreach my $field (@string_types) { | 
| 38 | 2239488 | 50 |  |  |  | 3099328 | return unless JMAP::Validation::Tests::String::is_string($value->{$field}); | 
| 39 |  |  |  |  |  |  | } | 
| 40 |  |  |  |  |  |  |  | 
| 41 | 248832 | 50 |  |  |  | 375537 | return unless JMAP::Validation::Tests::String::is_date($value->{birthday}); | 
| 42 | 248832 | 50 |  |  |  | 386001 | return unless JMAP::Validation::Tests::String::is_date($value->{anniversary}); | 
| 43 |  |  |  |  |  |  |  | 
| 44 | 248832 |  |  |  |  | 255491 | foreach my $ContactInformation_type (qw{emails phones online}) { | 
| 45 | 746496 | 50 |  |  |  | 1217041 | return unless JMAP::Validation::Tests::Array::is_array($value->{$ContactInformation_type}); | 
| 46 |  |  |  |  |  |  |  | 
| 47 | 746496 |  |  |  |  | 868185 | my $method = "JMAP::Validation::Tests::ContactInformation::is_ContactInformation_$ContactInformation_type"; | 
| 48 | 746496 |  |  |  |  | 1220755 | $method    =~ s/s$//; | 
| 49 |  |  |  |  |  |  |  | 
| 50 | 746496 |  |  |  |  | 502100 | foreach my $ContactInformation (@{$value->{$ContactInformation_type}}) { | 
|  | 746496 |  |  |  |  | 919495 |  | 
| 51 | 4 |  |  | 4 |  | 15 | no strict 'refs'; | 
|  | 4 |  |  |  |  | 3 |  | 
|  | 4 |  |  |  |  | 400 |  | 
| 52 | 11943936 | 50 |  |  |  | 24150343 | return unless $method->($ContactInformation); | 
| 53 |  |  |  |  |  |  | } | 
| 54 |  |  |  |  |  |  | } | 
| 55 |  |  |  |  |  |  |  | 
| 56 | 248832 | 50 |  |  |  | 395038 | return unless JMAP::Validation::Tests::Array::is_array($value->{addresses}); | 
| 57 |  |  |  |  |  |  |  | 
| 58 | 248832 |  |  |  |  | 202623 | foreach my $address (@{$value->{addresses}}) { | 
|  | 248832 |  |  |  |  | 310989 |  | 
| 59 | 2488320 | 50 |  |  |  | 3031932 | return unless JMAP::Validation::Tests::Address::is_Address($address); | 
| 60 |  |  |  |  |  |  | } | 
| 61 | 248832 |  |  |  |  | 643481 | return 1; | 
| 62 |  |  |  |  |  |  | } | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | 1; |