Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
5 / 5
AttachmentsTrait
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
5 / 5
 getAttachments
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 addAttachments
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 setAttachments
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
<?php
/**
 * @file
 * Contains \Drupal\Core\Render\AttachmentsTrait.
 */
namespace Drupal\Core\Render;
/**
 * Provides an implementation of AttachmentsInterface.
 *
 * @see \Drupal\Core\Render\AttachmentsInterface
 */
trait AttachmentsTrait {
  /**
   * The attachments for this response.
   *
   * @var array
   */
  protected $attachments = [];
  /**
   * {@inheritdoc}
   */
  public function getAttachments() {
    return $this->attachments;
  }
  /**
   * {@inheritdoc}
   */
  public function addAttachments(array $attachments) {
    $this->attachments = BubbleableMetadata::mergeAttachments($this->attachments, $attachments);
    return $this;
  }
  /**
   * {@inheritdoc}
   */
  public function setAttachments(array $attachments) {
    $this->attachments = $attachments;
    return $this;
  }
}