Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
'error_suppression' => true,
'ereg_to_preg' => true,
'dir_constant' => true,
'string_implicit_backslashes' => [
'single_quoted' => 'ignore',
],
])
->setFinder($finder)
->setCacheFile('.php-cs-fixer.cache') // forward compatibility with 3.x line
Expand Down
2 changes: 1 addition & 1 deletion src/Dockerfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class Dockerfile implements \IteratorAggregate, \Countable, FileInterface,
/** @var iterable|Dockerfile\LayerInterface[] */
private iterable $layers;

public function __construct(null|LayerInterface ...$layers)
public function __construct(?LayerInterface ...$layers)
{
$this->layers = $layers;
}
Expand Down
1 change: 1 addition & 0 deletions src/PHP/ComposerAuthenticationToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Kiboko\Component\Dockerfile\Dockerfile;

/** @deprecated */
final readonly class ComposerAuthenticationToken implements Dockerfile\LayerInterface, \Stringable
{
public function __construct(
Expand Down
24 changes: 24 additions & 0 deletions src/PHP/ComposerGithubOauthAuthentication.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace Kiboko\Component\Dockerfile\PHP;

use Kiboko\Component\Dockerfile\Dockerfile;

final readonly class ComposerGithubOauthAuthentication implements Dockerfile\LayerInterface, \Stringable
{
public function __construct(
private string $token,
private string $domain = 'github.com',
) {
}

public function __toString(): string
{
return (string) new Dockerfile\Run(sprintf(<<<'RUN'
set -ex \
&& composer config --auth github-oauth.%s %s
RUN, $this->domain, $this->token));
}
}
24 changes: 24 additions & 0 deletions src/PHP/ComposerGitlabOauthAuthentication.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace Kiboko\Component\Dockerfile\PHP;

use Kiboko\Component\Dockerfile\Dockerfile;

final readonly class ComposerGitlabOauthAuthentication implements Dockerfile\LayerInterface, \Stringable
{
public function __construct(
private string $token,
private string $domain = 'gitlab.com',
) {
}

public function __toString(): string
{
return (string) new Dockerfile\Run(sprintf(<<<'RUN'
set -ex \
&& composer config --auth gitlab-oauth.%s %s
RUN, $this->domain, $this->token));
}
}
24 changes: 24 additions & 0 deletions src/PHP/ComposerGitlabTokenAuthentication.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace Kiboko\Component\Dockerfile\PHP;

use Kiboko\Component\Dockerfile\Dockerfile;

final readonly class ComposerGitlabTokenAuthentication implements Dockerfile\LayerInterface, \Stringable
{
public function __construct(
private string $token,
private string $domain = 'gitlab.com',
) {
}

public function __toString(): string
{
return (string) new Dockerfile\Run(sprintf(<<<'RUN'
set -ex \
&& composer config --auth gitlab-token.%s %s
RUN, $this->domain, $this->token));
}
}
25 changes: 25 additions & 0 deletions src/PHP/ComposerHttpBasicAuthentication.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);

namespace Kiboko\Component\Dockerfile\PHP;

use Kiboko\Component\Dockerfile\Dockerfile;

final readonly class ComposerHttpBasicAuthentication implements Dockerfile\LayerInterface, \Stringable
{
public function __construct(
private string $domain,
private string $username,
private string $password,
) {
}

public function __toString(): string
{
return (string) new Dockerfile\Run(sprintf(<<<'RUN'
set -ex \
&& composer config --auth http-basic.%s %s %s
RUN, $this->domain, $this->username, $this->password));
}
}
24 changes: 24 additions & 0 deletions src/PHP/ComposerHttpBearerAuthentication.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace Kiboko\Component\Dockerfile\PHP;

use Kiboko\Component\Dockerfile\Dockerfile;

final readonly class ComposerHttpBearerAuthentication implements Dockerfile\LayerInterface, \Stringable
{
public function __construct(
private string $domain,
private string $token,
) {
}

public function __toString(): string
{
return (string) new Dockerfile\Run(sprintf(<<<'RUN'
set -ex \
&& composer config --auth bearer.%s %s
RUN, $this->domain, $this->token));
}
}