OpenGbg/Service/StyrOchStall/Station.pm

filter: Statementstmt 61.9% 26 / 42 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 41.6% 5 / 12 Podpod 100% 7 / 7 totaltotal 56.7% 38 / 67 CC 4 SCAR 11.8
CC
4
Cov
54%
capacity
6.0
free_bikes
6.0
free_stands
6.0
CRAP 3.3
« OpenGbg/Service/StyrOchStall.pm ↑ Summary OpenGbg/Service/Getter.pm »
1 1 ▶use 5.10.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package OpenGbg::Service::StyrOchStall::Station;
6  
7 # ABSTRACT: Data on a bike station
8 1 our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY
9 1 our $VERSION = '0.1404';
10  
11 1 ▶use XML::Rabbit;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use syntax 'qs';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 has_xpath_value id => './x:Id';
15 1 has_xpath_value original_label => './x:Label';
16 1 has_xpath_value lat => './x:Lat';
17 1 has_xpath_value long => './x:Long';
18 1 has_xpath_value _capacity => './x:Capacity';
19 1 has_xpath_value _free_bikes => './x:FreeBikes';
20 1 has_xpath_value _free_stands => './x:FreeStands';
21 1 has_xpath_value state => './x:State';
22  
23 0 ▶sub label {
Subroutine label: not called CC=1 SCAR=6.9
Pod documented
24 0 my $self = shift;
25  
26 0 my $label = $self->original_label;
27 0 $label =~ s{([\w']+)}{\u\L$1}g;
28 0 return $label;
29 }
30  
31 0 ▶sub capacity {
Subroutine capacity: not called CC=2 SCAR=17.9
Pod documented
32 0 my $self = shift;
33  
34 0 ▶ return length $self->_capacity ? $self->_capacity : 0;
Branch: 1 branch
BranchTrueFalseTotal
length $self->_capacity ? : 0 0 0
35 }
36 0 ▶sub free_bikes {
Subroutine free_bikes: not called CC=2 SCAR=17.9
Pod documented
37 0 my $self = shift;
38  
39 0 ▶ return length $self->_free_bikes ? $self->_free_bikes : 0;
Branch: 1 branch
BranchTrueFalseTotal
length $self->_free_bikes ? : 0 0 0
40 }
41 0 ▶sub free_stands {
Subroutine free_stands: not called CC=2 SCAR=17.9
Pod documented
42 0 my $self = shift;
43  
44 0 ▶ return length $self->_free_stands ? $self->_free_stands : 0;
Branch: 1 branch
BranchTrueFalseTotal
length $self->_free_stands ? : 0 0 0
45 }
46 0 ▶sub full {
Subroutine full: not called CC=1 SCAR=6.9
Pod documented
47 0 my $self = shift;
48  
49 0 return $self->free_stands == 0;
50 }
51 0 ▶sub empty {
Subroutine empty: not called CC=1 SCAR=6.9
Pod documented
52 0 my $self = shift;
53  
54 0 return $self->free_bikes == 0;
55 }
56  
57 0 ▶sub to_text {
Subroutine to_text: not called CC=1 SCAR=6.9
Pod documented
58 0 my $self = shift;
59  
60 0 return sprintf qs{
61 Id: %s
62 Label: %s
63 Latitude: %s
64 Longitude: %s
65 Capacity: %2d
66 Free bikes: %2d
67 Free stands: %2d
68 Empty: %s
69 Full: %s
70 State: %s
71 },
72 $self->id,
73 1 $self->label,
74 $self->lat,
75 1 $self->long,
76 $self->capacity,
77 $self->free_bikes,
78 $self->free_stands,
79 $self->empty,
80 $self->full,
81 $self->state;
82 }
83  
84 finalize_class();
85  
86 1;
87  
88 __END__
« OpenGbg/Service/StyrOchStall.pm ↑ Summary OpenGbg/Service/Getter.pm »