Branch Coverage

blib/lib/Mojolicious/Plugin/Piwik.pm
Criterion Covered Total %
branch 73 102 71.5


line true false branch
32 0 13 if (my $config_param = $mojo->config('Piwik'))
39 10 2 $mojo->mode eq 'production' ? :
65 3 33 unless $c->stash('piwik.embed')
72 23 10 if ($_[0])
73 10 13 if (index(lc $_[0], 'opt-out') == 0) { }
4 9 elsif (lc $_[0] eq 'as-script') { }
77 3 7 ref $_[-1] eq 'CODE' ? :
102 0 33 unless $url
108 4 29 if ($as_script)
109 1 3 unless ($script_route)
119 10 19 if (my $opt_out = delete $opt{'out'})
122 9 1 if ($prot ne 'https')
124 5 4 $req_url->scheme ? :
130 3 7 if ($opt_out eq 'opt-out-link')
165 2 0 if ($name eq 'track_script')
170 0 2 unless ($url)
218 4 27 if (not defined $param->{'secure'} and index($url, '/') != 0)
219 0 0 if ($url =~ s[^(?:http(s)?:)?//][]iu and $1)
222 0 4 $param->{'secure'} ? :
242 7 24 if (lc $method eq 'track') { }
251 4 3 if $header->user_agent
252 4 3 if $header->referrer
264 1 6 if (defined $param->{'dnt'}) { }
1 5 elsif ($header->dnt) { }
265 0 1 if $param->{'dnt'}
274 1 5 if ($param->{'res'} and ref $param->{'res'})
278 2 4 ref $site_id ? :
283 6 0 if $token_auth
290 2 22 ref $site_id ? :
299 2 22 if ($param->{'urls'})
302 2 0 if (ref $param->{'urls'}) { }
317 2 22 if ($param->{'period'})
326 2 0 if ($period eq 'range')
327 2 0 ref $date ? :
330 2 0 if ($period =~ /^(?:day|week|month|year|range)$/u)
359 1 13 unless my $url = $c->piwik->api_url($method, $param)
362 4 9 if $api_test
367 9 0 unless ($cb)
371 9 0 unless $tx->error
385 0 0 $res ? :
393 0 0 unless 'Mojo::IOLoop'->is_running
410 0 10 unless my $url = $c->piwik->api_url($method, $param)
413 0 10 if $api_test
422 0 8 if (ref $res eq 'HASH' and $res->{'error'})
459 1 18 unless ($res->body)
464 18 0 if (index($ct, 'json') >= 0) { }
0 0 elsif (index($ct, 'html') >= 0) { }
0 0 elsif ($ct =~ m[^image/(gif|jpe?g)]u) { }
475 0 0 unless $found
502 5 30 if (s[^http(s?):/*][]iu)
503 2 3 if $1