Gherkin/AstNode.pm

filter: Statementstmt 92.3% 24 / 26 Branchbran 100% 2 / 2 Conditioncond 66.6% 4 / 6 MC/DCmcdc 66.6% 2 / 3 Subroutinesub 88.8% 8 / 9 Podpod 0.0% 0 / 6 totaltotal 76.9% 40 / 52 CC 5 SCAR 8.0
CC
5
Cov
88%
get_tokens
6.0
add
2.0
get_single
2.0
CRAP 2.2
« App/gherkin.pm ↑ Summary Gherkin/Exceptions.pm »
1 package Gherkin::AstNode;
2 1 $Gherkin::AstNode::VERSION = '42.0.1';
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Class::XSAccessor accessors => [ qw/rule_type/, ];
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 39 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
9 39 my ( $class, $rule_type ) = @_;
10 39 bless { rule_type => $rule_type, _sub_items => {} }, $class;
11 }
12  
13 69 ▶sub add {
Subroutine add: called CC=2 SCAR=6.9
Pod undocumented
14 69 my ( $self, $rule_type, $obj ) = @_;
15 69 ▶ push( @{ ( $self->{'_sub_items'}->{$rule_type} ||= [] ) }, $obj );
Condition100%2/2
$self->{"_sub_items"}{$rule_type} ||= []
l!l
663
MC/DC100%1/1
$self->{"_sub_items"}{$rule_type} ||= []
$self->{"_sub_items"}{$rule_type}
Truth table100%2/2
A
A= $self->{"_sub_items"}{$rule_type}
Aresult
11
00
16 }
17  
18 78 ▶sub get_single {
Subroutine get_single: called CC=2 SCAR=6.9
Pod undocumented
19 78 my ( $self, $rule_type ) = @_;
20 78 my $items = $self->{'_sub_items'}->{$rule_type};
21 78 ▶ return $items unless $items;
Branch: 1 branch
BranchTrueFalseTotal
unless $items 39 39 78
22 39 return $items->[0];
23 }
24  
25 21 ▶sub get_items {
Subroutine get_items: called CC=2 SCAR=6.9
Pod undocumented
26 21 my ( $self, $rule_type ) = @_;
27 21 ▶ return $self->{'_sub_items'}->{$rule_type} || [];
Condition100%2/2
$self->{'_sub_items'}{$rule_type} || []
l!l
129
MC/DC100%1/1
$self->{'_sub_items'}{$rule_type} || []
$self->{'_sub_items'}{$rule_type}
Truth table100%2/2
A
A= $self->{'_sub_items'}{$rule_type}
Aresult
11
00
28 }
29  
30 21 ▶sub get_token {
Subroutine get_token: called CC=1 SCAR=0.0
Pod undocumented
31 21 my ( $self, $token_type ) = @_;
32 21 return $self->get_single($token_type);
33 }
34  
35 0 ▶sub get_tokens {
Subroutine get_tokens: not called CC=2 SCAR=17.9
Pod undocumented
36 0 my ( $self, $token_type ) = @_;
37 0 ▶ return $self->{'_sub_items'}->{$token_type} || [];
Condition0%0/2
$self->{'_sub_items'}{$token_type} || []
l!l
00
MC/DC0%0/1
$self->{'_sub_items'}{$token_type} || []
$self->{'_sub_items'}{$token_type}
Truth table0%0/2
A
A= $self->{'_sub_items'}{$token_type}
Aresult
11
00
38 }
39  
40 1 1;
« App/gherkin.pm ↑ Summary Gherkin/Exceptions.pm »