Code rearrangement.

This commit is contained in:
James Cole
2016-01-19 13:59:54 +01:00
parent 9360eb6a70
commit f3fff6f1c5
18 changed files with 805 additions and 822 deletions

View File

@@ -19,14 +19,14 @@ use Symfony\Component\HttpFoundation\File\UploadedFile;
class AttachmentHelper implements AttachmentHelperInterface
{
/** @var int */
protected $maxUploadSize;
/** @var array */
protected $allowedMimes;
/** @var MessageBag */
public $errors;
/** @var MessageBag */
public $messages;
/** @var array */
protected $allowedMimes;
/** @var int */
protected $maxUploadSize;
/**
*
@@ -51,6 +51,22 @@ class AttachmentHelper implements AttachmentHelperInterface
return $path;
}
/**
* @return MessageBag
*/
public function getErrors()
{
return $this->errors;
}
/**
* @return MessageBag
*/
public function getMessages()
{
return $this->messages;
}
/**
* @param Model $model
*
@@ -98,27 +114,6 @@ class AttachmentHelper implements AttachmentHelperInterface
return false;
}
/**
* @param UploadedFile $file
* @param Model $model
*
* @return bool
*/
protected function validateUpload(UploadedFile $file, Model $model)
{
if (!$this->validMime($file)) {
return false;
}
if (!$this->validSize($file)) {
return false;
}
if ($this->hasFile($file, $model)) {
return false;
}
return true;
}
/**
* @param UploadedFile $file
* @param Model $model
@@ -205,19 +200,24 @@ class AttachmentHelper implements AttachmentHelperInterface
}
/**
* @return MessageBag
* @param UploadedFile $file
* @param Model $model
*
* @return bool
*/
public function getErrors()
protected function validateUpload(UploadedFile $file, Model $model)
{
return $this->errors;
}
if (!$this->validMime($file)) {
return false;
}
if (!$this->validSize($file)) {
return false;
}
if ($this->hasFile($file, $model)) {
return false;
}
/**
* @return MessageBag
*/
public function getMessages()
{
return $this->messages;
return true;
}