original_string: public function get_photo_url($photoid) {
  
          $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'core', 'flickrclient');
  
          $url = $cache->get('photourl_'.$photoid);
  
          if ($url === false) {
              $response = $this->call('photos.getSizes', ['photo_id' => $photoid]);
              // Sizes are returned from smallest to greatest.
              if (!empty($response->sizes->size) && is_array($response->sizes->size)) {
                  while ($bestsize = array_pop($response->sizes->size)) {
                      if (isset($bestsize->source)) {
                          $url = $bestsize->source;
                          break;
                      }
                  }
              }
          }
  
          if ($url === false) {
              throw new repository_exception('cannotdownload', 'repository');
  
          } else {
              $cache->set('photourl_'.$photoid, $url);
          }
  
          return $url;
      }
code: public function get_photo_url($photoid) {
  
          $cache = cache::make_from_params(cache_store::MODE_APPLICATION, 'core', 'flickrclient');
  
          $url = $cache->get('photourl_'.$photoid);
  
          if ($url === false) {
              $response = $this->call('photos.getSizes', ['photo_id' => $photoid]);
              // Sizes are returned from smallest to greatest.
              if (!empty($response->sizes->size) && is_array($response->sizes->size)) {
                  while ($bestsize = array_pop($response->sizes->size)) {
                      if (isset($bestsize->source)) {
                          $url = $bestsize->source;
                          break;
                      }
                  }
              }
          }
  
          if ($url === false) {
              throw new repository_exception('cannotdownload', 'repository');
  
          } else {
              $cache->set('photourl_'.$photoid, $url);
          }
  
          return $url;
      }
code_tokens: public function get_photo_url ( $ photoid ) { $ cache = cache :: make_from_params ( cache_store :: MODE_APPLICATION , 'core' , 'flickrclient' ) ; $ url = $ cache -> get ( 'photourl_' . $ photoid ) ; if ( $ url === false ) { $ response = $ this -> call ( 'photos.getSizes' , [ 'photo_id' => $ photoid ] ) ; // Sizes are returned from smallest to greatest. if ( ! empty ( $ response -> sizes -> size ) && is_array ( $ response -> sizes -> size ) ) { while ( $ bestsize = array_pop ( $ response -> sizes -> size ) ) { if ( isset ( $ bestsize -> source ) ) { $ url = $ bestsize -> source ; break ; } } } } if ( $ url === false ) { throw new repository_exception ( 'cannotdownload' , 'repository' ) ; } else { $ cache -> set ( 'photourl_' . $ photoid , $ url ) ; } return $ url ; }
docstring: Return the URL to fetch the given photo from.
  
  Flickr photos are distributed via farm servers staticflickr.com in
  various sizes (resolutions). The method tries to find the source URL of
  the photo in the highest possible resolution. Results are cached so that
  we do not need to query the Flickr API over and over again.
  
  @param string $photoid Flickr photo identifier
  @return string URL
docstring_tokens: Return the URL to fetch the given photo from .