diff --git a/lib/Multiplayer/Multiplayer.php b/lib/Multiplayer/Multiplayer.php index a28cec0..e070bf8 100644 --- a/lib/Multiplayer/Multiplayer.php +++ b/lib/Multiplayer/Multiplayer.php @@ -6,6 +6,8 @@ */ namespace Multiplayer; +use Multiplayer\Param; + /** @@ -33,28 +35,17 @@ class Multiplayer { /** * A set of generic parameters. * - * ### Options - * - * - 'autoPlay' boolean Whether or not to start the video when it is loaded. - * - 'showInfos' boolean - * - 'showBranding' boolean - * - 'showRelated' boolean Whether or not to show related videos at the end. - * - 'backgroundColor' string Hex code of the player's background color. - * - 'foregroundColor' string Hex code of the player's foreground color. - * - 'highlightColor' string Hex code of the player's highlight color. - * - 'start' int The number of seconds at which the video must start. - * * @var array */ protected $_params = [ - 'autoPlay' => null, - 'showInfos' => null, - 'showBranding' => null, - 'showRelated' => null, - 'backgroundColor' => null, - 'foregroundColor' => null, - 'highlightColor' => null, - 'start' => null + Param::autoPlay => null, + Param::showInfos => null, + Param::showBranding => null, + Param::showRelated => null, + Param::backgroundColor => null, + Param::foregroundColor => null, + Param::highlightColor => null, + Param::start => null ]; @@ -77,19 +68,19 @@ class Multiplayer { 'id' => '#dailymotion\.com/(?:embed/)?video/(?[a-z0-9]+)#i', 'url' => '//www.dailymotion.com/embed/video/%s', 'map' => [ - 'autoPlay' => 'autoplay', - 'showInfos' => 'info', - 'showBranding' => 'logo', - 'showRelated' => 'related', - 'backgroundColor' => [ + Param::autoPlay => 'autoplay', + Param::showInfos => 'info', + Param::showBranding => 'logo', + Param::showRelated => 'related', + Param::backgroundColor => [ 'prefix' => '#', 'param' => 'background' ], - 'foregroundColor' => [ + Param::foregroundColor => [ 'prefix' => '#', 'param' => 'foreground' ], - 'highlightColor' => [ + Param::highlightColor => [ 'prefix' => '#', 'param' => 'highlight' ], @@ -99,18 +90,18 @@ class Multiplayer { 'id' => '#vimeo\.com/(?:video/)?(?[0-9]+)#i', 'url' => '//player.vimeo.com/video/%s', 'map' => [ - 'autoPlay' => 'autoplay', - 'showInfos' => ['byline', 'portrait'], - 'foregroundColor' => 'color' + Param::autoPlay => 'autoplay', + Param::showInfos => ['byline', 'portrait'], + Param::foregroundColor => 'color' ] ], 'youtube' => [ 'id' => '#(?:youtu\.be/|youtube.com/(?:v/|embed/|watch\?v=))(?[a-z0-9_-]+)#i', 'url' => '//www.youtube-nocookie.com/embed/%s', 'map' => [ - 'autoPlay' => 'autoplay', - 'showInfos' => 'showinfo', - 'showRelated' => 'rel' + Param::autoPlay => 'autoplay', + Param::showInfos => 'showinfo', + Param::showRelated => 'rel' ] ] ]; diff --git a/lib/Multiplayer/Param.php b/lib/Multiplayer/Param.php new file mode 100644 index 0000000..195b587 --- /dev/null +++ b/lib/Multiplayer/Param.php @@ -0,0 +1,86 @@ + + * @license FreeBSD License (http://opensource.org/licenses/BSD-2-Clause) + */ +namespace Multiplayer; + + + +/** + * A set of generic parameters. + */ +class Param { + + /** + * Whether or not to start the video when it is loaded. + * + * @var string + */ + const autoPlay = 'autoPlay'; + + + + /** + * + * + * @var string + */ + const showInfos = 'showInfos'; + + + + /** + * + * + * @var string + */ + const showBranding = 'showBranding'; + + + + /** + * Whether or not to show related videos at the end. + * + * @var string + */ + const showRelated = 'showRelated'; + + + + /** + * Hex code of the player's background color. + * + * @var string + */ + const backgroundColor = 'backgroundColor'; + + + + /** + * Hex code of the player's foreground color. + * + * @var string + */ + const foregroundColor = 'foregroundColor'; + + + + /** + * Hex code of the player's highlight color. + * + * @var string + */ + const highlightColor = 'highlightColor'; + + + + /** + * The number of seconds at which the video must start. + * + * @var string + */ + const start = 'start'; + +}