| 1 | package Travel::Status::DE::EFA::Departure; | ||||||||||||||||||||||||||||||||||||||||||
| 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 DateTime; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use List::Util qw(any); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use Travel::Status::DE::EFA::Stop; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use parent 'Class::Accessor'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 2 | our $VERSION = '3.22'; | |||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 2 | Travel::Status::DE::EFA::Departure->mk_ro_accessors( | |||||||||||||||||||||||||||||||||||||||||
| 16 | qw(countdown datetime delay destination is_cancelled key line lineref mot | ||||||||||||||||||||||||||||||||||||||||||
| 17 | occupancy operator origin platform platform_db platform_name rt_datetime | ||||||||||||||||||||||||||||||||||||||||||
| 18 | sched_datetime stateless stop_id_num train_type train_name train_no type) | ||||||||||||||||||||||||||||||||||||||||||
| 19 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 2 | my @mot_mapping = qw{ | |||||||||||||||||||||||||||||||||||||||||
| 22 | zug s-bahn u-bahn stadtbahn tram stadtbus regionalbus | ||||||||||||||||||||||||||||||||||||||||||
| 23 | schnellbus seilbahn schiff ast sonstige | ||||||||||||||||||||||||||||||||||||||||||
| 24 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | sub parse_departure { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_departure: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | my ( $self, $departure ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 40 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=14 SCAR=31.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 40 | my ( $obj, %conf ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 40 | my $departure = $conf{json}; | |||||||||||||||||||||||||||||||||||||||||
| 34 | 40 | my ( $sched_dt, $real_dt ); | |||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 40 | ▶ | if ( my $dt = $departure->{dateTime} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 40 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 38 | $sched_dt = DateTime->new( | ||||||||||||||||||||||||||||||||||||||||||
| 39 | year => $dt->{year}, | ||||||||||||||||||||||||||||||||||||||||||
| 40 | month => $dt->{month}, | ||||||||||||||||||||||||||||||||||||||||||
| 41 | day => $dt->{day}, | ||||||||||||||||||||||||||||||||||||||||||
| 42 | hour => $dt->{hour}, | ||||||||||||||||||||||||||||||||||||||||||
| 43 | minute => $dt->{minute}, | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 40 | ▶ | second => $dt->{second} // 0, | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$dt->{"second"} // 0
MC/DC0%0/1
$dt->{"second"} // 0
$dt->{"second"}
Truth table50%1/2
A
A= $dt->{"second"}
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | time_zone => 'Europe/Berlin', | ||||||||||||||||||||||||||||||||||||||||||
| 46 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 47 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 40 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | warn( | |||||||||||||||||||||||||||||||||||||||||
| 50 | "Departure $departure->{servingLine}{stateless}: Invalid departure dateTIme: $@" | ||||||||||||||||||||||||||||||||||||||||||
| 51 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 40 | ▶ | if ( my $dt = $departure->{realDateTime} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 38 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 57 | $real_dt = DateTime->new( | ||||||||||||||||||||||||||||||||||||||||||
| 58 | year => $dt->{year}, | ||||||||||||||||||||||||||||||||||||||||||
| 59 | month => $dt->{month}, | ||||||||||||||||||||||||||||||||||||||||||
| 60 | day => $dt->{day}, | ||||||||||||||||||||||||||||||||||||||||||
| 61 | hour => $dt->{hour}, | ||||||||||||||||||||||||||||||||||||||||||
| 62 | minute => $dt->{minute}, | ||||||||||||||||||||||||||||||||||||||||||
| 63 | 38 | ▶ | second => $dt->{second} // 0, | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$dt->{"second"} // 0
MC/DC0%0/1
$dt->{"second"} // 0
$dt->{"second"}
Truth table50%1/2
A
A= $dt->{"second"}
| |||||||||||||||||||||||||||||||||||||||||||
| 64 | time_zone => 'Europe/Berlin', | ||||||||||||||||||||||||||||||||||||||||||
| 65 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 66 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 67 | 38 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | warn( | |||||||||||||||||||||||||||||||||||||||||
| 69 | "Departure $departure->{servingLine}{stateless}: Invalid departure dateTIme: $@" | ||||||||||||||||||||||||||||||||||||||||||
| 70 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | my @hints | ||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | = map { $_->{content} } @{ $departure->{servingLine}{hints} // [] }; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$departure->{"servingLine"}{"hints"} // []
MC/DC0%0/1
$departure->{"servingLine"}{"hints"} // []
$departure->{"servingLine"}{"hints"}
Truth table50%1/2
A
A= $departure->{"servingLine"}{"hints"}
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | my $ref = { | ||||||||||||||||||||||||||||||||||||||||||
| 78 | strp_stopseq_s => $conf{strp_stopseq_s}, | ||||||||||||||||||||||||||||||||||||||||||
| 79 | strp_stopseq => $conf{strp_stopseq}, | ||||||||||||||||||||||||||||||||||||||||||
| 80 | rt_datetime => $real_dt, | ||||||||||||||||||||||||||||||||||||||||||
| 81 | platform => $departure->{platform}, | ||||||||||||||||||||||||||||||||||||||||||
| 82 | platform_name => $departure->{platformName}, | ||||||||||||||||||||||||||||||||||||||||||
| 83 | platform_type => $departure->{pointType}, | ||||||||||||||||||||||||||||||||||||||||||
| 84 | key => $departure->{servingLine}{key}, | ||||||||||||||||||||||||||||||||||||||||||
| 85 | stateless => $departure->{servingLine}{stateless}, | ||||||||||||||||||||||||||||||||||||||||||
| 86 | stop_id_num => $departure->{stopID}, | ||||||||||||||||||||||||||||||||||||||||||
| 87 | line => $departure->{servingLine}{symbol} | ||||||||||||||||||||||||||||||||||||||||||
| 88 | || $departure->{servingLine}{number}, | ||||||||||||||||||||||||||||||||||||||||||
| 89 | train_type => $departure->{servingLine}{trainType}, | ||||||||||||||||||||||||||||||||||||||||||
| 90 | train_name => $departure->{servingLine}{trainName}, | ||||||||||||||||||||||||||||||||||||||||||
| 91 | train_no => $departure->{servingLine}{trainNum}, | ||||||||||||||||||||||||||||||||||||||||||
| 92 | origin => $departure->{servingLine}{directionFrom}, | ||||||||||||||||||||||||||||||||||||||||||
| 93 | destination => $departure->{servingLine}{direction}, | ||||||||||||||||||||||||||||||||||||||||||
| 94 | occupancy => $departure->{occupancy}, | ||||||||||||||||||||||||||||||||||||||||||
| 95 | countdown => $departure->{countdown}, | ||||||||||||||||||||||||||||||||||||||||||
| 96 | delay => $departure->{servingLine}{delay}, | ||||||||||||||||||||||||||||||||||||||||||
| 97 | sched_datetime => $sched_dt, | ||||||||||||||||||||||||||||||||||||||||||
| 98 | type => $departure->{servingLine}{name}, | ||||||||||||||||||||||||||||||||||||||||||
| 99 | mot => $departure->{servingLine}{motType}, | ||||||||||||||||||||||||||||||||||||||||||
| 100 | 40 | ▶ | hints => \@hints, | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$departure->{'servingLine'}{'symbol'} || $departure->{'servingLine'}{'number'}
MC/DC0%0/2
$departure->{'servingLine'}{'symbol'} || $departure->{'servingLine'}{'number'}
$departure->{'servingLine'}{'symbol'}
$departure->{'servingLine'}{'number'}
Truth table33%1/3
A || B
A= $departure->{'servingLine'}{'symbol'}B= $departure->{'servingLine'}{'number'}
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | 40 | ▶ | if ( defined $ref->{delay} and $ref->{delay} eq '-9999' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $ref->{"delay"} and $ref->{"delay"} eq -9999
MC/DC0%0/2
defined $ref->{"delay"} and $ref->{"delay"} eq -9999
defined $ref->{"delay"}
$ref->{"delay"} eq -9999
Truth table66%2/3
A and B
A= defined $ref->{"delay"}B= $ref->{"delay"} eq -9999
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | $ref->{delay} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | $ref->{is_cancelled} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 107 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 108 | 40 | $ref->{is_cancelled} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 40 | ▶ | $ref->{datetime} = $ref->{rt_datetime} // $ref->{sched_datetime}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$ref->{"rt_datetime"} // $ref->{"sched_datetime"}
MC/DC0%0/2
$ref->{"rt_datetime"} // $ref->{"sched_datetime"}
$ref->{"rt_datetime"}
$ref->{"sched_datetime"}
Truth table66%2/3
A // B
A= $ref->{"rt_datetime"}B= $ref->{"sched_datetime"}
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | 40 | bless( $ref, $obj ); | |||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | 40 | ▶ | if ( $departure->{prevStopSeq} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | $ref->{prev_route} = $ref->parse_route( $departure->{prevStopSeq}, | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | $departure->{stopID} ); | |||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 119 | 40 | ▶ | if ( $departure->{onwardStopSeq} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | $ref->{next_route} = $ref->parse_route( $departure->{onwardStopSeq}, | ||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | $departure->{stopID} ); | |||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | 40 | return $ref; | |||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | sub parse_datetime { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_datetime: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | my ( $self, $strp, $str ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | my $ret; | |||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | eval { $ret = $strp->parse_datetime($str); }; | |||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | my $strp_str = $strp->pattern; | |||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | warn( | |||||||||||||||||||||||||||||||||||||||||
| 135 | "Departure $self->{stateless}: Cannot parse '$str' with '$strp_str': $@" | ||||||||||||||||||||||||||||||||||||||||||
| 136 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | return $ret; | |||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | sub parse_route { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_route: not called CC=15 SCAR=54.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | my ( $self, $stop_seq, $requested_id ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | my @ret; | |||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | if ( not $stop_seq ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | return \@ret; | |||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | # Oh EFA, you so silly | ||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | if ( ref($stop_seq) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | # For lines that start or terminate at the requested stop, onwardStopSeq / prevStopSeq includes the requested stop. | ||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | if ( $stop_seq->{ref}{id} eq $requested_id ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | return \@ret; | |||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | $stop_seq = [$stop_seq]; | |||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | for my $stop ( @{ $stop_seq // [] } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$stop_seq // []
MC/DC0%0/1
$stop_seq // []
$stop_seq
Truth table0%0/2
A
A= $stop_seq
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | my $ref = $stop->{ref}; | |||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | my ( $arr, $dep ); | |||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | if ( $ref->{arrDateTimeSec} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | $arr = $self->parse_datetime( $self->{strp_stopseq_s}, | ||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | $ref->{arrDateTimeSec} ); | |||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||
| 168 | elsif ( $ref->{arrDateTime} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 169 | $arr = $self->parse_datetime( $self->{strp_stopseq}, | ||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | $ref->{arrDateTime} ); | |||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | if ( $ref->{depDateTimeSec} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | $dep = $self->parse_datetime( $self->{strp_stopseq_s}, | ||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | $ref->{depDateTimeSec} ); | |||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||
| 177 | elsif ( $ref->{depDateTime} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 178 | $dep = $self->parse_datetime( $self->{strp_stopseq}, | ||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | $ref->{depDateTime} ); | |||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||
| 181 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | warn; | |||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | push( | ||||||||||||||||||||||||||||||||||||||||||
| 187 | @ret, | ||||||||||||||||||||||||||||||||||||||||||
| 188 | Travel::Status::DE::EFA::Stop->new( | ||||||||||||||||||||||||||||||||||||||||||
| 189 | sched_arr => $arr, | ||||||||||||||||||||||||||||||||||||||||||
| 190 | sched_dep => $dep, | ||||||||||||||||||||||||||||||||||||||||||
| 191 | arr_delay => $ref->{arrValid} ? $ref->{arrDelay} : undef, | ||||||||||||||||||||||||||||||||||||||||||
| 192 | dep_delay => $ref->{depValid} ? $ref->{depDelay} : undef, | ||||||||||||||||||||||||||||||||||||||||||
| 193 | id_num => $ref->{id}, | ||||||||||||||||||||||||||||||||||||||||||
| 194 | id_code => $ref->{gid}, | ||||||||||||||||||||||||||||||||||||||||||
| 195 | full_name => $stop->{name}, | ||||||||||||||||||||||||||||||||||||||||||
| 196 | place => $stop->{place}, | ||||||||||||||||||||||||||||||||||||||||||
| 197 | name => $stop->{nameWO}, | ||||||||||||||||||||||||||||||||||||||||||
| 198 | occupancy => $stop->{occupancy}, | ||||||||||||||||||||||||||||||||||||||||||
| 199 | platform => $ref->{platform} || $stop->{platformName} || undef, | ||||||||||||||||||||||||||||||||||||||||||
| 200 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/5
$ref->{'platform'} || $stop->{'platformName'} || undef
$ref->{"platform"} or $stop->{"platformName"}
MC/DC0%0/2
$ref->{'platform'} || $stop->{'platformName'} || undef
$ref->{"platform"}
$stop->{"platformName"}
Truth table0%0/3
A or B
A= $ref->{"platform"}B= $stop->{"platformName"}
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | return \@ret; | |||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | sub id { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
id: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | ▶ | if ( $self->{id} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | return $self->{id}; | |||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | return $self->{id} = sprintf( '%s@%d(%s)%d', | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
scalar $self->route_pre and ($self->route_pre)[0]->sched_dep
MC/DC0%0/2
scalar $self->route_pre and ($self->route_pre)[0]->sched_dep
scalar $self->route_pre
($self->route_pre)[0]->sched_dep
Truth table0%0/3
A and B
A= scalar $self->route_preB= ($self->route_pre)[0]->sched_dep
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | $self->stateless =~ s{ }{}gr, | ||||||||||||||||||||||||||||||||||||||||||
| 216 | scalar $self->route_pre ? ( $self->route_pre )[0]->id_num | ||||||||||||||||||||||||||||||||||||||||||
| 217 | : $self->stop_id_num, | ||||||||||||||||||||||||||||||||||||||||||
| 218 | ( scalar $self->route_pre and ( $self->route_pre )[0]->sched_dep ) | ||||||||||||||||||||||||||||||||||||||||||
| 219 | ? ( $self->route_pre )[0]->sched_dep->strftime('%Y%m%dT%H:%M') | ||||||||||||||||||||||||||||||||||||||||||
| 220 | : $self->sched_datetime->strftime('%Y%m%dT%H:%M'), | ||||||||||||||||||||||||||||||||||||||||||
| 221 | $self->key ); | ||||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | 3 | ▶ | sub hints { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hints: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 225 | 3 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | 3 | ▶ | return @{ $self->{hints} // [] }; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"hints"} // []
MC/DC0%0/1
$self->{"hints"} // []
$self->{"hints"}
Truth table50%1/2
A
A= $self->{"hints"}
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | 3 | ▶ | sub mot_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mot_name: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 231 | 3 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | 3 | ▶ | return $mot_mapping[ $self->{mot} ] // 'sonstige'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$mot_mapping[$self->{"mot"}] // "sonstige"
MC/DC0%0/1
$mot_mapping[$self->{"mot"}] // "sonstige"
$mot_mapping[$self->{"mot"}]
Truth table50%1/2
A
A= $mot_mapping[$self->{"mot"}]
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | ▶ | sub route_pre { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
route_pre: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | return @{ $self->{prev_route} // [] }; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"prev_route"} // []
MC/DC0%0/1
$self->{"prev_route"} // []
$self->{"prev_route"}
Truth table0%0/2
A
A= $self->{"prev_route"}
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | ▶ | sub route_post { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
route_post: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | return @{ $self->{next_route} // [] }; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"next_route"} // []
MC/DC0%0/1
$self->{"next_route"} // []
$self->{"next_route"}
Truth table0%0/2
A
A= $self->{"next_route"}
| |||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | sub route_interesting { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
route_interesting: not called CC=17 SCAR=57.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | my ( $self, $max_parts ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | my @via = $self->route_post; | |||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | my ( @via_main, @via_show, $last_stop ); | |||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | ▶ | $max_parts //= 3; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$max_parts //= 3
MC/DC0%0/1
$max_parts //= 3
$max_parts
Truth table0%0/2
A
A= $max_parts
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | for my $stop (@via) { | |||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 257 | $stop->name =~ m{ Bf | Hbf | Flughafen | [Bb]ahnhof | ||||||||||||||||||||||||||||||||||||||||||
| 258 | | Krankenhaus | Klinik | (?: S $ ) }ox | ||||||||||||||||||||||||||||||||||||||||||
| 259 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 260 | { | ||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | push( @via_main, $stop ); | |||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | $last_stop = pop(@via); | |||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | if ( @via_main and $via_main[-1] == $last_stop ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@via_main and $via_main[-1] == $last_stop
MC/DC0%0/2
@via_main and $via_main[-1] == $last_stop
@via_main
$via_main[-1] == $last_stop
Truth table0%0/3
A and B
A= @via_mainB= $via_main[-1] == $last_stop
| |||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | pop(@via_main); | |||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | ▶ | if ( @via and $via[-1] == $last_stop ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@via and $via[-1] == $last_stop
MC/DC0%0/2
@via and $via[-1] == $last_stop
@via
$via[-1] == $last_stop
Truth table0%0/3
A and B
A= @viaB= $via[-1] == $last_stop
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | pop(@via); | |||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | if ( @via_main and @via and $via[0] == $via_main[0] ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
@via_main and @via and $via[0] == $via_main[0]
@via_main and @via
MC/DC0%0/3
@via_main and @via and $via[0] == $via_main[0]
@via_main
@via
$via[0] == $via_main[0]
Truth table0%0/4
A and B and C
A= @via_mainB= @viaC= $via[0] == $via_main[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | shift(@via_main); | |||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | if ( @via < $max_parts ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | @via_show = @via; | |||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||
| 280 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | ▶ | if ( @via_main >= $max_parts ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | @via_show = ( $via[0] ); | |||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||
| 284 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | @via_show = splice( @via, 0, $max_parts - @via_main ); | |||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | ▶ | while ( @via_show < $max_parts and @via_main ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@via_show < $max_parts and @via_main
MC/DC0%0/2
@via_show < $max_parts and @via_main
@via_show < $max_parts
@via_main
Truth table0%0/3
A and B
A= @via_show < $max_partsB= @via_main
| |||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | my $stop = shift(@via_main); | |||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | if ( any { $_->name eq $stop->name } @via_show | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
Condition0%0/3
&any(sub {
$_->name eq $stop->name;
}
, @via_show) or $stop->name eq $last_stop->name
MC/DC0%0/2
&any(sub {
$_->name eq $stop->name;
}
, @via_show) or $stop->name eq $last_stop->name
&any(sub {
$_->name eq $stop->name;
}
, @via_show)
$stop->name eq $last_stop->name
Truth table0%0/3
A or B
A= &any(sub {
$_->name eq $stop->name;
}
, @via_show)B= $stop->name eq $last_stop->name
| |||||||||||||||||||||||||||||||||||||||||||
| 291 | or $stop->name eq $last_stop->name ) | ||||||||||||||||||||||||||||||||||||||||||
| 292 | { | ||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | push( @via_show, $stop ); | |||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | return @via_show; | |||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | ▶ | sub TO_JSON { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TO_JSON: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | # compute on-demand keys | ||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | $self->id; | |||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | my $ret = { %{$self} }; | |||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | delete $ret->{strp_stopseq}; | |||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | delete $ret->{strp_stopseq_s}; | |||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | for my $k (qw(datetime rt_datetime sched_datetime)) { | |||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | ▶ | if ( $ret->{$k} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | $ret->{$k} = $ret->{$k}->epoch; | |||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | return $ret; | |||||||||||||||||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||
| 322 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||
| 324 | __END__ | ||||||||||||||||||||||||||||||||||||||||||