Stripe/List.pm

filter: Statementstmt 93.6% 74 / 79 Branchbran 50.0% 13 / 26 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 92.8% 13 / 14 Podpod n/a totaltotal 81.4% 101 / 124 CC 16 SCAR 17.2
CC
16
Cov
81%
_merge_lists
11.7
_next_page_args
3.0
_previous_page_args
3.0
CRAP 5.6
« Stripe/Invoice.pm ↑ Summary Stripe/Invoiceitem.pm »
1 package Net::Stripe::List;
2 2 $Net::Stripe::List::VERSION = '0.43';
3 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use Kavorka;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 # ABSTRACT: represent a list of objects from Stripe
7  
8 2 has 'count' => (is => 'ro', isa => 'Maybe[Int]'); # no longer included by default, see note below
9 2 has 'url' => (is => 'ro', isa => 'Str', required => 1);
10 2 has 'has_more' => (is => 'ro', isa => 'Bool|Object', required => 1);
11 2 has 'data' => (traits => ['Array'],
12 is => 'ro',
13 isa => 'ArrayRef',
14 required => 1,
15 handles => {
16 elements => 'elements',
17 map => 'map',
18 grep => 'grep',
19 first => 'first',
20 get => 'get',
21 join => 'join',
22 is_empty => 'is_empty',
23 sort => 'sort',
24 });
25  
26 0 ▶method last {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine last: not called CC=2 SCAR=9.9
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
27 0 return $self->get(scalar($self->elements)-1);
28 }
29  
30 2 ▶method _next_page_args() {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _next_page_args: called CC=3 SCAR=11.1
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 1 0 1
if @_ != 0 0 1 1
31 return (
32 1 starting_after => $self->get(-1)->id,
33 );
34 }
35  
36 2 ▶method _previous_page_args() {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _previous_page_args: called CC=3 SCAR=11.1
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 1 0 1
if @_ != 0 0 1 1
37 return (
38 1 ending_before => $self->get(0)->id,
39 );
40 }
41  
42 fun _merge_lists(
43 ArrayRef[Net::Stripe::List] :$lists!,
44 0 ▶) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _merge_lists: called CC=11 SCAR=24.6
Branch: 7 branches
BranchTrueFalseTotal
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 1 1
if ($slice_length % 2 != 0) 0 1 1
if ($i <= $#_) 1 1 2
$OK{$_} or Carp::croak("Unknown named parameter: $_") 1 0 1
exists $_{'lists'} ? : 1 0 1
if (exists $_{"lists"}) 1 0 1
Type::Tiny::XS::AUTO::TC2($lists) or _failed_check(46, "ArrayRef[InstanceOf[\"Net::Stripe::List\"]]", $lists, "exception_class", "Error::TypeTiny::Assertion") 1 0 1
Condition33%1/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
100
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table33%1/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
45 1 my $has_count = defined( $lists->[-1]->count );
46 1 my $url = $lists->[-1]->url;
47 my %list_args = (
48 2 count => $has_count ? scalar( map { $_->elements } @$lists ) : undef,
49 1 ▶ data => [ map { $_->elements } @$lists ],
Branch: 1 branch
BranchTrueFalseTotal
$has_count ? : 1 0 1
50 has_more => 0,
51 url => $url,
52 );
53 1 return Net::Stripe::List->new( %list_args );
54 }
55  
56 2 __PACKAGE__->meta->make_immutable;
57 2 1;
58  
59 __END__
« Stripe/Invoice.pm ↑ Summary Stripe/Invoiceitem.pm »