TileMap/Role/Helpers.pm

filter: Statementstmt 100% 24 / 24 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 3 totaltotal 88.8% 32 / 36 CC 2 SCAR 2.4
CC
2
Cov
96%
get_class_of_object
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« TileMap/Legend.pm ↑ Summary TileMap/Tile.pm »
1 package Game::TileMap::Role::Helpers;
2 3 $Game::TileMap::Role::Helpers::VERSION = '1.000';
3 3 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 3 requires qw(
10 legend
11 _guide
12 );
13  
14 sub get_all_of_class
15 {
16 8 ▶ my ($self, $class) = @_;
Subroutine get_all_of_class: called CC=1 SCAR=0.0
Pod undocumented
17  
18 8 return @{$self->_guide->{$class}};
19 }
20  
21 sub get_all_of_type
22 {
23 3 ▶ my ($self, $obj) = @_;
Subroutine get_all_of_type: called CC=1 SCAR=0.0
Pod undocumented
24  
25 3 my $class = $self->legend->get_class_of_object($obj);
26 3 my @all_of_class = $self->get_all_of_class($class);
27  
28 3 return grep { $_->type eq $obj } @all_of_class;
29 }
30  
31 sub get_class_of_object
32 {
33 2 ▶ my ($self, $obj) = @_;
Subroutine get_class_of_object: called CC=2 SCAR=7.2
Pod undocumented
34  
35 2 ▶ return $self->legend->get_class_of_object(ref $obj ? $obj->type : $obj);
Branch: 1 branch
BranchTrueFalseTotal
ref $obj ? : 2 0 2
36 }
37  
38 3 1;
39  
« TileMap/Legend.pm ↑ Summary TileMap/Tile.pm »