| 1 | package Catalyst::Utils::StrongParameters; | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use Moose; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use Storable qw(dclone); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use Catalyst::Utils; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use Catalyst::Exception::MissingParameter; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Catalyst::Exception::InvalidArrayPointer; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||
| 9 | 2 | has context => (is=>'ro', required=>1); | |||||||||||||||||||||||||||||||
| 10 | 2 | has _namespace => (is=>'rw', required=>0, isa=>'ArrayRef', predicate=>'has_namespace', init_arg=>'namespace'); | |||||||||||||||||||||||||||||||
| 11 | 2 | has _flatten_array_value => (is=>'ro', required=>1, init_arg=>'flatten_array_value'); | |||||||||||||||||||||||||||||||
| 12 | 2 | has _current => (is=>'rw', required=>0, init_arg=>undef); | |||||||||||||||||||||||||||||||
| 13 | 2 | has _required => (is=>'rw', required=>0, init_arg=>undef); | |||||||||||||||||||||||||||||||
| 14 | 2 | has _src => (is=>'ro', required=>1, init_arg=>'src'); | |||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||
| 16 | 2 | ▶ | sub namespace { | ||||||||||||||||||||||||||||||
|
Subroutine
namespace: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 17 | 2 | my ($self, $arg) = @_; | |||||||||||||||||||||||||||||||
| 18 | 2 | ▶ | $self->_namespace($arg) if defined($arg); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 19 | 2 | return $self; | |||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | sub flatten_array_value { | ||||||||||||||||||||||||||||||
|
Subroutine
flatten_array_value: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 22 | 0 | my ($self, $arg) = @_; | |||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | $self->_flatten_array_value($arg) if defined($arg); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 24 | 0 | return $self; | |||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||
| 27 | 10 | ▶ | sub permitted { | ||||||||||||||||||||||||||||||
|
Subroutine
permitted: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 28 | 10 | my ($self, @proto) = @_; | |||||||||||||||||||||||||||||||
| 29 | 10 | ▶ | my $namespace = $self->_namespace ||[]; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->_namespace || []
MC/DC100%1/1
$self->_namespace || []
$self->_namespace
Truth table100%2/2
A
A= $self->_namespace
| |||||||||||||||||||||||||||||||||
| 30 | 10 | $self->_required(0); | |||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||
| 32 | 10 | ▶ | if(ref $proto[0]) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 33 | 4 | my $namespace_affix = shift @proto; | |||||||||||||||||||||||||||||||
| 34 | 4 | $namespace = [ @$namespace, @$namespace_affix ]; | |||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||
| 37 | 10 | my $context = dclone($self->context); | |||||||||||||||||||||||||||||||
| 38 | 10 | my $parsed = $self->_parse($context, $namespace, [@proto]); | |||||||||||||||||||||||||||||||
| 39 | 10 | ▶ | my $current = $self->_current ||+{}; | ||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->_current || {}
MC/DC100%1/1
$self->_current || {}
$self->_current
Truth table100%2/2
A
A= $self->_current
| |||||||||||||||||||||||||||||||||
| 40 | 10 | $current = Catalyst::Utils::merge_hashes($current, $parsed); | |||||||||||||||||||||||||||||||
| 41 | 10 | $self->_current($current); | |||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||
| 43 | 10 | return $self; | |||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||
| 46 | 4 | ▶ | sub required { | ||||||||||||||||||||||||||||||
|
Subroutine
required: called CC=4 SCAR=14.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 47 | 4 | my ($self, @proto) = @_; | |||||||||||||||||||||||||||||||
| 48 | 4 | ▶ | my $namespace = $self->_namespace ||[]; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->_namespace || []
MC/DC0%0/1
$self->_namespace || []
$self->_namespace
Truth table50%1/2
A
A= $self->_namespace
| |||||||||||||||||||||||||||||||||
| 49 | 4 | $self->_required(1); | |||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||
| 51 | 4 | ▶ | if(ref $proto[0]) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 52 | 0 | my $namespace_affix = shift @proto; | |||||||||||||||||||||||||||||||
| 53 | 0 | $namespace = [ @$namespace, @$namespace_affix ]; | |||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||
| 56 | 4 | my $context = dclone($self->context); | |||||||||||||||||||||||||||||||
| 57 | 4 | my $parsed = $self->_parse($context, $namespace, [@proto]); | |||||||||||||||||||||||||||||||
| 58 | 2 | ▶ | my $current = $self->_current ||+{}; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->_current || {}
MC/DC0%0/1
$self->_current || {}
$self->_current
Truth table50%1/2
A
A= $self->_current
| |||||||||||||||||||||||||||||||||
| 59 | 2 | $current = Catalyst::Utils::merge_hashes($current, $parsed); | |||||||||||||||||||||||||||||||
| 60 | 2 | $self->_current($current); | |||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||
| 62 | 2 | return $self; | |||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||
| 65 | 6 | ▶ | sub to_hash { | ||||||||||||||||||||||||||||||
|
Subroutine
to_hash: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 66 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||
| 67 | 6 | ▶ | return %{ $self->_current || +{} }; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->_current || {}
MC/DC0%0/1
$self->_current || {}
$self->_current
Truth table50%1/2
A
A= $self->_current
| |||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||
| 70 | 25 | ▶ | sub _sorted { | ||||||||||||||||||||||||||||||
|
Subroutine
_sorted: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||
| 71 | 25 | ▶ | return 1 if $a eq ''; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 72 | 23 | ▶ | return -1 if $b eq ''; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 73 | 19 | return $a <=> $b; | |||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||
| 76 | 112 | ▶ | sub _normalize_array_value { | ||||||||||||||||||||||||||||||
|
Subroutine
_normalize_array_value: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||
| 77 | 112 | my ($self, $value) = @_; | |||||||||||||||||||||||||||||||
| 78 | 112 | ▶ | return $value unless $self->_flatten_array_value; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 79 | 62 | ▶ | return ((ref($value)||'') eq 'ARRAY') ? $value->[-1] : $value; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
ref $value || ''
MC/DC100%1/1
ref $value || ''
ref $value
Truth table100%2/2
A
A= ref $value
| |||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||
| 82 | 14 | ▶ | sub _parse { | ||||||||||||||||||||||||||||||
|
Subroutine
_parse: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 83 | 14 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||
| 84 | 14 | ▶ | return $self->_src eq 'data' ? $self->_parse_data(@args) : $self->_parse_formlike(@args); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||
| 87 | 56 | ▶ | sub _parse_formlike { | ||||||||||||||||||||||||||||||
|
Subroutine
_parse_formlike: called CC=19 SCAR=29.5
| |||||||||||||||||||||||||||||||||
| 88 | 56 | my ($self, $context, $ns, $rules) = @_; | |||||||||||||||||||||||||||||||
| 89 | 56 | my $current = +{}; | |||||||||||||||||||||||||||||||
| 90 | 56 | ▶ | while(@{$rules}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 91 | 130 | my $rule = shift @{$rules}; | |||||||||||||||||||||||||||||||
| 92 | 130 | ▶ | if(ref($rule)||'' eq 'HASH') { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
ref $rule or
MC/DC100%1/1
ref $rule or
ref $rule
Truth table100%2/2
A
A= ref $rule
| |||||||||||||||||||||||||||||||||
| 93 | 24 | my ($local_ns, $rules) = %$rule; | |||||||||||||||||||||||||||||||
| 94 | 24 | my $key = join('.', @$ns, $local_ns); | |||||||||||||||||||||||||||||||
| 95 | 24 | my %indexes = (); | |||||||||||||||||||||||||||||||
| 96 | 24 | foreach my $context_field (keys %$context) { | |||||||||||||||||||||||||||||||
| 97 | 698 | my ($i, $under) = ($context_field =~m/^\Q$key\E\[(\d*)\]\.?(.*)$/); | |||||||||||||||||||||||||||||||
| 98 | 698 | ▶ | next unless defined $i; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 99 | 62 | $indexes{$i} = $under; | |||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||
| 101 | 24 | foreach my $index(sort _sorted keys %indexes) { | |||||||||||||||||||||||||||||||
| 102 | 27 | my $cloned_rules = dclone($rules); # each iteration in the loop needs its own copy of the rules; | |||||||||||||||||||||||||||||||
| 103 | 27 | ▶ | $cloned_rules = [''] unless @$cloned_rules; # to handle the bare array case | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 104 | 27 | my $value = $self->_parse_formlike( $context, [@$ns, "${local_ns}[$index]"], $cloned_rules); | |||||||||||||||||||||||||||||||
| 105 | ## I don't think these are missing params, just a row with invalid fields | ||||||||||||||||||||||||||||||||
| 106 | 27 | ▶ | next if( (ref($value)||'') eq 'HASH') && !%$value; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%5/5
(ref $value || "") eq "HASH" and not %$value
ref $value || ''
MC/DC100%2/2
(ref $value || "") eq "HASH" and not %$value
ref $value
not %$value
Truth table100%3/3
A and not(B)
A= ref $valueB= not %$value
| |||||||||||||||||||||||||||||||||
| 107 | 26 | push @{$current->{$local_ns}}, $value; | |||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||
| 109 | } else { | ||||||||||||||||||||||||||||||||
| 110 | 106 | ▶ | if((ref($rules->[0])||'') eq 'ARRAY') { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
ref $rules->[0] || ''
MC/DC100%1/1
ref $rules->[0] || ''
ref $rules->[0]
Truth table100%2/2
A
A= ref $rules->[0]
| |||||||||||||||||||||||||||||||||
| 111 | 17 | my $value = $self->_parse_formlike( $context, [@$ns, $rule], shift(@$rules) ); | |||||||||||||||||||||||||||||||
| 112 | 17 | ▶ | next unless %$value; # For 'permitted'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 113 | 10 | $current->{$rule} = $value; | |||||||||||||||||||||||||||||||
| 114 | } else { | ||||||||||||||||||||||||||||||||
| 115 | 89 | ▶ | if($rule eq '') { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 116 | 14 | my $key = join('.', @$ns); | |||||||||||||||||||||||||||||||
| 117 | 14 | ▶ | unless(defined $context->{$key}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | $self->_required ? Catalyst::Exception::MissingParameter->throw(param=>$key) : next; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||
| 120 | 14 | $current = $self->_normalize_array_value($context->{$key}); | |||||||||||||||||||||||||||||||
| 121 | } else { | ||||||||||||||||||||||||||||||||
| 122 | 75 | my $key = join('.', @$ns, $rule); | |||||||||||||||||||||||||||||||
| 123 | 75 | ▶ | unless(defined $context->{$key}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 124 | 27 | ▶ | $self->_required ? Catalyst::Exception::MissingParameter->throw(param=>$key) : next; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||
| 126 | 48 | $current->{$rule} = $self->_normalize_array_value($context->{$key}); | |||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||
| 131 | 54 | return $current; | |||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||
| 134 | 38 | ▶ | sub _parse_data { | ||||||||||||||||||||||||||||||
|
Subroutine
_parse_data: called CC=28 SCAR=34.8
| |||||||||||||||||||||||||||||||||
| 135 | 38 | my ($self, $context, $ns, $rules) = @_; | |||||||||||||||||||||||||||||||
| 136 | 38 | my $current = +{}; | |||||||||||||||||||||||||||||||
| 137 | 38 | ▶ | MAIN: while(@{$rules}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 138 | 98 | my $rule = shift @{$rules}; | |||||||||||||||||||||||||||||||
| 139 | 98 | ▶ | if(ref($rule)||'' eq 'HASH') { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
ref $rule or
MC/DC100%1/1
ref $rule or
ref $rule
Truth table100%2/2
A
A= ref $rule
| |||||||||||||||||||||||||||||||||
| 140 | 20 | my ($local_ns, $rules) = %$rule; | |||||||||||||||||||||||||||||||
| 141 | 20 | my $value = $context; | |||||||||||||||||||||||||||||||
| 142 | 20 | foreach my $pointer (@$ns, $local_ns) { | |||||||||||||||||||||||||||||||
| 143 | 30 | ▶ | if(exists($value->{$pointer})) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 144 | 20 | $value = $value->{$pointer}; | |||||||||||||||||||||||||||||||
| 145 | } else { | ||||||||||||||||||||||||||||||||
| 146 | 10 | ▶ | $self->_required ? Catalyst::Exception::MissingParameter->throw(param=>join('.', (@$ns, $local_ns))) : next MAIN; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||
| 150 | 10 | ▶ | Catalyst::Exception::InvalidArrayPointer->throw(pointer=>join('.', (@$ns, $local_ns))) unless (ref($value)||'') eq 'ARRAY'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
ref $value || ''
MC/DC0%0/1
ref $value || ''
ref $value
Truth table50%1/2
A
A= ref $value
| |||||||||||||||||||||||||||||||||
| 151 | 10 | my @gathered = (); | |||||||||||||||||||||||||||||||
| 152 | 10 | foreach my $item (@$value) { | |||||||||||||||||||||||||||||||
| 153 | 25 | my $cloned_rules = dclone($rules); # each iteration in the loop needs its own copy of the rules; | |||||||||||||||||||||||||||||||
| 154 | 25 | ▶ | $cloned_rules = [''] unless @$cloned_rules; # to handle the bare array case | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 155 | 25 | my $value = $self->_parse_data($item, [], $cloned_rules); | |||||||||||||||||||||||||||||||
| 156 | ## I don't think these are missing params, just a row with invalid fields | ||||||||||||||||||||||||||||||||
| 157 | 25 | ▶ | next if( (ref($value)||'') eq 'HASH') && !%$value; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%5/5
(ref $value || "") eq "HASH" and not %$value
ref $value || ''
MC/DC100%2/2
(ref $value || "") eq "HASH" and not %$value
ref $value
not %$value
Truth table100%3/3
A and not(B)
A= ref $valueB= not %$value
| |||||||||||||||||||||||||||||||||
| 158 | 24 | push @gathered, $value; | |||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||
| 160 | 10 | $current->{$local_ns} = \@gathered; | |||||||||||||||||||||||||||||||
| 161 | } else { | ||||||||||||||||||||||||||||||||
| 162 | 78 | ▶ | if((ref($rules->[0])||'') eq 'ARRAY') { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
ref $rules->[0] || ''
MC/DC100%1/1
ref $rules->[0] || ''
ref $rules->[0]
Truth table100%2/2
A
A= ref $rules->[0]
| |||||||||||||||||||||||||||||||||
| 163 | 11 | my $value = $self->_parse_data( $context, [@$ns, $rule], shift(@$rules) ); | |||||||||||||||||||||||||||||||
| 164 | 11 | ▶ | next unless %$value; # For 'permitted'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 165 | 6 | $current->{$rule} = $value; | |||||||||||||||||||||||||||||||
| 166 | } else { | ||||||||||||||||||||||||||||||||
| 167 | 67 | ▶ | if($rule eq '') { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 168 | 14 | my $value = $context; | |||||||||||||||||||||||||||||||
| 169 | 14 | foreach my $pointer (@$ns) { | |||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | if(((ref($value)||'') eq 'HASH') && exists($value->{$pointer})) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
(ref $value || "") eq "HASH" and exists $value->{$pointer}
ref $value || ''
MC/DC0%0/2
(ref $value || "") eq "HASH" and exists $value->{$pointer}
ref $value
exists $value->{$pointer}
Truth table0%0/3
A and B
A= ref $valueB= exists $value->{$pointer}
| |||||||||||||||||||||||||||||||||
| 171 | 0 | $value = $value->{$pointer}; | |||||||||||||||||||||||||||||||
| 172 | } else { | ||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | $self->_required ? Catalyst::Exception::MissingParameter->throw(param=>join('.', (@$ns, $rule))) : next MAIN; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||
| 176 | 14 | $current = $self->_normalize_array_value($value); | |||||||||||||||||||||||||||||||
| 177 | } else { | ||||||||||||||||||||||||||||||||
| 178 | 53 | my $value = $context; | |||||||||||||||||||||||||||||||
| 179 | 53 | foreach my $pointer (@$ns, $rule) { | |||||||||||||||||||||||||||||||
| 180 | 91 | ▶ | if(((ref($value)||'') eq 'HASH') && exists($value->{$pointer})) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%5/5
(ref $value || "") eq "HASH" and exists $value->{$pointer}
ref $value || ''
MC/DC100%2/2
(ref $value || "") eq "HASH" and exists $value->{$pointer}
ref $value
exists $value->{$pointer}
Truth table100%3/3
A and B
A= ref $valueB= exists $value->{$pointer}
| |||||||||||||||||||||||||||||||||
| 181 | 74 | $value = $value->{$pointer}; | |||||||||||||||||||||||||||||||
| 182 | } else { | ||||||||||||||||||||||||||||||||
| 183 | 17 | ▶ | $self->_required ? Catalyst::Exception::MissingParameter->throw(param=>join('.', (@$ns, $rule))) : next MAIN; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||
| 186 | 36 | $current->{$rule} = $self->_normalize_array_value($value); | |||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||
| 191 | 38 | return $current; | |||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||
| 195 | 2 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||
| 197 | 2 | 1; | |||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||
| 199 | =head1 NAME | ||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||
| 201 | Catalyst::Utils::StrongParameters - Enforce structural rules on your body and data parameters | ||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||
| 203 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||
| 205 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||
| 207 | See L<Catalyst::TraitFor::Request::StrongParameters> for usage. These are just utility classes | ||||||||||||||||||||||||||||||||
| 208 | and not likely useful for end user unless you are rolling your own parsing or something. All | ||||||||||||||||||||||||||||||||
| 209 | the publically useful docs are there. | ||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||
| 211 | =head1 ATTRIBUTES | ||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||
| 213 | This role defines the following attributes: | ||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||
| 215 | TBD | ||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||
| 217 | =head1 METHODS | ||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||
| 219 | This role defines the following methods: | ||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||
| 221 | TBD | ||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||
| 223 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||
| 225 | See L<Catalyst::TraitFor::Request::StrongParameters> | ||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||
| 227 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||
| 229 | L<Catalyst>, L<Catalyst::Request> | ||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||
| 231 | =head1 COPYRIGHT & LICENSE | ||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||
| 233 | See L<Catalyst::TraitFor::Request::StrongParameters> | ||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||
| 235 | =cut | ||||||||||||||||||||||||||||||||