DRI/Protocol/EPP/Extensions/Afilias/Trademark.pm

filter: Statementstmt 24.3% 10 / 41 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 50.0% 3 / 6 Podpod 0.0% 0 / 3 totaltotal 17.5% 13 / 74 CC 14 SCAR 41.9
CC
14
Cov
16%
create
110.0
info_parse
30.0
register_commands
2.0
CRAP 66.1
« DRI/DRD/RESTENA.pm ↑ Summary DRI/Protocol/EPP/Extensions/FCCN/Domain.pm »
1 ## Domain Registry Interface, Afilias Trademark extension (for .INFO .MOBI .IN)
2 ##
3 ## Copyright (c) 2010,2013,2016,2019 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::Protocol::EPP::Extensions::Afilias::Trademark;
16  
17 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 ▶use Net::DRI::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 ####################################################################################################
23  
24 sub register_commands
25 0 ▶{
Subroutine register_commands: not called CC=1 SCAR=6.9
Pod undocumented
26 0 my ($class,$version)=@_;
27 0 my %tmp=(
28 create => [ \&create, undef ],
29 ## update
30 info => [ undef, \&info_parse ]
31 );
32  
33 0 return { 'domain' => \%tmp };
34 }
35  
36 ## Namespace should be set in calling superclass, as it differs in each TLD !
37 ##
38 ## INFO requires: name, country, number, date
39 ## MOBI requires: name, country, number, regDate, appDate
40 ## IN requires: name, country, number, date, ownerCountry
41  
42 ####################################################################################################
43  
44 sub create
45 0 ▶{
Subroutine create: not called CC=10 SCAR=47.0
Pod undocumented
46 0 my ($epp,$domain,$rd)=@_;
47  
48 0 ▶ return unless Net::DRI::Util::has_key($rd,'trademark');
Branch: 1 branch
BranchTrueFalseTotal
unless Net::DRI::Util::has_key($rd, "trademark") 0 0 0
49 0 my $rt=$rd->{trademark};
50  
51 0 my @t;
52 0 foreach my $k (qw/name country number/)
53 {
54 0 ▶ next unless exists $rt->{$k} && length $rt->{$k};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $rt->{$k} and length $rt->{$k} 0 0 0
Condition0%0/3
exists $rt->{$k} and length $rt->{$k}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $rt->{$k} and length $rt->{$k}
exists $rt->{$k} length $rt->{$k}
Truth table0%0/3
A and B
A= exists $rt->{$k}B= length $rt->{$k}
ABresult
0X0
100
111
55 0 push @t,['trademark:'.$k,$rt->{$k}];
56 }
57 0 foreach my $k (qw/date regDate appDate/)
58 {
59 0 ▶ next unless exists $rt->{$k};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $rt->{$k} 0 0 0
60 0 Net::DRI::Util::check_isa($rt->{$k},'DateTime');
61 0 push @t,['trademark:'.$k,$rt->{$k}->set_time_zone('UTC')->ymd()];
62 }
63 0 foreach my $k (qw/ownerCountry/)
64 {
65 0 ▶ next unless exists $rt->{$k} && length $rt->{$k};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $rt->{$k} and length $rt->{$k} 0 0 0
Condition0%0/3
exists $rt->{$k} and length $rt->{$k}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $rt->{$k} and length $rt->{$k}
exists $rt->{$k} length $rt->{$k}
Truth table0%0/3
A and B
A= exists $rt->{$k}B= length $rt->{$k}
ABresult
0X0
100
111
66 0 push @t,['trademark:'.$k,$rt->{$k}];
67 }
68  
69 0 $epp->message()->command_extension('trademark', ['create', @t]);
70 0 return;
71 }
72  
73 sub info_parse
74 0 ▶{
Subroutine info_parse: not called CC=5 SCAR=34.0
Pod undocumented
75 0 my ($po,$otype,$oaction,$oname,$rinfo)=@_;
76 0 my $mes=$po->message();
77 0 my $infdata=$mes->get_extension('trademark','infData');
78 0 ▶ return unless defined $infdata;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $infdata 0 0 0
79  
80 0 my %t;
81 0 foreach my $el (Net::DRI::Util::xml_list_children($infdata))
82 {
83 0 my ($n,$c)=@$el;
84 0 ▶ if ($n=~m/^(?:name|country|number|ownerCountry)$/)
Branch: 2 branches
BranchTrueFalseTotal
if ($n =~ /^(?:name|country|number|ownerCountry)$/) { } 0 0 0
elsif ($n =~ /^(?:date|appDate|regDate)$/) { } 0 0 0
85 {
86 0 $t{$n}=$c->textContent();
87 } elsif ($n=~m/^(?:date|appDate|regDate)$/)
88 {
89 0 $t{$n}=$po->parse_iso8601($c->textContent());
90 }
91 }
92  
93 0 $rinfo->{$otype}->{$oname}->{trademark}=\%t;
94 0 return;
95 }
96  
97 ####################################################################################################
98 1 1;
99  
100 __END__
« DRI/DRD/RESTENA.pm ↑ Summary DRI/Protocol/EPP/Extensions/FCCN/Domain.pm »