Braintree/ValidationErrorCollection.pm

filter: Statementstmt 34.3% 11 / 32 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 42.8% 3 / 7 Podpod 0.0% 0 / 3 totaltotal 30.4% 14 / 46 CC 3 SCAR 16.1
CC
3
Cov
31%
BUILD
12.0
_deep_errors
2.0
for
2.0
CRAP 5.0
« Braintree/Result.pm ↑ Summary Braintree/ClientTokenGateway.pm »
1 package Net::Braintree::ValidationErrorCollection;
2  
3 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Net::Braintree::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Net::Braintree::ValidationError;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 has 'deep_errors' => (is => 'ro', lazy => 1, builder => '_deep_errors');
8  
9 0 ▶sub BUILD {
Subroutine BUILD: not called CC=3 SCAR=24.8
Pod undocumented
10 0 my ($self, $args) = @_;
11  
12 0 $self->{_errors} = [ map { Net::Braintree::ValidationError->new($_) } @{$args->{errors}} ];
13 0 $self->{_nested} = {};
14  
15 0 ▶ while (my ($key, $value) = each %$args) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$args) 0 0 0
16 0 ▶ next if $key eq 'errors';
Branch: 1 branch
BranchTrueFalseTotal
if $key eq "errors" 0 0 0
17 0 $self->{_nested}->{$key} = __PACKAGE__->new($value);
18 }
19 }
20  
21 0 ▶sub _deep_errors {
Subroutine _deep_errors: not called CC=1 SCAR=6.9
22 0 my $self = shift;
23 0 my @nested = map { @{$_->deep_errors} } values %{$self->{_nested}};
24 0 return [ @{$self->{_errors}}, @nested ];
25 }
26  
27 0 ▶sub for {
Subroutine for: not called CC=1 SCAR=6.9
Pod undocumented
28 0 my ($self, $target) = @_;
29 0 return $self->{_nested}->{$target};
30 }
31  
32 0 ▶sub on {
Subroutine on: not called CC=1 SCAR=6.9
Pod undocumented
33 0 my ($self, $attribute) = @_;
34 0 return [ grep { $_->attribute eq $attribute } @{$self->{_errors}} ]
35 }
36  
37 1 1;
« Braintree/Result.pm ↑ Summary Braintree/ClientTokenGateway.pm »