Cake/Utils/Accessor.pm

filter: Statementstmt 92.8% 26 / 28 Branchbran 66.6% 4 / 6 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 88.6% 39 / 44 CC 6 SCAR 9.8
CC
6
Cov
89%
__ANON__
4.1
Accessor
3.0
BEGIN
1.0
CRAP 2.7
« Cake/Plugins/View.pm ↑ Summary
1 package Cake::Utils::Accessor;
2 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 8 ▶use base qw/Exporter/;
Subroutine BEGIN: called CC=1 SCAR=0.0
5
6 8 our @EXPORT = qw(
7 Accessor
8 );
9
10 ###quick simple accessor
11 8 ▶sub Accessor {
Subroutine Accessor: called CC=3 SCAR=11.1
Pod undocumented
12 8 my $class;
13 8 ▶ if (caller eq $_[0]){
Branch: 1 branch
BranchTrueFalseTotal
if (caller eq $_[0]) { } 8 0 8
14 8 $class = shift;
15 } else {
16 0 $class = caller;
17 }
18
19 8 foreach my $method (@_){
20 48 my $code = $class.'::'.$method;
21 {
22 8 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
23 98 ▶ *$code = sub {
Subroutine __ANON__: called CC=4 SCAR=14.0
24 98 my $self = shift;
25 98 ▶ $self->{$method} ||= {};
Condition100%2/2
$self->{$method} ||= {}
l!l
8612
MC/DC100%1/1
$self->{$method} ||= {}
$self->{$method}
Truth table100%2/2
A
A= $self->{$method}
Aresult
11
00
26 98 ▶ if(@_ == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (@_ == 1) { } 8 90 98
elsif (@_ > 1) { } 0 90 90
27 8 return $self->{$method} = $_[0];
28 } elsif (@_ > 1) {
29 0 return $self->{$method} = [@_];
30 } else {
31 90 return $self->{$method};
32 }
33 48 };
34 }
35 }
36 }
37
38 8 1;
39
40 __END__
« Cake/Plugins/View.pm ↑ Summary