SlimTimer/TimeEntry.pm

filter: Statementstmt 88.4% 46 / 52 Branchbran 25.0% 1 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 92.8% 13 / 14 Podpod n/a totaltotal 85.7% 60 / 70 CC 3 SCAR 3.4
CC
3
Cov
84%
BUILDARGS
2.6
__ANON__
2.6
BEGIN
1.0
CRAP 1.4
« SlimTimer.pm ↑ Summary SlimTimer/Types.pm »
1 # PODNAME: WebService::SlimTimer::TimeEntry
2 #
3 # ABSTRACT: Represents a time entry record in SlimTimer.
4  
5 3 ▶use MooseX::Declare;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 class WebService::SlimTimer::TimeEntry
8 3 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.1
9  
10  
11 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 3 ▶use MooseX::Types::Moose qw(Bool Int Maybe Str);
Subroutine BEGIN: called CC=1 SCAR=0.0
15 3 ▶use WebService::SlimTimer::Types qw(TimeStamp);
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 0 ▶method BUILDARGS(ClassName $class: HashRef $desc) {
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine __ANON__: not called CC=2 SCAR=9.5
Subroutine BUILDARGS: called CC=2 SCAR=9.5
18 # We use a different (shorter) name for one of the attributes compared to
19 # the YAML format, translate it on the fly.
20 0 $desc->{duration} = delete $desc->{duration_in_seconds};
21  
22 # We also want to extract the associated task id and name from the nested
23 # task hash if present (otherwise task_id must be specified explicitly).
24 0 ▶ if ( exists $desc->{'task'} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $desc->{"task"}) 0 0 0
if (exists $desc->{"task"}) 3 0 3
25 0 $desc->{task_id} = $desc->{task}->{id};
26 0 $desc->{task_name} = $desc->{task}->{name};
27 }
28  
29 0 return $desc;
30 3 }
31  
32 3 has id => ( is => 'ro', isa => Int, required => 1 );
33 3 has task_id => ( is => 'ro', isa => Int, required => 1 );
34 3 has task_name => ( is => 'ro', isa => Str );
35 3 has start_time => ( is => 'ro', isa => TimeStamp, required => 1, coerce => 1 );
36 3 has end_time => ( is => 'ro', isa => TimeStamp, required => 1, coerce => 1 );
37 3 has created_at => ( is => 'ro', isa => TimeStamp, required => 1, coerce => 1 );
38 3 has updated_at => ( is => 'ro', isa => TimeStamp, required => 1, coerce => 1 );
39 3 has duration => ( is => 'ro', isa => Int, required => 1 );
40 3 has comments => ( is => 'ro', isa => Maybe[Str] );
41 3 has in_progress => ( is => 'ro', isa => Bool, required => 1 );
42  
43 # TODO: Add tags.
44  
45 3 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
46  
47 __END__
« SlimTimer.pm ↑ Summary SlimTimer/Types.pm »