DateTime.pm

filter: Statementstmt 94.2% 33 / 35 Branchbran 50.0% 2 / 4 Conditioncond 60.0% 3 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 88.8% 8 / 9 Podpod n/a totaltotal 82.1% 46 / 56 CC 6 SCAR 9.0
CC
6
Cov
86%
import
4.2
__ANON__
3.1
__ANON__
2.0
CRAP 2.5
« DateTime/Auto.pm ↑ Summary
1 package DBIx::Skinny::InflateColumn::DateTime;
2  
3 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 our $VERSION = '0.06';
6  
7 6 ▶use DateTime;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 6 ▶use DateTime::Format::Strptime;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 6 ▶use DateTime::Format::MySQL;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 6 ▶use DateTime::TimeZone;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 6 ▶sub import {
Subroutine import: called CC=4 SCAR=14.5
13 6 my $class = shift;
14 6 my %args = @_;
15 6 ▶ my $timezone = $args{time_zone} || DateTime::TimeZone->new(name => 'local');
Condition66%2/3
$args{'time_zone'} || 'DateTime::TimeZone'->new('name', 'local')
l!l&&r!l&&!r
105
MC/DC0%0/2
$args{'time_zone'} || 'DateTime::TimeZone'->new('name', 'local')
$args{'time_zone'} 'DateTime::TimeZone'->new('name', 'local')
Truth table33%1/3
A || B
A= $args{'time_zone'}B= 'DateTime::TimeZone'->new('name', 'local')
ABresult
1X1
011
000
16 1 ▶ my @rules = @{ $args{rules} || [qr/^.+_at$/, qr/^.+_on$/] };
Condition50%1/2
$args{'rules'} || [qr/^.+_at$/, qr/^.+_on$/]
l!l
01
MC/DC0%0/1
$args{'rules'} || [qr/^.+_at$/, qr/^.+_on$/]
$args{'rules'}
Truth table50%1/2
A
A= $args{'rules'}
Aresult
11
00
17 1 my $schema = caller;
18 1 for my $rule ( @rules ) {
19 1 ▶ $schema->inflate_rules->{ $rule }->{ inflate } = sub {
Subroutine __ANON__: called CC=3 SCAR=11.4
20 1 ▶ my $value = shift or return;
Branch: 1 branch
BranchTrueFalseTotal
my $value = shift() or return 1 0 1
21 1 ▶ return $value if ref $value eq 'DateTime';
Branch: 1 branch
BranchTrueFalseTotal
if ref $value eq "DateTime" 0 1 1
22 1 my $dt = DateTime::Format::Strptime->new(
23 pattern => '%Y-%m-%d %H:%M:%S',
24 time_zone => $timezone,
25 )->parse_datetime($value);
26 1 return DateTime->from_object( object => $dt );
27 2 };
28 0 ▶ $schema->inflate_rules->{ $rule }->{ deflate } = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
29 0 my $value = shift;
30 0 return DateTime::Format::MySQL->format_datetime($value);
31 2 };
32 }
33 }
34  
35 6 1;
36 __END__
« DateTime/Auto.pm ↑ Summary