/**
  * @param $command
  * @return void
  */
 protected function prepareAttachmentInput($command)
 {
     if ($command->attachmentsInput && is_array($command->attachmentsInput)) {
         $attachmentInputs = array();
         foreach ($command->attachmentsInput as $each) {
             $input = $this->decodeAttachmentInput($each);
             $attachmentInputs[] = AttachmentInput::createFromArray($input);
         }
         $command->attachmentsInput = $attachmentInputs;
     }
 }
 /**
  * Transform Symfony UploadedFile into AttachmentInput
  * @param array $value
  * @return array The array of AttachmentInput transformed from Symfony UploadedFile
  */
 public function reverseTransform($value)
 {
     $inputs = array();
     foreach ($value as $each) {
         if ($each) {
             if (false === $each instanceof UploadedFile) {
                 throw new TransformationFailedException("Every item in input files array should be an instance of the UploadedFile.");
             }
             $attachment = AttachmentInput::createFromUploadedFile($each);
             array_push($inputs, $attachment);
         }
     }
     return $inputs;
 }
 /**
  * @return AttachmentInput
  */
 private function attachmentInputs()
 {
     $attachmentInput = new AttachmentInput();
     $attachmentInput->setFilename(self::DUMMY_FILENAME);
     $attachmentInput->setContent(self::DUMMY_FILE_CONTENT);
     return array($attachmentInput);
 }
 /**
  * @param Attachment[]|null $attachments
  * @return AttachmentInput[]|null
  */
 private function convertAttachments(array $attachments = null)
 {
     if (is_null($attachments)) {
         return null;
     }
     $result = null;
     foreach ($attachments as $attachment) {
         if ($attachment instanceof Attachment) {
             $input = new AttachmentInput();
             $input->setFilename($attachment->getName());
             $input->setContent($attachment->getContent());
             $result[] = $input;
         }
     }
     return $result;
 }