Helper/ResultSet/Shortcut/Search/Base.pm

filter: Statementstmt 100% 25 / 25 Branchbran 100% 4 / 4 Conditioncond 83.3% 5 / 6 MC/DCmcdc 66.6% 2 / 3 Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 95.4% 42 / 44 CC 6 SCAR 9.0
CC
6
Cov
97%
_helper_unwrap_columns
4.0
_helper_meify
2.0
_helper_apply_search
2.0
CRAP 2.5
« Helper/ResultSet/AutoRemoveColumns.pm ↑ Summary Helper/Row/ToJSON.pm »
1 package DBIx::Class::Helper::ResultSet::Shortcut::Search::Base;
2 57 $DBIx::Class::Helper::ResultSet::Shortcut::Search::Base::VERSION = '2.037000';
3 57 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 57 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 57 ▶use parent 'DBIx::Class::ResultSet';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 #--------------------------------------------------------------------------#
9 # _helper_unwrap_columns(@columns)
10 #--------------------------------------------------------------------------#
11  
12 7 ▶sub _helper_unwrap_columns {
Subroutine _helper_unwrap_columns: called CC=4 SCAR=13.9
13 7 my ($self, @columns) = @_;
14  
15 7 ▶ if (@columns == 1 && ref($columns[0]) && ref($columns[0]) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (@columns == 1 and ref $columns[0] and ref $columns[0] eq "ARRAY") 2 5 7
Condition83%5/6
@columns == 1 and ref $columns[0] and ref $columns[0] eq "ARRAY"
!ll&&!rl&&r
502
@columns == 1 and ref $columns[0]
!ll&&!rl&&r
232
MC/DC66%2/3
@columns == 1 and ref $columns[0] and ref $columns[0] eq "ARRAY"
@columns == 1 ref $columns[0] ref $columns[0] eq "ARRAY"
Truth table75%3/4
A and B and C
A= @columns == 1B= ref $columns[0]C= ref $columns[0] eq "ARRAY"
ABCresult
0XX0
10X0
1100
1111
16 2 @columns = @{ $columns[0] };
17 }
18  
19 7 return @columns;
20 }
21  
22 #--------------------------------------------------------------------------#
23 # _helper_meify($column)
24 #--------------------------------------------------------------------------#
25  
26 8 ▶sub _helper_meify {
Subroutine _helper_meify: called CC=2 SCAR=6.9
27 8 my ($self, $column) = @_;
28  
29 8 ▶ return $self->current_source_alias . $column if $column =~ m/^\./;
Branch: 1 branch
BranchTrueFalseTotal
if $column =~ /^\./ 2 6 8
30 6 return $column;
31 }
32  
33 #--------------------------------------------------------------------------#
34 # _helper_apply_search($cond, @columns)
35 #--------------------------------------------------------------------------#
36  
37 5 ▶sub _helper_apply_search {
Subroutine _helper_apply_search: called CC=2 SCAR=6.9
38 5 my ($self, $cond, @columns) = @_;
39  
40 5 @columns = $self->_helper_unwrap_columns(@columns);
41  
42 5 my $rs = $self;
43 5 foreach my $column (@columns) {
44 6 $rs = $rs->search_rs({ $self->_helper_meify($column) => $cond });
45 }
46  
47 5 return $rs;
48 }
49  
50  
51 57 1;
52  
53 __END__
« Helper/ResultSet/AutoRemoveColumns.pm ↑ Summary Helper/Row/ToJSON.pm »