line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Valiemon::Attributes::MaxProperties; |
2
|
1
|
|
|
1
|
|
426
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
3
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
18
|
|
4
|
1
|
|
|
1
|
|
3
|
use utf8; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
5
|
1
|
|
|
1
|
|
21
|
use parent qw(Valiemon::Attributes); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
41
|
use Carp qw(croak); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
179
|
|
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
0
|
8
|
sub attr_name { 'maxProperties' } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub is_valid { |
12
|
4
|
|
|
4
|
0
|
6
|
my ($class, $context, $schema, $data) = @_; |
13
|
|
|
|
|
|
|
|
14
|
4
|
100
|
|
|
|
11
|
return 1 unless ref $data eq 'HASH'; # ignore |
15
|
|
|
|
|
|
|
|
16
|
3
|
|
|
|
|
3
|
my $max_properties = $schema->{maxProperties}; |
17
|
|
|
|
|
|
|
$context->in_attr($class, sub { |
18
|
3
|
50
|
33
|
3
|
|
7
|
if (!$context->prims->is_integer($max_properties) || !(0 <= $max_properties)) { |
19
|
0
|
|
|
|
|
0
|
croak sprintf '`maxProperties` must be an integer. This integer must be greater than, or equal to 0 at %s', |
20
|
|
|
|
|
|
|
$context->position; |
21
|
|
|
|
|
|
|
} |
22
|
3
|
|
|
|
|
10
|
scalar keys %$data <= $max_properties; |
23
|
3
|
|
|
|
|
16
|
}); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |