Metro/Graph/Line.pm

filter: Statementstmt 97.1% 34 / 35 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 1 totaltotal 93.4% 43 / 46 CC 2 SCAR 2.1
CC
2
Cov
95%
__ANON__
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Metro/Graph/Segment.pm ↑ Summary Metro/Cmd/Available.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::Line;
6  
7 # ABSTRACT: Meta information about 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/Str Int/;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 14 ▶use Map::Metro::Exceptions;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 14 has id => (
16 is => 'ro',
17 isa => Str,
18 required => 1,
19 );
20 14 has name => (
21 is => 'ro',
22 isa => Str,
23 required => 1,
24 );
25 14 has description => (
26 is => 'ro',
27 isa => Str,
28 required => 1,
29 );
30 14 has color => (
31 is => 'rw',
32 isa => Str,
33 default => '#333333',
34 );
35 14 has width => (
36 is => 'rw',
37 isa => Int,
38 default => 3,
39 );
40  
41 8 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=2 SCAR=7.2
42 8 my $orig = shift;
43 8 my $self = shift;
44 8 my %args = @_;
45  
46 8 ▶ if($args{'id'} =~ m{([^a-z0-9])}i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"id"} =~ /([^a-z0-9])/i) 0 8 8
47 0 die lineid_contains_illegal_character line_id => $args{'id'}, illegal_character => $_;
48 }
49 8 $self->$orig(%args);
50 14 };
51  
52 22 ▶sub to_hash {
Subroutine to_hash: called CC=1 SCAR=0.0
Pod undocumented
53 22 my $self = shift;
54  
55 return {
56 22 id => $self->id,
57 name => $self->name,
58 description => $self->description,
59 color => $self->color,
60 width => $self->width,
61 }
62 }
63  
64 14 __PACKAGE__->meta->make_immutable;
65  
66 14 1;
67  
68 __END__
« Metro/Graph/Segment.pm ↑ Summary Metro/Cmd/Available.pm »