line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Valiemon::Attributes::MinItems; |
2
|
3
|
|
|
3
|
|
1894
|
use strict; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
91
|
|
3
|
3
|
|
|
3
|
|
20
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
76
|
|
4
|
3
|
|
|
3
|
|
16
|
use utf8; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
16
|
|
5
|
3
|
|
|
3
|
|
501
|
use parent qw(Valiemon::Attributes); |
|
3
|
|
|
|
|
309
|
|
|
3
|
|
|
|
|
16
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
182
|
use Carp qw(croak); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
587
|
|
8
|
|
|
|
|
|
|
|
9
|
11
|
|
|
11
|
0
|
36
|
sub attr_name { 'minItems' } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub is_valid { |
12
|
13
|
|
|
13
|
0
|
36
|
my ($class, $context, $schema, $data) = @_; |
13
|
|
|
|
|
|
|
|
14
|
13
|
100
|
|
|
|
40
|
return 1 unless ref $data eq 'ARRAY'; # ignore |
15
|
|
|
|
|
|
|
|
16
|
11
|
|
|
|
|
20
|
my $min_items = $schema->{minItems}; |
17
|
|
|
|
|
|
|
$context->in_attr($class, sub { |
18
|
11
|
100
|
66
|
11
|
|
30
|
if (!$context->prims->is_integer($min_items) || !(0 <= $min_items)) { |
19
|
2
|
|
|
|
|
7
|
croak sprintf '`minItems` must be an integer. This integer must be greater than, or equal to 0 at %s', |
20
|
|
|
|
|
|
|
$context->position; |
21
|
|
|
|
|
|
|
} |
22
|
9
|
|
|
|
|
36
|
$min_items <= scalar @$data; |
23
|
11
|
|
|
|
|
61
|
}); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |