Branch Coverage

blib/lib/cPanel/PublicAPI.pm
Criterion Covered Total %
branch 85 202 42.0


line true false branch
65 2 12 exists $OPTS{'usessl'} ? :
67 2 12 if (exists $OPTS{'ip'}) { }
1 11 elsif (exists $OPTS{'host'}) { }
81 0 14 exists $OPTS{'ssl_verify_mode'} ? :
0 14 exists $OPTS{'keepalive'} ? :
84 4 10 if (exists $OPTS{'error_log'} and $OPTS{'error_log'} ne 'STDERR') { }
85 0 4 unless (open $self->{'error_fh'}, '>>', $OPTS{'error_log'})
94 2 12 if ($OPTS{'user'}) { }
96 0 2 if $self->{'debug'}
99 0 12 exists $INC{'Cpanel/PwCache.pm'} ? :
100 1 11 if $self->{'debug'}
103 1 1 if (exists $OPTS{'api_token'} and exists $OPTS{'accesshash'})
110 1 12 if $OPTS{'api_token'}
112 9 4 if (!exists $OPTS{'pass'} || $OPTS{'pass'} eq '' and !exists $OPTS{'accesshash'} || $OPTS{'accesshash'} eq '') { }
2 2 elsif ($OPTS{'pass'}) { }
113 0 9 exists $INC{'Cpanel/PwCache.pm'} ? :
114 1 8 if $self->{'debug'}
116 0 9 if (-e $homedir . '/.accesshash') { }
9 0 elsif (exists $ENV{'REMOTE_PASSWORD'} and $ENV{'REMOTE_PASSWORD'} and $ENV{'REMOTE_PASSWORD'} ne '__HIDDEN__' and exists $ENV{'SERVER_SOFTWARE'} and $ENV{'SERVER_SOFTWARE'} =~ /^cpsrvd/) { }
118 0 0 if (open my $hash_fh, '<', $homedir . '/.accesshash') { }
122 0 0 if $self->{'debug'}
125 0 0 if $self->{'debug'}
129 1 8 if $self->{'debug'}
138 0 2 if $self->{'debug'}
143 0 2 if $self->{'debug'}
181 1 8 unless exists $CFG{'serializer'}
182 0 9 if (not defined $call or $call eq '')
185 0 1 if (defined $format and $format ne 'xml' and $format ne 'json' and $format ne 'ref')
190 7 2 if (ref $formdata) { }
1 1 elsif (not $formdata =~ /(^|&)api\.version=/) { }
198 2 7 if (defined $format) { }
225 0 0 if $self->{'debug'}
227 0 0 unless exists $CFG{'init'}
236 0 0 if $self->{'debug'}
241 0 0 if ($self->{'operating_mode'} eq 'session')
242 0 0 unless $self->{'security_tokens'}{$service} and $self->{'cookie_jars'}{$service}
259 0 0 if ref $formdata
261 0 0 $self->{'usessl'} ? :
263 0 0 if ($self->{'operating_mode'} eq 'session') { }
272 0 0 if ($method eq 'POST' or $method eq 'PUT') { }
278 0 0 if $self->{'debug'}
280 0 0 unless (ref $headers)
284 0 0 unless length $line
286 0 0 unless length $key
292 0 0 if ($self->{'operating_mode'} eq 'accesshash')
293 0 0 $service eq 'whostmgr' ? :
306 0 0 if defined $content
311 0 0 if ($response->{'status'} == 599)
316 0 0 if ($hassigpipe)
318 0 0 if ($self->{'debug'})
323 0 0 if (exists $HEADERS{'transfer-encoding'} and $HEADERS{'transfer-encoding'} =~ /chunked/i) { }
0 0 elsif (defined $HEADERS{'content-length'}) { }
334 0 0 unless ($response->{'success'})
344 0 0 unless ($finished_request or $self->{'error'})
349 0 0 if ($self->{'debug'} and $@)
355 0 0 $self->{'error'} ? :
360 0 0 if ($self->{'operating_mode'} ne 'session')
364 0 0 unless ($service and $tfa_token)
377 0 0 unless ($self->{'user'})
382 0 0 if (not $self->{'remote_server'})
391 4 12 if (exists $self->{'accesshash'}) { }
12 0 elsif (exists $self->{'pass'}) { }
412 0 0 if $self->{'operating_mode'} ne 'session'
413 0 0 if $self->{'security_tokens'}{$service} and $self->{'cookie_jars'}{$service}
419 0 0 $self->{'usessl'} ? :
425 0 0 $tfa_token ? :
430 0 0 if (my $security_token = (split(m[/], $resp->{'headers'}{'location'}, 0))[1])
437 0 0 if $resp->{'status'} == 599
448 0 0 if ($self->{'usessl'}) { }
449 0 0 $service =~ /^\d+$/ ? :
452 0 0 $service =~ /^\d+$/ ? :
461 2 5 if (defined $format) { }
468 0 7 unless exists $CFG{'serializer'}
470 3 4 if (ref $formdata eq 'ARRAY')
478 7 0 scalar keys %$formdata < 10 && _total_form_length($formdata, 1024) < 1024 ? :
491 0 5 unless exists $CFG{'serializer'}
494 2 3 if (defined $format) { }
505 5 0 scalar keys %$formdata < 10 && _total_form_length($formdata, 1024) < 1024 ? :
519 0 21 if ($self->{'error'}) { }
0 21 elsif (${$opts_hr->{'data'};} =~ /tfa_login_form/) { }
527 6 15 if (defined $opts_hr->{'format'} and $opts_hr->{'format'} eq 'json' || $opts_hr->{'format'} eq 'xml') { }
532 0 15 $CFG{'serializer_can_deref'} ? :
533 0 15 unless (ref $parsed_data)
550 1 6 if (exists $parsed_data->{'error'} and $parsed_data->{'error'} =~ /Unknown App Requested/ or exists $parsed_data->{'metadata'}{'reason'} and $parsed_data->{'metadata'}{'reason'} =~ /Unknown app\s+(?:\(.+\))?\s+requested/)
562 1 0 if (exists $parsed_data->{'event'}{'reason'} and $parsed_data->{'event'}{'reason'} =~ /failed: Undefined subroutine/ || $parsed_data->{'event'}{'reason'} =~ /failed: Can\'t use string/)
577 1 2 if (exists $parsed_data->{'cpanelresult'}{'error'} and $parsed_data->{'cpanelresult'}{'error'} =~ /Could not find function/)
589 0 46 if ($size += length($key) + 2 + length($data->{$key})) >= 1024
595 0 2 if exists $CFG{'serializer'}
610 2 4 if (not $@) { }
611 0 2 if $self and ref $self and $self->{'debug'}
617 0 4 if $self and ref $self and $self->{'debug'}
620 0 2 if ($@)
626 0 1 if exists $CFG{'init'}
639 1 1 if (not $@) { }
640 0 1 if $self and ref $self and $self->{'debug'}
645 0 1 if $self and ref $self and $self->{'debug'}
648 0 1 if ($@)
666 1 0 if (ref $headers)
667 0 1 unless scalar keys %{$headers;}
668 1 0 $_ ? :
675 1 0 if (ref $formdata)