Skip to content

Commit

Permalink
adding concept of provider name
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethan Finlay authored and Ethan Finlay committed Dec 19, 2022
1 parent 45160fd commit 9229986
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Rule/VideoScan.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ public function check()
$captions = $this->getCaptionData($url, $provider);

if (self::NO_API_CREDITS === $captions) {
$this->setError('Out of Youtube API credits');
$this->setError("{$provider->getName()} videos cannot be scanned at this time. Please try again at a later time.");
continue;
}

if (self::FAILED_CONNECTION === $captions) {
$this->setError('Failed provider API connection.');
$this->setError("Failed {$provider->getName()} API connection.");
continue;
}

Expand Down
5 changes: 5 additions & 0 deletions src/Video/Kaltura.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Kaltura {
const KALTURA_FAILED_CONNECTION = -1;
const KALTURA_FAIL = 0;
const KALTURA_SUCCESS = 1;
const PROVIDER_NAME = 'Kaltura';

private $client;
private $language;
Expand Down Expand Up @@ -127,4 +128,8 @@ function getVideoData($link_url)
return !isset($result->objects) ? $result->objects : self::KALTURA_FAILED_CONNECTION;
}

public function getName() {
return self::PROVIDER_NAME;
}

}
5 changes: 5 additions & 0 deletions src/Video/Vimeo.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class Vimeo
const VIMEO_FAILED_CONNECTION = -1;
const VIMEO_FAIL = 0;
const VIMEO_SUCCESS = 1;
const PROVIDER_NAME = "Vimeo";

private $regex = '@vimeo\.com/[^0-9]*([0-9]{7,9})@i';
private $search_url = 'https://api.vimeo.com/videos/';
Expand Down Expand Up @@ -94,4 +95,8 @@ function getVideoData($link_url)

return isset($result->data) ? $result->data : self::VIMEO_FAILED_CONNECTION;
}

public function getName() {
return self::PROVIDER_NAME;
}
}
5 changes: 5 additions & 0 deletions src/Video/Youtube.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Youtube
const YOUTUBE_FAIL = 0;
const YOUTUBE_SUCCESS = 1;
const YOUTUBE_NO_CREDITS = -2;
const PROVIDER_NAME = 'Youtube';

private $regex = array(
'@youtube\.com/embed/([^"\&\? ]+)@i',
Expand Down Expand Up @@ -146,4 +147,8 @@ function getVideoData($link_url)

return isset($result->items) ? $result->items : self::YOUTUBE_FAILED_REQUEST;
}

public function getName() {
return self::PROVIDER_NAME;
}
}

0 comments on commit 9229986

Please sign in to comment.