SSVC.pm

filter: Statementstmt 61.5% 40 / 65 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 70.5% 12 / 17 Podpod 100% 5 / 5 totaltotal 50.8% 57 / 112 CC 10 SCAR 23.8
CC
10
Cov
47%
register_methodology
30.0
new
20.0
methodology_class
12.0
CRAP 10.8
« SSVC/CoordinatorTriage.pm ↑ Summary SSVC/Supplier.pm »
1 package SSVC;
2  
3 1 ▶use feature ':5.10';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use SSVC::Base ();
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use SSVC::CISA ();
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use SSVC::CISA::BOD2604 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use SSVC::CoordinatorPublication ();
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use SSVC::CoordinatorTriage ();
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use SSVC::Deployer ();
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use SSVC::Supplier ();
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 our $VERSION = '1.01';
19 1 $VERSION =~ tr/_//d; ## no critic
20  
21 1 my %METHODOLOGIES = (
22 cisa => 'SSVC::CISA',
23 cisa_bod_26_04 => 'SSVC::CISA::BOD2604',
24 coordinator_publication => 'SSVC::CoordinatorPublication',
25 coordinator_triage => 'SSVC::CoordinatorTriage',
26 deployer => 'SSVC::Deployer',
27 supplier => 'SSVC::Supplier',
28 );
29  
30 0 ▶sub new {
Subroutine new: not called CC=4 SCAR=30.0
Pod documented
31  
32 0 my $class = shift;
33  
34 0 ▶ my %params = (@_ == 2 && ref $_[1] eq 'HASH') ? (methodology => $_[0], %{$_[1]}) : @_;
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 && ref $_[1] eq 'HASH' ? : 0 0 0
Condition0%0/3
@_ == 2 and ref $_[1] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
@_ == 2 and ref $_[1] eq "HASH"
@_ == 2 ref $_[1] eq "HASH"
Truth table0%0/3
A and B
A= @_ == 2B= ref $_[1] eq "HASH"
ABresult
0X0
100
111
35  
36 0 ▶ my $methodology = delete $params{methodology} || Carp::croak 'Missing methodology';
Condition0%0/2
delete $params{'methodology'} || Carp::croak('Missing methodology')
l!l
00
MC/DC0%0/1
delete $params{'methodology'} || Carp::croak('Missing methodology')
delete $params{'methodology'}
Truth table0%0/2
A
A= delete $params{'methodology'}
Aresult
11
00
37  
38 0 return $class->methodology_class($methodology)->new(%params);
39  
40 }
41  
42 0 ▶sub methodologies { keys %METHODOLOGIES }
Subroutine methodologies: not called CC=1 SCAR=6.9
Pod documented
43  
44 0 ▶sub methodology_class {
Subroutine methodology_class: not called CC=3 SCAR=24.8
Pod documented
45  
46 0 my ($class, $name) = @_;
47  
48 0 ▶ unless (defined $name && defined $METHODOLOGIES{$name}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $name and defined $METHODOLOGIES{$name}) 0 0 0
Condition0%0/3
defined $name and defined $METHODOLOGIES{$name}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $name and defined $METHODOLOGIES{$name}
defined $name defined $METHODOLOGIES{$name}
Truth table0%0/3
A and B
A= defined $nameB= defined $METHODOLOGIES{$name}
ABresult
0X0
100
111
49 0 Carp::croak 'Unknown SSCV methodology';
50 }
51  
52 0 return $METHODOLOGIES{$name};
53  
54 }
55  
56 0 ▶sub methodology_info {
Subroutine methodology_info: not called CC=1 SCAR=6.9
Pod documented
57  
58 0 my ($class, $name) = @_;
59  
60 0 my $methodology_class = $class->methodology_class($name);
61  
62 my %decision_points
63 0 = map { $_ => $methodology_class->decision_point_info($_) } keys %{$methodology_class->DECISION_POINTS};
64  
65 0 return {%{$methodology_class->METADATA}, decision_points => \%decision_points};
66  
67 }
68  
69 0 ▶sub register_methodology {
Subroutine register_methodology: not called CC=5 SCAR=34.0
Pod documented
70  
71 0 my ($class, $name, $methodology_class) = @_;
72  
73 0 ▶ Carp::croak 'Missing methodology name' unless defined $name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name 0 0 0
74 0 ▶ Carp::croak 'Missing methodology class' unless defined $methodology_class;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $methodology_class 0 0 0
75 0 ▶ Carp::croak "'$methodology_class' is not loaded" unless $methodology_class->can('new');
Branch: 1 branch
BranchTrueFalseTotal
unless $methodology_class->can("new") 0 0 0
76  
77 0 ▶ unless ($methodology_class->isa('SSVC::Base')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($methodology_class->isa("SSVC::Base")) 0 0 0
78 0 Carp::croak "'$methodology_class' must extend SSVC::Base";
79 }
80  
81 0 $METHODOLOGIES{$name} = $methodology_class;
82  
83 0 return $class;
84  
85 }
86  
87 1 1;
88  
89  
90 __END__
« SSVC/CoordinatorTriage.pm ↑ Summary SSVC/Supplier.pm »