Branch Coverage

blib/lib/Mojolicious/Plugin/Piwik.pm
Criterion Covered Total %
branch 74 104 71.1


line true false branch
32 0 13 if (my $config_param = $mojo->config("Piwik"))
39 10 2 $mojo->mode eq 'production' ? :
58 0 9 $plugin_param->{'script'} ? :
67 3 33 unless $c->stash("piwik.embed")
74 23 10 if ($_[0])
75 10 13 if (index(lc $_[0], 'opt-out') == 0) { }
4 9 elsif (lc $_[0] eq 'as-script') { }
79 3 7 ref $_[-1] eq 'CODE' ? :
104 0 33 unless $url
110 4 29 if ($as_script)
111 1 3 unless ($script_route)
121 10 19 if (my $opt_out = delete $opt{'out'})
124 9 1 if ($prot ne "https")
126 5 4 $req_url->scheme ? :
132 3 7 if ($opt_out eq "opt-out-link")
167 2 0 if ($name eq "track_script")
172 0 2 unless ($url)
222 4 27 if (not defined $param->{'secure'} and index($url, "/") != 0)
223 0 0 if ($url =~ s[^(?:http(s)?:)?//][]iu and $1)
226 0 4 $param->{'secure'} ? :
246 7 24 if (lc $method eq 'track') { }
255 4 3 if $header->user_agent
256 4 3 if $header->referrer
269 1 6 if (defined $param->{'dnt'}) { }
1 5 elsif ($header->dnt) { }
270 0 1 if $param->{'dnt'}
278 1 5 if ($param->{'res'} and ref $param->{'res'})
282 2 4 ref $site_id ? :
287 6 0 if $token_auth
294 2 22 ref $site_id ? :
303 2 22 if ($param->{'urls'})
306 2 0 if (ref $param->{'urls'}) { }
321 2 22 if ($param->{'period'})
330 2 0 if ($period eq "range")
331 2 0 ref $date ? :
334 2 0 if ($period =~ /^(?:day|week|month|year|range)$/u)
363 1 13 unless my $url = $c->piwik->api_url($method, $param)
366 4 9 if $api_test
371 9 0 unless ($cb)
375 9 0 unless $tx->error
389 0 0 $res ? :
397 0 0 unless "Mojo::IOLoop"->is_running
414 0 10 unless my $url = $c->piwik->api_url($method, $param)
417 0 10 if $api_test
426 0 8 if (ref $res eq "HASH" and $res->{'error'})
463 1 18 unless ($res->body)
468 18 0 if (index($ct, 'json') >= 0) { }
0 0 elsif (index($ct, 'html') >= 0) { }
0 0 elsif ($ct =~ m[^image/(gif|jpe?g)]u) { }
479 0 0 unless $found
506 5 30 if (s[^http(s?):/*][]iu)
507 2 3 if $1