2011-11-09 00:15:44 +01:00
|
|
|
<?php
|
|
|
|
|
2012-03-14 00:21:04 +01:00
|
|
|
final class PhabricatorMetaMTAAttachment {
|
2011-11-09 00:15:44 +01:00
|
|
|
protected $data;
|
|
|
|
protected $filename;
|
|
|
|
protected $mimetype;
|
|
|
|
|
|
|
|
public function __construct($data, $filename, $mimetype) {
|
|
|
|
$this->setData($data);
|
2012-01-17 08:05:44 +01:00
|
|
|
$this->setFilename($filename);
|
2011-11-09 00:15:44 +01:00
|
|
|
$this->setMimeType($mimetype);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getData() {
|
|
|
|
return $this->data;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setData($data) {
|
|
|
|
$this->data = $data;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2012-01-17 08:05:44 +01:00
|
|
|
public function getFilename() {
|
2011-11-09 00:15:44 +01:00
|
|
|
return $this->filename;
|
|
|
|
}
|
|
|
|
|
2012-01-17 08:05:44 +01:00
|
|
|
public function setFilename($filename) {
|
2011-11-09 00:15:44 +01:00
|
|
|
$this->filename = $filename;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getMimeType() {
|
|
|
|
return $this->mimetype;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setMimeType($mimetype) {
|
|
|
|
$this->mimetype = $mimetype;
|
|
|
|
return $this;
|
|
|
|
}
|
2013-03-30 23:53:49 +01:00
|
|
|
|
|
|
|
public function toDictionary() {
|
|
|
|
return array(
|
|
|
|
'filename' => $this->getFilename(),
|
|
|
|
'mimetype' => $this->getMimetype(),
|
|
|
|
'data' => $this->getData(),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function newFromDictionary(array $dict) {
|
|
|
|
return new PhabricatorMetaMTAAttachment(
|
|
|
|
idx($dict, 'data'),
|
|
|
|
idx($dict, 'filename'),
|
|
|
|
idx($dict, 'mimetype'));
|
|
|
|
}
|
|
|
|
|
2011-11-09 00:15:44 +01:00
|
|
|
}
|