-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement basic git linker for developer installations
- Loading branch information
Showing
6 changed files
with
123 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
declare(strict_types=1); | ||
namespace Horde\Components\Composer; | ||
|
||
use stdClass; | ||
use Stringable; | ||
|
||
class PathRepositoryDefinition implements RepositoryDefinition | ||
{ | ||
public readonly string $path; | ||
|
||
public function __construct(string|Stringable $path, public readonly stdClass $repositoryOptions = new stdClass) | ||
{ | ||
// Cast to string once rather than everywhere. | ||
$this->path = (string) $path; | ||
} | ||
|
||
public function getType(): string | ||
{ | ||
return 'path'; | ||
} | ||
|
||
public function getUrl(): string | ||
{ | ||
return $this->path; | ||
} | ||
|
||
public function dumpStdClass() | ||
{ | ||
return (object) [ | ||
'type' => 'path', | ||
'options' => $this->repositoryOptions, | ||
'url' => $this->path | ||
]; | ||
} | ||
} |
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,16 @@ | ||
<?php | ||
namespace Horde\Components\Composer; | ||
|
||
use stdClass; | ||
/** | ||
* Create RepositoryDefinition implementations from stdClasses | ||
*/ | ||
class RepositoryDefinitionFactory | ||
{ | ||
public static function create(stdClass $input): RepositoryDefinition | ||
{ | ||
if ($input->type == 'path') { | ||
return new PathRepositoryDefinition($input->path, $input->options ?? new stdClass); | ||
} | ||
} | ||
} |
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