Tools/EUtilities/Info.pm

filter: Statementstmt 81.6% 40 / 49 Branchbran 63.6% 14 / 22 Conditioncond 83.3% 5 / 6 MC/DCmcdc 75.0% 3 / 4 Subroutinesub 87.5% 7 / 8 Podpod 100% 1 / 1 totaltotal 77.7% 70 / 90 CC 16 SCAR 24.1
CC
16
Cov
77%
to_string
20.0
_add_data
13.1
BEGIN
1.0
CRAP 11.1
« Tools/EUtilities/Link.pm ↑ Summary Tools/EUtilities/Summary/Item.pm »
1 package Bio::Tools::EUtilities::Info;
2 2 $Bio::Tools::EUtilities::Info::VERSION = '1.77';
3 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use base qw(Bio::Tools::EUtilities Bio::Tools::EUtilities::EUtilDataI);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Bio::Tools::EUtilities::Info::LinkInfo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Bio::Tools::EUtilities::Info::FieldInfo;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # ABSTRACT: Interface class for storing einfo data.
11 # AUTHOR: Chris Fields <cjfields@bioperl.org>
12 # OWNER: 2006-2013 Chris Fields
13 # LICENSE: Perl_5
14  
15  
16  
17  
18 # private EUtilDataI method
19  
20 2 ▶sub _add_data {
Subroutine _add_data: called CC=13 SCAR=25.7
21 2 my ($self, $simple) = @_;
22 2 ▶ if (exists $simple->{DbList} &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $simple->{"DbList"} and exists $simple->{"DbList"}{"DbName"}) 1 1 2
Condition66%2/3
exists $simple->{"DbList"} and exists $simple->{"DbList"}{"DbName"}
!ll&&!rl&&r
101
MC/DC50%1/2
exists $simple->{"DbList"} and exists $simple->{"DbList"}{"DbName"}
exists $simple->{"DbList"} exists $simple->{"DbList"}{"DbName"}
Truth table66%2/3
A and B
A= exists $simple->{"DbList"}B= exists $simple->{"DbList"}{"DbName"}
ABresult
0X0
100
111
23 exists $simple->{DbList}->{DbName}) {
24 1 $self->{'_available_databases'} = $simple->{DbList}->{DbName};
25 }
26 # start setting internal variables
27 2 ▶ if (exists $simple->{DbInfo}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $simple->{'DbInfo'}) { } 1 1 2
28 1 for my $key (sort keys %{ $simple->{DbInfo} }) {
29 my $data =
30 ($key eq 'FieldList') ? $simple->{DbInfo}->{$key}->{Field} :
31 ($key eq 'LinkList' ) ? $simple->{DbInfo}->{$key}->{Link} :
32 7 ▶ $simple->{DbInfo}->{$key};
Branch: 2 branches
BranchTrueFalseTotal
$key eq 'FieldList' ? : 1 6 7
$key eq 'LinkList' ? : 1 5 6
33 7 ▶ if ($key eq 'FieldList' || $key eq 'LinkList') {
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq 'FieldList' or $key eq 'LinkList') { } 2 5 7
Condition100%3/3
$key eq "FieldList" or $key eq "LinkList"
l!l&&r!l&&!r
115
MC/DC100%2/2
$key eq "FieldList" or $key eq "LinkList"
$key eq "FieldList" $key eq "LinkList"
Truth table100%3/3
A or B
A= $key eq "FieldList"B= $key eq "LinkList"
ABresult
1X1
011
000
34 2 for my $chunk (@{$data}) {
35 87 ▶ if (exists $simple->{DbInfo}->{DbName}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $simple->{"DbInfo"}{"DbName"}) 87 0 87
36 87 $chunk->{DbFrom} = $simple->{DbInfo}->{DbName};
37 }
38 87 ▶ my $type = ($key eq 'FieldList') ? 'FieldInfo' : 'LinkInfo';
Branch: 1 branch
BranchTrueFalseTotal
$key eq 'FieldList' ? : 41 46 87
39 87 my $obj = "Bio::Tools::EUtilities::Info::$type"->new(
40 -eutil => 'einfo',
41 -type => lc $type,
42 -verbose => $self->verbose);
43 87 $obj->_add_data($chunk);
44 87 push @{ $self->{'_'.lc $type} }, $obj;
45 }
46 } else {
47 5 $self->{'_'.lc $key} = $data;
48 }
49 }
50 } else {
51 1 ▶ map { $self->{'_'.lc $_} = $simple->{$_} unless ref $simple->{$_}} keys %$simple;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $simple->{$_} 0 1 1
52 }
53 }
54  
55  
56 0 ▶sub to_string {
Subroutine to_string: not called CC=4 SCAR=30.0
Pod documented
57 0 my $self = shift;
58 0 my $string = $self->SUPER::to_string;
59 0 ▶ if (my @dbs = $self->get_databases) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@dbs) = $self->get_databases) 0 0 0
60 0 $string .= sprintf("%-20s:%s\n\n", 'DB',
61 $self->_text_wrap('', ' 'x20 .':', join(', ',@dbs)));
62 }
63 0 ▶ while (my $fi = $self->next_FieldInfo) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $fi = $self->next_FieldInfo) 0 0 0
64 0 $string .= $fi->to_string."\n";
65 }
66 0 ▶ while (my $li = $self->next_LinkInfo) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $li = $self->next_LinkInfo) 0 0 0
67 0 $string .= $li->to_string."\n";
68 }
69 0 return $string;
70 }
71  
72 2 1;
73  
74 __END__
« Tools/EUtilities/Link.pm ↑ Summary Tools/EUtilities/Summary/Item.pm »