RequireSSL/Role.pm

filter: Statementstmt 100% 21 / 21 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod 100% 1 / 1 totaltotal 96.7% 30 / 31 CC 6 SCAR 15.6
CC
6
Cov
96%
check_chain
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.8
« RequireSSL.pm ↑ Summary NoSSL.pm »
1 package Catalyst::ActionRole::RequireSSL::Role;
2  
3 2 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 our $VERSION = '0.07';
6  
7 =head1 NAME
8  
9 Catalyst::ActionRole::RequireSSL::Role - Roles.
10  
11 =head1 VERSION
12  
13 version 1.00
14  
15 =head1 SYNOPSIS
16  
17 =cut
18  
19 2 my @ignore_chain = qw/Catalyst::ActionRole::NoSSL Catalyst::ActionRole::RequireSSL/;
20  
21 =head1 METHODS
22  
23 =head2 check_chain($c)
24  
25 check we are most relevant action
26  
27 =cut
28  
29 10 ▶sub check_chain {
Subroutine check_chain: called CC=6 SCAR=17.9
Pod documented
30 10 my ($self,$c) = @_;
31 return $c->config->{require_ssl}->{path_cache}->{$c->action->private_path}
32 eq $self->private_path
33 10 ▶ if $c->config->{require_ssl}->{path_cache}->{$c->action->private_path};
Branch: 1 branch
BranchTrueFalseTotal
if $c->config->{"require_ssl"}{"path_cache"}{$c->action->private_path} 2 8 10
34 8 ▶ if($c->action->can('chain')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->action->can("chain")) 7 1 8
35 7 foreach my $action (reverse @{$c->action->chain}) {
36 10 foreach my $role (@{$action->attributes->{Does}}) {
37 7 ▶ if(grep {$role eq $_} @ignore_chain ) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$role eq $_;} @ignore_chain) 7 0 7
38 7 $c->config->{require_ssl}->{path_cache}->{$action->private_path}
39 = $action->private_path;
40 7 return $action->private_path eq $self->private_path;
41 }
42 }
43 }
44 }
45 1 return 1;
46 }
47  
48 2 1;
« RequireSSL.pm ↑ Summary NoSSL.pm »