SIOC/Post.pm

filter: Statementstmt 83.8% 26 / 31 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 55.5% 5 / 9 Podpod n/a totaltotal 77.5% 31 / 40 CC 1 SCAR 3.7
CC
1
Cov
84%
__ANON__
2.0
__ANON__
2.0
__ANON__
2.0
CRAP 1.4
« SIOC/Container.pm ↑ Summary SIOC/Space.pm »
1 ###########################################################
2 # SIOC::Post
3 # Post class for the SIOC ontology
4 ###########################################################
5 #
6 # $Id: Post.pm 10 2008-03-01 21:38:39Z geewiz $
7 #
8  
9 package SIOC::Post;
10  
11 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 3 ▶use version; our $VERSION = qv(1.0.0);
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 3 ▶use MooseX::AttributeHelpers;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 3 extends 'SIOC::Item';
20  
21 ### required attributes
22  
23 3 has 'content' => (
24 isa => 'Str',
25 is => 'rw',
26 required => 1,
27 );
28  
29 3 has 'encoded_content' => (
30 isa => 'Str',
31 is => 'rw',
32 required => 1,
33 );
34  
35 ### optional attributes
36  
37 has 'attachments' => (
38 metaclass => 'Collection::Hash',
39 isa => 'HashRef[Str]',
40 is => 'rw',
41 0 ▶ default => sub { {} },
Subroutine __ANON__: not called CC=1 SCAR=6.9
42 3 provides => {
43 'set' => 'set_attachment',
44 'get' => 'get_attachment',
45 },
46 );
47  
48 has 'related' => (
49 isa => 'ArrayRef[SIOC::Item]',
50 metaclass => 'Collection::Array',
51 is => 'rw',
52 0 ▶ default => sub { [] },
Subroutine __ANON__: not called CC=1 SCAR=6.9
53 3 provides => {
54 'push' => 'add_related',
55 },
56 );
57  
58 has 'siblings' => (
59 isa => 'ArrayRef[SIOC::Item]',
60 metaclass => 'Collection::Array',
61 is => 'rw',
62 0 ▶ default => sub { [] },
Subroutine __ANON__: not called CC=1 SCAR=6.9
63 3 provides => {
64 'push' => 'add_sibling',
65 },
66 );
67  
68 3 has 'note' => (
69 isa => 'Str',
70 is => 'rw',
71 );
72  
73 3 has 'reply_count' => (
74 isa => 'Num',
75 is => 'rw',
76 );
77  
78  
79 ### methods
80  
81 # add additional template variables
82 0 ▶after 'fill_template' => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
83 0 my ($self) = @_;
84
85 0 $self->set_template_vars({
86 content => $self->content,
87 encoded_content => $self->encoded_content
88 });
89 3 };
90  
91 3 1;
92  
93 __DATA__
« SIOC/Container.pm ↑ Summary SIOC/Space.pm »