From 6d1587cff93a92f65932db75cd5a687aa110f3e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20Perr=C3=A9al?= <guillaume.perreal@irstea.fr> Date: Wed, 28 Jan 2015 15:10:07 +0100 Subject: [PATCH] Ajout d'une exception RejectFileException. --- Exception/Exception.php | 17 +++++++++++ Exception/RejectedFileException.php | 46 +++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 Exception/Exception.php create mode 100644 Exception/RejectedFileException.php diff --git a/Exception/Exception.php b/Exception/Exception.php new file mode 100644 index 00000000..1672f274 --- /dev/null +++ b/Exception/Exception.php @@ -0,0 +1,17 @@ +<?php + +/* + * Copyright (C) 2015 IRSTEA + * All rights reserved. + */ + +namespace Irstea\FileUploadBundle\Exception; + +/** + * + * @author Guillaume Perréal <guillaume.perreal@irstea.fr> + */ +interface Exception +{ + //put your code here +} diff --git a/Exception/RejectedFileException.php b/Exception/RejectedFileException.php new file mode 100644 index 00000000..afc1108a --- /dev/null +++ b/Exception/RejectedFileException.php @@ -0,0 +1,46 @@ +<?php + +/* + * Copyright (C) 2015 IRSTEA + * All rights reserved. + */ + +namespace Irstea\FileUploadBundle\Exception; + +use Irstea\FileUploadBundle\Model\UploadedFileInterface; +use RuntimeException; + +/** + * Description of RejectedFileException + * + * @author Guillaume Perréal <guillaume.perreal@irstea.fr> + */ +class RejectedFileException extends RuntimeException implements Exception +{ + /** + * + * @var UploadedFileInterface + */ + protected $uploadedFile; + + /** + * + * @param UploadedFileInterface $file + * @param string $message + * @param int $code + * @param \Exception $previous + */ + public function __construct(UploadedFileInterface $uploadedFile, $message, $code = 0, $previous = null) + { + parent::__construct($message, $code, $previous); + $this->uploadedFile = $uploadedFile; + } + + /** + * @return UploadedFileInterface + */ + public function getUploadedFile() + { + return $this->uploadedFile; + } +} -- GitLab