| 1 | package WWW::PTV::Area; | ||||||||||||||||||||
| 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 | |||||||||||||||||||||
| 6 | 0 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 7 | 0 | my ( $class, %args ) = @_; | |||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 0 | my $self = bless {}, $class; | |||||||||||||||||||
| 10 | 0 | $self->{id} = $args{id}; | |||||||||||||||||||
| 11 | 0 | $self->{name} = $args{name}; | |||||||||||||||||||
| 12 | 0 | $self->{suburbs} = $args{suburbs}; | |||||||||||||||||||
| 13 | 0 | $self->{service} = $args{service}; | |||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 0 | return $self | |||||||||||||||||||
| 16 | } | ||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 0 | ▶ | sub id { | ||||||||||||||||||
|
Subroutine
id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 19 | return $_[0]->{ id } | ||||||||||||||||||||
| 20 | 0 | } | |||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 0 | ▶ | sub name { | ||||||||||||||||||
|
Subroutine
name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 23 | return $_[0]->{ name } | ||||||||||||||||||||
| 24 | 0 | } | |||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | 0 | ▶ | sub suburbs { | ||||||||||||||||||
|
Subroutine
suburbs: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 27 | return $_[0]->{ suburbs } | ||||||||||||||||||||
| 28 | 0 | } | |||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 0 | ▶ | sub towns { | ||||||||||||||||||
|
Subroutine
towns: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 31 | 0 | $_[0]->suburbs | |||||||||||||||||||
| 32 | } | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | 0 | ▶ | sub service_types { | ||||||||||||||||||
|
Subroutine
service_types: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 35 | 0 | return keys %{ $_[0]->{ service }{ names } } | |||||||||||||||||||
| 36 | } | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 0 | ▶ | sub service_names { | ||||||||||||||||||
|
Subroutine
service_names: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 39 | return $_[0]->{ service }{ names } | ||||||||||||||||||||
| 40 | 0 | } | |||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 0 | ▶ | sub service_links { | ||||||||||||||||||
|
Subroutine
service_links: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 43 | return $_[0]->{ service }{ links } | ||||||||||||||||||||
| 44 | 0 | } | |||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 0 | ▶ | sub services { | ||||||||||||||||||
|
Subroutine
services: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||
| 47 | 0 | my $self = shift; | |||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | 0 | my @res; | |||||||||||||||||||
| 50 | 0 | my $service_names = $self->service_names; | |||||||||||||||||||
| 51 | 0 | my $service_links = $self->service_links; | |||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | # { name => 'Name', link => 'link', type => 'Type' } | ||||||||||||||||||||
| 54 | 0 | foreach my $type ( $self->service_types ) { | |||||||||||||||||||
| 55 | 0 | my $c = 0; | |||||||||||||||||||
| 56 | 0 | my $r; | |||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | 0 | foreach my $service ( @{ $service_names->{$type} } ) { | |||||||||||||||||||
| 59 | my $r = { type => $type, | ||||||||||||||||||||
| 60 | 0 | name => @{ $service_names->{ $type } }[ $c ], | |||||||||||||||||||
| 61 | 0 | link => @{ $service_links->{ $type } }[ $c ] }; | |||||||||||||||||||
| 62 | 0 | push @res, $r; | |||||||||||||||||||
| 63 | 0 | $c++; | |||||||||||||||||||
| 64 | } | ||||||||||||||||||||
| 65 | } | ||||||||||||||||||||
| 66 | |||||||||||||||||||||
| 67 | 0 | return @res; | |||||||||||||||||||
| 68 | } | ||||||||||||||||||||
| 69 | |||||||||||||||||||||
| 70 | 0 | ▶ | sub services_like { | ||||||||||||||||||
|
Subroutine
services_like: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||
| 71 | 0 | my ( $self, %args ) = @_; | |||||||||||||||||||
| 72 | |||||||||||||||||||||
| 73 | 0 | ▶ | $args{type} or return grep { $_->{name} =~ /$args{name}/i } $self->services; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 74 | |||||||||||||||||||||
| 75 | 0 | ▶ | $args{name} or return grep { $_->{type} =~ /$args{type}/i } $self->services; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 76 | |||||||||||||||||||||
| 77 | return grep { | ||||||||||||||||||||
| 78 | 0 | $_->{type} =~ /$args{type}/i | |||||||||||||||||||
| 79 | 0 | ▶ | and $_->{name} =~ /$args{name}/i | ||||||||||||||||||
|
Condition0%0/3
$_->{'type'} =~ /$args{'type'}/i && $_->{'name'} =~ /$args{'name'}/i
MC/DC0%0/2
$_->{'type'} =~ /$args{'type'}/i && $_->{'name'} =~ /$args{'name'}/i
$_->{'type'} =~ /$args{'type'}/i
$_->{'name'} =~ /$args{'name'}/i
Truth table0%0/3
A && B
A= $_->{'type'} =~ /$args{'type'}/iB= $_->{'name'} =~ /$args{'name'}/i
| |||||||||||||||||||||
| 80 | } $self->services | ||||||||||||||||||||
| 81 | } | ||||||||||||||||||||
| 82 | |||||||||||||||||||||
| 83 | 2 | 1; | |||||||||||||||||||
| 84 | |||||||||||||||||||||
| 85 | __END__ | ||||||||||||||||||||