CycloneDX/Declarations/Evidence.pm

filter: Statementstmt 71.6% 43 / 60 Branchbran 0.0% 0 / 24 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 68.7% 11 / 16 Podpod 100% 1 / 1 totaltotal 54.4% 55 / 101 CC 13 SCAR 37.1
CC
13
Cov
51%
TO_JSON
110.0
__ANON__
6.0
__ANON__
6.0
CRAP 41.0
« CycloneDX/Declarations/Claim.pm ↑ Summary CycloneDX/Citation.pm »
1 package SBOM::CycloneDX::Declarations::Evidence;
2  
3 1 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use SBOM::CycloneDX::BomRef;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use SBOM::CycloneDX::Timestamp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use SBOM::CycloneDX::Declarations::Data;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use Types::Standard qw(Str InstanceOf HashRef);
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Types::TypeTiny qw(ArrayLike);
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 extends 'SBOM::CycloneDX::Base';
19  
20 has bom_ref => (
21 is => 'rw',
22 isa => InstanceOf ['SBOM::CycloneDX::BomRef'],
23 0 ▶ coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::BomRef->new($_[0]) }
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 0 0
24 1 );
25  
26 1 has property_name => (is => 'rw', isa => Str);
27 1 has description => (is => 'rw', isa => Str);
28  
29 has data => (
30 is => 'rw',
31 isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Declarations::Data']],
32 0 ▶ default => sub { SBOM::CycloneDX::Declarations::Data->new }
Subroutine __ANON__: not called CC=1 SCAR=6.9
33 1 );
34  
35 has created => (
36 is => 'rw',
37 isa => InstanceOf ['SBOM::CycloneDX::Timestamp'],
38 0 ▶ coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::Timestamp->new($_[0]) }
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 0 0
39 1 );
40  
41 has expires => (
42 is => 'rw',
43 isa => InstanceOf ['SBOM::CycloneDX::Timestamp'],
44 0 ▶ coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::Timestamp->new($_[0]) }
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 0 0
45 1 );
46  
47 1 has author => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::OrganizationalContact']);
48 1 has reviewer => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::OrganizationalContact']);
49 1 has signature => (is => 'rw', isa => HashRef);
50  
51 0 ▶sub TO_JSON {
Subroutine TO_JSON: not called CC=10 SCAR=47.0
Pod documented
52  
53 0 my $self = shift;
54  
55 0 my $json = {};
56  
57 0 ▶ $json->{'bom-ref'} = $self->bom_ref if $self->bom_ref;
Branch: 1 branch
BranchTrueFalseTotal
if $self->bom_ref 0 0 0
58 0 ▶ $json->{propertyName} = $self->property_name if $self->property_name;
Branch: 1 branch
BranchTrueFalseTotal
if $self->property_name 0 0 0
59 0 ▶ $json->{description} = $self->description if $self->description;
Branch: 1 branch
BranchTrueFalseTotal
if $self->description 0 0 0
60 0 ▶ $json->{data} = $self->data if @{$self->data};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->data;} 0 0 0
61 0 ▶ $json->{created} = $self->created if $self->created;
Branch: 1 branch
BranchTrueFalseTotal
if $self->created 0 0 0
62 0 ▶ $json->{expires} = $self->expires if $self->expires;
Branch: 1 branch
BranchTrueFalseTotal
if $self->expires 0 0 0
63 0 ▶ $json->{author} = $self->author if $self->author;
Branch: 1 branch
BranchTrueFalseTotal
if $self->author 0 0 0
64 0 ▶ $json->{reviewer} = $self->reviewer if $self->reviewer;
Branch: 1 branch
BranchTrueFalseTotal
if $self->reviewer 0 0 0
65 0 ▶ $json->{signature} = $self->signature if $self->signature;
Branch: 1 branch
BranchTrueFalseTotal
if $self->signature 0 0 0
66  
67 0 return $json;
68  
69 }
70  
71 1 1;
72  
73 =encoding utf-8
74  
75 =head1 NAME
76  
77 SBOM::CycloneDX::Declarations::Evidence - Evidence
78  
79 =head1 SYNOPSIS
80  
81 SBOM::CycloneDX::Declarations::Evidence->new();
82  
83  
84 =head1 DESCRIPTION
85  
86 L<SBOM::CycloneDX::Declarations::Evidence> provides the evidence object.
87  
88 =head2 METHODS
89  
90 L<SBOM::CycloneDX::Declarations::Evidence> inherits all methods from L<SBOM::CycloneDX::Base>
91 and implements the following new ones.
92  
93 =over
94  
95 =item SBOM::CycloneDX::Declarations::Evidence->new( %PARAMS )
96  
97 Properties:
98  
99 =over
100  
101 =item * C<author>, The author of the evidence.
102  
103 =item * C<bom_ref>, An identifier which can be used to reference the object
104 elsewhere in the BOM. Every C<bom_ref> must be unique within the BOM.
105  
106 =item * C<created>, The date and time (timestamp) when the evidence was
107 created.
108  
109 =item * C<data>, The output or analysis that supports claims.
110  
111 =item * C<description>, The written description of what this evidence is and
112 how it was created.
113  
114 =item * C<expires>, The date and time (timestamp) when the evidence is no
115 longer valid.
116  
117 =item * C<property_name>, The reference to the property name as defined in
118 the CycloneDX Property Taxonomy (L<https://github.com/CycloneDX/cyclonedx-property-taxonomy/>).
119  
120 =item * C<reviewer>, The reviewer of the evidence.
121  
122 =item * C<signature>, Enveloped signature in JSON Signature Format (JSF)
123 (L<https://cyberphone.github.io/doc/security/jsf.html>).
124  
125 =back
126  
127 =item $evidence->author
128  
129 =item $evidence->bom_ref
130  
131 =item $evidence->created
132  
133 =item $evidence->data
134  
135 =item $evidence->description
136  
137 =item $evidence->expires
138  
139 =item $evidence->property_name
140  
141 =item $evidence->reviewer
142  
143 =item $evidence->signature
144  
145 =back
146  
147  
148 =head1 SUPPORT
149  
150 =head2 Bugs / Feature Requests
151  
152 Please report any bugs or feature requests through the issue tracker
153 at L<https://github.com/giterlizzi/perl-SBOM-CycloneDX/issues>.
154 You will be notified automatically of any progress on your issue.
155  
156 =head2 Source Code
157  
158 This is open source software. The code repository is available for
159 public review and contribution under the terms of the license.
160  
161 L<https://github.com/giterlizzi/perl-SBOM-CycloneDX>
162  
163 git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
164  
165  
166 =head1 AUTHOR
167  
168 =over 4
169  
170 =item * Giuseppe Di Terlizzi <gdt@cpan.org>
171  
172 =back
173  
174  
175 =head1 LICENSE AND COPYRIGHT
176  
177 This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
178  
179 This is free software; you can redistribute it and/or modify it under
180 the same terms as the Perl 5 programming language system itself.
181  
182 =cut
« CycloneDX/Declarations/Claim.pm ↑ Summary CycloneDX/Citation.pm »