Open/Document.pm

filter: Statementstmt 100% 49 / 49 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod n/a totaltotal 100% 65 / 65 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Open/DayGuide.pm ↑ Summary Open/Exceptions.pm »
1 # -*- cperl; cperl-indent-level: 4 -*-
2 # Copyright (C) 2011-2021, Roland van Ipenburg
3 package WWW::NOS::Open::Document v1.0.5;
4 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use 5.014000;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 4 ▶use Moose qw/has/;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use Moose::Util::TypeConstraints qw/enum/;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 4 ▶use namespace::autoclean '-also' => qr/^__/sxm;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 4 ▶use WWW::NOS::Open::TypeDef qw(NOSDateTime NOSURI);
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 4 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 4 Readonly::Scalar my $UNDER => q{_};
18 4 Readonly::Scalar my $GETTER => q{get};
19 4 Readonly::Array my @CATEGORIES => qw(Nieuws Sport);
20 4 Readonly::Array my @RESOURCE_TYPES => qw(artikel article video audio);
21  
22 4 has '_id' => (
23 'is' => 'ro',
24 'isa' => 'Str',
25 'reader' => 'get_id',
26 'init_arg' => 'id',
27 );
28  
29 4 has '_score' => (
30 'is' => 'ro',
31 'isa' => 'Num',
32 'reader' => 'get_score',
33 'init_arg' => 'score',
34 );
35  
36 4 has '_type' => (
37 'is' => 'ro',
38 'isa' => enum( [@RESOURCE_TYPES] ),
39 'reader' => $GETTER . $UNDER . 'type',
40 'init_arg' => 'type',
41 );
42  
43 4 my @strings = qw(title description subcategory);
44 4 ▶while ( my $string = shift @strings ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $string = shift @strings) 12 4 16
45 12 has $UNDER
46 . $string => (
47 'is' => 'ro',
48 'isa' => 'Str',
49 'reader' => $GETTER . $UNDER . $string,
50 'init_arg' => $string,
51 );
52 }
53  
54 4 my @dates = qw(published last_update);
55 4 ▶while ( my $date = shift @dates ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $date = shift @dates) 8 4 12
56 8 has $UNDER
57 . $date => (
58 'is' => 'ro',
59 'isa' => NOSDateTime,
60 'coerce' => 1,
61 'reader' => $GETTER . $UNDER . $date,
62 'init_arg' => $date,
63 );
64 }
65  
66 4 my @uris = qw(thumbnail link);
67 4 ▶while ( my $uri = shift @uris ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $uri = shift @uris) 8 4 12
68 8 has $UNDER
69 . $uri => (
70 'is' => 'ro',
71 'isa' => NOSURI,
72 'coerce' => 1,
73 'reader' => $GETTER . $UNDER . $uri,
74 'init_arg' => $uri,
75 );
76 }
77  
78 4 has '_category' => (
79 'is' => 'ro',
80 'isa' => enum( [@CATEGORIES] ),
81 'reader' => 'get_category',
82 'init_arg' => 'category',
83 );
84  
85 4 has '_keywords' => (
86 'is' => 'ro',
87 'isa' => 'ArrayRef[Str]',
88 'reader' => 'get_keywords',
89 'init_arg' => 'keywords',
90 );
91  
92 4 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
93  
94 4 __PACKAGE__->meta->make_immutable;
95  
96 4 1;
97  
98 __END__
« Open/DayGuide.pm ↑ Summary Open/Exceptions.pm »