File Coverage

blib/lib/UID2/Client/Key.pm
Criterion Covered Total %
statement 15 15 100.0
branch 2 2 100.0
condition 2 3 66.6
subroutine 5 5 100.0
pod 0 1 0.0
total 24 26 92.3


line stmt bran cond sub pod time code
1             package UID2::Client::Key;
2 4     4   54548 use strict;
  4         12  
  4         95  
3 4     4   15 use warnings;
  4         7  
  4         117  
4              
5             use Class::Accessor::Lite (
6 4         41 new => 1,
7             ro => [qw(id site_id created activates expires secret)],
8 4     4   394 );
  4         1360  
9 4     4   898 use UID2::Client::Timestamp;
  4         6  
  4         290  
10              
11             sub is_active {
12 35     35 0 843 my ($self, $now) = @_;
13 35   66     91 $now //= UID2::Client::Timestamp->now;
14 35 100       62 $self->activates <= $now->get_epoch_second && $now->get_epoch_second < $self->expires;
15             }
16              
17             1;
18             __END__