Skip to content

Commit

Permalink
refactor: move non-public API into a sub-namespace called _internal
Browse files Browse the repository at this point in the history
…, so that its reliability is obvious.

Signed-off-by: Jan Kowalleck <[email protected]>
  • Loading branch information
jkowalleck committed Oct 27, 2023
1 parent e5bcce8 commit bdfdc99
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 26 deletions.
3 changes: 3 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.

## unreleased

* Misc
* Moved non-public API into a sub-namespace called `_internal`, so that its reliability is obvious.

## 4.2.0 - 2023-09-04

* Added
Expand Down
6 changes: 2 additions & 4 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
use Composer\Plugin\PluginInterface;

/**
* @internal
*
* @author jkowalleck
*
* @psalm-suppress UnusedClass
Expand Down Expand Up @@ -67,9 +65,9 @@ public function getCapabilities(): array
public function getCommands(): array
{
return [
new MakeBom\Command(
new _internal\MakeBom\Command(
'CycloneDX:make-sbom',
new MakeBom\Options(),
new _internal\MakeBom\Options(),
new Factory()
),
];
Expand Down
4 changes: 2 additions & 2 deletions src/MakeBom/Builder.php → src/_internal/MakeBom/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Copyright (c) OWASP Foundation. All Rights Reserved.
*/

namespace CycloneDX\Composer\MakeBom;
namespace CycloneDX\Composer\_internal\MakeBom;

use Composer\Composer;
use Composer\Package\CompletePackageInterface;
Expand All @@ -31,7 +31,7 @@
use Composer\Repository\InstalledRepositoryInterface;
use Composer\Repository\LockArrayRepository;
use Composer\Semver\Constraint\MatchAllConstraint;
use CycloneDX\Composer\Properties;
use CycloneDX\Composer\_internal\Properties;
use CycloneDX\Core\Enums;
use CycloneDX\Core\Factories\LicenseFactory;
use CycloneDX\Core\Models;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Copyright (c) OWASP Foundation. All Rights Reserved.
*/

namespace CycloneDX\Composer\MakeBom;
namespace CycloneDX\Composer\_internal\MakeBom;

use Composer\Command\BaseCommand;
use Composer\Factory as ComposerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Copyright (c) OWASP Foundation. All Rights Reserved.
*/

namespace CycloneDX\Composer\MakeBom\Errors;
namespace CycloneDX\Composer\_internal\MakeBom\Errors;

use DomainException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Copyright (c) OWASP Foundation. All Rights Reserved.
*/

namespace CycloneDX\Composer\MakeBom\Errors;
namespace CycloneDX\Composer\_internal\MakeBom\Errors;

use Exception;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Copyright (c) OWASP Foundation. All Rights Reserved.
*/

namespace CycloneDX\Composer\MakeBom\Errors;
namespace CycloneDX\Composer\_internal\MakeBom\Errors;

use Exception;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Copyright (c) OWASP Foundation. All Rights Reserved.
*/

namespace CycloneDX\Composer\MakeBom;
namespace CycloneDX\Composer\_internal\MakeBom;

use CycloneDX\Core\Spec\Format;
use CycloneDX\Core\Spec\Version;
Expand Down
2 changes: 1 addition & 1 deletion src/Properties.php → src/_internal/Properties.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Copyright (c) OWASP Foundation. All Rights Reserved.
*/

namespace CycloneDX\Composer;
namespace CycloneDX\Composer\_internal;

/**
* CDX properties' names and well-known values - specific to this very tool.
Expand Down
5 changes: 5 additions & 0 deletions src/_internal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# INTERNAL

All in here is to be treated non-public API.
All code in here might change without any notice during version upgrades.
No backwards compatibility is guaranteed.
4 changes: 2 additions & 2 deletions tests/Functional/PluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
use Composer\Plugin\Capability\CommandProvider;
use Composer\Plugin\Capable;
use Composer\Plugin\PluginInterface;
use CycloneDX\Composer\MakeBom\Command;
use CycloneDX\Composer\MakeBom\Options;
use CycloneDX\Composer\_internal\MakeBom\Command;
use CycloneDX\Composer\_internal\MakeBom\Options;
use CycloneDX\Composer\Plugin;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\CoversNothing;
Expand Down
6 changes: 3 additions & 3 deletions tests/Integration/CommandMakeSbomAsExpectedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@

namespace CycloneDX\Tests\Integration;

use CycloneDX\Composer\MakeBom\Builder;
use CycloneDX\Composer\MakeBom\Command;
use CycloneDX\Composer\MakeBom\Options;
use CycloneDX\Composer\_internal\MakeBom\Builder;
use CycloneDX\Composer\_internal\MakeBom\Command;
use CycloneDX\Composer\_internal\MakeBom\Options;
use CycloneDX\Composer\Plugin;
use Generator;
use PHPUnit\Framework\Attributes\CoversClass;
Expand Down
6 changes: 3 additions & 3 deletions tests/Integration/CommandMakeSbomFailsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@

namespace CycloneDX\Tests\Integration;

use CycloneDX\Composer\MakeBom\Builder;
use CycloneDX\Composer\MakeBom\Command;
use CycloneDX\Composer\MakeBom\Options;
use CycloneDX\Composer\_internal\MakeBom\Builder;
use CycloneDX\Composer\_internal\MakeBom\Command;
use CycloneDX\Composer\_internal\MakeBom\Options;
use CycloneDX\Composer\Plugin;
use Generator;
use PHPUnit\Framework\Attributes\CoversClass;
Expand Down
6 changes: 3 additions & 3 deletions tests/Integration/CommandMakeSbomTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@

namespace CycloneDX\Tests\Integration;

use CycloneDX\Composer\MakeBom\Builder;
use CycloneDX\Composer\MakeBom\Command;
use CycloneDX\Composer\MakeBom\Options;
use CycloneDX\Composer\_internal\MakeBom\Builder;
use CycloneDX\Composer\_internal\MakeBom\Command;
use CycloneDX\Composer\_internal\MakeBom\Options;
use CycloneDX\Composer\Plugin;
use Generator;
use PHPUnit\Framework\Attributes\CoversClass;
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/CommandTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
namespace CycloneDX\Tests\Integration;

use Composer\Console\Application;
use CycloneDX\Composer\MakeBom\Command;
use CycloneDX\Composer\_internal\MakeBom\Command;
use PHPUnit\Framework\TestCase;

abstract class CommandTestCase extends TestCase
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/MakeBom/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

use Composer\Factory as ComposerFactory;
use Composer\IO\NullIO;
use CycloneDX\Composer\MakeBom\Builder;
use CycloneDX\Composer\_internal\MakeBom\Builder;
use CycloneDX\Composer\Plugin;
use CycloneDX\Core\Enums;
use CycloneDX\Core\Models;
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/MakeBom/OptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

namespace CycloneDX\Tests\Unit\MakeBom;

use CycloneDX\Composer\MakeBom\Options;
use CycloneDX\Composer\_internal\MakeBom\Options;
use CycloneDX\Core\Spec\Format;
use CycloneDX\Core\Spec\Version;
use DomainException;
Expand Down

0 comments on commit bdfdc99

Please sign in to comment.