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

filter: Statementstmt 66.6% 34 / 51 Branchbran 0.0% 0 / 22 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 56.2% 9 / 16 Podpod 100% 5 / 5 totaltotal 46.1% 48 / 104 CC 14 SCAR 27.7
CC
14
Cov
43%
to_hash
42.0
__ANON__
20.0
opts
20.0
CRAP 16.0
« blib/lib/CXC/Gnuplot/V0/MultiPlot/Margins.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/MultiPlot/Title.pm »
1 package CXC::Gnuplot::V0::Title;
2  
3 1 ▶use v5.38;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use experimental 'builtin', 'declared_refs';
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::Title;
10  
11 1 ▶use builtin 'is_bool', 'true';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 ▶no namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 ▶use Ref::Util 'is_ref';
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 use CXC::Gnuplot::V0::Types
20 1 -lexical => 'NonEmptyStr',
21 'CoordOffset3D',
22 'SetFormats',
23 1 ▶ 'signature_for';
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 1 use CXC::Gnuplot::V0::Util -lexical, 'maybe_quote', 'assert_coerce_object', 'clone_object',
26 1 ▶ 'pvalidate', 'to_hash_r', 'render_opts', 'render_set';
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 my sub croak {
29 0 ▶ require Carp;
Subroutine croak: not called CC=1 SCAR=6.9
30 0 goto \&Carp::croak;
31 }
32  
33 #<<< notidy
34 1 field $text :param :reader = undef;
35 1 field $offset :param :reader = undef;
36 1 field $font :param :reader = undef;
37 1 field $textcolor :param :reader = undef;
38 1 field $enhanced :param :reader = undef;
39 #>>>
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59 ADJUST {
60  
61 0 ▶ defined $offset
Subroutine __ANON__: not called CC=4 SCAR=30.0
Branch: 1 branch
BranchTrueFalseTotal
defined $offset and pvalidate "offset", "CoordOffset3D", \$offset 0 0 0
62 and pvalidate( offset => CoordOffset3D => \$offset );
63  
64 0 pvalidate( font => Font => \$font );
65  
66 0 pvalidate( textcolor => ColorSpec => \$textcolor );
67  
68 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
69 and !is_bool( $enhanced )
70 and croak( q{invalid value for "enhanced" parameter; must be bool} );
71  
72 }
73  
74  
75  
76  
77  
78 method to_hash {
79  
80 0 ▶ to_hash_r( {
Subroutine to_hash: not called CC=6 SCAR=37.4
Pod documented
Branch: 5 branches
BranchTrueFalseTotal
defined $text ? : 0 0 0
defined $offset ? : 0 0 0
defined $font ? : 0 0 0
defined $textcolor ? : 0 0 0
defined $enhanced ? : 0 0 0
81 ( defined $text ? ( text => $text ) : () ),
82 ( defined $offset ? ( offset => $offset ) : () ),
83 ( defined $font ? ( font => $font ) : () ),
84 ( defined $textcolor ? ( textcolor => $textcolor ) : () ),
85 ( defined $enhanced ? ( enhanced => $enhanced ) : () ),
86 } );
87  
88 }
89  
90  
91  
92  
93  
94 ▶sub assert_coerce( $class, $args ) {
Subroutine assert_coerce: not called CC=1 SCAR=6.9
Pod documented
95 0 assert_coerce_object( $class, $args );
96 }
97  
98  
99  
100  
101  
102 ▶method clone ( %args ) {
Subroutine clone: not called CC=1 SCAR=6.9
Pod documented
103 0 return clone_object( $self, \%args );
104 }
105  
106  
107  
108  
109  
110 ▶sub coerce_attrs ( $class, @attrs ) {
Subroutine coerce_attrs: not called CC=3 SCAR=24.8
Pod documented
111 0 ▶ return @attrs == 1 && !is_ref( $attrs[0] )
Branch: 1 branch
BranchTrueFalseTotal
@attrs == 1 && !Ref::Util::XS::is_ref($attrs[0]) ? : 0 0 0
Condition0%0/3
@attrs == 1 and not Ref::Util::XS::is_ref($attrs[0])
!ll&&!rl&&r
000
MC/DC0%0/2
@attrs == 1 and not Ref::Util::XS::is_ref($attrs[0])
@attrs == 1 not Ref::Util::XS::is_ref($attrs[0])
Truth table0%0/3
A and not(B)
A= @attrs == 1B= not Ref::Util::XS::is_ref($attrs[0])
ABresult
0X0
100
111
112 ? { text => $attrs[0] }
113 : undef;
114 }
115  
116  
117  
118  
119  
120 method opts {
121  
122 0 ▶ my @opts;
Subroutine opts: not called CC=4 SCAR=30.0
Pod documented
123  
124 0 ▶ defined $text
Branch: 1 branch
BranchTrueFalseTotal
defined $text and push @opts, maybe_quote($text) 0 0 0
125 and push @opts, maybe_quote( $text );
126  
127  
128 0 push @opts, render_opts( offset => $offset );
129  
130 0 push @opts, render_opts( font => $font );
131  
132 0 push @opts, render_opts( textcolor => $textcolor );
133  
134 0 ▶ defined $enhanced
Branch: 2 branches
BranchTrueFalseTotal
defined $enhanced and push @opts, $enhanced ? "enhanced" : "noenhanced" 0 0 0
$enhanced ? : 0 0 0
135 and push @opts, ( $enhanced ? 'enhanced' : 'noenhanced' );
136  
137 0 return @opts;
138 }
139  
140  
141  
142  
143  
144 1 signature_for set => (
145 method => 1,
146 named => [
147 as => SetFormats,
148 { default => 'string' },
149 ],
150 );
151  
152 method set ( $opt ) {
153  
154 return render_set( [ render_opts( [ set => 'title' ], $self ) ], $opt->as );
155 }
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/MultiPlot/Margins.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/MultiPlot/Title.pm »