Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
11 / 11
100.00% covered (success)
100.00%
11 / 11
CRAP
100.00% covered (success)
100.00%
1 / 1
Support
100.00% covered (success)
100.00%
11 / 11
100.00% covered (success)
100.00%
11 / 11
11
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getEmail
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getIssues
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getForum
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getWiki
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getIrc
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getSource
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getDocs
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getRss
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getChat
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getSecurity
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5/**
6 * Fast Forward Development Tools for PHP projects.
7 *
8 * This file is part of fast-forward/dev-tools project.
9 *
10 * @author   Felipe SayĆ£o Lobato Abreu <github@mentordosnerds.com>
11 * @license  https://opensource.org/licenses/MIT MIT License
12 *
13 * @see      https://github.com/php-fast-forward/
14 * @see      https://github.com/php-fast-forward/dev-tools
15 * @see      https://github.com/php-fast-forward/dev-tools/issues
16 * @see      https://php-fast-forward.github.io/dev-tools/
17 * @see      https://datatracker.ietf.org/doc/html/rfc2119
18 */
19
20namespace FastForward\DevTools\Composer\Json\Schema;
21
22/**
23 * Represents the optional "support" section of a composer.json file.
24 *
25 * This value object provides structured access to support-related metadata such as
26 * support email, issue tracker, forum, wiki, IRC, source code, documentation,
27 * RSS feed, chat channel, and security disclosure policy.
28 *
29 * All properties of this class are immutable after instantiation. Consumers MAY
30 * safely treat instances of this class as readonly value objects. Since the
31 * "support" section is optional in composer.json, each field MAY contain an empty
32 * string when the corresponding value is not defined.
33 *
34 * Implementations SHALL preserve the exact values provided at construction time.
35 * URL-based properties SHOULD contain fully qualified URLs whenever available.
36 * The IRC property SHOULD follow the format "irc://server/channel" when provided.
37 */
38  class Support implements SupportInterface
39{
40    /**
41     * Constructs a new ComposerJsonSupport instance.
42     *
43     * Each argument represents an optional support entry from the composer.json
44     * "support" section. Callers MAY omit any argument, in which case the value
45     * SHALL default to an empty string.
46     *
47     * @param string $email The support email address. SHOULD be a valid email address.
48     * @param string $issues The URL to the issue tracker. SHOULD be a fully qualified URL.
49     * @param string $forum The URL to the support forum. SHOULD be a fully qualified URL.
50     * @param string $wiki The URL to the project wiki. SHOULD be a fully qualified URL.
51     * @param string $irc The IRC support channel. SHOULD follow the format "irc://server/channel".
52     * @param string $source The URL to browse or download the project source code.
53     *                       SHOULD be a fully qualified URL.
54     * @param string $docs The URL to the project documentation. SHOULD be a fully qualified URL.
55     * @param string $rss The URL to the RSS feed. SHOULD be a fully qualified URL.
56     * @param string $chat The URL to the chat channel. SHOULD be a fully qualified URL.
57     * @param string $security The URL to the vulnerability disclosure policy.
58     *                         SHOULD be a fully qualified URL.
59     */
60    public function __construct(
61        private string $email = '',
62        private string $issues = '',
63        private string $forum = '',
64        private string $wiki = '',
65        private string $irc = '',
66        private string $source = '',
67        private string $docs = '',
68        private string $rss = '',
69        private string $chat = '',
70        private string $security = '',
71    ) {}
72
73    /**
74     * Retrieves the support email address.
75     *
76     * This method MUST return the support email value exactly as stored by the instance.
77     *
78     * @return string the support email address
79     */
80    public function getEmail(): string
81    {
82        return $this->email;
83    }
84
85    /**
86     * Retrieves the issue tracker URL.
87     *
88     * This method MUST return the issue tracker value exactly as stored by the instance.
89     *
90     * @return string the issue tracker URL
91     */
92    public function getIssues(): string
93    {
94        return $this->issues;
95    }
96
97    /**
98     * Retrieves the forum URL.
99     *
100     * This method MUST return the forum value exactly as stored by the instance.
101     *
102     * @return string the forum URL
103     */
104    public function getForum(): string
105    {
106        return $this->forum;
107    }
108
109    /**
110     * Retrieves the wiki URL.
111     *
112     * This method MUST return the wiki value exactly as stored by the instance.
113     *
114     * @return string the wiki URL
115     */
116    public function getWiki(): string
117    {
118        return $this->wiki;
119    }
120
121    /**
122     * Retrieves the IRC support channel.
123     *
124     * This method MUST return the IRC value exactly as stored by the instance.
125     *
126     * @return string the IRC support channel
127     */
128    public function getIrc(): string
129    {
130        return $this->irc;
131    }
132
133    /**
134     * Retrieves the source code URL.
135     *
136     * This method MUST return the source URL value exactly as stored by the instance.
137     *
138     * @return string the source code URL
139     */
140    public function getSource(): string
141    {
142        return $this->source;
143    }
144
145    /**
146     * Retrieves the documentation URL.
147     *
148     * This method MUST return the documentation URL value exactly as stored by the instance.
149     *
150     * @return string the documentation URL
151     */
152    public function getDocs(): string
153    {
154        return $this->docs;
155    }
156
157    /**
158     * Retrieves the RSS feed URL.
159     *
160     * This method MUST return the RSS feed URL value exactly as stored by the instance.
161     *
162     * @return string the RSS feed URL
163     */
164    public function getRss(): string
165    {
166        return $this->rss;
167    }
168
169    /**
170     * Retrieves the chat channel URL.
171     *
172     * This method MUST return the chat channel URL value exactly as stored by the instance.
173     *
174     * @return string the chat channel URL
175     */
176    public function getChat(): string
177    {
178        return $this->chat;
179    }
180
181    /**
182     * Retrieves the vulnerability disclosure policy URL.
183     *
184     * This method MUST return the security policy URL value exactly as stored by the instance.
185     *
186     * @return string the vulnerability disclosure policy URL
187     */
188    public function getSecurity(): string
189    {
190        return $this->security;
191    }
192}