Commit 7dad7e18 authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

Mise à jour de la doc de UploadedFile.

Showing with 72 additions and 103 deletions
+72 -103
......@@ -113,10 +113,12 @@ class UploadedFile implements UploadedFileInterface
*/
private $localTempPath = null;
/**
/** Crée un UploadedFile.
*
* @param string $createdBy Nom du créateur.
* @param string $createdFrom Adresse UP du créateur.
*
* @param string $createdBy
* @param string $createdFrom
* @internal
*/
public function __construct($createdBy = null, $createdFrom = null)
{
......@@ -128,9 +130,7 @@ class UploadedFile implements UploadedFileInterface
}
/**
* Get id
*
* @return integer
* {@inheritdoc}
*/
public function getId()
{
......@@ -138,10 +138,7 @@ class UploadedFile implements UploadedFileInterface
}
/**
* Set originalFilename
*
* @param string $displayName
* @return UploadedFileInterface
* {@inheritdoc}
*/
public function setDisplayName($displayName)
{
......@@ -151,9 +148,7 @@ class UploadedFile implements UploadedFileInterface
}
/**
* Get originalFilename
*
* @return string
* {@inheritdoc}
*/
public function getDisplayName()
{
......@@ -161,9 +156,7 @@ class UploadedFile implements UploadedFileInterface
}
/**
* Get path
*
* @return string
* {@inheritdoc}
*/
public function getPath()
{
......@@ -171,10 +164,7 @@ class UploadedFile implements UploadedFileInterface
}
/**
* Set path
*
* @param string $path
* @return UploadedFileInterface
* {@inheritdoc}
*/
public function setPath($path)
{
......@@ -186,10 +176,8 @@ class UploadedFile implements UploadedFileInterface
return $this;
}
/** Change le chemin d'un fichier sans changer le nom.
*
* @param string $newDir Nouveau répertoire
* @return UploadedFileInterface
/**
* {@inheritdoc}
*/
public function moveTo($newDir)
{
......@@ -197,10 +185,7 @@ class UploadedFile implements UploadedFileInterface
}
/**
* Set mimeType
*
* @param string $mimeType
* @return UploadedFileInterface
* {@inheritdoc}
*/
public function setMimeType($mimeType)
{
......@@ -210,9 +195,7 @@ class UploadedFile implements UploadedFileInterface
}
/**
* Get mimeType
*
* @return string
* {@inheritdoc}
*/
public function getMimeType()
{
......@@ -220,10 +203,7 @@ class UploadedFile implements UploadedFileInterface
}
/**
* Set size
*
* @param integer $size
* @return UploadedFileInterface
* {@inheritdoc}
*/
public function setSize($size)
{
......@@ -233,9 +213,7 @@ class UploadedFile implements UploadedFileInterface
}
/**
* Get size
*
* @return integer
* {@inheritdoc}
*/
public function getSize()
{
......@@ -243,10 +221,7 @@ class UploadedFile implements UploadedFileInterface
}
/**
* Set checksum
*
* @param string $checksum
* @return UploadedFileInterface
* {@inheritdoc}
*/
public function setChecksum($checksum)
{
......@@ -256,9 +231,7 @@ class UploadedFile implements UploadedFileInterface
}
/**
* Get checksum
*
* @return string
* {@inheritdoc}
*/
public function getChecksum()
{
......@@ -266,10 +239,7 @@ class UploadedFile implements UploadedFileInterface
}
/**
* Set etat
*
* @param string $etat
* @return UploadedFileInterface
* {@inheritdoc}
*/
public function setEtat($etat)
{
......@@ -298,9 +268,7 @@ class UploadedFile implements UploadedFileInterface
}
/**
* Get etat
*
* @return string
* {@inheritdoc}
*/
public function getEtat()
{
......@@ -308,9 +276,7 @@ class UploadedFile implements UploadedFileInterface
}
/**
* Get createdAt
*
* @return \DateTime
* {@inheritdoc}
*/
public function getCreatedAt()
{
......@@ -318,10 +284,7 @@ class UploadedFile implements UploadedFileInterface
}
/**
* Set metadata
*
* @param array $metadata
* @return UploadedFileInterface
* {@inheritdoc}
*/
public function setMetadata(array $metadata = null)
{
......@@ -331,9 +294,7 @@ class UploadedFile implements UploadedFileInterface
}
/**
* Get metadata
*
* @return array
* {@inheritdoc}
*/
public function getMetadata()
{
......@@ -341,7 +302,7 @@ class UploadedFile implements UploadedFileInterface
}
/**
* @return string
* {@inheritdoc}
*/
public function __toString()
{
......@@ -361,6 +322,8 @@ class UploadedFile implements UploadedFileInterface
/**
* @param Filesystem $filesystem
* @return self
*
* @internal
*/
public function setFilesystem(Filesystem $filesystem)
{
......@@ -368,6 +331,9 @@ class UploadedFile implements UploadedFileInterface
return $this;
}
/**
* {@inheritdoc}
*/
public function validate()
{
if (self::ETAT_EN_COURS === $this->getEtat()) {
......@@ -389,8 +355,7 @@ class UploadedFile implements UploadedFileInterface
}
/**
*
* @return boolean
* {@inheritdoc}
*/
public function isValid()
{
......@@ -398,17 +363,15 @@ class UploadedFile implements UploadedFileInterface
}
/**
*
* @return boolean
* {@inheritdoc}
*/
public function isOrphelin()
{
return $this->getEtat() === self::ETAT_ORPHELIN;
}
/** Retourne la date de dernière modification dans le filesystem.
*
* @return \DateTime
/**
* {@inheritdoc}
*/
public function getLastModified()
{
......@@ -419,30 +382,24 @@ class UploadedFile implements UploadedFileInterface
}
}
/** Retourne le contenu du fichier.
*
* @return string Une chaîne si $asResource vaut faux,
/**
* {@inheritdoc}
*/
public function getContent()
{
return $this->filesystem->read($this->getPath());
}
/** Ecrit dans le fichier.
*
* @param string $content
/**
* {@inheritdoc}
*/
public function setContent($content)
{
return $this->filesystem->write($this->getPath(), $content, true);
}
/** Ecrit dans le fichier depuis un descripteur de fichier.
*
* @param resource $source
* @param int $maxlen
* @param int $writeOffset
* @return int
/**
* {@inheritdoc}
*/
public function copyFrom($source, $maxlen = -1, $writeOffset = 0)
{
......@@ -472,16 +429,12 @@ class UploadedFile implements UploadedFileInterface
return $copied;
}
/** Envoie le contenu du fichier dans un descripteur de fichier.
*
* @param resource $dest
* @param int $maxlen
* @param int $readOffset
* @return int
/**
* {@inheritdoc}
*/
public function copyTo($dest, $maxlen = -1, $readOffset = 0)
{
if($maxlen === -1) {
if($maxlen === -1) {a
$actualLength = $this->getSize() - $readOffset;
} else {
$actualLength = min($maxlen, $this->getSize() - $readOffset);
......@@ -517,7 +470,10 @@ class UploadedFile implements UploadedFileInterface
* @param resource $dest
* @param int $maxlen
* @param int $offset
*
* @return int
*
* @internal
*/
protected function stream_copy_to_stream($source, $dest, $maxlen = -1, $offset = 0)
{
......@@ -527,7 +483,10 @@ class UploadedFile implements UploadedFileInterface
/** Wrapper de feof
*
* @param resource $filehandle
*
* @return boolean
*
* @internal
*/
protected function feof($filehandle)
{
......@@ -538,7 +497,10 @@ class UploadedFile implements UploadedFileInterface
*
* @param resource $filehandle
* @param int $maxlen
*
* @return int|boolean
*
* @internal
*/
protected function fread($filehandle, $maxlen = -1)
{
......@@ -549,20 +511,28 @@ class UploadedFile implements UploadedFileInterface
*
* @param resource $filehandle
* @param int $maxlen
*
* @return int|boolean
*
* @internal
*/
protected function fwrite($filehandle, $maxlen = -1)
{
return fwrite($filehandle, $maxlen);
}
/** Vérifie si
/** Vérifie si un chemin est "safe".
*
* @param string $path
*
* @return boolean
*
* @internal
*/
public static function isSafePath($path)
{
{ /**
* @return string
*/
$parts = explode('/', trim($path, '/'));
$level = 0;
foreach($parts as $part) {
......@@ -575,7 +545,9 @@ class UploadedFile implements UploadedFileInterface
return false;
}
break;
default:
default: /**
* @return string
*/
$level++;
}
}
......@@ -583,7 +555,7 @@ class UploadedFile implements UploadedFileInterface
}
/**
* @return string
* {@inheritdoc}
*/
public function getDescription()
{
......@@ -591,9 +563,7 @@ class UploadedFile implements UploadedFileInterface
}
/**
*
* @param string $description
* @return UploadedFileInterface
* {@inheritdoc}
*/
public function setDescription($description = null)
{
......@@ -602,7 +572,7 @@ class UploadedFile implements UploadedFileInterface
}
/**
* @return array
* {@inheritdoc}
*/
public function toArray()
{
......@@ -619,9 +589,7 @@ class UploadedFile implements UploadedFileInterface
}
/**
* Get createdBy
*
* @return string
* {@inheritdoc}
*/
public function getCreatedBy()
{
......@@ -629,15 +597,16 @@ class UploadedFile implements UploadedFileInterface
}
/**
* Get createdFrom
*
* @return string
* {@inheritdoc}
*/
public function getCreatedFrom()
{
return $this->createdFrom;
}
/**
* {@inheritdoc}
*/
public function getLocalPath()
{
if(null !== $this->localTempPath) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment