RST/DataProvider.pm

filter: Statementstmt 30.3% 10 / 33 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 37.5% 3 / 8 Podpod 100% 5 / 5 totaltotal 32.7% 18 / 55 CC 8 SCAR 27.7
CC
8
Cov
25%
cases
30.0
errors
20.0
description
2.0
CRAP 15.9
« RST/Error.pm ↑ Summary RST/Case.pm »
1 package ICANN::RST::DataProvider;
2 # ABSTRACT: an object representing an RST data provider.
3 1 ▶use ICANN::RST::DataProvider::Column;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use base qw(ICANN::RST::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 0 ▶sub description { ICANN::RST::Text->new($_[0]->{'Description'}) }
Subroutine description: not called CC=1 SCAR=6.9
Pod documented
8  
9 0 ▶sub rows { $_[0]->{'Rows'} }
Subroutine rows: not called CC=1 SCAR=6.9
Pod documented
10  
11 0 ▶sub columns { map { ICANN::RST::DataProvider::Column->new($_) } @{$_[0]->{'Columns'}} }
Subroutine columns: not called CC=1 SCAR=6.9
Pod documented
12  
13 sub cases {
14 0 ▶ my $self = shift;
Subroutine cases: not called CC=5 SCAR=34.0
Pod documented
15  
16 0 my %cases;
17  
18 0 foreach my $case ($self->spec->cases) {
19 0 foreach my $provider ($case->providers) {
20 0 ▶ $cases{$case->id} = $case if ($provider->id eq $self->id && !defined($cases{$case->id}));
Branch: 1 branch
BranchTrueFalseTotal
if $provider->id eq $self->id and not defined $cases{$case->id} 0 0 0
Condition0%0/3
$provider->id eq $self->id and not defined $cases{$case->id}
!ll&&!rl&&r
000
MC/DC0%0/2
$provider->id eq $self->id and not defined $cases{$case->id}
$provider->id eq $self->id not defined $cases{$case->id}
Truth table0%0/3
A and not(B)
A= $provider->id eq $self->idB= not defined $cases{$case->id}
ABresult
0X0
100
111
21 }
22 }
23  
24 0 return sort { $a->id cmp $b->id } values(%cases);
25 }
26  
27 sub errors {
28 0 ▶ my $self = shift;
Subroutine errors: not called CC=4 SCAR=30.0
Pod documented
29  
30 0 my $i = 0;
31  
32 0 my @errors;
33  
34 0 foreach my $column ($self->columns) {
35 0 ▶ if ('errorCode' eq $column->name) {
Branch: 1 branch
BranchTrueFalseTotal
if ("errorCode" eq $column->name) 0 0 0
36 0 foreach my $row (@{$self->rows}) {
37 0 push(@errors, $self->spec->error($row->[$i]));
38 }
39  
40 0 last;
41 }
42  
43 0 $i++;
44 }
45  
46 0 return @errors;
47 }
48  
49 1 1;
50  
51 __END__
52  
53 =pod
54  
55 =encoding UTF-8
56  
57 =head1 NAME
58  
59 ICANN::RST::DataProvider - an object representing an RST data provider.
60  
61 =head1 VERSION
62  
63 version 0.03
64  
65 =head1 DESCRIPTION
66  
67 This class inherits from L<ICANN::RST::Base> (so it has the C<id()> and
68 C<spec()> methods).
69  
70 =head1 METHODS
71  
72 =head2 description()
73  
74 A L<ICANN::RST::Text> object containing the long textual description of the
75 error.
76  
77 =head2 columns()
78  
79 An array of L<ICANN::RST::DataProvider::Column> objects representing the columns
80 for this data provider.
81  
82 =head2 rows()
83  
84 An arrayref of arrayrefs containing the rows for this data provider.
85  
86 =head2 cases()
87  
88 A list of all C<ICANN::RST::Case> objects that use this data provider.
89  
90 =head2 errors()
91  
92 A list of all C<ICANN::RST::Error> objects referenced by this data provider.
93  
94 =head1 AUTHOR
95  
96 Gavin Brown <gavin.brown@icann.org>
97  
98 =head1 COPYRIGHT AND LICENSE
99  
100 This software is copyright (c) 2025 by Internet Corporation for Assigned Names and Number (ICANN).
101  
102 This is free software; you can redistribute it and/or modify it under
103 the same terms as the Perl 5 programming language system itself.
104  
105 =cut
« RST/Error.pm ↑ Summary RST/Case.pm »