| 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
| |||||||||||
| 16 | 0 | ▶ | next if $key eq 'errors'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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; | |||||||||