-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve #252: Integrate symfony/console and split out composer plugin…
… implementation Signed-off-by: Andreas Frömer <andreas.froemer@check24.de>
- Loading branch information
1 parent
c3c6d69
commit b4d1c1c
Showing
31 changed files
with
367 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ parameters: | |
level: max | ||
inferPrivatePropertyTypeFromConstructor: true | ||
paths: | ||
- bin/ | ||
- src/ | ||
- tests/ | ||
tmpDir: data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Icanhazstring\Composer\Unused\Composer; | ||
|
||
final class Config | ||
{ | ||
/** @var array<string, mixed> */ | ||
protected array $config = []; | ||
protected string $name; | ||
/** @var array<string, mixed> */ | ||
private array $require = []; | ||
/** @var array<string, mixed> */ | ||
private array $autoload = []; | ||
|
||
public function getName(): string | ||
{ | ||
return $this->name; | ||
} | ||
|
||
/** | ||
* @return array<string, mixed> | ||
*/ | ||
public function getRequire(): array | ||
{ | ||
return $this->require; | ||
} | ||
|
||
/** | ||
* @return array<string, mixed> | ||
*/ | ||
public function getAutoload(): array | ||
{ | ||
return $this->autoload; | ||
} | ||
|
||
public function get(string $property): string | ||
{ | ||
$value = $this->config[$property] ?? null; | ||
|
||
if ($property === 'vendor-dir') { | ||
$value = $value ?? 'vendor'; | ||
} | ||
|
||
return $value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Icanhazstring\Composer\Unused\Composer; | ||
|
||
use Symfony\Component\Serializer\Encoder\JsonEncoder; | ||
use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter; | ||
use Symfony\Component\Serializer\Normalizer\PropertyNormalizer; | ||
use Symfony\Component\Serializer\Serializer; | ||
use Symfony\Component\Serializer\SerializerInterface; | ||
|
||
final class ConfigFactory | ||
{ | ||
private SerializerInterface $serializer; | ||
|
||
public function __construct() | ||
{ | ||
$encoders = [new JsonEncoder()]; | ||
$normalizers = [new PropertyNormalizer(null, new CamelCaseToSnakeCaseNameConverter())]; | ||
|
||
$this->serializer = new Serializer($normalizers, $encoders); | ||
} | ||
|
||
public function fromComposerJson(string $jsonContent): Config | ||
{ | ||
return $this->serializer->deserialize($jsonContent, Config::class, 'json'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Icanhazstring\Composer\Unused\Composer; | ||
|
||
use ComposerUnused\Contracts\LinkInterface; | ||
|
||
final class Link implements LinkInterface | ||
{ | ||
private string $target; | ||
|
||
public function __construct(string $target) | ||
{ | ||
$this->target = $target; | ||
} | ||
|
||
public function getTarget(): string | ||
{ | ||
return $this->target; | ||
} | ||
} |
Oops, something went wrong.