Picnic/Result/Login.pm

filter: Statementstmt 94.4% 17 / 18 Branchbran 37.5% 3 / 8 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 85.7% 6 / 7 Podpod 100% 2 / 2 totaltotal 72.5% 29 / 40 CC 6 SCAR 10.6
CC
6
Cov
72%
__ANON__
6.0
is_authenticated
3.7
__ANON__
2.1
CRAP 2.9
« Picnic/Result/Article.pm ↑ Summary Picnic/Result/Suggestions.pm »
1 package WWW::Picnic::Result::Login;
2 # ABSTRACT: Picnic login result with 2FA status
3 2 our $VERSION = '0.101';
4 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 extends 'WWW::Picnic::Result';
7  
8  
9 has auth_key => (
10 is => 'ro',
11 lazy => 1,
12 1 ▶ default => sub { shift->_get('auth_key') },
Subroutine __ANON__: called CC=1 SCAR=0.0
13 2 );
14  
15  
16 has user_id => (
17 is => 'ro',
18 lazy => 1,
19 1 ▶ default => sub { shift->_get('user_id') },
Subroutine __ANON__: called CC=1 SCAR=0.0
20 2 );
21  
22  
23 has second_factor_authentication_required => (
24 is => 'ro',
25 lazy => 1,
26 1 ▶ default => sub { shift->_get('second_factor_authentication_required') || 0 },
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
(shift())->_get("second_factor_authentication_required") or 0 0 1 1
27 2 );
28  
29  
30 has show_second_factor_authentication_intro => (
31 is => 'ro',
32 lazy => 1,
33 0 ▶ default => sub { shift->_get('show_second_factor_authentication_intro') || 0 },
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
(shift())->_get("show_second_factor_authentication_intro") or 0 0 0 0
34 2 );
35  
36  
37 2 ▶sub requires_2fa {
Subroutine requires_2fa: called CC=2 SCAR=7.2
Pod documented
38 2 my ( $self ) = @_;
39 2 ▶ return $self->second_factor_authentication_required ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$self->second_factor_authentication_required ? : 0 2 2
40 }
41  
42  
43 1 ▶sub is_authenticated {
Subroutine is_authenticated: called CC=3 SCAR=13.1
Pod documented
44 1 my ( $self ) = @_;
45 1 ▶ return $self->auth_key && !$self->requires_2fa ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$self->auth_key && !$self->requires_2fa ? : 1 0 1
Condition33%1/3
$self->auth_key and not $self->requires_2fa
!ll&&!rl&&r
001
MC/DC0%0/2
$self->auth_key and not $self->requires_2fa
$self->auth_key not $self->requires_2fa
Truth table33%1/3
A and not(B)
A= $self->auth_keyB= not $self->requires_2fa
ABresult
0X0
100
111
46 }
47  
48  
49 2 1;
50  
51 __END__
« Picnic/Result/Article.pm ↑ Summary Picnic/Result/Suggestions.pm »