Braintree/ResultObject.pm

filter: Statementstmt 21.6% 8 / 37 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 20.0% 2 / 10 Podpod 0.0% 0 / 8 totaltotal 14.4% 10 / 69 CC 10 SCAR 29.3
CC
10
Cov
16%
setup_sub_objects
42.0
set_attr_value
20.0
set_attributes_from_hash
6.0
CRAP 18.7
« Braintree/Validations.pm ↑ Summary Braintree/HTTP.pm »
1 package Net::Braintree::ResultObject;
2 1 ▶use Net::Braintree::Util qw(is_arrayref is_hashref);
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 my $meta = __PACKAGE__->meta;
6  
7 0 ▶sub set_attributes_from_hash {
Subroutine set_attributes_from_hash: not called CC=2 SCAR=17.9
Pod undocumented
8 0 my ($self, $target, $attributes) = @_;
9 0 ▶ while(my($attribute, $value) = each(%$attributes)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$attributes) 0 0 0
10 0 $meta->add_attribute($attribute, is => 'rw');
11 0 $target->$attribute($self->set_attr_value($value));
12 }
13 }
14  
15 0 ▶sub set_attr_value {
Subroutine set_attr_value: not called CC=4 SCAR=30.0
Pod undocumented
16 0 my ($self, $value) = @_;
17  
18 0 ▶ if(is_hashref($value)) {
Branch: 2 branches
BranchTrueFalseTotal
if (is_hashref($value)) { } 0 0 0
elsif (is_arrayref($value)) { } 0 0 0
19 0 return Hash::Inflator->new($value);
20 } elsif(is_arrayref($value)) {
21 0 my $new_array = [];
22 0 foreach(@$value) {
23 0 push(@$new_array, $self->set_attr_value($_));
24 }
25 0 return $new_array;
26 } else {
27 0 return $value;
28 }
29 }
30  
31 0 ▶sub setup_sub_objects {
Subroutine setup_sub_objects: not called CC=6 SCAR=37.4
Pod undocumented
32 0 my($self, $target, $params, $sub_objects) = @_;
33 0 ▶ while(my($attribute, $class) = each(%$sub_objects)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$sub_objects) 0 0 0
34 0 $meta->add_attribute($attribute, is => 'rw');
35 0 ▶ if (is_arrayref($params->{$attribute})) {
Branch: 1 branch
BranchTrueFalseTotal
if (is_arrayref($params->{$attribute})) { } 0 0 0
36 0 my $new_array = [];
37 0 foreach my $element (@{$params->{$attribute}}) {
38 0 ▶ push(@$new_array, $class->new($element)) if is_hashref($element);
Branch: 1 branch
BranchTrueFalseTotal
if is_hashref($element) 0 0 0
39 }
40 0 $target->$attribute($new_array);
41 } else {
42 0 ▶ push(@{$target->$attribute}, $class->new($params->{$attribute})) if is_hashref($params->{$attribute});
Branch: 1 branch
BranchTrueFalseTotal
if is_hashref($params->{$attribute}) 0 0 0
43 }
44 0 delete($params->{$attribute});
45 }
46 }
47  
48  
49 0 ▶sub credit_card_details { shift->credit_card; }
Subroutine credit_card_details: not called CC=1 SCAR=6.9
Pod undocumented
50 0 ▶sub customer_details { shift->customer; }
Subroutine customer_details: not called CC=1 SCAR=6.9
Pod undocumented
51 0 ▶sub billing_details { shift->billing; }
Subroutine billing_details: not called CC=1 SCAR=6.9
Pod undocumented
52 0 ▶sub shipping_details { shift->shipping; }
Subroutine shipping_details: not called CC=1 SCAR=6.9
Pod undocumented
53 0 ▶sub subscription_details { shift->subscription; }
Subroutine subscription_details: not called CC=1 SCAR=6.9
Pod undocumented
54  
55 1 1;
« Braintree/Validations.pm ↑ Summary Braintree/HTTP.pm »