line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package APISchema::Validator::Result; |
2
|
3
|
|
|
3
|
|
15
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
72
|
|
3
|
3
|
|
|
3
|
|
12
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
73
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# core |
6
|
3
|
|
|
3
|
|
1005
|
use List::MoreUtils qw(all); |
|
3
|
|
|
|
|
26082
|
|
|
3
|
|
|
|
|
16
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# cpan |
9
|
3
|
|
|
3
|
|
2615
|
use Hash::Merge::Simple (); |
|
3
|
|
|
|
|
406
|
|
|
3
|
|
|
|
|
64
|
|
10
|
|
|
|
|
|
|
use Class::Accessor::Lite ( |
11
|
3
|
|
|
|
|
23
|
new => 1, |
12
|
3
|
|
|
3
|
|
15
|
); |
|
3
|
|
|
|
|
4
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new_valid { |
15
|
100
|
|
|
100
|
0
|
10460
|
my ($class, @targets) = @_; |
16
|
100
|
|
|
|
|
242
|
return $class->new(values => { map { ($_ => [1]) } @targets }); |
|
230
|
|
|
|
|
798
|
|
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub new_error { |
20
|
44
|
|
|
44
|
0
|
4695
|
my ($class, $target, $err) = @_; |
21
|
44
|
|
100
|
|
|
260
|
return $class->new(values => { ( $target // '' ) => [ undef, $err] }); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
410
|
|
100
|
410
|
|
1813
|
sub _values { shift->{values} // {} } |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub merge { |
27
|
61
|
|
|
61
|
0
|
692
|
my ($self, $other) = @_; |
28
|
61
|
|
|
|
|
195
|
$self->{values} = Hash::Merge::Simple::merge( |
29
|
|
|
|
|
|
|
$self->_values, |
30
|
|
|
|
|
|
|
$other->_values, |
31
|
|
|
|
|
|
|
); |
32
|
61
|
|
|
|
|
2180
|
return $self; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub errors { |
36
|
88
|
|
|
88
|
0
|
5748
|
my $self = shift; |
37
|
|
|
|
|
|
|
return +{ map { |
38
|
98
|
|
|
|
|
182
|
my $err = $self->_values->{$_}->[1]; |
39
|
98
|
100
|
|
|
|
595
|
$err ? ( $_ => $err ) : (); |
40
|
88
|
|
|
|
|
136
|
} keys %{$self->_values} }; |
|
88
|
|
|
|
|
168
|
|
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub is_valid { |
44
|
50
|
|
|
50
|
0
|
3325
|
my $self = shift; |
45
|
50
|
|
|
52
|
|
216
|
return all { $self->_values->{$_}->[0] } keys %{$self->_values}; |
|
52
|
|
|
|
|
102
|
|
|
50
|
|
|
|
|
107
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |