line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Braintree::ValidationErrorCollection; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
3
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
4
|
1
|
|
|
1
|
|
3832
|
use Net::Braintree::Util; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
61
|
|
5
|
1
|
|
|
1
|
|
346
|
use Net::Braintree::ValidationError; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
239
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has 'deep_errors' => (is => 'ro', lazy => 1, builder => '_deep_errors'); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub BUILD { |
10
|
0
|
|
|
0
|
0
|
|
my ($self, $args) = @_; |
11
|
|
|
|
|
|
|
|
12
|
0
|
|
|
|
|
|
$self->{_errors} = [ map { Net::Braintree::ValidationError->new($_) } @{$args->{errors}} ]; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
13
|
0
|
|
|
|
|
|
$self->{_nested} = {}; |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
while (my ($key, $value) = each %$args) { |
16
|
0
|
0
|
|
|
|
|
next if $key eq 'errors'; |
17
|
0
|
|
|
|
|
|
$self->{_nested}->{$key} = __PACKAGE__->new($value); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _deep_errors { |
22
|
0
|
|
|
0
|
|
|
my $self = shift; |
23
|
0
|
|
|
|
|
|
my @nested = map { @{$_->deep_errors} } values %{$self->{_nested}}; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
return [ @{$self->{_errors}}, @nested ]; |
|
0
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub for { |
28
|
0
|
|
|
0
|
0
|
|
my ($self, $target) = @_; |
29
|
0
|
|
|
|
|
|
return $self->{_nested}->{$target}; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub on { |
33
|
0
|
|
|
0
|
0
|
|
my ($self, $attribute) = @_; |
34
|
0
|
|
|
|
|
|
return [ grep { $_->attribute eq $attribute } @{$self->{_errors}} ] |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |