EFA/Route/Part.pm

filter: Statementstmt 68.1% 47 / 69 Branchbran 21.4% 3 / 14 Conditioncond 30.0% 3 / 10 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 76.4% 13 / 17 Podpod 92.3% 12 / 13 totaltotal 60.4% 78 / 129 CC 12 SCAR 13.4
CC
12
Cov
57%
is_cancelled
12.0
footpath_parts
6.0
regular_notes
6.0
CRAP 3.8
« EFA.pm ↑ Summary EFA/Route/Message.pm »
1 package Travel::Routing::DE::EFA::Route::Part;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶use parent 'Class::Accessor';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 our $VERSION = '2.25';
10  
11 2 my %occupancy = (
12 MANY_SEATS => 1,
13 FEW_SEATS => 2,
14 STANDING_ONLY => 3
15 );
16  
17 2 Travel::Routing::DE::EFA::Route::Part->mk_ro_accessors(
18 qw(arrival_platform arrival_stop
19 arrival_date arrival_time arrival_sdate arrival_stime arrival_delay
20 delay
21 departure_platform departure_delay
22 departure_stop departure_date departure_time departure_sdate
23 departure_stime
24 footpath_duration footpath_type
25 occupancy
26 train_destination train_line train_product
27 )
28 );
29  
30 10 ▶sub new {
Subroutine new: called CC=3 SCAR=12.0
Pod documented
31 10 my ( $obj, %conf ) = @_;
32  
33 10 my $ref = \%conf;
34  
35 10 ▶ if ( $ref->{occupancy} and exists $occupancy{ $ref->{occupancy} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ref->{'occupancy'} and exists $occupancy{$ref->{'occupancy'}}) { } 0 10 10
Condition33%1/3
$ref->{"occupancy"} and exists $occupancy{$ref->{"occupancy"}}
!ll&&!rl&&r
1000
MC/DC0%0/2
$ref->{"occupancy"} and exists $occupancy{$ref->{"occupancy"}}
$ref->{"occupancy"} exists $occupancy{$ref->{"occupancy"}}
Truth table33%1/3
A and B
A= $ref->{"occupancy"}B= exists $occupancy{$ref->{"occupancy"}}
ABresult
0X0
100
111
36 0 $ref->{occupancy} = $occupancy{ $ref->{occupancy} };
37 }
38 else {
39 10 delete $ref->{occupancy};
40 }
41  
42 10 $ref->{delay} = $ref->{departure_delay};
43  
44 10 return bless( $ref, $obj );
45 }
46  
47 2 ▶sub arrival_routemaps {
Subroutine arrival_routemaps: called CC=1 SCAR=0.0
Pod documented
48 2 my ($self) = @_;
49  
50 2 return @{ $self->{arrival_routemaps} };
51 }
52  
53 2 ▶sub arrival_stationmaps {
Subroutine arrival_stationmaps: called CC=1 SCAR=0.0
Pod documented
54 2 my ($self) = @_;
55  
56 2 return @{ $self->{arrival_stationmaps} };
57 }
58  
59 2 ▶sub arrival_stop_and_platform {
Subroutine arrival_stop_and_platform: called CC=2 SCAR=7.6
Pod documented
60 2 my ($self) = @_;
61  
62 2 ▶ if ( length( $self->arrival_platform ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $self->arrival_platform) 2 0 2
63 return
64 2 sprintf( '%s: %s', $self->get(qw(arrival_stop arrival_platform)) );
65 }
66 0 return $self->arrival_stop;
67 }
68  
69 2 ▶sub departure_routemaps {
Subroutine departure_routemaps: called CC=1 SCAR=0.0
Pod documented
70 2 my ($self) = @_;
71  
72 2 return @{ $self->{departure_routemaps} };
73 }
74  
75 2 ▶sub departure_stationmaps {
Subroutine departure_stationmaps: called CC=1 SCAR=0.0
Pod documented
76 2 my ($self) = @_;
77  
78 2 return @{ $self->{departure_stationmaps} };
79 }
80  
81 2 ▶sub departure_stop_and_platform {
Subroutine departure_stop_and_platform: called CC=2 SCAR=7.6
Pod documented
82 2 my ($self) = @_;
83  
84 2 ▶ if ( length( $self->departure_platform ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $self->departure_platform) 2 0 2
85  
86 return
87 2 sprintf( '%s: %s',
88 $self->get(qw(departure_stop departure_platform)) );
89 }
90 0 return $self->departure_stop;
91 }
92  
93 0 ▶sub footpath_parts {
Subroutine footpath_parts: not called CC=2 SCAR=17.9
Pod documented
94 0 my ($self) = @_;
95  
96 0 ▶ if ( $self->{footpath_parts} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"footpath_parts"}) 0 0 0
97 0 return @{ $self->{footpath_parts} };
98 }
99 0 return;
100 }
101  
102 0 ▶sub is_cancelled {
Subroutine is_cancelled: not called CC=3 SCAR=24.8
Pod documented
103 0 my ($self) = @_;
104  
105 0 ▶ if ( $self->{delay} and $self->{delay} eq '-9999' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"delay"} and $self->{"delay"} eq -9999) 0 0 0
Condition0%0/3
$self->{"delay"} and $self->{"delay"} eq -9999
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"delay"} and $self->{"delay"} eq -9999
$self->{"delay"} $self->{"delay"} eq -9999
Truth table0%0/3
A and B
A= $self->{"delay"}B= $self->{"delay"} eq -9999
ABresult
0X0
100
111
106 0 return 1;
107 }
108 0 return;
109 }
110  
111 # DEPRECATED
112 2 ▶sub extra {
Subroutine extra: called CC=2 SCAR=7.0
Pod undocumented
113 2 my ($self) = @_;
114  
115 2 ▶ my @ret = map { $_->summary } @{ $self->{regular_notes} // [] };
Condition50%1/2
$self->{"regular_notes"} // []
l!l
20
MC/DC0%0/1
$self->{"regular_notes"} // []
$self->{"regular_notes"}
Truth table50%1/2
A
A= $self->{"regular_notes"}
Aresult
11
00
116  
117 2 return @ret;
118 }
119  
120 0 ▶sub regular_notes {
Subroutine regular_notes: not called CC=2 SCAR=17.9
Pod documented
121 0 my ($self) = @_;
122  
123 0 ▶ if ( $self->{regular_notes} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"regular_notes"}) 0 0 0
124 0 return @{ $self->{regular_notes} };
125 }
126 0 return;
127 }
128  
129 0 ▶sub current_notes {
Subroutine current_notes: not called CC=2 SCAR=17.9
Pod documented
130 0 my ($self) = @_;
131  
132 0 ▶ if ( $self->{current_notes} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"current_notes"}) 0 0 0
133 0 return @{ $self->{current_notes} };
134 }
135 0 return;
136 }
137  
138 1 ▶sub via {
Subroutine via: called CC=2 SCAR=7.1
Pod documented
139 1 my ($self) = @_;
140  
141 1 ▶ return @{ $self->{via} // [] };
Condition50%1/2
$self->{"via"} // []
l!l
10
MC/DC0%0/1
$self->{"via"} // []
$self->{"via"}
Truth table50%1/2
A
A= $self->{"via"}
Aresult
11
00
142 }
143  
144 2 1;
145  
146 __END__
« EFA.pm ↑ Summary EFA/Route/Message.pm »