lib/Kwiki/Pane.pm

filter: Statementstmt 17.5% 13 / 74 Branchbran 0.0% 0 / 26 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 36.3% 4 / 11 Podpod 0.0% 0 / 7 totaltotal 13.4% 17 / 126 CC 20 SCAR 38.8
CC
20
Cov
12%
show
110.0
html
30.0
ordered_unit_ids
30.0
CRAP 48.2
↑ Summary lib/Kwiki/Command.pm »
1 package Kwiki::Pane;
2 1 ▶use Kwiki::Plugin -Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use mixin 'Kwiki::Installer';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 0 ▶sub order { () }
Subroutine order: not called CC=1 SCAR=6.9
Pod undocumented
6 0 ▶sub pane_unit { $self->class_id }
Subroutine pane_unit: not called CC=1 SCAR=6.9
Pod undocumented
7  
8 0 ▶sub register {
Subroutine register: not called CC=1 SCAR=6.9
Pod undocumented
9 0 my $registry = shift;
10 0 $registry->add(preload => $self->class_id);
11 }
12  
13 0 ▶sub html {
Subroutine html: not called CC=5 SCAR=34.0
Pod undocumented
14 0 ▶ return $self->{html} if defined $self->{html};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"html"} 0 0 0
15  
16 0 my @all = $self->pages->current->all;
17 0 my $pane_info = $self->pane_info;
18 0 my $params_method = $self->class_id . '_params';
19 my @units = grep {
20 0 ▶ defined $_ and do {
Condition0%0/3
defined $_ && do { my $button = $_; $button =~ s/<!--.*?-->//gs; $button =~ /\S/ }
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_ && do { my $button = $_; $button =~ s/<!--.*?-->//gs; $button =~ /\S/ }
defined $_ do { my $button = $_; $button =~ s/<!--.*?-->//gs; $button =~ /\S/ }
Truth table0%0/3
A && B
A= defined $_B= do { my $button = $_; $button =~ s/<!--.*?-->//gs; $button =~ /\S/ }
ABresult
0X0
100
111
21 0 my $button = $_;
22 0 $button =~ s/<!--.*?-->//gs;
23 0 $button =~ /\S/;
24 }
25 } map {
26 $self->show($_)
27 ? $self->template->process(
28 $_->{template},
29 @all,
30 $_->{params_class}
31 0 ▶ ? do {
Branch: 2 branches
BranchTrueFalseTotal
$self->show($_) ? : 0 0 0
$_->{'params_class'} ? : 0 0 0
32 0 my $class_id = $_->{params_class};
33 0 $self->hub->$class_id->$params_method
34 }
35 : ()
36 )
37 : undef
38 } map {
39 0 $pane_info->{$_};
40 } $self->ordered_unit_ids;
41
42 0 $self->{html} = $self->template->process($self->pane_template,
43 units => \ @units,
44 );
45 }
46  
47 0 ▶sub pane_info {
Subroutine pane_info: not called CC=3 SCAR=24.8
Pod undocumented
48 0 ▶ my $units = $self->hub->registry->lookup->{$self->pane_unit}
Branch: 1 branch
BranchTrueFalseTotal
my $units = $self->hub->registry->lookup->{$self->pane_unit} or return {} 0 0 0
49 or return {};
50 0 my $info;
51 0 for my $unit_id (keys %$units) {
52 0 my $array = $units->{$unit_id};
53 0 $info->{$unit_id} = {@{$array}[1..$#{$array}]};
54 }
55 0 return $info;
56 }
57  
58 0 ▶sub ordered_unit_ids {
Subroutine ordered_unit_ids: not called CC=5 SCAR=34.0
Pod undocumented
59 0 my $lookup = $self->hub->registry->lookup;
60 my @unit_ids = map {
61 0 ▶ @{$lookup->{add_order}{$_->{id}}{$self->pane_unit} || []};
Condition0%0/2
$lookup->{'add_order'}{$_->{'id'}}{$self->pane_unit} || []
l!l
00
MC/DC0%0/1
$lookup->{'add_order'}{$_->{'id'}}{$self->pane_unit} || []
$lookup->{'add_order'}{$_->{'id'}}{$self->pane_unit}
Truth table0%0/2
A
A= $lookup->{'add_order'}{$_->{'id'}}{$self->pane_unit}
Aresult
11
00
62 0 } @{$lookup->plugins};
63 0 my @ordered_unit_ids;
64 0 for my $unit_id ($self->order) {
65 0 ▶ for (my $i = 0; $i < @unit_ids; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @unit_ids) 0 0 0
66 0 ▶ if ($unit_id eq $unit_ids[$i]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($unit_id eq $unit_ids[$i]) 0 0 0
67 0 push @ordered_unit_ids, splice @unit_ids, $i, 1;
68 0 last;
69 }
70 }
71 }
72 0 (@ordered_unit_ids, @unit_ids);
73 }
74  
75 0 ▶sub show {
Subroutine show: not called CC=10 SCAR=47.0
Pod undocumented
76 0 my $unit = shift;
77 0 my $action = $self->hub->action;
78 0 my $show = $unit->{show_for};
79 0 ▶ if (defined $show) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $show) 0 0 0
80 0 ▶ for (ref($show) ? (@$show) : ($show)) {
Branch: 1 branch
BranchTrueFalseTotal
ref $show ? : 0 0 0
81 0 ▶ return 1 if $_ eq $action;
Branch: 1 branch
BranchTrueFalseTotal
if $_ eq $action 0 0 0
82 }
83 0 return 0;
84 }
85 0 my $omit = $unit->{omit_for};
86 0 ▶ if (defined $omit) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $omit) 0 0 0
87 0 ▶ for (ref($omit) ? (@$omit) : ($omit)) {
Branch: 1 branch
BranchTrueFalseTotal
ref $omit ? : 0 0 0
88 0 ▶ return 0 if $_ eq $action;
Branch: 1 branch
BranchTrueFalseTotal
if $_ eq $action 0 0 0
89 }
90 0 return 1;
91 }
92 0 my $pref = $unit->{show_if_preference};
93 0 ▶ if (defined $pref) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $pref) 0 0 0
94 0 return $self->preferences->$pref->value;
95 }
96
97 0 return 1;
98 }
↑ Summary lib/Kwiki/Command.pm »