Declare/Controller/ActionPreparation.pm

filter: Statementstmt 47.9% 35 / 73 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 69.5% 16 / 23 Podpod n/a totaltotal 42.5% 51 / 120 CC 12 SCAR 21.1
CC
12
Cov
37%
__ANON__
26.7
__ANON__
17.3
__ANON__
9.6
CRAP 8.3
« Declare/Controller/QualifyClassNames.pm ↑ Summary Declare/Controller/DetermineActionClass.pm »
1 15 ▶use MooseX::Declare;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 15 ▶role CatalystX::Declare::Controller::ActionPreparation {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=2.6
4  
5 15 ▶ use aliased 'CatalystX::Declare::Action::CatchValidationError';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 15 ▶ use aliased 'CatalystX::Declare::Dispatching::ChainTypeSensitivity';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 0 ▶ method _find_method_type_constraint (Str $name) {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine __ANON__: not called CC=3 SCAR=22.3
9  
10 $self->meta->find_method_type_constraint($name)
11 0 ▶ || do {
Branch: 1 branch
BranchTrueFalseTotal
$self->meta->find_method_type_constraint($name) or do { my $method = $self->meta->find_method_by_name($name); ($_ = $method->can("type_constraint")) ? $method->$_ : undef } 0 0 0
12 0 my $method = $self->meta->find_method_by_name($name);
13 0 ▶ ( $_ = $method->can('type_constraint') )
Branch: 1 branch
BranchTrueFalseTotal
($_ = $method->can('type_constraint')) ? : 0 0 0
14 ? $method->$_
15 : undef
16 };
17 15 }
18  
19 0 ▶ method _find_method_named_params (Str $name) {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine __ANON__: not called CC=1 SCAR=2.6
20  
21 0 return $self->meta->find_method_named_params($name);
22 15 }
23  
24 0 ▶ method _find_method_named_type_constraint (Str $method, Str $param) {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine __ANON__: not called CC=1 SCAR=2.6
25  
26 0 return $self->meta->find_method_named_type_constraint($method, $param);
27 15 }
28  
29 0 ▶ method _ensure_applied_dispatchtype_roles {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine __ANON__: not called CC=4 SCAR=28.5
30  
31 0 my $type = $self->_app->dispatcher->dispatch_type('Chained');
32  
33 return
34 0 ▶ if $type->DOES(ChainTypeSensitivity);
Branch: 1 branch
BranchTrueFalseTotal
if $type->DOES("CatalystX::Declare::Dispatching::ChainTypeSensitivity") 0 0 0
35  
36 0 my $immutable = $type->meta->is_immutable;
37 0 my %immutable_options;
38 0 ▶ if ($immutable) {
Branch: 1 branch
BranchTrueFalseTotal
if ($immutable) 0 0 0
39 0 %immutable_options = $type->meta->immutable_options;
40 0 $type->meta->make_mutable;
41 }
42  
43 # FIXME we really shouldn't have to tweak the dispatch type
44 0 ChainTypeSensitivity->meta->apply($type->meta);
45  
46 0 ▶ $type->meta->make_immutable(%immutable_options)
Branch: 1 branch
BranchTrueFalseTotal
if $immutable 0 0 0
47 if $immutable;
48 15 }
49  
50 0 ▶ after register_actions {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine __ANON__: not called CC=1 SCAR=2.6
51  
52 0 $self->_ensure_applied_dispatchtype_roles;
53 15 }
54  
55  
56 0 ▶ around gather_action_roles(%args) {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine __ANON__: not called CC=3 SCAR=22.6
57 return (
58 $self->$orig(%args),
59 (map {
60 0 $self->_qualify_class_name(ActionRole => $_);
61 #$self->_expand_role_shortname($_);
62 0 ▶ } @{ delete($args{attributes}{CatalystX_Declarative_ActionRoles}) || [] }),
Condition0%0/2
delete $args{'attributes'}{'CatalystX_Declarative_ActionRoles'} || []
l!l
00
MC/DC0%0/1
delete $args{'attributes'}{'CatalystX_Declarative_ActionRoles'} || []
delete $args{'attributes'}{'CatalystX_Declarative_ActionRoles'}
Truth table0%0/2
A
A= delete $args{'attributes'}{'CatalystX_Declarative_ActionRoles'}
Aresult
11
00
63 0 ▶ @{ delete($args{attributes}{CatalystX_Declarative_DefaultActionRoles}) || [] },
Condition0%0/2
delete $args{'attributes'}{'CatalystX_Declarative_DefaultActionRoles'} || []
l!l
00
MC/DC0%0/1
delete $args{'attributes'}{'CatalystX_Declarative_DefaultActionRoles'} || []
delete $args{'attributes'}{'CatalystX_Declarative_DefaultActionRoles'}
Truth table0%0/2
A
A= delete $args{'attributes'}{'CatalystX_Declarative_DefaultActionRoles'}
Aresult
11
00
64 );
65 15 }
66  
67 0 ▶ around create_action (%args) {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine __ANON__: not called CC=5 SCAR=32.9
68 0 my $action = $self->$orig(%args);
69  
70 ## TODO Do we really need this anymore?
71 return $action
72 0 ▶ if $args{attributes}{Private};
Branch: 1 branch
BranchTrueFalseTotal
if $args{"attributes"}{"Private"} 0 0 0
73  
74 0 ▶ return $action
Branch: 1 branch
BranchTrueFalseTotal
unless $action->DOES("CatalystX::Declare::Action::CatchValidationError") 0 0 0
75 unless $action->DOES(CatchValidationError);
76  
77 0 my $tc = $self->_find_method_type_constraint($action->name);
78 0 my $np = $self->_find_method_named_params($action->name);
79  
80 0 ▶ return $action
Branch: 1 branch
BranchTrueFalseTotal
unless $tc 0 0 0
81 unless $tc;
82  
83 0 $action->controller_instance($self);
84 0 $action->method_type_constraint($tc);
85  
86 0 ▶ if ($np) {
Branch: 1 branch
BranchTrueFalseTotal
if ($np) 0 0 0
87  
88 0 $action->method_named_params($np);
89 0 $action->method_named_type_constraint({
90 map +($_, $self->_find_method_named_type_constraint($action->name, $_)),
91 @$np,
92 });
93 }
94  
95 0 return $action;
96 15 }
97 15 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
« Declare/Controller/QualifyClassNames.pm ↑ Summary Declare/Controller/DetermineActionClass.pm »