| 1 | package JMAP::Validation::Generators::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::Generators::String; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use JSON::PP; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use JSON::Typist; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 1 | my %types = ( | |||||||||
| 11 | emails => [qw{ | ||||||||||
| 12 | personal | ||||||||||
| 13 | work | ||||||||||
| 14 | other | ||||||||||
| 15 | }], | ||||||||||
| 16 | phones => [qw{ | ||||||||||
| 17 | home | ||||||||||
| 18 | work | ||||||||||
| 19 | mobile | ||||||||||
| 20 | fax | ||||||||||
| 21 | pager | ||||||||||
| 22 | other | ||||||||||
| 23 | }], | ||||||||||
| 24 | online => [qw{ | ||||||||||
| 25 | uri | ||||||||||
| 26 | username | ||||||||||
| 27 | other | ||||||||||
| 28 | }], | ||||||||||
| 29 | ); | ||||||||||
| 30 | |||||||||||
| 31 | sub generate { | ||||||||||
| 32 | 3 | ▶ | my ($type) = @_; | ||||||||
|
Subroutine
generate: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||
| 33 | |||||||||||
| 34 | 3 | my @ContactInformation; | |||||||||
| 35 | |||||||||||
| 36 | 3 | ▶ | foreach my $type_value (@{$types{$type} || []}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 12 | foreach my $label (JMAP::Validation::Generators::String->generate(), undef) { | |||||||||
| 38 | 24 | foreach my $isDefault (JSON::PP::true, JSON::PP::false) { | |||||||||
| 39 | 48 | push @ContactInformation, { | |||||||||
| 40 | type => JSON::Typist::String->new($type_value), | ||||||||||
| 41 | label => $label, | ||||||||||
| 42 | value => JMAP::Validation::Generators::String->generate(), | ||||||||||
| 43 | isDefault => $isDefault, | ||||||||||
| 44 | } | ||||||||||
| 45 | } | ||||||||||
| 46 | } | ||||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | 3 | return @ContactInformation; | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 1 | 1; | |||||||||