mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-14 07:27:47 +00:00
feat(#129): add iCal response parser
This commit is contained in:
parent
838db288e7
commit
60f2a38169
12 changed files with 513 additions and 49 deletions
31
app/Services/Plugin/Parsers/ResponseParserRegistry.php
Normal file
31
app/Services/Plugin/Parsers/ResponseParserRegistry.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace App\Services\Plugin\Parsers;
|
||||
|
||||
class ResponseParserRegistry
|
||||
{
|
||||
/**
|
||||
* @var array<int, ResponseParser>
|
||||
*/
|
||||
private readonly array $parsers;
|
||||
|
||||
/**
|
||||
* @param array<int, ResponseParser> $parsers
|
||||
*/
|
||||
public function __construct(array $parsers = [])
|
||||
{
|
||||
$this->parsers = $parsers ?: [
|
||||
new XmlResponseParser(),
|
||||
new IcalResponseParser(),
|
||||
new JsonOrTextResponseParser(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, ResponseParser>
|
||||
*/
|
||||
public function getParsers(): array
|
||||
{
|
||||
return $this->parsers;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue