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

filter: Statementstmt 66.0% 33 / 50 Branchbran 0.0% 0 / 20 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 56.2% 9 / 16 Podpod 100% 5 / 5 totaltotal 46.5% 47 / 101 CC 13 SCAR 27.1
CC
13
Cov
43%
to_hash
42.0
opts
20.0
__ANON__
12.0
CRAP 15.0
« blib/lib/CXC/Gnuplot/V0/Title.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/Terminal.pm »
1 package CXC::Gnuplot::V0::MultiPlot::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::MultiPlot::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 ▶no namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 ▶use Ref::Util qw( is_ref );
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 1 ▶use builtin 'is_bool';
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 my sub croak {
27 0 ▶ require Carp;
Subroutine croak: not called CC=1 SCAR=6.9
28 0 goto \&Carp::croak;
29 }
30  
31 #<<< no tidy
32 1 field $text :param :reader;
33 1 field $font :param :reader = undef;
34 1 field $enhanced :param :reader = undef;
35 1 field $justify :param :reader = undef;
36 1 field $textcolor :param :reader = undef;
37 #>>>
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58 ADJUST {
59  
60 0 ▶ pvalidate( font => Font => \$font );
Subroutine __ANON__: not called CC=3 SCAR=24.8
61  
62 0 pvalidate( textcolor => ColorSpec => \$textcolor );
63  
64 # {{no}enhanced}
65 # $enhanced => Bool
66 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
67 and !is_bool( $enhanced )
68 and croak( q{invalid value for "enhanced" parameter; must be bool} );
69  
70 # $justify => [ left, center, right ]
71 0 pvalidate( justify => Enum->of( 'left', 'right', 'center' ), \$justify );
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 $font ? : 0 0 0
defined $enhanced ? : 0 0 0
defined $textcolor ? : 0 0 0
defined $justify ? : 0 0 0
81 ( defined $text ? ( text => $text ) : () ),
82 ( defined $font ? ( font => $font ) : () ),
83 ( defined $enhanced ? ( enhanced => $enhanced ) : () ),
84 ( defined $textcolor ? ( textcolor => $textcolor ) : () ),
85 ( defined $justify ? ( justify => $justify ) : () ),
86 } );
87  
88 }
89  
90  
91  
92  
93  
94 ▶sub coerce_attrs ( $class, @attrs ) {
Subroutine coerce_attrs: not called CC=3 SCAR=24.8
Pod documented
95 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
96 ? { text => $attrs[0] }
97 : undef;
98 }
99  
100  
101  
102  
103  
104 ▶sub assert_coerce( $class, $args ) {
Subroutine assert_coerce: not called CC=1 SCAR=6.9
Pod documented
105 0 assert_coerce_object( $class, $args );
106 }
107  
108  
109  
110  
111  
112 ▶method clone ( %args ) {
Subroutine clone: not called CC=1 SCAR=6.9
Pod documented
113 0 return clone_object( $self, \%args );
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 push @opts, maybe_quote( $text );
125  
126 0 push @opts, render_opts( font => $font );
127  
128 0 ▶ defined $enhanced
Branch: 2 branches
BranchTrueFalseTotal
defined $enhanced and push @opts, $enhanced ? "enhanced" : "noenhaced" 0 0 0
$enhanced ? : 0 0 0
129 and push @opts, $enhanced ? 'enhanced' : 'noenhaced';
130  
131 0 ▶ defined $justify
Branch: 1 branch
BranchTrueFalseTotal
defined $justify and push @opts, $justify 0 0 0
132 and push @opts, $justify;
133  
134 0 push @opts, render_opts( textcolor => $textcolor );
135  
136 0 return @opts;
137 }
138  
139  
140 1 1;
141  
142 #
143 # This file is part of CXC-Gnuplot
144 #
145 # This software is Copyright (c) 2024 by Smithsonian Astrophysical Observatory.
146 #
147 # This is free software, licensed under:
148 #
149 # The GNU General Public License, Version 3, June 2007
150 #
151  
152 __END__
« blib/lib/CXC/Gnuplot/V0/Title.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/Terminal.pm »