lib/Reaction/UI/Controller.pm

filter: Statementstmt 71.1% 32 / 45 Branchbran 20.0% 2 / 10 Conditioncond 37.5% 3 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 70.0% 7 / 10 Podpod 60.0% 3 / 5 totaltotal 56.6% 47 / 83 CC 9 SCAR 20.6
CC
9
Cov
59%
push_viewport
17.3
build_per_context_instance
3.2
pop_viewport
2.0
CRAP 7.8
« lib/Reaction/InterfaceModel/Action/User/ChangePassword.pm ↑ Summary lib/Reaction/UI/Widget/Image.pm »
1 package Reaction::UI::Controller;
2  
3 4 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use Scalar::Util 'weaken';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use namespace::clean -except => [ qw(meta) ];
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 ▶BEGIN { extends 'Catalyst::Controller'; }
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 4 has context => (is => 'ro', isa => 'Object', weak_ref => 1);
10 4 with(
11 'Catalyst::Component::InstancePerContext',
12 'Reaction::UI::Controller::Role::RedirectTo'
13 );
14  
15 7 ▶sub build_per_context_instance {
Subroutine build_per_context_instance: called CC=3 SCAR=11.8
Pod undocumented
16 7 my ($self, $c, @args) = @_;
17 7 ▶ my $class = ref($self) || $self;
Condition33%1/3
ref $self || $self
l!l&&r!l&&!r
700
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table33%1/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
18 7 ▶ my $newself = $class->new($self->_application, {%{$self || {}}, context => $c, @args});
Condition50%1/2
$self || {}
l!l
70
MC/DC0%0/1
$self || {}
$self
Truth table50%1/2
A
A= $self
Aresult
11
00
19 7 return $newself;
20 }
21  
22 8 ▶sub push_viewport {
Subroutine push_viewport: called CC=7 SCAR=28.5
Pod documented
23 8 my $self = shift;
24 8 my $c = $self->context;
25 8 my $focus_stack = $c->stash->{focus_stack};
26 8 my ($class, @proto_args) = @_;
27 8 my %args;
28 8 ▶ if (my $vp_attr = $c->stack->[-1]->attributes->{ViewPort}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $vp_attr = $c->stack->[-1]->attributes->{'ViewPort'}) { } 0 8 8
29 0 ▶ if (ref($vp_attr) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $vp_attr eq "ARRAY") 0 0 0
30 0 $vp_attr = $vp_attr->[0];
31 }
32 0 ▶ if (ref($vp_attr) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $vp_attr eq 'HASH') { } 0 0 0
33 0 ▶ $class = $vp_attr->{class} if defined $vp_attr->{class};
Branch: 1 branch
BranchTrueFalseTotal
if defined $vp_attr->{"class"} 0 0 0
34 0 %args = %{ $self->merge_config_hashes($vp_attr, {@proto_args}) };
35 } else {
36 0 $class = $vp_attr;
37 0 %args = @proto_args;
38 }
39 } else {
40 8 %args = @proto_args;
41 }
42  
43 8 $args{ctx} = $c;
44  
45 8 ▶ if (exists $args{next_action} && !ref($args{next_action})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{"next_action"} and not ref $args{"next_action"}) 0 8 8
Condition33%1/3
exists $args{"next_action"} and not ref $args{"next_action"}
!ll&&!rl&&r
800
MC/DC0%0/2
exists $args{"next_action"} and not ref $args{"next_action"}
exists $args{"next_action"} not ref $args{"next_action"}
Truth table33%1/3
A and not(B)
A= exists $args{"next_action"}B= not ref $args{"next_action"}
ABresult
0X0
100
111
46 0 $args{next_action} = [ $self, 'redirect_to', $args{next_action} ];
47 }
48 8 $focus_stack->push_viewport($class, %args);
49 }
50  
51 0 ▶sub pop_viewport {
Subroutine pop_viewport: not called CC=1 SCAR=6.9
Pod documented
52 0 return shift->context->stash->{focus_stack}->pop_viewport;
53 }
54  
55 0 ▶sub pop_viewports_to {
Subroutine pop_viewports_to: not called CC=1 SCAR=6.9
Pod undocumented
56 0 my ($self, $vp) = @_;
57 0 return $self->context->stash->{focus_stack}->pop_viewports_to($vp);
58 }
59  
60 3 ▶sub make_context_closure {
Subroutine make_context_closure: called CC=1 SCAR=0.1
Pod documented
61 3 my($self, $closure) = @_;
62 3 my $ctx = $self->context;
63 3 weaken($ctx);
64 0 ▶ return sub { $closure->($ctx, @_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
65 }
66  
67 4 1;
68  
69 __END__;
« lib/Reaction/InterfaceModel/Action/User/ChangePassword.pm ↑ Summary lib/Reaction/UI/Widget/Image.pm »