Picnic/Result/Login.pm

filter: Statementstmt 94.7% 18 / 19 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 73.1% 30 / 41 CC 6 SCAR 10.6
CC
6
Cov
73%
__ANON__
6.0
is_authenticated
3.7
__ANON__
2.1
CRAP 2.9
« Picnic/Result/Article.pm ↑ Summary Picnic/Result/SearchResult.pm »
1 package WWW::Picnic::Result::Login;
2 2 our $VERSION = '0.100';
3 2 our $AUTHORITY = 'cpan:GETTY';
4 # ABSTRACT: Picnic login result with 2FA status
5  
6 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 extends 'WWW::Picnic::Result';
9  
10  
11 has auth_key => (
12 is => 'ro',
13 lazy => 1,
14 1 ▶ default => sub { shift->_get('auth_key') },
Subroutine __ANON__: called CC=1 SCAR=0.0
15 2 );
16  
17  
18 has user_id => (
19 is => 'ro',
20 lazy => 1,
21 1 ▶ default => sub { shift->_get('user_id') },
Subroutine __ANON__: called CC=1 SCAR=0.0
22 2 );
23  
24  
25 has second_factor_authentication_required => (
26 is => 'ro',
27 lazy => 1,
28 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 1 0 1
29 2 );
30  
31  
32 has show_second_factor_authentication_intro => (
33 is => 'ro',
34 lazy => 1,
35 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
36 2 );
37  
38  
39 sub requires_2fa {
40 2 ▶ my ( $self ) = @_;
Subroutine requires_2fa: called CC=2 SCAR=7.2
Pod documented
41 2 ▶ return $self->second_factor_authentication_required ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$self->second_factor_authentication_required ? : 0 2 2
42 }
43  
44  
45 sub is_authenticated {
46 1 ▶ my ( $self ) = @_;
Subroutine is_authenticated: called CC=3 SCAR=13.1
Pod documented
47 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
48 }
49  
50  
51 2 1;
52  
53 __END__
« Picnic/Result/Article.pm ↑ Summary Picnic/Result/SearchResult.pm »