Commit 37b445c4 authored by Tomas Norre Mikkelsen's avatar Tomas Norre Mikkelsen

Merge branch 'fixing-terfe2-models-cgl' into 'develop'

Change models to PHP7 and CGL compatibility

See merge request !200
parents 27126b19 57224622
Pipeline #2383 passed with stages
in 1 minute and 30 seconds
......@@ -25,45 +25,53 @@ namespace T3o\TerFe2\Domain\Model;
* This copyright notice MUST APPEAR in all copies of the script!
******************************************************************/
use TYPO3\CMS\Extbase\Domain\Model\FrontendUser;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
/**
* Author of an extension
*/
class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* Name of the author
*
* @var string
* @validate NotEmpty
*/
protected $name;
protected $name = '';
/**
* Email address
*
* @var string
*/
protected $email;
protected $email = '';
/**
* Company name
*
* @var string
*/
protected $company;
protected $company = '';
/**
* Link to forge profile
*
* @var string
*/
protected $forgeLink;
protected $forgeLink = '';
/**
* Owner username
*
* @var string
*/
protected $username;
protected $username = '';
/**
* versions
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3o\TerFe2\Domain\Model\Version>
* @lazy
*/
......@@ -71,6 +79,7 @@ class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Frontend user
*
* @var \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
*/
protected $frontendUser;
......@@ -83,7 +92,7 @@ class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* 2 = Developer
* 3 = Support
*
* @var integer
* @var int
*/
protected $authorType;
......@@ -92,17 +101,16 @@ class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*/
public function __construct()
{
$this->versions = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->versions = new ObjectStorage();
}
/**
* Setter for name
*
* @param string $name Name of the author
* @return void
*/
public function setName($name)
public function setName(string $name)
{
$this->name = $name;
}
......@@ -113,7 +121,7 @@ class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*
* @return string Name of the author
*/
public function getName()
public function getName(): string
{
return $this->name;
}
......@@ -125,7 +133,7 @@ class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param string $email Email address
* @return void
*/
public function setEmail($email)
public function setEmail(string $email)
{
$this->email = $email;
}
......@@ -136,7 +144,7 @@ class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*
* @return string Email address
*/
public function getEmail()
public function getEmail(): string
{
return $this->email;
}
......@@ -148,7 +156,7 @@ class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param string $company Company name
* @return void
*/
public function setCompany($company)
public function setCompany(string $company)
{
$this->company = $company;
}
......@@ -159,7 +167,7 @@ class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*
* @return string Company name
*/
public function getCompany()
public function getCompany(): string
{
return $this->company;
}
......@@ -171,7 +179,7 @@ class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param string $forgeLink Link to forge profile
* @return void
*/
public function setForgeLink($forgeLink)
public function setForgeLink(string $forgeLink)
{
$this->forgeLink = $forgeLink;
}
......@@ -182,7 +190,7 @@ class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*
* @return string Link to forge profile
*/
public function getForgeLink()
public function getForgeLink(): string
{
return $this->forgeLink;
}
......@@ -194,7 +202,7 @@ class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param string $username Owner username
* @return void
*/
public function setUsername($username)
public function setUsername(string $username)
{
$this->username = $username;
}
......@@ -205,7 +213,7 @@ class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*
* @return string Owner username
*/
public function getUsername()
public function getUsername(): string
{
return $this->username;
}
......@@ -214,9 +222,9 @@ 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()
public function getVersions(): ObjectStorage
{
return $this->versions;
}
......@@ -228,7 +236,7 @@ class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param \T3o\TerFe2\Domain\Model\Version $version The Version to be added
* @return void
*/
public function addVersion(\T3o\TerFe2\Domain\Model\Version $version)
public function addVersion(Version $version)
{
$this->versions->attach($version);
}
......@@ -240,7 +248,7 @@ class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
* @param \T3o\TerFe2\Domain\Model\Version $version The Version to be removed
* @return void
*/
public function removeVersion(\T3o\TerFe2\Domain\Model\Version $version)
public function removeVersion(Version $version)
{
$this->versions->detach($version);
}
......@@ -250,7 +258,7 @@ class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
*/
public function getFrontendUser()
public function getFrontendUser(): FrontendUser
{
return $this->frontendUser;
}
......@@ -260,7 +268,7 @@ class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FrontendUser $frontendUser
*/
public function setFrontendUser($frontendUser)
public function setFrontendUser(FrontendUser $frontendUser = null)
{
$this->frontendUser = $frontendUser;
}
......@@ -268,10 +276,10 @@ class Author extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Setter for authorType
*
* @param integer $authorType Type of the author
* @param int $type Type of the author
* @return void
*/
public function setAuthorType($type)
public function setAuthorType(int $type)
{
$this->authorType = $type;
}
......@@ -280,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()
public function getAuthorType(): int
{
return $this->authorType;
}
......
......@@ -25,10 +25,12 @@ namespace T3o\TerFe2\Domain\Model;
* This copyright notice MUST APPEAR in all copies of the script!
******************************************************************/
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
/**
* Extension manager cache entry
*/
class ExtensionManagerCacheEntry extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
class ExtensionManagerCacheEntry extends AbstractEntity
{
// No attributes, getters and setters. Only required to get RAW result from respository
}
<?php
namespace T3o\TerFe2\Domain\Model;
/*******************************************************************
......@@ -25,191 +26,186 @@ namespace T3o\TerFe2\Domain\Model;
* This copyright notice MUST APPEAR in all copies of the script!
******************************************************************/
use T3o\TerFe2\Utility\Version;
/**
* Any type of relation of an extension
*/
class Relation extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
{
/**
* Dependancy, conflict or suggest
*
* @var string
* @validate NotEmpty
*/
protected $relationType;
protected $relationType = '';
/**
* Extension key, php, mysql or something else
*
* @var string
* @validate NotEmpty
*/
protected $relationKey;
protected $relationKey = '';
/**
* Minimum required version for this Relation
* @var integer
*
* @var int
*/
protected $minimumVersion;
protected $minimumVersion = 0;
/**
* Maximum allowed version for this Relation
* @var integer
*
* @var int
*/
protected $maximumVersion;
protected $maximumVersion = 0;
/**
* Related extension if in TER
*
* @lazy
* @var \T3o\TerFe2\Domain\Model\Extension $relatedExtension
*/
protected $relatedExtension;
/**
* Setter for relationType
*
* @param string $relationType Dependancy, conflict or suggest
* @return void
*/
public function setRelationType($relationType)
public function setRelationType(string $relationType)
{
$this->relationType = $relationType;
}
/**
* Getter for relationType
*
* @return string Dependancy, conflict or suggest
*/
public function getRelationType()
public function getRelationType(): string
{
return $this->relationType;
}
/**
* Setter for relationKey
*
* @param string $relationKey extension key, php, mysql or something else
* @return void
*/
public function setRelationKey($relationKey)
public function setRelationKey(string $relationKey)
{
$this->relationKey = $relationKey;
}
/**
* Getter for relationKey
*
* @return string extension key, php, mysql or something else
*/
public function getRelationKey()
public function getRelationKey(): string
{
if (empty($this->relationKey)) {
return '';
}
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($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()
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($maximumVersion)
public function setMaximumVersion(int $maximumVersion)
{
$this->maximumVersion = $maximumVersion;
}
/**
* Getter for maximumVersion
*
* @return integer Maximum allowed version
* @return int Maximum allowed version
*/
public function getMaximumVersion()
public function getMaximumVersion(): int
{
return (int)$this->maximumVersion;
return $this->maximumVersion;
}
/**
* Setter for relatedExtension
*
* @param \T3o\TerFe2\Domain\Model\Extension $relatedExtension
* @return void
*/
public function setRelatedExtension($relatedExtension)
public function setRelatedExtension(Extension $relatedExtension = null)
{
$this->relatedExtension = $relatedExtension;
}
/**
* Getter for relatedExtension
*
* @return \T3o\TerFe2\Domain\Model\Extension
*/
public function getRelatedExtension()
public function getRelatedExtension(): Extension
{
return $this->relatedExtension;
}
/**
* Returns minumum and maximum version as string
*
* @return string Version
*/
public function getVersionString()
public function getVersionString(): string
{
$version = array();
$version = [];
if (!empty($this->minimumVersion)) {
$version[] = \T3o\TerFe2\Utility\Version::versionFromInteger($this->minimumVersion);
$version[] = Version::versionFromInteger($this->minimumVersion);
}
if (!empty($this->maximumVersion)) {
$version[] = \T3o\TerFe2\Utility\Version::versionFromInteger($this->maximumVersion);
$version[] = Version::versionFromInteger($this->maximumVersion);
}
return (!empty($version) ? implode(' - ', $version) : '');
}
/**
* Get software type
*
* @return string core, system or extension
*/
public function getType()
public function getType(): string
{
$key = $this->getRelationKey();
......@@ -228,36 +224,33 @@ class Relation extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
return 'extension';
}
/**
* Is core relation
*
* @return boolean TRUE if related to core
* @return bool TRUE if related to core
*/
public function getIsCore()
public function getIsCore(): bool
{
return ($this->getType() == 'core');
return ($this->getType() === 'core');
}
/**
* Is system relation
*
* @return boolean TRUE if related to system
* @return bool TRUE if related to system
*/
public function getIsSystem()
public function getIsSystem(): bool
{
return ($this->getType() == 'system');
return ($this->getType() === 'system');
}
/**
* Is extension relation
*
* @return boolean TRUE if related to an extension
* @return bool TRUE if related to an extension
*/
public function getIsExtension()
public function getIsExtension(): bool
{
return ($this->getType() == 'extension');
return ($this->getType() === 'extension');
}
}
......@@ -33,11 +33,19 @@ class Tag extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
/**
* Title of the tag
*
* @var string
* @validate NotEmpty
*/
protected $title;
protected $title = '';
/**
* @return string
*/
public function __toString(): string
{
return $this->title;
}
/**
* Setter for title
......@@ -45,26 +53,17 @@ class Tag extends \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject
* @param string $title Title of the tag
* @return void
*/
public function setTitle($title)
public function setTitle(string $title)
{
$this->title = $title;
}
/**
* Getter for title
*
* @return string Title of the tag
*/
public function getTitle()
{
return $this->title;
}
/**
* @return string
*/
public function __toString()
public function getTitle(): string
{
return $this->title;
}
......
Markdown is supported
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