Entity type-hinting and phpDoc cleanup.

This commit is contained in:
Alexey Skobkin 2018-06-22 18:21:10 +03:00
parent a02d7685cc
commit e35a855319
2 changed files with 17 additions and 7 deletions

View File

@ -21,7 +21,7 @@ class File
private $id;
/**
* @var int
* @var Torrent
*
* @ORM\ManyToOne(targetEntity="App\Entity\Torrent", inversedBy="files")
* @ORM\JoinColumn(name="torrent_id")
@ -29,7 +29,7 @@ class File
private $torrent;
/**
* @var int
* @var int File size in bytes
*
* @ORM\Column(name="size", type="integer", nullable=false)
*/
@ -47,16 +47,18 @@ class File
return $this->id;
}
public function getTorrent(): int
public function getTorrent(): Torrent
{
return $this->torrent;
}
/** Returns file size in bytes */
public function getSize(): int
{
return $this->size;
}
/** Returns file path relative to the torrent root directory */
public function getPath(): string
{
return $this->path;

View File

@ -23,7 +23,7 @@ class Torrent
private $id;
/**
* @var resource
* @var resource Resource pointing to info-hash BLOB
*
* @ORM\Column(name="info_hash", type="blob", nullable=false)
*/
@ -35,21 +35,21 @@ class Torrent
private $infoHashHexCache;
/**
* @var string
* @var string Torrent name
*
* @ORM\Column(name="name", type="text", nullable=false)
*/
private $name;
/**
* @var int
* @var int Torrent files total size in bytes
*
* @ORM\Column(name="total_size", type="integer", nullable=false)
*/
private $totalSize;
/**
* @var int
* @var int Torrent discovery timestamp
*
* @ORM\Column(name="discovered_on", type="integer", nullable=false)
*/
@ -67,11 +67,17 @@ class Torrent
return $this->id;
}
/**
* Returns torrent info hash BLOB resource
*
* @return resource
*/
public function getInfoHash()
{
return $this->infoHash;
}
/** Returns torrent info hash as HEX string */
public function getInfoHashAsHex(): string
{
if (null === $this->infoHashHexCache) {
@ -87,11 +93,13 @@ class Torrent
return $this->name;
}
/** Returns torrent files total size in bytes */
public function getTotalSize(): int
{
return $this->totalSize;
}
/** Returns torrent discovery timestamp */
public function getDiscoveredOn(): int
{
return $this->discoveredOn;