Commit 57224622 authored by Thomas Löffler's avatar Thomas Löffler

Changes from long types to short ones

* Removes some empty lines
* Adds default values
parent ea109439
Pipeline #2365 passed with stages
in 1 minute and 27 seconds
......@@ -33,7 +33,6 @@ use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
*/
class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* Name of the author
*
......@@ -76,14 +75,14 @@ class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3o\TerFe2\Domain\Model\Version>
* @lazy
*/
protected $versions = null;
protected $versions;
/**
* Frontend user
*
* @var \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
*/
protected $frontendUser = null;
protected $frontendUser;
/**
* Author type
......@@ -93,7 +92,7 @@ class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* 2 = Developer
* 3 = Support
*
* @var integer
* @var int
*/
protected $authorType;
......@@ -223,7 +222,7 @@ class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Getter for versions
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3o\TerFe2\Domain\Model\Version> versions
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
*/
public function getVersions(): ObjectStorage
{
......@@ -269,7 +268,7 @@ class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FrontendUser $frontendUser
*/
public function setFrontendUser(FrontendUser $frontendUser)
public function setFrontendUser(FrontendUser $frontendUser = null)
{
$this->frontendUser = $frontendUser;
}
......@@ -277,10 +276,10 @@ class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Setter for authorType
*
* @param integer $type Type of the author
* @param int $type Type of the author
* @return void
*/
public function setAuthorType(integer $type)
public function setAuthorType(int $type)
{
$this->authorType = $type;
}
......@@ -289,9 +288,9 @@ class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Getter for authorType
*
* @return integer Type of the author
* @return int Type of the author
*/
public function getAuthorType(): integer
public function getAuthorType(): int
{
return $this->authorType;
}
......
<?php
namespace T3o\TerFe2\Domain\Model;
/*******************************************************************
......@@ -33,7 +32,6 @@ use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
*/
class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* Extension key
*
......@@ -54,19 +52,19 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*
* @var \DateTime
*/
protected $lastUpdate = null;
protected $lastUpdate;
/**
* @var \DateTime
*/
protected $lastMaintained = null;
protected $lastMaintained;
/**
* Tags
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3o\TerFe2\Domain\Model\Tag>
*/
protected $tags = null;
protected $tags;
/**
* Versions
......@@ -74,14 +72,14 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3o\TerFe2\Domain\Model\Version>
* @lazy
*/
protected $versions = null;
protected $versions;
/**
* Last version
*
* @var \T3o\TerFe2\Domain\Model\Version
*/
protected $lastVersion = null;
protected $lastVersion;
/**
* Frontend user
......@@ -93,7 +91,7 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Sum of all version downloads
*
* @var integer
* @var int
*/
protected $downloads = 0;
......@@ -116,7 +114,7 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*
* @var \DateTime
*/
protected $crdate = null;
protected $crdate;
/**
* Link to an external repository
......@@ -152,7 +150,7 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* @var \DateTime
*/
protected $expire = null;
protected $expire;
/**
......@@ -349,7 +347,7 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param bool $reverseAfterSlice
* @return array|\T3o\TerFe2\Domain\Model\Version[] Versions
*/
public function getReverseVersionsByVersionNumber($limit = 0, $reverseAfterSlice = true): array
public function getReverseVersionsByVersionNumber(int $limit = 0, bool $reverseAfterSlice = true): array
{
$versions = [];
......@@ -370,9 +368,9 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Returns the count of versions
*
* @return integer Version count
* @return int Version count
*/
public function getVersionCount(): integer
public function getVersionCount(): int
{
return (!empty($this->versions) ? count($this->versions) : 0);
}
......@@ -388,7 +386,7 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
$this->versions->attach($version);
$this->setLastVersion($version);
$this->addDownloads((int)$version->getAllDownloads());
$this->addDownloads($version->getAllDownloads());
}
......@@ -428,8 +426,8 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
return;
}
$curVersionNumber = (int)$this->lastVersion->getVersionNumber();
$newVersionNumber = (int)$lastVersion->getVersionNumber();
$curVersionNumber = $this->lastVersion->getVersionNumber();
$newVersionNumber = $lastVersion->getVersionNumber();
// Add lastVersion only if newer
if ($newVersionNumber > $curVersionNumber) {
......@@ -568,7 +566,7 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
continue;
}
foreach ($experiences as $experience) {
$rating = (int)$experience->getRating();
$rating = $experience->getRating();
if ($rating > 0) {
$votes['positive'] += $rating;
} else {
......@@ -584,33 +582,33 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Set all downloads sum
*
* @param integer $downloads Count of downloads
* @param int $downloads Count of downloads
* @return void
*/
public function setDownloads(integer $downloads)
public function setDownloads(int $downloads)
{
$this->downloads = (int)$downloads;
$this->downloads = $downloads;
}
/**
* Get sum of all version downloads
*
* @return integer All downloads
* @return int All downloads
*/
public function getDownloads(): integer
public function getDownloads(): int
{
return (int)$this->downloads;
return $this->downloads;
}
/**
* Add downloads to all downloads sum
*
* @param integer $downloads Count of downloads to add
* @param int $downloads Count of downloads to add
* @return void
*/
public function addDownloads(integer $downloads)
public function addDownloads(int $downloads)
{
$this->downloads += (int)$downloads;
$this->downloads += $downloads;
}
......@@ -685,7 +683,7 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
$versions = $this->getVersions();
foreach ($versions as $version) {
$downloads += (int)$version->getAllDownloads();
$downloads += $version->getAllDownloads();
}
if (!empty($downloads)) {
......
......@@ -33,7 +33,6 @@ use T3o\TerFe2\Utility\Version;
*/
class Relation extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
{
/**
* Dependancy, conflict or suggest
*
......@@ -53,14 +52,14 @@ class Relation extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
/**
* Minimum required version for this Relation
*
* @var integer
* @var int
*/
protected $minimumVersion = 0;
/**
* Maximum allowed version for this Relation
*
* @var integer
* @var int
*/
protected $maximumVersion = 0;
......@@ -70,7 +69,7 @@ class Relation extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
* @lazy
* @var \T3o\TerFe2\Domain\Model\Extension $relatedExtension
*/
protected $relatedExtension = null;
protected $relatedExtension;
/**
* Setter for relationType
......@@ -118,36 +117,34 @@ class Relation extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
return strtolower(trim($this->relationKey));
}
/**
* Setter for minimumVersion
*
* @param integer $minimumVersion Minimum required version
* @param int $minimumVersion Minimum required version
* @return void
*/
public function setMinimumVersion(integer $minimumVersion)
public function setMinimumVersion(int $minimumVersion)
{
$this->minimumVersion = $minimumVersion;
}
/**
* Getter for minimumVersion
*
* @return integer Minimum required version
* @return int Minimum required version
*/
public function getMinimumVersion(): integer
public function getMinimumVersion(): int
{
return (int)$this->minimumVersion;
return $this->minimumVersion;
}
/**
* Setter for maximumVersion
*
* @param integer $maximumVersion Maximum allowed version
* @param int $maximumVersion Maximum allowed version
* @return void
*/
public function setMaximumVersion(integer $maximumVersion)
public function setMaximumVersion(int $maximumVersion)
{
$this->maximumVersion = $maximumVersion;
}
......@@ -155,11 +152,11 @@ class Relation extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
/**
* Getter for maximumVersion
*
* @return integer Maximum allowed version
* @return int Maximum allowed version
*/
public function getMaximumVersion(): integer
public function getMaximumVersion(): int
{
return (int)$this->maximumVersion;
return $this->maximumVersion;
}
/**
......@@ -168,7 +165,7 @@ class Relation extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
* @param \T3o\TerFe2\Domain\Model\Extension $relatedExtension
* @return void
*/
public function setRelatedExtension(Extension $relatedExtension)
public function setRelatedExtension(Extension $relatedExtension = null)
{
$this->relatedExtension = $relatedExtension;
}
......@@ -230,9 +227,9 @@ class Relation extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
/**
* Is core relation
*
* @return boolean TRUE if related to core
* @return bool TRUE if related to core
*/
public function getIsCore(): boolean
public function getIsCore(): bool
{
return ($this->getType() === 'core');
}
......@@ -240,9 +237,9 @@ class Relation extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
/**
* Is system relation
*
* @return boolean TRUE if related to system
* @return bool TRUE if related to system
*/
public function getIsSystem(): boolean
public function getIsSystem(): bool
{
return ($this->getType() === 'system');
}
......@@ -250,9 +247,9 @@ class Relation extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
/**
* Is extension relation
*
* @return boolean TRUE if related to an extension
* @return bool TRUE if related to an extension
*/
public function getIsExtension(): boolean
public function getIsExtension(): bool
{
return ($this->getType() === 'extension');
}
......
......@@ -61,12 +61,12 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @var \T3o\TerFe2\Domain\Model\Author
* @lazy
*/
protected $author = null;
protected $author;
/**
* The version number as integer
*
* @var integer
* @var int
* @validate NotEmpty
*/
protected $versionNumber = 0;
......@@ -82,7 +82,7 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Upload date and time
*
* @var integer
* @var int
* @validate NotEmpty
*/
protected $uploadDate = 0;
......@@ -97,14 +97,14 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Count of downloads for this version
*
* @var integer
* @var int
*/
protected $downloadCounter = 0;
/**
* Count of downloads for this version made in frontend
*
* @var integer
* @var int
*/
protected $frontendDownloadCounter = 0;
......@@ -141,35 +141,35 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Information if extension is shy
*
* @var boolean
* @var bool
*/
protected $shy = false;
/**
* Internal
*
* @var boolean
* @var bool
*/
protected $internal = false;
/**
* Whether extension will be loaded in Frontend or not
*
* @var boolean
* @var bool
*/
protected $doNotLoadInFe = false;
/**
* Whether an upload folder will be created or not
*
* @var boolean
* @var bool
*/
protected $uploadfolder = false;
/**
* Whether to clear cache on load or not
*
* @var boolean
* @var bool
*/
protected $clearCacheOnLoad = false;
......@@ -218,7 +218,7 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Review state (-2=outdated, -1=insecure, 0=standard, 1=reviewed)
*
* @var integer
* @var int
*/
protected $reviewState = 0;
......@@ -232,7 +232,7 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Check if a manual is existing in this version
*
* @var boolean
* @var bool
*/
protected $hasManual = false;
......@@ -242,7 +242,7 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3o\TerFe2\Domain\Model\Relation>
* @lazy
*/
protected $softwareRelations = null;
protected $softwareRelations;
/**
* Parent extension object
......@@ -250,7 +250,7 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @var \T3o\TerFe2\Domain\Model\Extension
* @lazy
*/
protected $extension = null;
protected $extension;
/**
* Extension provider
......@@ -262,28 +262,28 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Has zip file
*
* @var boolean
* @var bool
*/
protected $hasZipFile = false;
/**
* Has images
*
* @var boolean
* @var bool
*/
protected $hasImages = false;
/**
* File size of the t3x file
*
* @var integer
* @var int
*/
protected $t3xFileSize = 0;
/**
* File size of the zip file
*
* @var integer
* @var int
*/
protected $zipFileSize = 0;
......@@ -292,7 +292,7 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*
* @var \DateTime
*/
protected $creationDate = null;
protected $creationDate;
/**
* Constructor. Initializes all ObjectStorage instances.
......@@ -389,10 +389,10 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Setter for versionNumber
*
* @param integer $versionNumber The version number
* @param int $versionNumber The version number
* @return void
*/
public function setVersionNumber(integer $versionNumber)
public function setVersionNumber(int $versionNumber)
{
$this->versionNumber = $versionNumber;
}
......@@ -400,9 +400,9 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Getter for versionNumber
*
* @return integer The version number
* @return int The version number
*/
public function getVersionNumber(): integer
public function getVersionNumber(): int
{
return $this->versionNumber;
}
......@@ -431,10 +431,10 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Setter for uploadDate
*
* @param integer $uploadDate Upload date and time
* @param int $uploadDate Upload date and time
* @return void
*/
public function setUploadDate(integer $uploadDate)
public function setUploadDate(int $uploadDate)
{
$this->uploadDate = $uploadDate;
}
......@@ -442,9 +442,9 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Getter for uploadDate
*
* @return integer Upload date and time
* @return int Upload date and time
*/
public function getUploadDate(): integer
public function getUploadDate(): int
{
return $this->uploadDate;
}
......@@ -473,27 +473,27 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Setter for downloadCounter
*
* @param integer $downloadCounter Count of downloads
* @param int $downloadCounter Count of downloads
* @return void
*/
public function setDownloadCounter(integer $downloadCounter)
public function setDownloadCounter(int $downloadCounter)
{
$this->downloadCounter = (int)$downloadCounter;
$this->downloadCounter = $downloadCounter;
}
/**
* Increment downloadCounter
*
* @param integer $downloads Count of downloads
* @param boolean $frontend Downloads were made in frontend
* @param int $downloads Count of downloads
* @param bool $frontend Downloads were made in frontend
* @return void
*/
public function incrementDownloadCounter(integer $downloads = 1, boolean $frontend = true)
public function incrementDownloadCounter(int $downloads = 1, bool $frontend = true)
{
if (!empty($frontend)) {
$this->frontendDownloadCounter += (int)$downloads;
$this->frontendDownloadCounter += $downloads;
} else {
$this->downloadCounter += (int)$downloads;
$this->downloadCounter += $downloads;