blib/lib/CXC/Gnuplot/V0/Key/Title.pm

filter: Statementstmt 52.0% 25 / 48 Branchbran 0.0% 0 / 32 Conditioncond 0.0% 0 / 15 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 46.1% 6 / 13 Podpod 100% 5 / 5 totaltotal 29.7% 36 / 121 CC 22 SCAR 37.5
CC
22
Cov
26%
opts
90.0
to_hash
56.0
__ANON__
30.0
CRAP 42.5
« blib/lib/CXC/Gnuplot/V0/ColorSpec.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/MultiPlot.pm »
1 package CXC::Gnuplot::V0::Key::Title;
2  
3 1 ▶use v5.38;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use experimental 'builtin';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Feature::Compat::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $VERSION = 'v0.29.3';
8  
9 class CXC::Gnuplot::V0::Key::Title;
10  
11 1 use CXC::Gnuplot::V0::Types -lexical => qw(
12 Enum is_Str
13 1 ▶);
Subroutine BEGIN: called CC=1 SCAR=0.0
14 use CXC::Gnuplot::V0::Util
15 1 -lexical => 'maybe_quote',
16 1 ▶ 'assert_coerce_object', 'clone_object', 'pvalidate', 'to_hash_r', 'render_opts';
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 ▶use builtin 'is_bool';
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 my sub croak {
21 0 ▶ require Carp;
Subroutine croak: not called CC=1 SCAR=6.9
22 0 goto \&Carp::croak;
23 }
24  
25 #<<< no tidy
26 1 field $on :param :reader = undef;
27 1 field $text :param :reader = undef;
28 1 field $enhanced :param :reader = undef;
29 1 field $justify :param :reader = undef;
30 1 field $font :param :reader = undef;
31 1 field $textcolor :param :reader = undef;
32 #>>>
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55 ADJUST {
56  
57 # this is equivalent to 'set key notitle'
58 # $on => Bool
59 0 ▶ defined $on
Subroutine __ANON__: not called CC=5 SCAR=34.0
Branch: 1 branch
BranchTrueFalseTotal
defined $on and not builtin::is_bool($on) and croak "\"on\" parameter is not a Boolean" 0 0 0
Condition0%0/3
defined $on and not builtin::is_bool($on)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $on and not builtin::is_bool($on)
defined $on not builtin::is_bool($on)
Truth table0%0/3
A and not(B)
A= defined $onB= not builtin::is_bool($on)
ABresult
0X0
100
111
60 and !is_bool( $on )
61 and croak( q{"on" parameter is not a Boolean} );
62  
63 # {font "<face>,<size>"}
64 # $font => Font|ArrayRef
65 0 pvalidate( font => Font => \$font );
66  
67 0 pvalidate( textcolor => ColorSpec => \$textcolor );
68  
69 # {{no}enhanced}
70 # $enhanced => Bool
71 0 ▶ defined $enhanced
Branch: 1 branch
BranchTrueFalseTotal
defined $enhanced and not builtin::is_bool($enhanced) and croak "invalid value for \"enhanced\" parameter; must be bool" 0 0 0
Condition0%0/3
defined $enhanced and not builtin::is_bool($enhanced)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $enhanced and not builtin::is_bool($enhanced)
defined $enhanced not builtin::is_bool($enhanced)
Truth table0%0/3
A and not(B)
A= defined $enhancedB= not builtin::is_bool($enhanced)
ABresult
0X0
100
111
72 and !is_bool( $enhanced )
73 and croak( q{invalid value for "enhanced" parameter; must be bool} );
74  
75 # $justify => [ left, center, right ]
76 0 pvalidate( justify => Enum->of( 'left', 'right', 'center' ), \$justify );
77 }
78  
79  
80  
81  
82  
83 method to_hash {
84  
85 0 ▶ to_hash_r( {
Subroutine to_hash: not called CC=7 SCAR=40.3
Pod documented
Branch: 6 branches
BranchTrueFalseTotal
defined $text ? : 0 0 0
defined $on ? : 0 0 0
defined $font ? : 0 0 0
defined $enhanced ? : 0 0 0
defined $textcolor ? : 0 0 0
defined $justify ? : 0 0 0
86 ( defined $text ? ( text => $text ) : () ),
87 ( defined $on ? ( on => $on ) : () ),
88 ( defined $font ? ( font => $font ) : () ),
89 ( defined $enhanced ? ( enhanced => $enhanced ) : () ),
90 ( defined $textcolor ? ( textcolor => $textcolor ) : () ),
91 ( defined $justify ? ( justify => $justify ) : () ),
92 } );
93  
94 }
95  
96  
97  
98  
99  
100 ▶sub assert_coerce( $class, $args ) {
Subroutine assert_coerce: not called CC=1 SCAR=6.9
Pod documented
101 0 assert_coerce_object( $class, $args );
102 }
103  
104  
105  
106  
107  
108 ▶method clone ( %args ) {
Subroutine clone: not called CC=1 SCAR=6.9
Pod documented
109 0 return clone_object( $self, \%args );
110 }
111  
112  
113  
114  
115  
116 method opts {
117  
118 0 ▶ return 'notitle'
Subroutine opts: not called CC=9 SCAR=45.0
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if defined $on and not $on or defined $text and 0 == length $text 0 0 0
Condition0%0/9
defined $on and not $on or defined $text and 0 == length $text
l!l&&r!l&&!r
000
defined $on and not $on
!ll&&!rl&&r
000
defined $text and 0 == length $text
!ll&&!rl&&r
000
MC/DC0%0/4
defined $on and not $on or defined $text and 0 == length $text
defined $on not $on defined $text 0 == length $text
Truth table0%0/7
A and not(B) or C and D
A= defined $onB= not $onC= defined $textD= 0 == length $text
ABCDresult
11XX1
0X111
10111
0X0X0
0X100
100X0
10100
119 if defined $on and !$on
120 or defined $text and 0 == length( $text );
121  
122 0 my @opts;
123  
124 0 ▶ push @opts, maybe_quote( $text ) if defined $text;
Branch: 1 branch
BranchTrueFalseTotal
if defined $text 0 0 0
125  
126 0 push @opts, render_opts( font => $font );
127  
128 0 ▶ push @opts, $enhanced ? 'enhanced' : 'noenhaced'
Branch: 2 branches
BranchTrueFalseTotal
if defined $enhanced 0 0 0
$enhanced ? : 0 0 0
129 if defined $enhanced;
130  
131 0 ▶ push @opts, $justify if defined $justify;
Branch: 1 branch
BranchTrueFalseTotal
if defined $justify 0 0 0
132  
133 0 push @opts, render_opts( textcolor => $textcolor );
134  
135 0 return @opts;
136 }
137  
138  
139  
140  
141  
142  
143 ▶sub coerce_attrs( $class, @attrs ) {
Subroutine coerce_attrs: not called CC=4 SCAR=30.0
Pod documented
144  
145 0 ▶ return undef if @attrs > 1;
Branch: 1 branch
BranchTrueFalseTotal
if @attrs > 1 0 0 0
146  
147 0 my $attr = $attrs[0];
148  
149 0 ▶ return { on => $attr }
Branch: 1 branch
BranchTrueFalseTotal
if builtin::is_bool($attr) 0 0 0
150 if is_bool( $attr );
151  
152 0 ▶ return { text => $attr }
Branch: 1 branch
BranchTrueFalseTotal
if is_Str $attr 0 0 0
153 if is_Str( $attr );
154  
155 0 return undef;
156 }
157  
158 1 1;
159  
160 #
161 # This file is part of CXC-Gnuplot
162 #
163 # This software is Copyright (c) 2024 by Smithsonian Astrophysical Observatory.
164 #
165 # This is free software, licensed under:
166 #
167 # The GNU General Public License, Version 3, June 2007
168 #
169  
170 __END__
« blib/lib/CXC/Gnuplot/V0/ColorSpec.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/MultiPlot.pm »