/**
  * Get appendix for an URL based on it's Source caching settings.
  *
  * @param BaseAssetSourceType $source
  * @param AssetFileModel      $file
  *
  * @return string
  */
 public static function getUrlAppendix(BaseAssetSourceType $source, AssetFileModel $file)
 {
     $appendix = '';
     if (!empty($source->getSettings()->expires) && DateTimeHelper::isValidIntervalString($source->getSettings()->expires)) {
         $appendix = '?mtime=' . $file->dateModified->format("YmdHis");
     }
     return $appendix;
 }
 /**
  * Put an object into an S3 bucket.
  *
  * @param $filePath
  * @param $bucket
  * @param $uriPath
  * @param $permissions
  *
  * @return bool
  */
 protected function putObject($filePath, $bucket, $uriPath, $permissions)
 {
     $object = empty($filePath) ? '' : array('file' => $filePath);
     $headers = array();
     if (!empty($object) && !empty($this->getSettings()->expires) && DateTimeHelper::isValidIntervalString($this->getSettings()->expires)) {
         $expires = new DateTime();
         $now = new DateTime();
         $expires->modify('+' . $this->getSettings()->expires);
         $diff = $expires->format('U') - $now->format('U');
         $headers['Cache-Control'] = 'max-age=' . $diff . ', must-revalidate';
     }
     return $this->_s3->putObject($object, $bucket, $uriPath, $permissions, array(), $headers);
 }