Metro/Graph/Connection.pm

filter: Statementstmt 93.5% 29 / 31 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod 0.0% 0 / 1 totaltotal 81.8% 36 / 44 CC 3 SCAR 14.6
CC
3
Cov
83%
to_hash
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.3
« Metro.pm ↑ Summary Metro/Cmd/MetroToTube.pm »
1 14 ▶use 5.10.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 14 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 14 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Map::Metro::Graph::Connection;
6  
7 # ABSTRACT: Connects two stations on a line
8 14 our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY
9 14 our $VERSION = '0.2405';
10  
11 14 ▶use Map::Metro::Elk;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 14 ▶use Types::Standard qw/Maybe Int/;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 14 ▶use Map::Metro::Types qw/LineStation Connection/;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 14 ▶use PerlX::Maybe qw/maybe/;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 14 has origin_line_station => (
17 is => 'ro',
18 isa => LineStation,
19 required => 1,
20 );
21 14 has destination_line_station => (
22 is => 'ro',
23 isa => LineStation,
24 required => 1,
25 );
26 14 has previous_connection => (
27 is => 'rw',
28 isa => Maybe[ Connection ],
29 predicate => 1,
30 );
31 14 has next_connection => (
32 is => 'rw',
33 isa => Maybe[ Connection ],
34 predicate => 1,
35 );
36 14 has weight => (
37 is => 'ro',
38 isa => Int,
39 required => 1,
40 default => 1,
41 );
42  
43 0 ▶sub to_hash {
Subroutine to_hash: not called CC=3 SCAR=24.8
Pod undocumented
44 0 my $self = shift;
45  
46 return {
47 0 ▶ origin_line_station => $self->origin_line_station->to_hash,
Branch: 2 branches
BranchTrueFalseTotal
$self->has_previous_connection ? : 0 0 0
$self->has_next_connection ? : 0 0 0
48 destination_line_station => $self->destination_line_station->to_hash,
49 maybe previous_connection => $self->has_previous_connection ? $self->previous_connection->to_hash : undef,
50 maybe next_connection => $self->has_next_connection ? $self->next_connection->to_hash : undef,
51 weight => $self->weight,
52 };
53 }
54  
55 14 __PACKAGE__->meta->make_immutable;
56  
57 14 1;
58  
59 __END__
« Metro.pm ↑ Summary Metro/Cmd/MetroToTube.pm »