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
36 changes: 36 additions & 0 deletions src/Adapters/Tidal/Detectors/Code.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
declare(strict_types = 1);

namespace Embed\Adapters\Tidal\Detectors;

use Embed\Detectors\Code as Detector;
use Embed\EmbedCode;
use function Embed\html;

class Code extends Detector

Check failure on line 10 in src/Adapters/Tidal/Detectors/Code.php

View workflow job for this annotation

GitHub Actions / PHPStan Static Analysis

Class Embed\Adapters\Tidal\Detectors\Code extends generic class Embed\Detectors\Code but does not specify its types: TExtractor
{
public function detect(): ?EmbedCode
{
return parent::detect()

Check failure on line 14 in src/Adapters/Tidal/Detectors/Code.php

View workflow job for this annotation

GitHub Actions / PHPStan Static Analysis

Short ternary operator is not allowed. Use null coalesce operator if applicable or consider using long ternary.
?: $this->fallback();
}

private function fallback(): ?EmbedCode
{
$uri = $this->extractor->getUri();

if (!preg_match('{^/playlist/(?P<uuid>[0-9a-fA-F\-]{36})$}', $uri->getPath(), $matches)) {

Check failure on line 22 in src/Adapters/Tidal/Detectors/Code.php

View workflow job for this annotation

GitHub Actions / PHPStan Static Analysis

Only booleans are allowed in a negated boolean, int|false given.
return NULL;
}

$html = html('iframe', [
'src' => 'https://embed.tidal.com/playlists/' . $matches['uuid'] . '?disableAnalytics=true',
'allow' => 'encrypted-media',
'allowfullscreen' => 'allowfullscreen',
'frameborder' => '0',
'style' => 'width:100%;height:352px',
]);

return new EmbedCode($html, null, 352);
}
}
14 changes: 14 additions & 0 deletions src/Adapters/Tidal/Detectors/ProviderName.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
declare(strict_types = 1);

namespace Embed\Adapters\Tidal\Detectors;

use Embed\Detectors\ProviderName as Detector;

class ProviderName extends Detector

Check failure on line 8 in src/Adapters/Tidal/Detectors/ProviderName.php

View workflow job for this annotation

GitHub Actions / PHPStan Static Analysis

Class Embed\Adapters\Tidal\Detectors\ProviderName extends generic class Embed\Detectors\ProviderName but does not specify its types: TExtractor
{
public function detect(): string
{
return 'TIDAL';
}
}
17 changes: 17 additions & 0 deletions src/Adapters/Tidal/Extractor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
declare(strict_types = 1);

namespace Embed\Adapters\Tidal;

use Embed\Extractor as Base;

class Extractor extends Base
{
public function createCustomDetectors(): array

Check failure on line 10 in src/Adapters/Tidal/Extractor.php

View workflow job for this annotation

GitHub Actions / PHPStan Static Analysis

Method Embed\Adapters\Tidal\Extractor::createCustomDetectors() return type with generic class Embed\Detectors\Detector does not specify its types: TExtractor
{
return [
'code' => new Detectors\Code($this),
'providerName' => new Detectors\ProviderName($this),
];
}
}
1 change: 1 addition & 0 deletions src/ExtractorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class ExtractorFactory
'bandcamp.com' => Adapters\Bandcamp\Extractor::class,
'twitter.com' => Adapters\Twitter\Extractor::class,
'x.com' => Adapters\Twitter\Extractor::class,
'tidal.com' => Adapters\Tidal\Extractor::class,
];
private array $customDetectors = [];
private array $settings;
Expand Down
Loading