Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
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
2 changes: 1 addition & 1 deletion src/PHP/ComposerAutoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private static function escapeArgument(?string $argument): string
if (!preg_match('/[\/()%!^"<>&|\s]/', $argument)) {
return $argument;
}
$argument = preg_replace('/(\\\\+)$/', '$1$1', $argument);
$argument = preg_replace('/(\\\+)$/', '$1$1', $argument);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ce changement est volontaire ou c'est CS-fixer qui l'a provoqué ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C'est CS-Fixer qui l'a changé


return '"'.str_replace(['"', '^', '%', '!', "\n"], ['""', '"^^"', '"^%"', '"^!"', '!LF!'], $argument).'"';
}
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));
}
}