2017-02-03 15:22:37 +01:00
|
|
|
<?php
|
|
|
|
|
2017-03-15 10:25:48 +01:00
|
|
|
namespace Fixtures;
|
2017-02-03 15:22:37 +01:00
|
|
|
|
2017-03-15 10:25:48 +01:00
|
|
|
use Fixtures\Attachment\Attachment;
|
|
|
|
use Fixtures\Attachment\AttachmentCollection;
|
2017-02-03 15:22:37 +01:00
|
|
|
|
|
|
|
class DummyServiceHandlerWithAttachments
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @param DummyServiceRequestWithAttachments $request
|
|
|
|
* @return DummyServiceResponseWithAttachments
|
|
|
|
*/
|
|
|
|
public function handle(DummyServiceRequestWithAttachments $request)
|
|
|
|
{
|
|
|
|
$response = new DummyServiceResponseWithAttachments();
|
|
|
|
$response->status = true;
|
|
|
|
if ($request->includeAttachments === true) {
|
|
|
|
if ($request->hasAttachments() === true) {
|
|
|
|
$attachments = [];
|
|
|
|
foreach ($request->attachmentCollection->attachments as $attachment) {
|
|
|
|
$attachments[] = new Attachment($attachment->fileName, $attachment->contentType, $attachment->content);
|
|
|
|
}
|
|
|
|
$response->attachmentCollection = new AttachmentCollection($attachments);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
}
|