| 1 | 2 | ▶ | use 5.10.0; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | package Map::Metro::Plugin::Hook::Helsinki::Swedish; | ||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | # ABSTRACT: Use the Swedish station names | ||||||||||||||||||||
| 8 | 2 | our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY | |||||||||||||||||||
| 9 | 2 | our $VERSION = '0.1987'; | |||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 2 | ▶ | use Moose; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | 2 | ▶ | use namespace::autoclean; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | 2 | ▶ | use Map::Metro::Hook; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | 2 | ▶ | use Encode qw/encode_utf8 decode_utf8/; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 15 | 2 | ▶ | use utf8; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | 2 | ▶ | sub register { | ||||||||||||||||||
|
Subroutine
register: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 18 | 34 | ▶ | before_add_station => sub { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 34 | my $self = shift; | |||||||||||||||||||
| 21 | 34 | my $station = shift; | |||||||||||||||||||
| 22 | 34 | $station->set_name($self->station_translation($station->name)); | |||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | 2 | }; | |||||||||||||||||||
| 25 | } | ||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | 34 | ▶ | sub station_translation { | ||||||||||||||||||
|
Subroutine
station_translation: called CC=2 SCAR=7.4
Pod
undocumented
| |||||||||||||||||||||
| 28 | 34 | my $self = shift; | |||||||||||||||||||
| 29 | 34 | my $name = shift; | |||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | 34 | my $to_swedish = { | |||||||||||||||||||
| 32 | 'Ruoholahti' => 'Gräsviken', | ||||||||||||||||||||
| 33 | 'Kamppi' => 'Kampen', | ||||||||||||||||||||
| 34 | 'Rautatientori' => 'Järnvägstorget', | ||||||||||||||||||||
| 35 | 'Kaisaniemi' => 'Kajsaniemi', | ||||||||||||||||||||
| 36 | 'Hakaniemi' => 'Hagnäs', | ||||||||||||||||||||
| 37 | 'Sörnälnen' => 'Sörnäs', | ||||||||||||||||||||
| 38 | 'Kalasatama' => 'Fiskhamnen', | ||||||||||||||||||||
| 39 | 'Kulosaari' => 'Brändö', | ||||||||||||||||||||
| 40 | 'Herttoniemi' => 'Hertonäs', | ||||||||||||||||||||
| 41 | 'Siilitie' => 'Igelkottsvägen', | ||||||||||||||||||||
| 42 | 'Itäkeskus' => 'Östra centrum', | ||||||||||||||||||||
| 43 | 'Myllypuro' => 'Kvarnbäcken', | ||||||||||||||||||||
| 44 | 'Kontula' => 'Gårdsbacka', | ||||||||||||||||||||
| 45 | 'Mellunmäki' => 'Mellungsbacka', | ||||||||||||||||||||
| 46 | 'Puotila' => 'Botby gård', | ||||||||||||||||||||
| 47 | 'Rastila' => 'Rastböle', | ||||||||||||||||||||
| 48 | 'Vuosaari' => 'Nordsjö', | ||||||||||||||||||||
| 49 | }; | ||||||||||||||||||||
| 50 | 34 | ▶ | return $to_swedish->{ $name } // $name; | ||||||||||||||||||
|
Condition33%1/3
$to_swedish->{$name} // $name
MC/DC0%0/2
$to_swedish->{$name} // $name
$to_swedish->{$name}
$name
Truth table33%1/3
A // B
A= $to_swedish->{$name}B= $name
| |||||||||||||||||||||
| 51 | } | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | 2 | 1; | |||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | __END__ | ||||||||||||||||||||