Skip to content
Merged
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
4 changes: 2 additions & 2 deletions src/Adapters/Archive/Detectors/Code.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Embed\Detectors\Code as Detector;
use Embed\EmbedCode;
use function Embed\html;
use function Embed\match;
use function Embed\matchPath;

class Code extends Detector
{
Expand All @@ -15,7 +15,7 @@ public function detect(): ?EmbedCode
$uri = $this->extractor->getUri();
$path = $uri->getPath();

if (!match('/details/*', $path)) {
if (!matchPath('/details/*', $path)) {
return null;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Adapters/CadenaSer/Detectors/Code.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Embed\Detectors\Code as Detector;
use Embed\EmbedCode;
use function Embed\html;
use function Embed\match;
use function Embed\matchPath;

class Code extends Detector
{
Expand All @@ -21,7 +21,7 @@ private function fallback(): ?EmbedCode
{
$uri = $this->extractor->getUri();

if (!match('/audio/*', $uri->getPath())) {
if (!matchPath('/audio/*', $uri->getPath())) {
return null;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Adapters/Flickr/Detectors/Code.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Embed\Detectors\Code as Detector;
use Embed\EmbedCode;
use function Embed\html;
use function Embed\match;
use function Embed\matchPath;

class Code extends Detector
{
Expand All @@ -21,7 +21,7 @@ private function fallback(): ?EmbedCode
{
$uri = $this->extractor->getUri();

if (!match('/photos/*', $uri->getPath())) {
if (!matchPath('/photos/*', $uri->getPath())) {
return null;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Adapters/Github/Detectors/Code.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Embed\Detectors\Code as Detector;
use Embed\EmbedCode;
use function Embed\html;
use function Embed\match;
use function Embed\matchPath;

class Code extends Detector
{
Expand All @@ -21,7 +21,7 @@ private function fallback(): ?EmbedCode
$uri = $this->extractor->getUri();
$path = $uri->getPath();

if (!match('/*/*/blob/*', $path)) {
if (!matchPath('/*/*/blob/*', $path)) {
return null;
}

Expand Down
6 changes: 3 additions & 3 deletions src/Adapters/ImageShack/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use function Embed\getDirectory;
use Embed\HttpApiTrait;
use function Embed\match;
use function Embed\matchPath;

class Api
{
Expand All @@ -15,10 +15,10 @@ protected function fetchData(): array
{
$uri = $this->extractor->getUri();

if (!match('/i/*', $uri->getPath())) {
if (!matchPath('/i/*', $uri->getPath())) {
$uri = $this->extractor->getRequest()->getUri();

if (!match('/i/*', $uri->getPath())) {
if (!matchPath('/i/*', $uri->getPath())) {
return [];
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Adapters/Pinterest/Detectors/Code.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Embed\Detectors\Code as Detector;
use Embed\EmbedCode;
use function Embed\html;
use function Embed\match;
use function Embed\matchPath;

class Code extends Detector
{
Expand All @@ -20,7 +20,7 @@ private function fallback(): ?EmbedCode
{
$uri = $this->extractor->getUri();

if (!match('/pin/*', $uri->getPath())) {
if (!matchPath('/pin/*', $uri->getPath())) {
return null;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Adapters/Sassmeister/Detectors/Code.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Embed\Detectors\Code as Detector;
use Embed\EmbedCode;
use function Embed\html;
use function Embed\match;
use function Embed\matchPath;

class Code extends Detector
{
Expand All @@ -20,7 +20,7 @@ private function fallback(): ?EmbedCode
{
$uri = $this->extractor->getUri();

if (!match('/gist/*', $uri->getPath())) {
if (!matchPath('/gist/*', $uri->getPath())) {
return null;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Adapters/Snipplr/Detectors/Code.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Embed\Detectors\Code as Detector;
use Embed\EmbedCode;
use function Embed\html;
use function Embed\match;
use function Embed\matchPath;

class Code extends Detector
{
Expand All @@ -20,7 +20,7 @@ private function fallback(): ?EmbedCode
{
$uri = $this->extractor->getUri();

if (!match('/view/*', $uri->getPath())) {
if (!matchPath('/view/*', $uri->getPath())) {
return null;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Adapters/Wikipedia/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use function Embed\getDirectory;
use Embed\HttpApiTrait;
use function Embed\match;
use function Embed\matchPath;

class Api
{
Expand All @@ -15,7 +15,7 @@ protected function fetchData(): array
{
$uri = $this->extractor->getUri();

if (!match('/wiki/*', $uri->getPath())) {
if (!matchPath('/wiki/*', $uri->getPath())) {
return [];
}

Expand Down
4 changes: 2 additions & 2 deletions src/Adapters/Youtube/Detectors/Feeds.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use Embed\Detectors\Feeds as Detector;
use function Embed\getDirectory;
use function Embed\match;
use function Embed\matchPath;
use Psr\Http\Message\UriInterface;

class Feeds extends Detector
Expand All @@ -23,7 +23,7 @@ private function fallback(): array
{
$uri = $this->extractor->getUri();

if (!match('/channel/*', $uri->getPath())) {
if (!matchPath('/channel/*', $uri->getPath())) {
return [];
}

Expand Down
2 changes: 1 addition & 1 deletion src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function cleanPath(string $path): string
return $path;
}

function match(string $pattern, string $subject): bool
function matchPath(string $pattern, string $subject): bool
{
$pattern = str_replace('\\*', '.*', preg_quote($pattern, '|'));

Expand Down