diff --git a/Command/CheckCommand.php b/Command/CheckCommand.php index e634cb8f8788384f2989c91d2f11c4a6189df2a6..a9d681e5892608e96d9f9b96cd75428dae770c5a 100644 --- a/Command/CheckCommand.php +++ b/Command/CheckCommand.php @@ -18,7 +18,7 @@ use Symfony\Component\Console\Output\OutputInterface; class CheckCommand extends ContainerAwareCommand { /** - * {@inheritDoc} + * {@inheritdoc} */ protected function configure() { @@ -28,7 +28,7 @@ class CheckCommand extends ContainerAwareCommand } /** - * {@inheritDoc} + * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { diff --git a/Command/CollectGarbageCommand.php b/Command/CollectGarbageCommand.php index c38e7197320ca8bd2c117ffcb25a8b1b59cc7ec4..ccc5b83e8432eef646dd05ab3fd4f4d935b419a4 100644 --- a/Command/CollectGarbageCommand.php +++ b/Command/CollectGarbageCommand.php @@ -19,7 +19,7 @@ use Symfony\Component\Console\Output\OutputInterface; class CollectGarbageCommand extends ContainerAwareCommand { /** - * {@inheritDoc} + * {@inheritdoc} */ protected function configure() { @@ -30,7 +30,7 @@ class CollectGarbageCommand extends ContainerAwareCommand } /** - * {@inheritDoc} + * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { diff --git a/Command/CreateCommand.php b/Command/CreateCommand.php index ba6067c93e0099ac37c8d57b1d5d2dacca8cf54b..05c03c9e2fab67a652eb9d53442be46e75176763 100644 --- a/Command/CreateCommand.php +++ b/Command/CreateCommand.php @@ -20,7 +20,7 @@ use Symfony\Component\Console\Output\OutputInterface; class CreateCommand extends ContainerAwareCommand { /** - * {@inheritDoc} + * {@inheritdoc} */ protected function configure() { @@ -34,7 +34,7 @@ class CreateCommand extends ContainerAwareCommand } /** - * {@inheritDoc} + * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { diff --git a/Command/ReadCommand.php b/Command/ReadCommand.php index 0bc03e84fc942a879f98333878d125e030df143a..750c736ab5c2a948039168b03e297cc0adad5df8 100644 --- a/Command/ReadCommand.php +++ b/Command/ReadCommand.php @@ -19,7 +19,7 @@ use Symfony\Component\Console\Output\OutputInterface; class ReadCommand extends ContainerAwareCommand { /** - * {@inheritDoc} + * {@inheritdoc} */ protected function configure() { @@ -33,7 +33,7 @@ class ReadCommand extends ContainerAwareCommand } /** - * {@inheritDoc} + * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { diff --git a/Controller/UploadController.php b/Controller/UploadController.php index 8044f2f00322d345b39a9991c510f7ab5dc2e50d..bffbbac7d84afeb0475d3070de89fb5c0304d178 100644 --- a/Controller/UploadController.php +++ b/Controller/UploadController.php @@ -84,6 +84,7 @@ class UploadController extends Controller /** * @Route("", name="file_upload_create") * @Method("POST") + * * @param Request $request * * @return JsonResponse @@ -130,7 +131,8 @@ class UploadController extends Controller /** * @Route("/{id}/content", name="file_upload_put_content") * @Method("PUT") - * @param Request $request + * + * @param Request $request * @param UploadedFile $file * * @return JsonResponse|Response @@ -173,9 +175,9 @@ class UploadController extends Controller throw new BadRequestHttpException('Invalid Content-Range'); } - $start = (int)$matches[1]; - $end = (int)$matches[2]; - $total = (int)$matches[3]; + $start = (int) $matches[1]; + $end = (int) $matches[2]; + $total = (int) $matches[3]; if ($start < 0 || $start >= $end || $end >= $total) { throw new HttpException(Response::HTTP_REQUESTED_RANGE_NOT_SATISFIABLE); @@ -217,7 +219,8 @@ class UploadController extends Controller /** * @Route("/{id}/content", name="file_upload_get_content") * @Method("GET") - * @param Request $request + * + * @param Request $request * @param UploadedFile $file * * @return UploadedFileResponse @@ -239,7 +242,8 @@ class UploadController extends Controller /** * @Route("/{id}", name="file_upload_delete") * @Method("DELETE") - * @param Request $request + * + * @param Request $request * @param UploadedFile $file * * @return JsonResponse diff --git a/Controller/UploadedFileController.php b/Controller/UploadedFileController.php index d5e2aa56a5a9e7ec2bfc59f7e799c399bd47f0fa..c31ba1f27606474b49b784dc714e02f654cedf71 100644 --- a/Controller/UploadedFileController.php +++ b/Controller/UploadedFileController.php @@ -18,6 +18,7 @@ use Symfony\Component\HttpFoundation\Request; /** * UploadedFile controller. + * * @Route("/files") * @Security("is_granted('ROLE_FILES_ADMIN')") */ @@ -25,6 +26,7 @@ class UploadedFileController extends Controller { /** * Lists all UploadedFile entities. + * * @Route("/", name="files") * @Method("GET") * @Template() @@ -54,6 +56,7 @@ class UploadedFileController extends Controller /** * Finds and displays a UploadedFile entity. + * * @Route("/{id}", name="files_show") * @Method("GET") * @Template() diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index f01a677cad11c7ec4a668fa70e60a3bc2c00a480..ee72ec6e5bf0763beb647ac6945c9c11692518b6 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -11,7 +11,7 @@ use Symfony\Component\Config\Definition\ConfigurationInterface; /** * This is the class that validates and merges configuration from your app/config files. - * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class} + * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}. */ class Configuration implements ConfigurationInterface { @@ -30,7 +30,7 @@ class Configuration implements ConfigurationInterface ->ifString() ->then( function ($v) { - $int = (int)$v; + $int = (int) $v; if (strpos($v, 'K')) { return 1000 * $int; } diff --git a/DependencyInjection/IrsteaFileUploadExtension.php b/DependencyInjection/IrsteaFileUploadExtension.php index 239afd4f8ee7e7aa13b567ca46b97a17b2454823..f5572bfa33b2f6bfb8a190c5e80d84ce22e5fd37 100644 --- a/DependencyInjection/IrsteaFileUploadExtension.php +++ b/DependencyInjection/IrsteaFileUploadExtension.php @@ -13,7 +13,7 @@ use Symfony\Component\DependencyInjection\Loader; use Symfony\Component\HttpKernel\DependencyInjection\Extension; /** - * {@inheritDoc} + * {@inheritdoc} */ class IrsteaFileUploadExtension extends Extension implements PrependExtensionInterface { diff --git a/Entity/Repository/UploadedFileRepository.php b/Entity/Repository/UploadedFileRepository.php index 9099c43121c3d6173319c3af3ff03ae52fdd6838..99933d7293c72fa86bae6a43a4fe3939c6c06027 100644 --- a/Entity/Repository/UploadedFileRepository.php +++ b/Entity/Repository/UploadedFileRepository.php @@ -24,8 +24,7 @@ use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventDispatcherInterface; /** - * Class UploadedFileRepository - * @package Irstea\FileUploadBundle\Entity\Repository + * Class UploadedFileRepository. */ class UploadedFileRepository extends EntityRepository implements FileManagerInterface { @@ -143,8 +142,6 @@ class UploadedFileRepository extends EntityRepository implements FileManagerInte /** * @param string $uuid - * - * @return null */ public function get($uuid) { @@ -152,7 +149,7 @@ class UploadedFileRepository extends EntityRepository implements FileManagerInte return null; } if (!is_string($uuid) || !Uuid::isValid($uuid)) { - throw new InvalidArgumentException(sprintf('Identifiant invalide: %s', (string)$uuid)); + throw new InvalidArgumentException(sprintf('Identifiant invalide: %s', (string) $uuid)); } return $this->findOneById($uuid); diff --git a/Entity/UploadedFile.php b/Entity/UploadedFile.php index 8869f83c1b32830cefd0a0519c3dd971a82ac08d..ce92cb9b97e7e3f6a33e9c8adad9ce1567fbdcc3 100644 --- a/Entity/UploadedFile.php +++ b/Entity/UploadedFile.php @@ -27,7 +27,8 @@ use Rhumsaa\Uuid\Uuid; class UploadedFile implements UploadedFileInterface { /** - * Taille de bloc utilisé pour les copies + * Taille de bloc utilisé pour les copies. + * * @var int */ public static $copyBlockSize = 8192; @@ -37,18 +38,21 @@ class UploadedFile implements UploadedFileInterface /** * @ORM\Id * @ORM\Column(type="guid") + * * @var string */ private $id; /** * @ORM\Column(type="string", length=1024) + * * @var string */ private $displayName; /** * @ORM\Column(type="string", length=1024) + * * @var string */ private $path; @@ -60,54 +64,63 @@ class UploadedFile implements UploadedFileInterface /** * @ORM\Column(type="string", length=255, nullable=true) + * * @var string */ private $mimeType; /** * @ORM\Column(type="integer", nullable=true) + * * @var int */ private $size; /** * @ORM\Column(type="string", length=64, nullable=true) + * * @var string */ private $checksum; /** * @ORM\Column(type="string", length=10) + * * @var string */ private $etat = self::ETAT_EN_COURS; /** * @ORM\Column(type="datetime") + * * @var DateTime */ private $createdAt; /** * @ORM\Column(type="string", nullable=true) + * * @var string */ private $createdBy; /** * @ORM\Column(type="string", nullable=true) + * * @var string */ private $createdFrom; /** * @ORM\Column(type="json_array", nullable=true) + * * @var array */ private $metadata; /** * @ORM\Column(type="string", length=256, nullable=true) + * * @var string */ private $description; @@ -269,7 +282,7 @@ class UploadedFile implements UploadedFileInterface ], true )) { - throw new InvalidArgumentException(sprintf("Etat invalide: '%s'", (string)$etat)); + throw new InvalidArgumentException(sprintf("Etat invalide: '%s'", (string) $etat)); } // Déplace le fichier hors de l'orphelinat quand on passe d'orphelin à nouveau @@ -339,6 +352,7 @@ class UploadedFile implements UploadedFileInterface * @param Filesystem $filesystem * * @return self + * * @internal */ public function setFilesystem(Filesystem $filesystem) @@ -484,13 +498,13 @@ class UploadedFile implements UploadedFileInterface } /** Wrapper de stream_copy_to_stream - * * @param resource $source * @param resource $dest * @param int $maxlen * @param int $offset * * @return int + * * @internal */ protected function stream_copy_to_stream($source, $dest, $maxlen = -1, $offset = 0) @@ -499,10 +513,10 @@ class UploadedFile implements UploadedFileInterface } /** Wrapper de feof - * * @param resource $filehandle * * @return bool + * * @internal */ protected function feof($filehandle) @@ -511,11 +525,11 @@ class UploadedFile implements UploadedFileInterface } /** Wrapper de fread - * * @param resource $filehandle * @param int $maxlen * * @return int|bool + * * @internal */ protected function fread($filehandle, $maxlen = -1) @@ -524,11 +538,11 @@ class UploadedFile implements UploadedFileInterface } /** Wrapper de fwrite - * * @param resource $filehandle * @param int $maxlen * * @return int|bool + * * @internal */ protected function fwrite($filehandle, $maxlen = -1) @@ -537,10 +551,10 @@ class UploadedFile implements UploadedFileInterface } /** Vérifie si un chemin est "safe". - * * @param string $path * * @return bool + * * @internal */ public static function isSafePath($path) @@ -684,6 +698,7 @@ class UploadedFile implements UploadedFileInterface /** * Met à jour le chemin réel du fichier. + * * @ORM\PostLoad * @ORM\PostPersist * @ORM\PostUpdate diff --git a/Exception/RejectedFileException.php b/Exception/RejectedFileException.php index 064b6d6e1e463b0c02efce390eaadd0293887c22..d06277c6ffe59de3ee11087191e2f020d2dc7e6d 100644 --- a/Exception/RejectedFileException.php +++ b/Exception/RejectedFileException.php @@ -21,9 +21,9 @@ class RejectedFileException extends RuntimeException implements Exception /** * @param UploadedFileInterface $uploadedFile - * @param string $message - * @param int $code - * @param \Exception $previous + * @param string $message + * @param int $code + * @param \Exception $previous * * @internal param UploadedFileInterface $file */ diff --git a/Form/Type/FileUploadType.php b/Form/Type/FileUploadType.php index 9272074af86fe10ee939c0652d44004453fa6082..993b4afb5e94f8ffec3f63afbb2526177ec8794f 100644 --- a/Form/Type/FileUploadType.php +++ b/Form/Type/FileUploadType.php @@ -127,7 +127,7 @@ class FileUploadType extends AbstractType * @todo Implémenter min_file_size, max_file_size && accept_file_types. * * @param OptionsResolver $options - * @param mixed $constraints + * @param mixed $constraints * * @return array|mixed */ diff --git a/Http/UploadedFileResponse.php b/Http/UploadedFileResponse.php index 9edcfa19a0bedde5f7144a0241056b4859ab4fb8..a11b978c2e4b3c2e12103dec2d36b6ef4b221187 100644 --- a/Http/UploadedFileResponse.php +++ b/Http/UploadedFileResponse.php @@ -77,10 +77,11 @@ class UploadedFileResponse extends Response /** * Sets the file to stream. * - * @param UploadedFileInterface $file The file to stream + * @param UploadedFileInterface $file The file to stream * @param string $contentDisposition * * @throws FileException + * * @return UploadedFileResponse */ public function setFile(UploadedFileInterface $file, $contentDisposition = null) @@ -100,6 +101,7 @@ class UploadedFileResponse extends Response /** * Gets the file. + * * @return UploadedFileInterface The file to stream */ public function getFile() @@ -164,13 +166,13 @@ class UploadedFileResponse extends Response [$start, $end] = explode('-', substr($range, 6), 2) + [0]; - $end = ('' === $end) ? $fileSize - 1 : (int)$end; + $end = ('' === $end) ? $fileSize - 1 : (int) $end; if ('' === $start) { $start = $fileSize - $end; $end = $fileSize - 1; } else { - $start = (int)$start; + $start = (int) $start; } if ($start <= $end) { @@ -213,6 +215,7 @@ class UploadedFileResponse extends Response /** * {@inheritdoc} + * * @throws LogicException when the content is not null */ public function setContent($content) @@ -224,6 +227,7 @@ class UploadedFileResponse extends Response /** * {@inheritdoc} + * * @return false */ public function getContent() diff --git a/IrsteaFileUploadBundle.php b/IrsteaFileUploadBundle.php index 2275430fa697a319474a3e91692ad3b20c90f0ba..0a5ca7f2f691f3a16c6be2aa709083c0592607b1 100644 --- a/IrsteaFileUploadBundle.php +++ b/IrsteaFileUploadBundle.php @@ -9,7 +9,7 @@ namespace Irstea\FileUploadBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; /** - * {@inheritDoc} + * {@inheritdoc} */ class IrsteaFileUploadBundle extends Bundle { diff --git a/Listener/CreationDataListener.php b/Listener/CreationDataListener.php index c9d1d883db789a856b54267920f7218c559eb5b9..df8ade07ac7633f5dfd888eb41707292dd3a2b66 100644 --- a/Listener/CreationDataListener.php +++ b/Listener/CreationDataListener.php @@ -35,7 +35,7 @@ class CreationDataListener /** * @param UploadedFileInterface $file - * @param LifecycleEventArgs $event + * @param LifecycleEventArgs $event */ public function prePersist(UploadedFileInterface $file, LifecycleEventArgs $event) { diff --git a/Listener/UploadedFileListener.php b/Listener/UploadedFileListener.php index 05e5a72e59f586d7a867af2578454f809f1272d0..cce11d12b07c40e5c6ae4d4d7df6406a9f311a6e 100644 --- a/Listener/UploadedFileListener.php +++ b/Listener/UploadedFileListener.php @@ -35,7 +35,6 @@ class UploadedFileListener } /** Passe le filesystem à l'entité. - * * @param UploadedFileInterface $file * @param LifecycleEventArgs $event */ @@ -45,7 +44,6 @@ class UploadedFileListener } /** Renomme le fichier disque lorsque l'on change l'attribut 'path'. - * * @param UploadedFileInterface $file * @param LifecycleEventArgs $event */ @@ -61,7 +59,6 @@ class UploadedFileListener } /** Enregistre le chemin du fichier à supprimer. - * * @param UploadedFileInterface $file * @param LifecycleEventArgs $event */ @@ -71,7 +68,6 @@ class UploadedFileListener } /** Supprime le fichier correspondant à l'UploadedFileInterface supprimé. - * * @param UploadedFileInterface $file * @param LifecycleEventArgs $event */ diff --git a/Model/FileManagerInterface.php b/Model/FileManagerInterface.php index 9890d3ef06df0479d352241103a00adc5317aebe..75a08316a7e0e6a23848d348036740efa4348d85 100644 --- a/Model/FileManagerInterface.php +++ b/Model/FileManagerInterface.php @@ -15,10 +15,10 @@ use Symfony\Component\Validator\Exception\InvalidArgumentException; interface FileManagerInterface { /** Retrouve un fichier uploadé par son identifiant. - * * @param string $id identifiant du fichier * * @return UploadedFileInterface|null le fichier retrouvé ou null si aucun fichier ne correspond + * * @api */ public function get($id); @@ -32,6 +32,7 @@ interface FileManagerInterface * @param int $lastModified timestamp de la date de dernière modification * * @return UploadedFileInterface le fichier créé + * * @api */ public function create($name, $size, $mimeType, $lastModified = null); @@ -43,7 +44,9 @@ interface FileManagerInterface * @param UploadedFileInterface $original * * @throws InvalidArgumentException le fichier original est invalide + * * @return UploadedFileInterface + * * @api */ public function duplicate(UploadedFileInterface $original); @@ -69,13 +72,16 @@ interface FileManagerInterface /** Retourne une liste de fichiers invalides à supprimer. * Ce sont des fichiers partiels ou orphelin qui n'ont pas été modifiés depuis plus d'une heure. + * * @return UploadedFileInterface[] + * * @internal */ public function findGarbage(); /** Retourne la liste des fichiers à valider. * @return UploadedFileInterface[] + * * @internal */ public function findFilesToValidate(); diff --git a/Model/UploadedFileInterface.php b/Model/UploadedFileInterface.php index a4c26cbeb268099c353efc12e604f67fc7f866ca..ac6baea691e7e978b86bb1bda73db67a6791a23e 100644 --- a/Model/UploadedFileInterface.php +++ b/Model/UploadedFileInterface.php @@ -19,36 +19,42 @@ interface UploadedFileInterface /** Fichier orphelin. * Fichier qui n'a pas encore été associé à un objet métier. + * * @var string */ public const ETAT_ORPHELIN = 'orphelin'; /** Fichier normal. * Fichier associé à un objet métier. + * * @var string */ public const ETAT_NORMAL = 'normal'; /** Fichier corrompu. * Fichier dont le contenu disque ne correspond pas à la somme de contrôle enregistreé en base de données. + * * @var string */ public const ETAT_CORROMPU = 'corrompu'; /** Fichier manquant. * Fichier existant en base de données mais introuvable sur disque. + * * @var string */ public const ETAT_MANQUANT = 'manquant'; /** Fichier rejeté. * Fichier uploadé mais rejeté par un listener (par exemple l'antivirus). + * * @var string */ public const ETAT_REJETE = 'rejete'; /** Retourne l'identifiant du fichier. * @return string + * * @api */ public function getId(); @@ -59,12 +65,14 @@ interface UploadedFileInterface * @param string $displayName * * @return UploadedFileInterface + * * @api */ public function setDisplayName($displayName); /** Retourne le nom original du fichier (c-à -d sur le poste de l'utilisateur ayant fait l'upload.) * @return string + * * @api */ public function getDisplayName(); @@ -73,18 +81,21 @@ interface UploadedFileInterface * @param string $description * * @return UploadedFileInterface + * * @api */ public function setDescription($description = null); /** Retourne la description du fichier. * @return string + * * @api */ public function getDescription(); /** Retourne le chemin du fichier dans le filesystem. * @return string + * * @api */ public function getPath(); @@ -95,16 +106,18 @@ interface UploadedFileInterface * @param string $path * * @return UploadedFileInterface + * * @api */ public function setPath($path); /** Change le chemin du fichier sans changer le nom. - * * @param string $newDir Nouveau répertoire * * @return UploadedFileInterface + * * @uses \UploadedFileInterface::setPath + * * @api */ public function moveTo($newDir); @@ -115,12 +128,14 @@ interface UploadedFileInterface * @param string $mimeType * * @return UploadedFileInterface + * * @api */ public function setMimeType($mimeType); /** Retourne le type MIME enregistré. * @return string + * * @api */ public function getMimeType(); @@ -131,12 +146,14 @@ interface UploadedFileInterface * @param int $size * * @return UploadedFileInterface + * * @api */ public function setSize($size); /** Retourne la taille enregistrée, en octets. * @return int + * * @api */ public function getSize(); @@ -147,93 +164,101 @@ interface UploadedFileInterface * @param string $checksum * * @return UploadedFileInterface + * * @api */ public function setChecksum($checksum); /** Retourne la somme de contrôle enregistrée. * @return string + * * @api */ public function getChecksum(); /** Modifie l'état courant du fichier. - * * @param string $etat * * @return UploadedFileInterface + * * @api */ public function setEtat($etat); /** Retourne l'état courant du fichier. * @return string + * * @api */ public function getEtat(); /** Définit la date de création du fichier. - * * @param DateTime $time * * @return self + * * @api */ public function setCreatedAt(\DateTime $time); /** Définit le nom de l'utilisateur ayant uploadé le fichier. - * * @param string $username * * @return self + * * @api */ public function setCreatedBy($username); /** Retourne l'adresse IP du client ayant uploadé le fichier. - * * @param string $ipAddress * * @return self + * * @api */ public function setCreatedFrom($ipAddress); /** Retourne la date de création du fichier. * @return DateTime + * * @api */ public function getCreatedAt(); /** Retourne le nom de l'utilisateur ayant uploadé le fichier. * @return string + * * @api */ public function getCreatedBy(); /** Retourne l'adresse IP du client ayant uploadé le fichier. * @return string + * * @api */ public function getCreatedFrom(); /** Remplace les métadonnées du fichier. - * * @param array $metadata les nouvelles métadonnées * * @return UploadedFileInterface + * * @api */ public function setMetadata(array $metadata); /** Retourne les métadonnées du fichier. * @return array + * * @api */ public function getMetadata(); /** Retourne une représentation texte du fichier. * @return string + * * @api */ public function __toString(); @@ -241,37 +266,42 @@ interface UploadedFileInterface /** Vérifie la validité du fichier. * Cela consiste à vérifier que le fichier existe dans le filesystem, et que la taille et la somme de contrôle * correspondent. En cas d'erreur, l'état du fichier est modifié en conséquence. + * * @uses \UploadedFileInterface::setEtat + * * @api */ public function validate(); /** Détermine si le fichier est dans un état "valide". * @return bool + * * @api */ public function isValid(); /** Détermine si le fichier est orphelin. * @return bool + * * @api */ public function isOrphelin(); /** Retourne la date de dernière modification dans le filesystem. * @return DateTime + * * @api */ public function getLastModified(); /** Retourne le contenu du fichier. * @return string une chaîne + * * @api */ public function getContent(); /** Remplace le contenu du fichier. - * * @param string $content * * @api @@ -279,38 +309,43 @@ interface UploadedFileInterface public function setContent($content); /** Ecrit dans le fichier depuis un descripteur de fichier. - * * @param resource $source flux d'entrée à lire * @param int $maxlen nombre maximum d'octets à lire * @param int $writeOffset offset depuis le début du fichier * * @return int nombre d'octets écrits + * * @api */ public function copyFrom($source, $maxlen = -1, $writeOffset = 0); /** Envoie le contenu du fichier dans un descripteur de fichier. - * * @param resource $dest flux de sortie * @param int $maxlen nombre maximum d'octets à lire * @param int $readOffset offset depuis le début du fichier * * @return int nombre d'octets lus + * * @api */ public function copyTo($dest, $maxlen = PHP_INT_MAX, $readOffset = 0); /** Retourne un nom de fichier local pour ce fichier. * Ce peut-être un fichier temporaire qui sera supprimé à la fin de la requête. + * * @return string + * * @api */ public function getLocalPath(); /** Retourne une représentation "tableau" des attributs du fichier uploadé. * Utilisé comme sérialisation du pauvre. + * * @todo Utiliser un vrai serializer. + * * @return array + * * @internal */ public function toArray(); @@ -321,6 +356,7 @@ interface UploadedFileInterface * @param UploadedFileInterface $other * * @return bool true si les deux fichiers ont le même contenu + * * @api */ public function hasSameContent(UploadedFileInterface $other); diff --git a/Service/FileUrlGeneratorInterface.php b/Service/FileUrlGeneratorInterface.php index 71077640d81264a14b8c56f72c29d6e1285eda58..149cfac9269b77e787d2f2a5e90f924883adc3d2 100644 --- a/Service/FileUrlGeneratorInterface.php +++ b/Service/FileUrlGeneratorInterface.php @@ -16,7 +16,7 @@ interface FileUrlGeneratorInterface /** * Génère une URL sécurisée pour un fichier. * - * @param string $idFile identifiant du fichier pour lequel générer l'URL + * @param string $idFile identifiant du fichier pour lequel générer l'URL * @param bool|int|string $referenceType type d'URL à générer * * @return string L'url générée diff --git a/Tests/Form/DataTranformer/UploadedFileTransformerTest.php b/Tests/Form/DataTranformer/UploadedFileTransformerTest.php index 0b109772688622ead215dac1c590ee46ad5a9cb9..2f49be8471147f21e03cd65a6c87878f978ce0f9 100644 --- a/Tests/Form/DataTranformer/UploadedFileTransformerTest.php +++ b/Tests/Form/DataTranformer/UploadedFileTransformerTest.php @@ -7,10 +7,10 @@ namespace Irstea\FileUploadBundle\Tests\Form\DataTranformer; use Irstea\FileUploadBundle\Form\DataTranformer\UploadedFileTransformer; +use Irstea\FileUploadBundle\Model\FileManagerInterface; use Irstea\FileUploadBundle\Model\UploadedFileInterface; use PHPUnit_Framework_MockObject_MockObject; use PHPUnit_Framework_TestCase; -use Irstea\FileUploadBundle\Model\FileManagerInterface; /** * Generated by PHPUnit_SkeletonGenerator on 2015-01-27 at 11:36:06. diff --git a/Tests/Listener/UploadedFileListenerTest.php b/Tests/Listener/UploadedFileListenerTest.php index acfaca0cbc4fe715a96af6bffe9d244871d651c5..6a9aaf3b31fd59936ae62a916b7ca0bf51796586 100644 --- a/Tests/Listener/UploadedFileListenerTest.php +++ b/Tests/Listener/UploadedFileListenerTest.php @@ -6,14 +6,14 @@ namespace Irstea\FileUploadBundle\Listener; +use Doctrine\ORM\EntityManager; use Doctrine\ORM\Event\LifecycleEventArgs; +use Doctrine\ORM\UnitOfWork; use Gaufrette\Exception\FileNotFound; +use Gaufrette\Filesystem; +use Irstea\FileUploadBundle\Entity\UploadedFile; use PHPUnit_Framework_MockObject_MockObject; use PHPUnit_Framework_TestCase; -use Doctrine\ORM\EntityManager; -use Doctrine\ORM\UnitOfWork; -use Irstea\FileUploadBundle\Entity\UploadedFile; -use Gaufrette\Filesystem; /** * Generated by PHPUnit_SkeletonGenerator on 2015-01-29 at 14:56:00. @@ -82,6 +82,7 @@ class UploadedFileListenerTest extends PHPUnit_Framework_TestCase /** * @covers \Irstea\FileUploadBundle\Listener\UploadedFileListener::postLoad + * * @todo Implement testPostLoad(). */ public function testPostLoad() diff --git a/Tests/Listener/VirusScannerListenerTest.php b/Tests/Listener/VirusScannerListenerTest.php index 204946e4d29ec3af8c19501d4b791886774f5a49..582da7f5ccf45c61513949d4cfd68297b60484fe 100644 --- a/Tests/Listener/VirusScannerListenerTest.php +++ b/Tests/Listener/VirusScannerListenerTest.php @@ -12,7 +12,6 @@ use Irstea\FileUploadBundle\Event\FileUploadCompleteEvent; use Irstea\FileUploadBundle\Listener\VirusScannerListener; use PHPUnit_Framework_MockObject_MockObject; use PHPUnit_Framework_TestCase; -use Irstea\FileUploadBundle\Model\UploadedFileInterface; /** * Generated by PHPUnit_SkeletonGenerator on 2015-01-29 at 14:43:16. @@ -40,7 +39,7 @@ class VirusScannerListenerTest extends PHPUnit_Framework_TestCase protected $file; /** - * {@inheritDoc} + * {@inheritdoc} */ protected function setUp() { diff --git a/Twig/FileUploadExtension.php b/Twig/FileUploadExtension.php index bb75dc1d2df26d56dcfa33bd78ee7913d3b07520..1c01f1074cdb9f0ffe9c0bd09f5e816d97ed0fd6 100644 --- a/Twig/FileUploadExtension.php +++ b/Twig/FileUploadExtension.php @@ -34,7 +34,7 @@ class FileUploadExtension extends Twig_Extension private $urlGenerator; /** - * @param TranslatorInterface $translator + * @param TranslatorInterface $translator * @param FileUrlGeneratorInterface $urlGenerator */ public function __construct(TranslatorInterface $translator, FileUrlGeneratorInterface $urlGenerator) @@ -96,7 +96,7 @@ class FileUploadExtension extends Twig_Extension /** Genère un tag HTML pour représenter le fichier. * Inclut un lien sécurisé qui permet de télécharger le fichier, mais uniquement à l'utilisateur qui a affiché la page. - * Usage : `{{ irstea_uploaded_file(file) }}` + * Usage : `{{ irstea_uploaded_file(file) }}`. * * @param Twig_Environment $env * @param UploadedFileInterface $file @@ -119,7 +119,7 @@ class FileUploadExtension extends Twig_Extension /** Genère un URL sécurisée pour télécharger un fichier. * Usage : `{{ irstea_file_path(file.id) }}`. * - * @param string $idFile + * @param string $idFile * @param bool|int|string $referenceType * * @return string @@ -135,6 +135,7 @@ class FileUploadExtension extends Twig_Extension * @param string $mimeType type MIME * * @return string un tag <i></i> avec les classes Font-Awesome + * * @uses \MimeTypeIcon::getMimeTypeIcon */ public function formatFileIcon($mimeType) @@ -153,6 +154,7 @@ class FileUploadExtension extends Twig_Extension * @param string $locale Langue * * @return string + * * @uses \NumberFormatter */ public function formatFileSize($context, $size, $precision = null, $locale = null)