lib/OODoc/Text/SubSection.pm

filter: Statementstmt 36.5% 19 / 52 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 7 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 35.7% 5 / 14 Podpod 87.5% 7 / 8 totaltotal 31.9% 31 / 97 CC 11 SCAR 26.8
CC
11
Cov
27%
init
42.0
findEntry
12.0
subsubsections
12.0
CRAP 14.6
« lib/OODoc/Text/Section.pm ↑ Summary lib/OODoc/Parser.pm »
1 # This code is part of Perl distribution OODoc version 3.05.
2 # The POD got stripped from this file by OODoc version 3.05.
3 # For contributors see file ChangeLog.
4  
5 # This software is copyright (c) 2003-2025 by Mark Overmeer.
6  
7 # This is free software; you can redistribute it and/or modify it under
8 # the same terms as the Perl 5 programming language system itself.
9 # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later
10  
11  
12 package OODoc::Text::SubSection;{
13 1 our $VERSION = '3.05';
14 }
15  
16 1 ▶use parent 'OODoc::Text::Structure';
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 ▶use Log::Report 'oodoc';
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 1 ▶use List::Util qw/first/;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 #--------------------
26  
27 sub init($)
28 0 ▶{ my ($self, $args) = @_;
Subroutine init: not called CC=6 SCAR=37.4
Pod undocumented
29 0 ▶ $args->{type} ||= 'Subsection';
Condition0%0/2
$args->{"type"} ||= "Subsection"
l!l
00
MC/DC0%0/1
$args->{"type"} ||= "Subsection"
$args->{"type"}
Truth table0%0/2
A
A= $args->{"type"}
Aresult
11
00
30 0 ▶ $args->{container} ||= delete $args->{section} or panic;
Branch: 1 branch
BranchTrueFalseTotal
$args->{"container"} ||= delete $args->{"section"} or &panic() 0 0 0
Condition0%0/3
$args->{"container"} ||= delete $args->{"section"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$args->{"container"} ||= delete $args->{"section"}
$args->{"container"} delete $args->{"section"}
Truth table0%0/3
A ||= B
A= $args->{"container"}B= delete $args->{"section"}
ABresult
1X1
011
000
31 0 ▶ $args->{level} ||= 3;
Condition0%0/2
$args->{"level"} ||= 3
l!l
00
MC/DC0%0/1
$args->{"level"} ||= 3
$args->{"level"}
Truth table0%0/2
A
A= $args->{"level"}
Aresult
11
00
32  
33 0 ▶ $self->SUPER::init($args) or return;
Branch: 1 branch
BranchTrueFalseTotal
$self->SUPER::init($args) or return 0 0 0
34 0 $self->{OTS_subsubsections} = [];
35 0 $self;
36 }
37  
38 sub emptyExtension($)
39 0 ▶{ my ($self, $container) = @_;
Subroutine emptyExtension: not called CC=1 SCAR=6.9
Pod documented
40 0 my $empty = $self->SUPER::emptyExtension($container);
41 0 my @subsub = map $_->emptyExtension($empty), $self->subsubsections;
42 0 $empty->subsubsections(@subsub);
43 0 $empty;
44 }
45  
46 sub findEntry($)
47 0 ▶{ my ($self, $name) = @_;
Subroutine findEntry: not called CC=3 SCAR=24.8
Pod documented
48 0 ▶ return $self if $self->name eq $name;
Branch: 1 branch
BranchTrueFalseTotal
if $self->name eq $name 0 0 0
49 0 my $subsubsect = $self->subsubsection($name);
50 0 ▶ defined $subsubsect ? $subsubsect : ();
Branch: 1 branch
BranchTrueFalseTotal
defined $subsubsect ? : 0 0 0
51 }
52  
53 #--------------------
54  
55 0 ▶sub section() { $_[0]->container }
Subroutine section: not called CC=1 SCAR=6.9
Pod documented
56  
57  
58 0 ▶sub chapter() { $_[0]->section->chapter }
Subroutine chapter: not called CC=1 SCAR=6.9
Pod documented
59  
60 sub path()
61 0 ▶{ my $self = shift;
Subroutine path: not called CC=1 SCAR=6.9
Pod documented
62 0 $self->section->path . '/' . $self->name;
63 }
64  
65 #--------------------
66  
67 sub subsubsection($)
68 0 ▶{ my ($self, $thing) = @_;
Subroutine subsubsection: not called CC=2 SCAR=17.9
Pod documented
69  
70 0 ▶ if(ref $thing)
Branch: 1 branch
BranchTrueFalseTotal
if (ref $thing) 0 0 0
71 0 { push @{$self->{OTS_subsubsections}}, $thing;
72 0 return $thing;
73 }
74  
75 0 ▶ first { $_->name eq $thing } $self->subsubsections;
Subroutine __ANON__: not called CC=1 SCAR=6.9
76 }
77  
78  
79 sub subsubsections(;@)
80 0 ▶{ my $self = shift;
Subroutine subsubsections: not called CC=3 SCAR=24.8
Pod documented
81 0 ▶ if(@_)
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
82 0 { $self->{OTS_subsubsections} = [ @_ ];
83 0 $_->container($self) for @_;
84 }
85  
86 0 @{$self->{OTS_subsubsections}};
87 }
88  
89 1 *nest = \*subsubsections;
90  
91 1 1;
« lib/OODoc/Text/Section.pm ↑ Summary lib/OODoc/Parser.pm »