original_string: protected function detectPaperclipAttachments()
      {
          $model = $this->model();
  
          if ( ! ($model instanceof PaperclippableInterface)) {
              return [];
          }
  
          $files = $model->getAttachedFiles();
  
          $attachments = [];
  
          /** @var PaperclipAttachmentInstance[] $files */
          foreach ($files as $attribute => $file) {
  
              $variants = $file->variants();
  
              $normalizedVariants = [];
  
              foreach ($variants as $variant) {
  
                  if ($variant === 'original') {
                      continue;
                  }
  
                  $normalizedVariants[ $variant ] = $this->extractPaperclipVariantInfo($file, $variant);
              }
  
              $attachments[ $attribute ] = new PaperclipAttachmentData([
                  'image'      => (is_array($variants) && count($variants) > 1),
                  'resizes'    => array_pluck($normalizedVariants, 'dimensions'),
                  'variants'   => $variants,
                  'extensions' => array_pluck($normalizedVariants, 'extension'),
                  'types'      => array_pluck($normalizedVariants, 'mimeType'),
              ]);
          }
  
          return $attachments;
      }
code: protected function detectPaperclipAttachments()
      {
          $model = $this->model();
  
          if ( ! ($model instanceof PaperclippableInterface)) {
              return [];
          }
  
          $files = $model->getAttachedFiles();
  
          $attachments = [];
  
          /** @var PaperclipAttachmentInstance[] $files */
          foreach ($files as $attribute => $file) {
  
              $variants = $file->variants();
  
              $normalizedVariants = [];
  
              foreach ($variants as $variant) {
  
                  if ($variant === 'original') {
                      continue;
                  }
  
                  $normalizedVariants[ $variant ] = $this->extractPaperclipVariantInfo($file, $variant);
              }
  
              $attachments[ $attribute ] = new PaperclipAttachmentData([
                  'image'      => (is_array($variants) && count($variants) > 1),
                  'resizes'    => array_pluck($normalizedVariants, 'dimensions'),
                  'variants'   => $variants,
                  'extensions' => array_pluck($normalizedVariants, 'extension'),
                  'types'      => array_pluck($normalizedVariants, 'mimeType'),
              ]);
          }
  
          return $attachments;
      }
code_tokens: protected function detectPaperclipAttachments ( ) { $ model = $ this -> model ( ) ; if ( ! ( $ model instanceof PaperclippableInterface ) ) { return [ ] ; } $ files = $ model -> getAttachedFiles ( ) ; $ attachments = [ ] ; /** @var PaperclipAttachmentInstance[] $files */ foreach ( $ files as $ attribute => $ file ) { $ variants = $ file -> variants ( ) ; $ normalizedVariants = [ ] ; foreach ( $ variants as $ variant ) { if ( $ variant === 'original' ) { continue ; } $ normalizedVariants [ $ variant ] = $ this -> extractPaperclipVariantInfo ( $ file , $ variant ) ; } $ attachments [ $ attribute ] = new PaperclipAttachmentData ( [ 'image' => ( is_array ( $ variants ) && count ( $ variants ) > 1 ) , 'resizes' => array_pluck ( $ normalizedVariants , 'dimensions' ) , 'variants' => $ variants , 'extensions' => array_pluck ( $ normalizedVariants , 'extension' ) , 'types' => array_pluck ( $ normalizedVariants , 'mimeType' ) , ] ) ; } return $ attachments ; }
docstring: Returns list of paperclip attachments, if the model has any.
  
  @return PaperclipAttachmentData[]  assoc, keyed by attribute name
docstring_tokens: Returns list of paperclip attachments if the model has any .