Skip to content

Commit

Permalink
Expose environment in API via environment() function instead of pub…
Browse files Browse the repository at this point in the history
…lic readonly property
  • Loading branch information
pionl committed May 1, 2022
1 parent f3bb85a commit 3b8faa0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/AbstractApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,20 @@ abstract class AbstractApi implements HeadersContract
private readonly BuildHeaders $buildHeaders;

public function __construct(
public readonly AbstractEnvironment $environment,
private readonly AbstractEnvironment $environment,
private readonly ApiFactory $factory,
) {
$this->buildHeaders = $this->factory()
->container()
->make(BuildHeaders::class);
}

public function environment(): AbstractEnvironment
{
// Makes the environment testable
return $this->environment;
}

public function factory(): ApiFactory
{
// Makes the factory testable
Expand Down

0 comments on commit 3b8faa0

Please sign in to comment.