Nested/Profile/Param/Processor.pm

filter: Statementstmt 96.9% 32 / 33 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 93.6% 44 / 47 CC 4 SCAR 4.8
CC
4
Cov
95%
_build_method_ref
2.1
process
2.0
_make_param_name
2.0
CRAP 1.6
« Nested/Validator/Blank.pm ↑ Summary Nested/Validator/Japanese.pm »
1 package FormValidator::Nested::Profile::Param::Processor;
2 18 ▶use Any::Moose '::Role';
Subroutine BEGIN: called CC=1 SCAR=0.0
3 18 ▶use Any::Moose 'X::AttributeHelpers';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 18 ▶use namespace::clean -except => 'meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 18 has 'param' => (
7 is => 'ro',
8 isa => 'FormValidator::Nested::Profile::Param',
9 required => 1,
10 weak_ref => 1,
11 );
12 18 has 'class' => (
13 is => 'ro',
14 isa => 'ClassName',
15 required => 1,
16 );
17 18 has 'method' => (
18 is => 'ro',
19 isa => 'Str',
20 required => 1,
21 );
22 18 has 'method_ref' => (
23 is => 'ro',
24 isa => 'CodeRef',
25 lazy_build => 1,
26 );
27 has 'options' => (
28 metaclass => 'Collection::Hash',
29 is => 'ro',
30 isa => 'HashRef',
31 4 ▶ default => sub { {} },
Subroutine __ANON__: called CC=1 SCAR=0.0
32 18 provides => {
33 get => 'get_option',
34 exists => 'exists_option',
35 },
36 );
37 18 requires 'process_array';
38 18 requires 'process_scalar';
39  
40  
41 61 ▶sub _build_method_ref {
Subroutine _build_method_ref: called CC=2 SCAR=7.4
42 61 my $self = shift;
43 61 my $method = $self->class->can($self->method);
44 61 ▶ if ( !$method ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($method) 0 61 61
45 0 die("method not found " . $self->class . "::" . $self->method);
46 }
47 61 return $method;
48 }
49  
50  
51  
52 782 ▶sub process {
Subroutine process: called CC=2 SCAR=6.9
Pod undocumented
53 782 my $self = shift;
54  
55 782 ▶ if ( $self->param->array ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->param->array) { } 29 753 782
56 29 return $self->process_array(@_);
57 }
58 else {
59 753 return $self->process_scalar(@_);
60 }
61  
62 }
63  
64 342 ▶sub _make_param_name {
Subroutine _make_param_name: called CC=2 SCAR=6.9
65 342 my ( $self, $parent_names, $param_name ) = @_;
66  
67 342 ▶ if ( $parent_names ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parent_names) { } 83 259 342
68 83 my $parent_count = @{$parent_names};
69 83 return sprintf('%s' . '[%s]' x $parent_count, @${parent_names}, $param_name);
70 }
71 else {
72 259 return $param_name;
73 }
74  
75 }
76  
77 18 1;
« Nested/Validator/Blank.pm ↑ Summary Nested/Validator/Japanese.pm »