TimeZone/OffsetOnly.pm

filter: Statementstmt 64.0% 32 / 50 Branchbran 33.3% 2 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 50.0% 8 / 16 Podpod 77.7% 7 / 9 totaltotal 56.9% 49 / 86 CC 5 SCAR 11.8
CC
5
Cov
58%
STORABLE_thaw
12.0
new
3.1
offset_for_datetime
2.0
CRAP 3.3
« TimeZone/Floating.pm ↑ Summary TimeZone/Local/Android.pm »
1 package DateTime::TimeZone::OffsetOnly;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 our $VERSION = '2.72';
8  
9 3 ▶use parent 'DateTime::TimeZone';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 3 ▶use DateTime::TimeZone::UTC;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 3 ▶use Params::ValidationCompiler 0.13 qw( validation_for );
Subroutine BEGIN: called CC=1 SCAR=0.0
13 3 ▶use Specio::Library::String;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 {
16 3 my $validator = validation_for(
17 name => '_check_new_params',
18 name_is_optional => 1,
19 params => {
20 offset => {
21 type => t('NonEmptyStr'),
22 },
23 },
24 );
25  
26 1 ▶ sub new {
Subroutine new: called CC=3 SCAR=11.2
Pod documented
27 1 my $class = shift;
28 1 my %p = $validator->(@_);
29  
30 1 my $offset = DateTime::TimeZone::offset_as_seconds( $p{offset} );
31  
32 1 ▶ die "Invalid offset: $p{offset}\n" unless defined $offset;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $offset 0 1 1
33  
34 1 ▶ return DateTime::TimeZone::UTC->new unless $offset;
Branch: 1 branch
BranchTrueFalseTotal
unless $offset 0 1 1
35  
36 1 my $self = {
37 name => DateTime::TimeZone::offset_as_string($offset),
38 offset => $offset,
39 };
40  
41 1 return bless $self, $class;
42 }
43 }
44  
45 0 ▶sub is_dst_for_datetime {0}
Subroutine is_dst_for_datetime: not called CC=1 SCAR=1.2
Pod documented
46  
47 0 ▶sub offset_for_datetime { $_[0]->{offset} }
Subroutine offset_for_datetime: not called CC=1 SCAR=6.9
Pod documented
48 0 ▶sub offset_for_local_datetime { $_[0]->{offset} }
Subroutine offset_for_local_datetime: not called CC=1 SCAR=6.9
Pod documented
49  
50 0 ▶sub is_utc {0}
Subroutine is_utc: not called CC=1 SCAR=6.9
Pod documented
51  
52 0 ▶sub short_name_for_datetime { $_[0]->name }
Subroutine short_name_for_datetime: not called CC=1 SCAR=6.9
Pod documented
53  
54 0 ▶sub category {undef}
Subroutine category: not called CC=1 SCAR=6.9
Pod documented
55  
56 0 ▶sub STORABLE_freeze {
Subroutine STORABLE_freeze: not called CC=1 SCAR=6.9
Pod undocumented
57 0 my $self = shift;
58  
59 0 return $self->name;
60 }
61  
62 0 ▶sub STORABLE_thaw {
Subroutine STORABLE_thaw: not called CC=3 SCAR=24.8
Pod undocumented
63 0 my $self = shift;
64 0 shift;
65 0 my $serialized = shift;
66  
67 0 ▶ my $class = ref $self || $self;
Condition0%0/3
ref $self || $self
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table0%0/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
68  
69 0 my $obj;
70 0 ▶ if ( $class->isa(__PACKAGE__) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($class->isa(__PACKAGE__)) { } 0 0 0
71 0 $obj = __PACKAGE__->new( offset => $serialized );
72 }
73 else {
74 0 $obj = $class->new( offset => $serialized );
75 }
76  
77 0 %$self = %$obj;
78  
79 0 return $self;
80 }
81  
82 3 1;
83  
84 # ABSTRACT: A DateTime::TimeZone object that just contains an offset
85  
86 __END__
« TimeZone/Floating.pm ↑ Summary TimeZone/Local/Android.pm »