API/Favorite.pm

filter: Statementstmt 100% 30 / 30 Branchbran 87.5% 7 / 8 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 90.0% 45 / 50 CC 6 SCAR 13.3
CC
6
Cov
93%
favorite
6.1
BEGIN
1.0
BEGIN
1.0
CRAP 3.8
« API.pm ↑ Summary API/Module.pm »
1 17 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 17 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 package MetaCPAN::API::Favorite;
4  
5 17 our $VERSION = '0.52';
6  
7 17 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 17 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 17 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 # /favorite/_search only
12 3 ▶sub favorite {
Subroutine favorite: called CC=6 SCAR=18.0
Pod documented
13 3 my $self = shift;
14 3 ▶ my %opts = @_ ? @_ : ();
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 2 1 3
15 3 my $url = '';
16 3 my $error = "Only 'search' can be used here";
17  
18 3 ▶ %opts or croak $error;
Branch: 1 branch
BranchTrueFalseTotal
%opts or croak($error) 2 1 3
19  
20 2 my %extra_opts = ();
21  
22 2 ▶ if ( defined ( my $search_opts = $opts{'search'} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $search_opts = $opts{'search'})) { } 1 1 2
23 1 ▶ croak $error
Branch: 1 branch
BranchTrueFalseTotal
unless ref $search_opts and ref $search_opts eq "HASH" 0 1 1
Condition33%1/3
ref $search_opts and ref $search_opts eq "HASH"
!ll&&!rl&&r
001
MC/DC0%0/2
ref $search_opts and ref $search_opts eq "HASH"
ref $search_opts ref $search_opts eq "HASH"
Truth table33%1/3
A and B
A= ref $search_optsB= ref $search_opts eq "HASH"
ABresult
0X0
100
111
24 unless ref $search_opts && ref $search_opts eq 'HASH';
25  
26 1 %extra_opts = %{$search_opts};
27 1 $url = 'favorite/_search';
28 } else {
29 1 croak $error;
30 }
31  
32 1 return $self->fetch( $url, %extra_opts );
33 }
34  
35 17 1;
36  
37 __END__
« API.pm ↑ Summary API/Module.pm »