lib/Mail/DMARC/Result/Reason.pm

filter: Statementstmt 100% 34 / 34 Branchbran 83.3% 10 / 12 Conditioncond 66.6% 4 / 6 MC/DCmcdc 50.0% 2 / 4 Subroutinesub 100% 9 / 9 Podpod 75.0% 3 / 4 totaltotal 89.8% 62 / 69 CC 12 SCAR 11.9
CC
12
Cov
92%
type
5.0
as_known_type
4.4
new
3.0
CRAP 3.3
« lib/Mail/DMARC/Report/Aggregate/Record/Auth_Results/DKIM.pm ↑ Summary lib/Mail/DMARC/Report/Aggregate/Record/Row.pm »
1 package Mail::DMARC::Result::Reason;
2 16 our $VERSION = '2.20261110';
3 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 16 ▶use feature 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 16 ▶no warnings 'experimental::args_array_with_signatures'; ## no critic (ProhibitNoWarnings)
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 16 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 40 ▶sub new( $class, @args ) {
Subroutine new: called CC=3 SCAR=11.0
Pod undocumented
11 40 ▶ croak "invalid arguments" if @args % 2;
Branch: 1 branch
BranchTrueFalseTotal
if @args % 2 0 40 40
12 40 my %args = @args;
13 40 my $self = bless {}, $class;
14 40 foreach my $key ( keys %args ) {
15 66 $self->$key( $args{$key} );
16 }
17 34 return $self;
18 }
19  
20 41 ▶sub type( $self, $val = undef ) {
Subroutine type: called CC=5 SCAR=16.1
Pod documented
21 41 ▶ return $self->{type} if @_ == 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ == 1 1 40 41
22 croak "invalid type"
23 if !defined $val
24 40 ▶ || 0 == grep {/^\Q$val\E$/ix}
Branch: 1 branch
BranchTrueFalseTotal
if not defined $val or 0 == grep({/^\Q$val\E$/xi;} "forwarded", "sampled_out", "trusted_forwarder", "mailing_list", "local_policy", "other", "policy_test_mode") 7 33 40
Condition100%3/3
not defined $val or 0 == grep({/^\Q$val\E$/xi;} "forwarded", "sampled_out", "trusted_forwarder", "mailing_list", "local_policy", "other", "policy_test_mode")
l!l&&r!l&&!r
1633
MC/DC100%2/2
not defined $val or 0 == grep({/^\Q$val\E$/xi;} "forwarded", "sampled_out", "trusted_forwarder", "mailing_list", "local_policy", "other", "policy_test_mode")
not defined $val 0 == grep({/^\Q$val\E$/xi;} "forwarded", "sampled_out", "trusted_forwarder", "mailing_list", "local_policy", "other", "policy_test_mode")
Truth table100%3/3
not(A) or B
A= not defined $valB= 0 == grep({/^\Q$val\E$/xi;} "forwarded", "sampled_out", "trusted_forwarder", "mailing_list", "local_policy", "other", "policy_test_mode")
ABresult
1X1
011
000
25 qw/ forwarded sampled_out trusted_forwarder
26 mailing_list local_policy other policy_test_mode /;
27 33 return $self->{type} = $val;
28 }
29  
30 35 ▶sub comment( $self, $val = undef ) {
Subroutine comment: called CC=3 SCAR=11.0
Pod documented
31 35 ▶ return $self->{comment} if @_ == 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ == 1 5 30 35
32  
33 # comment is optional and requires no validation
34 30 return $self->{comment} = $val;
35 }
36  
37 # keeps an unrecognized type as the comment, rather than losing it
38 22 ▶sub as_known_type( $type, $comment, $known ) {
Subroutine as_known_type: called CC=4 SCAR=14.9
Pod documented
39 22 ▶ return ( lc $type, $comment ) if $known->{ lc $type };
Branch: 1 branch
BranchTrueFalseTotal
if $$known{lc $type} 20 2 22
40 2 ▶ $comment = $type if !defined $comment || $comment !~ /\S/;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $comment and $comment =~ /\S/ 2 0 2
Condition33%1/3
defined $comment and $comment =~ /\S/
!ll&&!rl&&r
200
MC/DC0%0/2
defined $comment and $comment =~ /\S/
defined $comment $comment =~ /\S/
Truth table33%1/3
A and B
A= defined $commentB= $comment =~ /\S/
ABresult
0X0
100
111
41 2 return ( 'other', $comment );
42 }
43  
44 16 1;
45  
46 __END__
« lib/Mail/DMARC/Report/Aggregate/Record/Auth_Results/DKIM.pm ↑ Summary lib/Mail/DMARC/Report/Aggregate/Record/Row.pm »