Schema/ResultSet/User.pm

filter: Statementstmt 100% 20 / 20 Branchbran 66.6% 4 / 6 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 83.7% 31 / 37 CC 5 SCAR 12.4
CC
5
Cov
86%
find_user_with_reset_token
5.4
BEGIN
1.0
BEGIN
1.0
CRAP 3.4
« Schema/Base/Attribute.pm ↑ Summary Schema.pm »
1 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 package Interchange6::Schema::ResultSet::User;
4  
5 =head1 NAME
6  
7 Interchange6::Schema::ResultSet::User
8  
9 =cut
10  
11 =head1 SYNOPSIS
12  
13 Provides extra accessor methods for L<Interchange6::Schema::Result::User>
14  
15 =cut
16  
17 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 2 ▶use parent 'Interchange6::Schema::ResultSet';
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 =head1 METHODS
23  
24 =head2 find_user_with_reset_token( $token );
25  
26 Where $token is the combined <Interchange6::Schema::Result::User/reset_token>
27 and <Interchange6::Schema::Result::User/reset_token_checksum> as would be
28 returned by <Interchange6::Schema::Result::User/reset_token_generate>.
29  
30 Returns an <Interchange6::Schema::Result::User> object if $token is found and
31 is valid. On failure returns undef.
32  
33 =cut
34  
35 sub find_user_with_reset_token {
36 2 ▶ my ( $self, $arg ) = @_;
Subroutine find_user_with_reset_token: called CC=5 SCAR=16.8
Pod documented
37  
38 2 my ( $token, $checksum ) = split(/_/, $arg);
39  
40 2 ▶ $self->throw_exception("Bad argument to find_user_with_reset_token")
Branch: 1 branch
BranchTrueFalseTotal
unless $token and $checksum 0 2 2
Condition33%1/3
$token and $checksum
!ll&&!rl&&r
002
MC/DC0%0/2
$token and $checksum
$token $checksum
Truth table33%1/3
A and B
A= $tokenB= $checksum
ABresult
0X0
100
111
41 unless ( $token && $checksum );
42  
43 2 my $users = $self->search({reset_token => $token});
44  
45 2 ▶ while ( my $user = $users->next ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $user = $users->next) 1 1 2
46 1 ▶ return $user if $user->reset_token_verify( $arg );
Branch: 1 branch
BranchTrueFalseTotal
if $user->reset_token_verify($arg) 1 0 1
47 }
48  
49 1 return undef;
50 }
51  
52 2 1;
« Schema/Base/Attribute.pm ↑ Summary Schema.pm »