Chart/GGPlot/HasRequiredAes.pm

filter: Statementstmt 96.5% 28 / 29 Branchbran 50.0% 5 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 87.2% 41 / 47 CC 6 SCAR 10.0
CC
6
Cov
85%
check_required_aes
4.2
required_aes
3.1
BEGIN
1.0
CRAP 2.7
« Chart/GGPlot/Facet/Null.pm ↑ Summary Chart/GGPlot/Backend.pm »
1 package Chart::GGPlot::HasRequiredAes;
2  
3 # ABSTRACT: The role for the 'required_aes' attr
4  
5 8 ▶use Chart::GGPlot::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 8 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 8 our $VERSION = '0.002003'; # VERSION
9  
10 8 ▶use Types::Standard qw(ArrayRef);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12  
13 11 ▶classmethod required_aes() { [] }
Subroutine required_aes: called CC=3 SCAR=11.2
Pod documented
Branch: 2 branches
BranchTrueFalseTotal
@_ < 1 and Function::Parameters::_croak('Too few arguments for classmethod required_aes (expected 1, got ' . @_ . ')') 0 11 11
@_ > 1 and Function::Parameters::_croak('Too many arguments for classmethod required_aes (expected 1, got ' . @_ . ')') 0 11 11
14  
15  
16 13 ▶method check_required_aes($aesthetics) {
Subroutine check_required_aes: called CC=4 SCAR=14.4
Pod documented
Branch: 2 branches
BranchTrueFalseTotal
@_ < 2 and Function::Parameters::_croak('Too few arguments for method check_required_aes (expected 2, got ' . @_ . ')') 0 13 13
@_ > 2 and Function::Parameters::_croak('Too many arguments for method check_required_aes (expected 2, got ' . @_ . ')') 0 13 13
17 13 my %aesthetics = map { $_ => 1 } @$aesthetics;
18 13 ▶ my $missing_aes = $self->required_aes->grep(sub { !exists $aesthetics{$_} } );
Subroutine __ANON__: called CC=1 SCAR=0.0
19 13 ▶ return if @$missing_aes == 0;
Branch: 1 branch
BranchTrueFalseTotal
if @$missing_aes == 0 13 0 13
20  
21 0 croak( sprintf("%s requires the following missing aesthetics: %s",
22 ref($self), join( ', ', @$missing_aes ) ));
23 8 }
24  
25 8 1;
26  
27 __END__
« Chart/GGPlot/Facet/Null.pm ↑ Summary Chart/GGPlot/Backend.pm »