DRI/Data/Contact/FCCN.pm

filter: Statementstmt 60.7% 17 / 28 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 23 MC/DCmcdc 0.0% 0 / 12 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 26.8% 22 / 82 CC 15 SCAR 51.9
CC
15
Cov
27%
validate
240.0
BEGIN
1.0
BEGIN
1.0
CRAP 180.2
« DRI/Protocol/EPP/Extensions/LU/Poll.pm ↑ Summary DRI/Protocol/EPP/Extensions/DNSBE/Notifications.pm »
1 ## Domain Registry Interface, Handling of contact data for .PT
2 ##
3 ## Copyright (c) 2008,2013 Patrick Mevzek <netdri@dotandco.com>. All rights reserved.
4 ##
5 ## This file is part of Net::DRI
6 ##
7 ## Net::DRI is free software; you can redistribute it and/or modify
8 ## it under the terms of the GNU General Public License as published by
9 ## the Free Software Foundation; either version 2 of the License, or
10 ## (at your option) any later version.
11 ##
12 ## See the LICENSE file that comes with this distribution for more details.
13 ####################################################################################################
14  
15 package Net::DRI::Data::Contact::FCCN;
16  
17 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 2 ▶use base qw/Net::DRI::Data::Contact/;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 ▶use Net::DRI::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 2 __PACKAGE__->register_attributes(qw(type identification mobile));
25  
26 =pod
27  
28 =head1 NAME
29  
30 Net::DRI::Data::Contact::FCCN - Handle FCCN (.PT) contact data for Net::DRI
31  
32 =head1 DESCRIPTION
33  
34 This subclass of Net::DRI::Data::Contact adds accessors and validation for
35 .PT specific data.
36  
37 =head1 METHODS
38  
39 The following mutators can be called in chain, as they all return the object itself.
40  
41 =head2 type()
42  
43 type of contact (individual or organization)
44  
45 =head2 identification()
46  
47 formal identification of the contact
48  
49 =head2 mobile()
50  
51 mobile number of the contact
52  
53 =head1 SUPPORT
54  
55 For now, support questions should be sent to:
56  
57 E<lt>netdri@dotandco.comE<gt>
58  
59 Please also see the SUPPORT file in the distribution.
60  
61 =head1 SEE ALSO
62  
63 http://www.dotandco.com/services/software/Net-DRI/
64  
65 =head1 AUTHOR
66  
67 Patrick Mevzek, E<lt>netdri@dotandco.comE<gt>
68  
69 =head1 COPYRIGHT
70  
71 Copyright (c) 2008,2013 Patrick Mevzek <netdri@dotandco.com>.
72 All rights reserved.
73  
74 This program is free software; you can redistribute it and/or modify
75 it under the terms of the GNU General Public License as published by
76 the Free Software Foundation; either version 2 of the License, or
77 (at your option) any later version.
78  
79 See the LICENSE file that comes with this distribution for more details.
80  
81 =cut
82  
83 ####################################################################################################
84  
85 sub validate
86 0 ▶{
Subroutine validate: not called CC=15 SCAR=54.8
Pod undocumented
87 0 my ($self,$change)=@_;
88 0 ▶ $change||=0;
Condition0%0/2
$change ||= 0
l!l
00
MC/DC0%0/1
$change ||= 0
$change
Truth table0%0/2
A
A= $change
Aresult
11
00
89 0 my @errs;
90  
91 0 $self->SUPER::validate($change); ## will trigger an Exception if problem
92  
93 0 ▶ if (!$change)
Branch: 1 branch
BranchTrueFalseTotal
unless ($change) 0 0 0
94 {
95 0 ▶ Net::DRI::Exception::usererr_insufficient_parameters('identification is mandatory') unless ($self->identification() && Net::DRI::Util::has_key($self->identification(),'value'));
Branch: 1 branch
BranchTrueFalseTotal
unless $self->identification and Net::DRI::Util::has_key($self->identification, "value") 0 0 0
Condition0%0/3
$self->identification and Net::DRI::Util::has_key($self->identification, "value")
!ll&&!rl&&r
000
MC/DC0%0/2
$self->identification and Net::DRI::Util::has_key($self->identification, "value")
$self->identification Net::DRI::Util::has_key($self->identification, "value")
Truth table0%0/3
A and B
A= $self->identificationB= Net::DRI::Util::has_key($self->identification, "value")
ABresult
0X0
100
111
96 }
97  
98 0 ▶ push @errs,'type' if ($self->type() && $self->type()!~m/^(?:individual|organization)$/);
Branch: 1 branch
BranchTrueFalseTotal
if $self->type and not $self->type =~ /^(?:individual|organization)$/ 0 0 0
Condition0%0/3
$self->type and not $self->type =~ /^(?:individual|organization)$/
!ll&&!rl&&r
000
MC/DC0%0/2
$self->type and not $self->type =~ /^(?:individual|organization)$/
$self->type not $self->type =~ /^(?:individual|organization)$/
Truth table0%0/3
A and not(B)
A= $self->typeB= not $self->type =~ /^(?:individual|organization)$/
ABresult
0X0
100
111
99 0 ▶ push @errs,'identification' if ($self->identification() && (($self->identification()->{type} && $self->identification()->{type}!~m/^(?:010|020|030|040|110)$/) || (! Net::DRI::Util::xml_is_token($self->identification()->{value},1,20))));
Branch: 1 branch
BranchTrueFalseTotal
if $self->identification and $self->identification->{"type"} && !($self->identification->{"type"} =~ /^(?:010|020|030|040|110)$/) || !Net::DRI::Util::xml_is_token($self->identification->{"value"}, 1, 20) 0 0 0
Condition0%0/9
$self->identification and $self->identification->{"type"} && !($self->identification->{"type"} =~ /^(?:010|020|030|040|110)$/) || !Net::DRI::Util::xml_is_token($self->identification->{"value"}, 1, 20)
!ll&&!rl&&r
000
$self->identification->{"type"} and not $self->identification->{"type"} =~ /^(?:010|020|030|040|110)$/ or not Net::DRI::Util::xml_is_token($self->identification->{"value"}, 1, 20)
l!l&&r!l&&!r
000
$self->identification->{"type"} and not $self->identification->{"type"} =~ /^(?:010|020|030|040|110)$/
!ll&&!rl&&r
000
MC/DC0%0/4
$self->identification and $self->identification->{"type"} && !($self->identification->{"type"} =~ /^(?:010|020|030|040|110)$/) || !Net::DRI::Util::xml_is_token($self->identification->{"value"}, 1, 20)
$self->identification $self->identification->{"type"} not $self->identification->{"type"} =~ /^(?:010|020|030|040|110)$/ not Net::DRI::Util::xml_is_token($self->identification->{"value"}, 1, 20)
Truth table0%0/6
A and B and not(C) or not(D)
A= $self->identificationB= $self->identification->{"type"}C= not $self->identification->{"type"} =~ /^(?:010|020|030|040|110)$/D= not Net::DRI::Util::xml_is_token($self->identification->{"value"}, 1, 20)
ABCDresult
0XXX0
10X00
11000
111X1
10X11
11011
100 0 ▶ push @errs,'mobile' if ($self->mobile() && !Net::DRI::Util::xml_is_token($self->mobile(),undef,17) && $self->mobile()!~m/^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/);
Branch: 1 branch
BranchTrueFalseTotal
if $self->mobile and not Net::DRI::Util::xml_is_token($self->mobile, undef, 17) and not $self->mobile =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/ 0 0 0
Condition0%0/6
$self->mobile and not Net::DRI::Util::xml_is_token($self->mobile, undef, 17) and not $self->mobile =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/
!ll&&!rl&&r
000
$self->mobile and not Net::DRI::Util::xml_is_token($self->mobile, undef, 17)
!ll&&!rl&&r
000
MC/DC0%0/3
$self->mobile and not Net::DRI::Util::xml_is_token($self->mobile, undef, 17) and not $self->mobile =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/
$self->mobile not Net::DRI::Util::xml_is_token($self->mobile, undef, 17) not $self->mobile =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/
Truth table0%0/4
A and not(B) and not(C)
A= $self->mobileB= not Net::DRI::Util::xml_is_token($self->mobile, undef, 17)C= not $self->mobile =~ /^\+[0-9]{1,3}\.[0-9]{1,14}(?:x\d+)?$/
ABCresult
0XX0
10X0
1100
1111
101  
102 0 ▶ Net::DRI::Exception::usererr_invalid_parameters('Invalid contact information: '.join('/',@errs)) if @errs;
Branch: 1 branch
BranchTrueFalseTotal
if @errs 0 0 0
103  
104 0 return 1; ## everything ok.
105 }
106  
107 ####################################################################################################
108 2 1;
« DRI/Protocol/EPP/Extensions/LU/Poll.pm ↑ Summary DRI/Protocol/EPP/Extensions/DNSBE/Notifications.pm »