Example #1
0
 /**
  * Get streams of a game.
  *
  * @return Service
  */
 public static function game()
 {
     // Allow for unlimited arguments or an array.
     $games = self::convertArgs(func_get_args());
     $gameObjects = [];
     foreach ($games as $game) {
         // Build an array of the stream objects.
         $gameObjects = array_merge($gameObjects, StreamDriver::byGame($game, static::$service));
     }
     // Store the streams in a new Service.
     $streams = new Service($gameObjects);
     // Sort by viewers.
     $streams->sort();
     return $streams;
 }
Example #2
0
<?php

error_reporting(-1);
ini_set('display_errors', 'On');
require_once "../vendor/autoload.php";
\Vinlock\StreamAPI\StreamDriver::setLimit(10);
$bladeandsoul_twitch = \Vinlock\StreamAPI\Services\Twitch::game("Blade and Soul");
$overwatch_twitch = \Vinlock\StreamAPI\Services\Twitch::game("Overwatch");
$merge = \Vinlock\StreamAPI\Services\Service::mergeMulti($bladeandsoul_twitch, $overwatch_twitch);
var_dump($merge);
die;
header('Content-Type: application/json');
echo $merge->getJSON();