lib/PurpleWiki/StructuralNode.pm

filter: Statementstmt 92.3% 36 / 39 Branchbran 66.6% 8 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.0% 9 / 10 Podpod 57.1% 4 / 7 totaltotal 83.8% 57 / 68 CC 7 SCAR 9.7
CC
7
Cov
86%
id
6.0
new
4.0
content
2.0
CRAP 2.6
« lib/PurpleWiki/Syndication/Rss.pm ↑ Summary lib/PurpleWiki/Apache1Handler.pm »
1 # PurpleWiki::StructuralNode.pm
2 #
3 # $Id: StructuralNode.pm 352 2004-05-08 22:00:33Z cdent $
4 #
5 # Copyright (c) Blue Oxen Associates 2002-2003. All rights reserved.
6 #
7 # This file is part of PurpleWiki. PurpleWiki is derived from:
8 #
9 # UseModWiki v0.92 (c) Clifford A. Adams 2000-2001
10 # AtisWiki v0.3 (c) Markus Denker 1998
11 # CVWiki CVS-patches (c) Peter Merel 1997
12 # The Original WikiWikiWeb (c) Ward Cunningham
13 #
14 # PurpleWiki is free software; you can redistribute it and/or modify
15 # it under the terms of the GNU General Public License as published by
16 # the Free Software Foundation; either version 2 of the License, or
17 # (at your option) any later version.
18 #
19 # This program is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
23 #
24 # You should have received a copy of the GNU General Public License
25 # along with this program; if not, write to the
26 # Free Software Foundation, Inc.
27 # 59 Temple Place, Suite 330
28 # Boston, MA 02111-1307 USA
29  
30 package PurpleWiki::StructuralNode;
31  
32 18 ▶use 5.005;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 18 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 18 ▶use PurpleWiki::InlineNode;
Subroutine BEGIN: called CC=1 SCAR=0.0
35  
36 18 our $VERSION;
37 18 $VERSION = sprintf("%d", q$Id: StructuralNode.pm 352 2004-05-08 22:00:33Z cdent $ =~ /\s(\d+)\s/);
38  
39 ### constructor
40  
41 8 ▶sub new {
Subroutine new: called CC=4 SCAR=13.9
Pod documented
42 8 my $this = shift;
43 8 my (%options) = @_;
44 8 my $self = {};
45  
46 # TODO: Type checking.
47 8 ▶ $self->{type} = $options{type} ? $options{type} : undef;
Branch: 1 branch
BranchTrueFalseTotal
$options{'type'} ? : 7 1 8
48 8 ▶ $self->{id} = $options{id} ? $options{id} : undef;
Branch: 1 branch
BranchTrueFalseTotal
$options{'id'} ? : 0 8 8
49 8 ▶ $self->{content} = $options{content} ? $options{content} : undef;
Branch: 1 branch
BranchTrueFalseTotal
$options{'content'} ? : 3 5 8
50 8 bless $self, $this;
51 8 return $self;
52 }
53  
54 ### methods
55  
56 3 ▶sub insertChild {
Subroutine insertChild: called CC=1 SCAR=0.0
Pod documented
57 3 my $this = shift;
58 3 my (%options) = @_;
59  
60 3 my $newNode = PurpleWiki::StructuralNode->new(%options);
61 3 $newNode->{parent} = $this;
62 3 push(@{$this->{children}}, $newNode);
63 3 return $newNode;
64 }
65  
66 2 ▶sub parent {
Subroutine parent: called CC=1 SCAR=0.0
Pod documented
67 2 my $this = shift;
68 2 return $this->{parent};
69 }
70  
71 10 ▶sub children {
Subroutine children: called CC=1 SCAR=0.0
Pod documented
72 10 my $this = shift;
73  
74 10 return $this->{children};
75 }
76  
77 ### accessors/mutators
78  
79 8 ▶sub type {
Subroutine type: called CC=2 SCAR=6.9
Pod undocumented
80 8 my $this = shift;
81  
82 8 ▶ $this->{type} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 2 6 8
83 8 return $this->{type};
84 }
85  
86 0 ▶sub id {
Subroutine id: not called CC=2 SCAR=17.9
Pod undocumented
87 0 my $this = shift;
88  
89 0 ▶ $this->{id} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
90 0 return $this->{id};
91 }
92  
93 9 ▶sub content {
Subroutine content: called CC=2 SCAR=7.1
Pod undocumented
94 9 my $this = shift;
95  
96 9 ▶ $this->{content} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 9 9
97 9 return $this->{content};
98 }
99  
100 18 1;
101 __END__
« lib/PurpleWiki/Syndication/Rss.pm ↑ Summary lib/PurpleWiki/Apache1Handler.pm »