PTV/Stop.pm

filter: Statementstmt 48.5% 17 / 35 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 44.4% 4 / 9 Podpod 75.0% 3 / 4 totaltotal 44.4% 24 / 54 CC 5 SCAR 16.0
CC
5
Cov
41%
new
12.0
get_routes
6.0
__ANON__
4.3
CRAP 5.0
« PTV/TimeTable.pm ↑ Summary
1 package WWW::PTV::Stop;
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 2 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 our @ATTR = qw(
9 address
10 bicycle_cage
11 bicycle_lockers
12 bicycle_racks
13 car_parking
14 escalator
15 hearing_loop
16 id
17 latitude
18 lift
19 lighting
20 lines
21 locality
22 lockers
23 longitude
24 map_ref
25 municipiality
26 municipiality_id
27 myki_checks
28 myki_machines
29 phone_feedback
30 phone_station
31 postcode
32 public_phone
33 public_toilet
34 routes
35 seating
36 staff_hours
37 stairs
38 street
39 tactile_paths
40 taxi_rank
41 transport_type
42 vline_bookings
43 waiting_area_indoor
44 waiting_area_sheltered
45 wheelchair_accessible
46 zone
47 );
48  
49 2 foreach my $attr ( @ATTR ) {
50 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
51  
52 76 ▶ *{ __PACKAGE__ .'::'. $attr } = sub {
Subroutine __ANON__: not called CC=2 SCAR=14.6
53 0 my( $self, $val ) = @_;
54 0 ▶ $self->{$attr} = $val if $val;
Branch: 1 branch
BranchTrueFalseTotal
if $val 0 0 0
55 0 return $self->{$attr}
56 }
57 76 }
58  
59 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
Pod undocumented
60 0 my( $class, %args ) = @_;
61  
62 0 my $self = bless {}, $class;
63 $args{ id }
64 0 ▶ or croak 'Constructor failed: mandatory id argument not supplied';
Branch: 1 branch
BranchTrueFalseTotal
$args{"id"} or croak("Constructor failed: mandatory id argument not supplied") 0 0 0
65  
66 0 foreach my $attr ( @ATTR ) {
67 0 $self->{$attr} = $args{$attr}
68 }
69  
70 0 return $self
71 }
72  
73 0 ▶sub get_route_names {
Subroutine get_route_names: not called CC=1 SCAR=6.9
Pod documented
74 0 map { $_->{name} } @{ $_[0]->{routes} }
75 }
76  
77 0 ▶sub get_route_ids {
Subroutine get_route_ids: not called CC=1 SCAR=6.9
Pod documented
78 0 map { $_->{id} } @{ $_[0]->{routes} }
79 }
80  
81 0 ▶sub get_routes {
Subroutine get_routes: not called CC=2 SCAR=17.9
Pod documented
82 0 my $self = shift;
83  
84 return wantarray
85 0 ? @{ $self->{routes} }
86 : $self->{routes}
87 0 ▶}
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
88  
89 2 1;
90  
91 __END__
« PTV/TimeTable.pm ↑ Summary