original_string: public function getStreams($channelId = null)
      {
          if (!$channelId) {
              $channelId = $this->channelId;
          }
  
          if (!$channelId) {
              throw new MissingChannelIdException("You must specify the channel id");
          }
  
          if ($this->cache) {
              $data = $this->cache->fetch($this->getCacheKey($channelId));
              if ($data !== false) {
                  return $data;
              }
          }
  
          $searchResponse = $this->client->get(
              'search',
              [
                  'query' => [
                      'part' => 'id',
                      'channelId' => $channelId,
                      'eventType' => 'live',
                      'type' => 'video',
                      'maxResults' => 50
                  ]
              ]
          );
  
          $searchData = json_decode($searchResponse->getBody()->getContents(), true);
  
          $videosResponse = $this->client->get(
              'videos',
              [
                  'query' => [
                      'part' => 'id,snippet,liveStreamingDetails',
                      'id' => implode(
                          ',',
                          array_map(
                              function ($video) {
                                  return $video['id']['videoId'];
                              },
                              $searchData['items']
                          )
                      )
                  ]
              ]
          );
  
          $videosData = json_decode($videosResponse->getBody()->getContents(), true);
  
          $streams = array_map(
              function ($video) {
                  return [
                      'name' => $video['snippet']['title'],
                      'thumb' => $video['snippet']['thumbnails']['high']['url'],
                      'videoId' => $video['id']
                  ];
              },
              array_values(
                  array_filter(
                      $videosData['items'],
                      function ($video) {
                          return !isset($video['liveStreamingDetails']['actualEndTime']);
                      }
                  )
              )
          );
  
          if ($this->cache && $this->cacheTimeout > 0) {
              $this->cache->save($this->getCacheKey($channelId), $streams, $this->cacheTimeout);
          }
  
          return $streams;
      }
code: public function getStreams($channelId = null)
      {
          if (!$channelId) {
              $channelId = $this->channelId;
          }
  
          if (!$channelId) {
              throw new MissingChannelIdException("You must specify the channel id");
          }
  
          if ($this->cache) {
              $data = $this->cache->fetch($this->getCacheKey($channelId));
              if ($data !== false) {
                  return $data;
              }
          }
  
          $searchResponse = $this->client->get(
              'search',
              [
                  'query' => [
                      'part' => 'id',
                      'channelId' => $channelId,
                      'eventType' => 'live',
                      'type' => 'video',
                      'maxResults' => 50
                  ]
              ]
          );
  
          $searchData = json_decode($searchResponse->getBody()->getContents(), true);
  
          $videosResponse = $this->client->get(
              'videos',
              [
                  'query' => [
                      'part' => 'id,snippet,liveStreamingDetails',
                      'id' => implode(
                          ',',
                          array_map(
                              function ($video) {
                                  return $video['id']['videoId'];
                              },
                              $searchData['items']
                          )
                      )
                  ]
              ]
          );
  
          $videosData = json_decode($videosResponse->getBody()->getContents(), true);
  
          $streams = array_map(
              function ($video) {
                  return [
                      'name' => $video['snippet']['title'],
                      'thumb' => $video['snippet']['thumbnails']['high']['url'],
                      'videoId' => $video['id']
                  ];
              },
              array_values(
                  array_filter(
                      $videosData['items'],
                      function ($video) {
                          return !isset($video['liveStreamingDetails']['actualEndTime']);
                      }
                  )
              )
          );
  
          if ($this->cache && $this->cacheTimeout > 0) {
              $this->cache->save($this->getCacheKey($channelId), $streams, $this->cacheTimeout);
          }
  
          return $streams;
      }
code_tokens: public function getStreams ( $ channelId = null ) { if ( ! $ channelId ) { $ channelId = $ this -> channelId ; } if ( ! $ channelId ) { throw new MissingChannelIdException ( "You must specify the channel id" ) ; } if ( $ this -> cache ) { $ data = $ this -> cache -> fetch ( $ this -> getCacheKey ( $ channelId ) ) ; if ( $ data !== false ) { return $ data ; } } $ searchResponse = $ this -> client -> get ( 'search' , [ 'query' => [ 'part' => 'id' , 'channelId' => $ channelId , 'eventType' => 'live' , 'type' => 'video' , 'maxResults' => 50 ] ] ) ; $ searchData = json_decode ( $ searchResponse -> getBody ( ) -> getContents ( ) , true ) ; $ videosResponse = $ this -> client -> get ( 'videos' , [ 'query' => [ 'part' => 'id,snippet,liveStreamingDetails' , 'id' => implode ( ',' , array_map ( function ( $ video ) { return $ video [ 'id' ] [ 'videoId' ] ; } , $ searchData [ 'items' ] ) ) ] ] ) ; $ videosData = json_decode ( $ videosResponse -> getBody ( ) -> getContents ( ) , true ) ; $ streams = array_map ( function ( $ video ) { return [ 'name' => $ video [ 'snippet' ] [ 'title' ] , 'thumb' => $ video [ 'snippet' ] [ 'thumbnails' ] [ 'high' ] [ 'url' ] , 'videoId' => $ video [ 'id' ] ] ; } , array_values ( array_filter ( $ videosData [ 'items' ] , function ( $ video ) { return ! isset ( $ video [ 'liveStreamingDetails' ] [ 'actualEndTime' ] ) ; } ) ) ) ; if ( $ this -> cache && $ this -> cacheTimeout > 0 ) { $ this -> cache -> save ( $ this -> getCacheKey ( $ channelId ) , $ streams , $ this -> cacheTimeout ) ; } return $ streams ; }
docstring: Get the list of videos from YouTube
  
  @param string $channelId
  @throws \Mcfedr\YouTube\LiveStreamsBundle\Exception\MissingChannelIdException
  @return array
docstring_tokens: Get the list of videos from YouTube