line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Valiemon::Attributes::MinItems; |
2
|
3
|
|
|
3
|
|
1261
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
73
|
|
3
|
3
|
|
|
3
|
|
9
|
use warnings; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
58
|
|
4
|
3
|
|
|
3
|
|
9
|
use utf8; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
11
|
|
5
|
3
|
|
|
3
|
|
449
|
use parent qw(Valiemon::Attributes); |
|
3
|
|
|
|
|
229
|
|
|
3
|
|
|
|
|
10
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
133
|
use Carp qw(croak); |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
504
|
|
8
|
|
|
|
|
|
|
|
9
|
11
|
|
|
11
|
0
|
24
|
sub attr_name { 'minItems' } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub is_valid { |
12
|
13
|
|
|
13
|
0
|
16
|
my ($class, $context, $schema, $data) = @_; |
13
|
|
|
|
|
|
|
|
14
|
13
|
100
|
|
|
|
32
|
return 1 unless ref $data eq 'ARRAY'; # ignore |
15
|
|
|
|
|
|
|
|
16
|
11
|
|
|
|
|
13
|
my $min_items = $schema->{minItems}; |
17
|
|
|
|
|
|
|
$context->in_attr($class, sub { |
18
|
11
|
100
|
66
|
11
|
|
22
|
if (!$context->prims->is_integer($min_items) || !(0 <= $min_items)) { |
19
|
2
|
|
|
|
|
5
|
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
|
|
|
|
|
25
|
$min_items <= scalar @$data; |
23
|
11
|
|
|
|
|
48
|
}); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |