Branch Coverage

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


line true false branch
69 2 12 exists $OPTS{'usessl'} ? :
71 2 12 if (exists $OPTS{'ip'}) { }
1 11 elsif (exists $OPTS{'host'}) { }
87 0 14 exists $OPTS{'ssl_verify_mode'} ? :
0 14 exists $OPTS{'keepalive'} ? :
90 4 10 if (exists $OPTS{'error_log'} and $OPTS{'error_log'} ne 'STDERR') { }
91 0 4 unless (open $self->{'error_fh'}, '>>', $OPTS{'error_log'})
100 2 12 if ($OPTS{'user'}) { }
102 0 2 if $self->{'debug'}
105 0 12 exists $INC{'Cpanel/PwCache.pm'} ? :
106 1 11 if $self->{'debug'}
109 1 1 if (exists $OPTS{'api_token'} and exists $OPTS{'accesshash'})
116 1 12 if $OPTS{'api_token'}
118 9 4 if (!exists $OPTS{'pass'} || $OPTS{'pass'} eq '' and !exists $OPTS{'accesshash'} || $OPTS{'accesshash'} eq '') { }
2 2 elsif ($OPTS{'pass'}) { }
119 0 9 exists $INC{'Cpanel/PwCache.pm'} ? :
120 1 8 if $self->{'debug'}
122 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/) { }
124 0 0 if (open my $hash_fh, '<', $homedir . '/.accesshash') { }
128 0 0 if $self->{'debug'}
131 0 0 if $self->{'debug'}
135 1 8 if $self->{'debug'}
144 0 2 if $self->{'debug'}
149 0 2 if $self->{'debug'}
187 1 8 unless exists $CFG{'serializer'}
188 0 9 if (not defined $call or $call eq '')
191 0 1 if (defined $format and $format ne 'xml' and $format ne 'json' and $format ne 'ref')
196 7 2 if (ref $formdata) { }
1 1 elsif (not $formdata =~ /(^|&)api\.version=/) { }
204 2 7 if (defined $format) { }
231 0 0 if $self->{'debug'}
233 0 0 unless exists $CFG{'init'}
242 0 0 if $self->{'debug'}
247 0 0 if ($self->{'operating_mode'} eq 'session')
248 0 0 unless $self->{'security_tokens'}{$service} and $self->{'cookie_jars'}{$service}
265 0 0 if ref $formdata
267 0 0 $self->{'usessl'} ? :
269 0 0 if ($self->{'operating_mode'} eq 'session') { }
278 0 0 if ($method eq 'POST' or $method eq 'PUT') { }
284 0 0 if $self->{'debug'}
286 0 0 unless (ref $headers)
290 0 0 unless length $line
292 0 0 unless length $key
298 0 0 if ($self->{'operating_mode'} eq 'accesshash')
299 0 0 $service eq 'whostmgr' ? :
312 0 0 if defined $content
317 0 0 if ($response->{'status'} == 599)
322 0 0 if ($hassigpipe)
324 0 0 if ($self->{'debug'})
329 0 0 if (exists $HEADERS{'transfer-encoding'} and $HEADERS{'transfer-encoding'} =~ /chunked/i) { }
0 0 elsif (defined $HEADERS{'content-length'}) { }
340 0 0 unless ($response->{'success'})
350 0 0 unless ($finished_request or $self->{'error'})
355 0 0 if ($self->{'debug'} and $@)
361 0 0 $self->{'error'} ? :
366 0 0 if ($self->{'operating_mode'} ne 'session')
370 0 0 unless ($service and $tfa_token)
383 0 0 unless ($self->{'user'})
388 0 0 if (not $self->{'remote_server'})
397 4 12 if (exists $self->{'accesshash'}) { }
12 0 elsif (exists $self->{'pass'}) { }
418 0 0 if $self->{'operating_mode'} ne 'session'
419 0 0 if $self->{'security_tokens'}{$service} and $self->{'cookie_jars'}{$service}
425 0 0 $self->{'usessl'} ? :
431 0 0 $tfa_token ? :
436 0 0 if (my $security_token = (split(m[/], $resp->{'headers'}{'location'}, 0))[1])
443 0 0 if $resp->{'status'} == 599
454 0 0 if ($self->{'usessl'}) { }
455 0 0 $service =~ /^\d+$/ ? :
458 0 0 $service =~ /^\d+$/ ? :
467 2 5 if (defined $format) { }
474 0 7 unless exists $CFG{'serializer'}
476 3 4 if (ref $formdata eq 'ARRAY')
484 7 0 scalar keys %$formdata < 10 && _total_form_length($formdata, 1024) < 1024 ? :
497 0 5 unless exists $CFG{'serializer'}
500 2 3 if (defined $format) { }
511 5 0 scalar keys %$formdata < 10 && _total_form_length($formdata, 1024) < 1024 ? :
525 0 21 if ($self->{'error'}) { }
0 21 elsif (${$opts_hr->{'data'};} =~ /tfa_login_form/) { }
533 6 15 if (defined $opts_hr->{'format'} and $opts_hr->{'format'} eq 'json' || $opts_hr->{'format'} eq 'xml') { }
538 0 15 $CFG{'serializer_can_deref'} ? :
539 0 15 unless (ref $parsed_data)
556 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/)
568 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/)
583 1 2 if (exists $parsed_data->{'cpanelresult'}{'error'} and $parsed_data->{'cpanelresult'}{'error'} =~ /Could not find function/)
595 0 46 if ($size += length($key) + 2 + length($data->{$key})) >= 1024
601 0 2 if exists $CFG{'serializer'}
616 2 4 if (not $@) { }
617 0 2 if $self and ref $self and $self->{'debug'}
623 0 4 if $self and ref $self and $self->{'debug'}
626 0 2 if ($@)
632 0 1 if exists $CFG{'init'}
645 1 1 if (not $@) { }
646 0 1 if $self and ref $self and $self->{'debug'}
651 0 1 if $self and ref $self and $self->{'debug'}
654 0 1 if ($@)
672 1 0 if (ref $headers)
673 0 1 unless scalar keys %{$headers;}
674 1 0 $_ ? :
681 1 0 if (ref $formdata)