« blib/lib/Valiemon/Attributes/Required.pm
↑ Summary
blib/lib/Valiemon/Attributes/MinProperties.pm »
| 1 | package Valiemon::Attributes::MaxProperties; | ||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use utf8; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use parent qw(Valiemon::Attributes); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 3 | ▶ | sub attr_name { 'maxProperties' } | ||||||||||||||||||||||||||
|
Subroutine
attr_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | sub is_valid { | ||||||||||||||||||||||||||||
| 12 | 4 | ▶ | my ($class, $context, $schema, $data) = @_; | ||||||||||||||||||||||||||
|
Subroutine
is_valid: called CC=2 SCAR=7.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 4 | ▶ | return 1 unless ref $data eq 'HASH'; # ignore | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 3 | my $max_properties = $schema->{maxProperties}; | |||||||||||||||||||||||||||
| 17 | $context->in_attr($class, sub { | ||||||||||||||||||||||||||||
| 18 | 3 | ▶ | if (!$context->prims->is_integer($max_properties) || !(0 <= $max_properties)) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=14.2
Branch: 1 branch
Condition33%1/3
$context->prims->is_integer($max_properties) and 0 <= $max_properties
MC/DC0%0/2
$context->prims->is_integer($max_properties) and 0 <= $max_properties
$context->prims->is_integer($max_properties)
0 <= $max_properties
Truth table33%1/3
A and B
A= $context->prims->is_integer($max_properties)B= 0 <= $max_properties
| |||||||||||||||||||||||||||||
| 19 | 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 | scalar keys %$data <= $max_properties; | |||||||||||||||||||||||||||
| 23 | 3 | }); | |||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 1 | 1; | |||||||||||||||||||||||||||