Skip to content

Commit 928e479

Browse files
committed
removed getters and made readonly public
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
1 parent 2d51103 commit 928e479

File tree

6 files changed

+8
-48
lines changed

6 files changed

+8
-48
lines changed

src/Core/Factories/LicenseFactory.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,11 @@
3333
class LicenseFactory
3434
{
3535
public function __construct(
36-
private readonly LicenseIdentifiers $licenseIdentifiers = new LicenseIdentifiers(),
37-
private readonly SpdxLicenses $spdxLicenses = new SpdxLicenses()
36+
public readonly LicenseIdentifiers $licenseIdentifiers = new LicenseIdentifiers(),
37+
public readonly SpdxLicenses $spdxLicenses = new SpdxLicenses()
3838
) {
3939
}
4040

41-
public function getLicenseIdentifiers(): LicenseIdentifiers
42-
{
43-
return $this->licenseIdentifiers;
44-
}
45-
46-
public function getSpdxLicenses(): SpdxLicenses
47-
{
48-
return $this->spdxLicenses;
49-
}
50-
5141
public function makeFromString(string $license): SpdxLicense|LicenseExpression|NamedLicense
5242
{
5343
try {

src/Core/Serialization/DOM/NormalizerFactory.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ class NormalizerFactory
3838
{
3939
public const FORMAT = Format::XML;
4040

41-
private readonly Spec $spec;
41+
public readonly Spec $spec;
4242

43-
private readonly DOMDocument $document;
43+
public readonly DOMDocument $document;
4444

4545
/**
4646
* @throws DomainException when the spec does not support XML format
@@ -55,16 +55,6 @@ public function __construct(Spec $spec)
5555

5656
// intention: all factory methods return an instance of "_BaseNormalizer"
5757

58-
public function getSpec(): Spec
59-
{
60-
return $this->spec;
61-
}
62-
63-
public function getDocument(): DOMDocument
64-
{
65-
return $this->document;
66-
}
67-
6858
public function makeForBom(): Normalizers\BomNormalizer
6959
{
7060
return new Normalizers\BomNormalizer($this);

src/Core/Serialization/DOM/_BaseNormalizer.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,12 @@
3333
*/
3434
abstract class _BaseNormalizer
3535
{
36-
private readonly NormalizerFactory $normalizerFactory;
36+
public readonly NormalizerFactory $normalizerFactory;
3737

3838
public function __construct(NormalizerFactory $normalizerFactory)
3939
{
4040
$this->normalizerFactory = $normalizerFactory;
4141
}
4242

43-
public function getNormalizerFactory(): NormalizerFactory
44-
{
45-
return $this->normalizerFactory;
46-
}
47-
4843
// intention to implement a "public function normalize" that accepts an object, and returns a normalized object
4944
}

src/Core/Serialization/JSON/NormalizerFactory.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class NormalizerFactory
3737
{
3838
public const FORMAT = Format::JSON;
3939

40-
private readonly Spec $spec;
40+
public readonly Spec $spec;
4141

4242
/**
4343
* @throws DomainException when the spec does not support JSON format
@@ -49,11 +49,6 @@ public function __construct(Spec $spec)
4949
: throw new DomainException('Unsupported format "'.self::FORMAT->name.'" for spec '.$spec->getVersion()->name);
5050
}
5151

52-
public function getSpec(): Spec
53-
{
54-
return $this->spec;
55-
}
56-
5752
// intention: all factory methods return an instance of "_BaseNormalizer"
5853

5954
public function makeForBom(): Normalizers\BomNormalizer

src/Core/Serialization/JSON/_BaseNormalizer.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,12 @@
3333
*/
3434
abstract class _BaseNormalizer
3535
{
36-
private readonly NormalizerFactory $normalizerFactory;
36+
public readonly NormalizerFactory $normalizerFactory;
3737

3838
public function __construct(NormalizerFactory $normalizerFactory)
3939
{
4040
$this->normalizerFactory = $normalizerFactory;
4141
}
4242

43-
public function getNormalizerFactory(): NormalizerFactory
44-
{
45-
return $this->normalizerFactory;
46-
}
47-
4843
// intention to implement a "public function normalize" that accepts an object, and returns a normalized object
4944
}

src/Core/Validation/BaseValidator.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,13 @@
3030
*/
3131
abstract class BaseValidator implements Validator
3232
{
33-
private readonly Spec $spec;
33+
public readonly Spec $spec;
3434

3535
public function __construct(Spec $spec)
3636
{
3737
$this->spec = $spec;
3838
}
3939

40-
public function getSpec(): Spec
41-
{
42-
return $this->spec;
43-
}
44-
4540
/**
4641
* @throws Exceptions\FailedLoadingSchemaException when schema file unknown or not readable
4742
*/

0 commit comments

Comments
 (0)