Skip to content

Commit

Permalink
removed getters and made readonly public
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Kowalleck <[email protected]>
  • Loading branch information
jkowalleck committed Mar 10, 2023
1 parent 60ccbbe commit 5f33dbc
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 48 deletions.
14 changes: 2 additions & 12 deletions src/Core/Factories/LicenseFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,11 @@
class LicenseFactory
{
public function __construct(
private readonly LicenseIdentifiers $licenseIdentifiers = new LicenseIdentifiers(),
private readonly SpdxLicenses $spdxLicenses = new SpdxLicenses()
public readonly LicenseIdentifiers $licenseIdentifiers = new LicenseIdentifiers(),
public readonly SpdxLicenses $spdxLicenses = new SpdxLicenses()
) {
}

public function getLicenseIdentifiers(): LicenseIdentifiers
{
return $this->licenseIdentifiers;
}

public function getSpdxLicenses(): SpdxLicenses
{
return $this->spdxLicenses;
}

public function makeFromString(string $license): SpdxLicense|LicenseExpression|NamedLicense
{
try {
Expand Down
14 changes: 2 additions & 12 deletions src/Core/Serialization/DOM/NormalizerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ class NormalizerFactory
{
public const FORMAT = Format::XML;

private readonly Spec $spec;
public readonly Spec $spec;

private readonly DOMDocument $document;
public readonly DOMDocument $document;

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

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

public function getSpec(): Spec
{
return $this->spec;
}

public function getDocument(): DOMDocument
{
return $this->document;
}

public function makeForBom(): Normalizers\BomNormalizer
{
return new Normalizers\BomNormalizer($this);
Expand Down
7 changes: 1 addition & 6 deletions src/Core/Serialization/DOM/_BaseNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,12 @@
*/
abstract class _BaseNormalizer
{
private readonly NormalizerFactory $normalizerFactory;
public readonly NormalizerFactory $normalizerFactory;

public function __construct(NormalizerFactory $normalizerFactory)
{
$this->normalizerFactory = $normalizerFactory;
}

public function getNormalizerFactory(): NormalizerFactory
{
return $this->normalizerFactory;
}

// intention to implement a "public function normalize" that accepts an object, and returns a normalized object
}
7 changes: 1 addition & 6 deletions src/Core/Serialization/JSON/NormalizerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class NormalizerFactory
{
public const FORMAT = Format::JSON;

private readonly Spec $spec;
public readonly Spec $spec;

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

public function getSpec(): Spec
{
return $this->spec;
}

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

public function makeForBom(): Normalizers\BomNormalizer
Expand Down
7 changes: 1 addition & 6 deletions src/Core/Serialization/JSON/_BaseNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,12 @@
*/
abstract class _BaseNormalizer
{
private readonly NormalizerFactory $normalizerFactory;
public readonly NormalizerFactory $normalizerFactory;

public function __construct(NormalizerFactory $normalizerFactory)
{
$this->normalizerFactory = $normalizerFactory;
}

public function getNormalizerFactory(): NormalizerFactory
{
return $this->normalizerFactory;
}

// intention to implement a "public function normalize" that accepts an object, and returns a normalized object
}
7 changes: 1 addition & 6 deletions src/Core/Validation/BaseValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,13 @@
*/
abstract class BaseValidator implements Validator
{
private readonly Spec $spec;
public readonly Spec $spec;

public function __construct(Spec $spec)
{
$this->spec = $spec;
}

public function getSpec(): Spec
{
return $this->spec;
}

/**
* @throws Exceptions\FailedLoadingSchemaException when schema file unknown or not readable
*/
Expand Down

0 comments on commit 5f33dbc

Please sign in to comment.