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

filter: Statementstmt 67.5% 27 / 40 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 14 MC/DCmcdc 0.0% 0 / 9 Subroutinesub 53.3% 8 / 15 Podpod 100% 5 / 5 totaltotal 42.1% 40 / 95 CC 12 SCAR 25.0
CC
12
Cov
41%
__ANON__
30.0
opts
20.0
to_hash
12.0
CRAP 12.2
« blib/lib/CXC/Gnuplot/V0/Margin.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/CoordOffset3D.pm »
1 package CXC::Gnuplot::V0::Font;
2  
3 1 ▶use v5.38;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use experimental '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::Font;
10  
11 1 ▶no namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 ▶use Ref::Util 'is_ref';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 ▶use CXC::Gnuplot::V0::Types -lexical, 'is_PositiveInt';
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use CXC::Gnuplot::V0::Util -lexical => 'assert_coerce_object', 'clone_object', 'to_hash_r', 'quote';
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 $name :param :reader = undef;
27 1 field $size :param :reader = undef;
28 #>>>
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43 ADJUST {
44  
45 0 ▶ defined $name
Subroutine __ANON__: not called CC=5 SCAR=34.0
Branch: 1 branch
BranchTrueFalseTotal
defined $name and not length $name and croak "\"name\" must be non-empty" 0 0 0
Condition0%0/3
defined $name and not length $name
!ll&&!rl&&r
000
MC/DC0%0/2
defined $name and not length $name
defined $name not length $name
Truth table0%0/3
A and not(B)
A= defined $nameB= not length $name
ABresult
0X0
100
111
46 and !length $name
47 and croak( '"name" must be non-empty' );
48  
49 0 ▶ defined $size
Branch: 1 branch
BranchTrueFalseTotal
defined $size and not is_PositiveInt($size) and croak "\"size\" must be a positive integer" 0 0 0
Condition0%0/3
defined $size and not is_PositiveInt($size)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $size and not is_PositiveInt($size)
defined $size not is_PositiveInt($size)
Truth table0%0/3
A and not(B)
A= defined $sizeB= not is_PositiveInt($size)
ABresult
0X0
100
111
50 and !is_PositiveInt( $size )
51 and croak( '"size" must be a positive integer' );
52  
53 }
54  
55  
56  
57  
58  
59 ▶method to_hash ( %args ) {
Subroutine to_hash: not called CC=3 SCAR=24.8
Pod documented
60 0 ▶ to_hash_r( {
Branch: 2 branches
BranchTrueFalseTotal
defined $name ? : 0 0 0
defined $size ? : 0 0 0
61 ( defined $name ? ( name => $name ) : () ), #
62 ( defined $size ? ( size => $size ) : () ),
63 } );
64 }
65  
66  
67  
68  
69  
70 ▶sub assert_coerce( $class, $args ) {
Subroutine assert_coerce: not called CC=1 SCAR=6.9
Pod documented
71 0 assert_coerce_object( $class, $args );
72 }
73  
74  
75  
76  
77  
78 ▶method clone ( %args ) {
Subroutine clone: not called CC=1 SCAR=6.9
Pod documented
79 0 return clone_object( $self, \%args );
80 }
81  
82  
83  
84  
85  
86 method opts {
87 0 ▶ my $font = join( q{,}, $name // q{}, $size // () );
Subroutine opts: not called CC=4 SCAR=30.0
Pod documented
Condition0%0/5
$name // ""
l!l
00
$size // ()
l!l&&r!l&&!r
000
MC/DC0%0/1
$name // ""
$name
MC/DC0%0/2
$size // ()
$size ()
Truth table0%0/2
A
A= $name
Aresult
11
00
Truth table0%0/3
A // B
A= $sizeB= ()
ABresult
1X1
011
000
88 0 ▶ return ( length( $font ) ? quote( $font ) : () );
Branch: 1 branch
BranchTrueFalseTotal
length $font ? : 0 0 0
89 }
90  
91  
92  
93  
94  
95 ▶sub coerce_attrs ( $class, @attrs ) {
Subroutine coerce_attrs: not called CC=3 SCAR=24.8
Pod documented
96  
97 0 ▶ return undef if @attrs > 1 || is_ref( $attrs[0] );
Branch: 1 branch
BranchTrueFalseTotal
if @attrs > 1 or Ref::Util::XS::is_ref($attrs[0]) 0 0 0
Condition0%0/3
@attrs > 1 or Ref::Util::XS::is_ref($attrs[0])
l!l&&r!l&&!r
000
MC/DC0%0/2
@attrs > 1 or Ref::Util::XS::is_ref($attrs[0])
@attrs > 1 Ref::Util::XS::is_ref($attrs[0])
Truth table0%0/3
A or B
A= @attrs > 1B= Ref::Util::XS::is_ref($attrs[0])
ABresult
1X1
011
000
98  
99 0 my %args;
100 ## no critic( SplitQuotedPattern )
101 0 @args{ 'font', 'size' } = split( $attrs[0] );
102 0 return \%args;
103  
104 }
105  
106  
107 1 1;
108  
109 #
110 # This file is part of CXC-Gnuplot
111 #
112 # This software is Copyright (c) 2024 by Smithsonian Astrophysical Observatory.
113 #
114 # This is free software, licensed under:
115 #
116 # The GNU General Public License, Version 3, June 2007
117 #
118  
119 __END__
« blib/lib/CXC/Gnuplot/V0/Margin.pm ↑ Summary blib/lib/CXC/Gnuplot/V0/CoordOffset3D.pm »