Commit bfe242a1 authored by Stefan Busemann's avatar Stefan Busemann
Browse files

Merge branch 'task/update-to-v10' into 'master'

Task/update to v10

See merge request !5
parents a3f3c402 0d71bc05
<?php
declare(strict_types=1);
namespace T3o\Certifications\Controller;
/**
......@@ -20,7 +21,6 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class ListingController extends ActionController
{
/**
* feUsersRepository
*
......@@ -28,19 +28,30 @@ class ListingController extends ActionController
*/
protected $userRepository;
/**
* injectFeUsersRepository
*
* @param UserRepository $userRepository
* @return void
*/
public function injectFeUsersRepository(UserRepository $userRepository): void
{
$this->userRepository = $userRepository;
}
/**
* listAction
*
* @param string $char
* @return void
*/
public function listAction($char = NULL)
public function listAction($char = null): void
{
if (empty($char)) {
$char = 'A';
}
$chars = range('A', 'Z');
array_push($chars, '#');
$chars[] = '#';
$feUsers = $this->userRepository->findByFirstChar($char);
$this->view->assignMultiple(
[
......@@ -50,29 +61,4 @@ class ListingController extends ActionController
]
);
}
/**
* action show
*
* @param User $user
* @return void
*/
public function showAction(User $user)
{
$this->view->assign('certUser', $user);
}
/**
* injectFeUsersRepository
*
* @param UserRepository $userRepository
* @return void
*/
public function injectFeUsersRepository(UserRepository $userRepository)
{
$this->userRepository = $userRepository;
}
}
?>
\ No newline at end of file
<?php
declare(strict_types=1);
namespace T3o\Certifications\Domain\Model;
/**
......@@ -24,30 +25,29 @@ class Certificate extends AbstractEntity
* certificationDate
*
* @var DateTime
* @TYPO3\CMS\Extbase\Annotation\Validate NotEmpty
*/
protected $certificationDate;
protected $certificationDate = null;
/**
* expirationDate
*
* @var DateTime
*/
protected $expirationDate;
protected $expirationDate = null;
/**
* allowListing
*
* @var boolean
*/
protected $allowListing = TRUE;
protected $allowListing = true;
/**
* true for all certifications for 4.x
*
* @var boolean
*/
protected $versionFour = FALSE;
protected $versionFour = false;
/**
* certificateType
......@@ -61,7 +61,7 @@ class Certificate extends AbstractEntity
*
* @return DateTime $certificationDate
*/
public function getCertificationDate()
public function getCertificationDate(): ?DateTime
{
return $this->certificationDate;
}
......@@ -72,7 +72,7 @@ class Certificate extends AbstractEntity
* @param DateTime $certificationDate
* @return void
*/
public function setCertificationDate($certificationDate)
public function setCertificationDate(DateTime $certificationDate): void
{
$this->certificationDate = $certificationDate;
}
......@@ -82,7 +82,7 @@ class Certificate extends AbstractEntity
*
* @return DateTime $expirationDate
*/
public function getExpirationDate()
public function getExpirationDate(): ?DateTime
{
return $this->expirationDate;
}
......@@ -93,17 +93,27 @@ class Certificate extends AbstractEntity
* @param DateTime $expirationDate
* @return void
*/
public function setExpirationDate($expirationDate)
public function setExpirationDate(DateTime $expirationDate): void
{
$this->expirationDate = $expirationDate;
}
/**
* Returns the boolean state of allowListing
*
* @return boolean
*/
public function isAllowListing(): bool
{
return $this->getAllowListing();
}
/**
* Returns the allowListing
*
* @return boolean $allowListing
*/
public function getAllowListing()
public function getAllowListing(): bool
{
return $this->allowListing;
}
......@@ -114,19 +124,19 @@ class Certificate extends AbstractEntity
* @param boolean $allowListing
* @return void
*/
public function setAllowListing($allowListing)
public function setAllowListing(bool $allowListing): void
{
$this->allowListing = $allowListing;
}
/**
* Returns the boolean state of allowListing
* Returns the boolean state of version_four
*
* @return boolean
*/
public function isAllowListing()
public function isVersionFour(): bool
{
return $this->getAllowListing();
return $this->getVersionFour();
}
/**
......@@ -134,7 +144,7 @@ class Certificate extends AbstractEntity
*
* @return boolean $version_four
*/
public function getVersionFour()
public function getVersionFour(): bool
{
return $this->versionFour;
}
......@@ -145,27 +155,17 @@ class Certificate extends AbstractEntity
* @param boolean $version_four
* @return void
*/
public function setVersionFour($versionFour)
public function setVersionFour(bool $versionFour): void
{
$this->versionFour = $versionFour;
}
/**
* Returns the boolean state of version_four
*
* @return boolean
*/
public function isVersionFour()
{
return $this->getVersionFour();
}
/**
* Returns the certificateType
*
* @return CertificateType $certificateType
*/
public function getCertificateType()
public function getCertificateType(): CertificateType
{
return $this->certificateType;
}
......@@ -176,11 +176,9 @@ class Certificate extends AbstractEntity
* @param CertificateType $certificateType
* @return void
*/
public function setCertificateType(CertificateType $certificateType)
public function setCertificateType(CertificateType $certificateType): void
{
$this->certificateType = $certificateType;
}
}
?>
\ No newline at end of file
<?php
declare(strict_types=1);
namespace T3o\Certifications\Domain\Model;
/**
......@@ -31,7 +32,7 @@ class CertificateType extends AbstractEntity
*
* @return string $title
*/
public function getTitle()
public function getTitle(): string
{
return $this->title;
}
......@@ -42,11 +43,9 @@ class CertificateType extends AbstractEntity
* @param string $title
* @return void
*/
public function setTitle($title)
public function setTitle(string $title): void
{
$this->title = $title;
}
}
?>
\ No newline at end of file
<?php
declare(strict_types=1);
namespace T3o\Certifications\Domain\Model;
/**
......@@ -14,28 +15,25 @@ namespace T3o\Certifications\Domain\Model;
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Extbase\Domain\Model\FrontendUser;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
class User extends AbstractEntity
{
/**
* @var string
*/
protected $firstName;
protected $firstName = '';
/**
* @var string
*/
protected $middleName;
protected $middleName = '';
/**
* @var string
*/
protected $lastName;
protected $lastName = '';
/**
* @var string
......@@ -47,149 +45,139 @@ class User extends AbstractEntity
*
* @var string
*/
protected $certReason;
protected $certReason = '';
/**
* publicEmailAddress
*
* @var boolean
*/
protected $publicEmailAddress = FALSE;
protected $publicEmailAddress = false;
/**
* email
*
* @var string
*/
protected $email;
protected $email = '';
/**
* certificates
*
* @var ObjectStorage
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3o\Certifications\Domain\Model\Certificate>
*/
protected $certificates;
protected $certificates = null;
/**
* feUser
*
* @var TYPO3\CMS\Extbase\Domain\Model\FrontendUser
* @var User
*/
protected $feUser;
protected $feUser = null;
/**
* twitter
*
* @var string
*/
protected $twitter;
protected $twitter = '';
/**
* publicTwitter
*
* @var boolean
*/
protected $publicTwitter;
protected $publicTwitter = false;
/**
* @param string $country
* __construct
*
* @return void
*/
public function setCountry($country)
public function __construct()
{
$this->country = $country;
$this->initStorageObjects();
}
/**
* @return void
*/
protected function initStorageObjects()
{
$this->certificates = new ObjectStorage();
}
/**
* @return string
*/
public function getCountry()
public function getCountry(): string
{
return $this->country;
}
/**
* @param string $firstName
* @param string $country
*/
public function setFirstName($firstName)
public function setCountry(string $country): void
{
$this->firstName = $firstName;
$this->country = $country;
}
/**
* @return string
*/
public function getFirstName()
public function getFirstName(): string
{
return $this->firstName;
}
/**
* @param string $lastName
* @param string $firstName
*/
public function setLastName($lastName)
public function setFirstName(string $firstName): void
{
$this->lastName = $lastName;
$this->firstName = $firstName;
}
/**
* @return string
*/
public function getLastName()
public function getLastName(): string
{
return $this->lastName;
}
/**
* @param string $middleName
* @param string $lastName
*/
public function setMiddleName($middleName)
public function setLastName(string $lastName): void
{
$this->middleName = $middleName;
$this->lastName = $lastName;
}
/**
* @return string
*/
public function getMiddleName()
public function getMiddleName(): string
{
return $this->middleName;
}
/**
* __construct
*
* @return void
*/
public function __construct()
{
//Do not remove the next line: It would break the functionality
$this->initStorageObjects();
}
/**
* Initializes all Tx_Extbase_Persistence_ObjectStorage properties.
*
* @return void
* @param string $middleName
*/
protected function initStorageObjects()
public function setMiddleName(string $middleName): void
{
/**
* Do not modify this method!
* It will be rewritten on each save in the extension builder
* You may modify the constructor of this class instead
*/
$this->certificates = new ObjectStorage();
$this->middleName = $middleName;
}
/**
* Adds a Certificate
*
* @param Certificate $certificate
* @param \T3o\Certifications\Domain\Model\Certificate $certificate
* @return void
*/
public function addCertificate(Certificate $certificate)
public function addCertificate(Certificate $certificate): void
{
$this->certificates->attach($certificate);
}
......@@ -197,10 +185,10 @@ class User extends AbstractEntity
/**
* Removes a Certificate
*
* @param Certificate $certificateToRemove The Certificate to be removed
* @param \T3o\Certifications\Domain\Model\Certificate $certificateToRemove The Certificate to be removed
* @return void
*/
public function removeCertificate(Certificate $certificateToRemove)
public function removeCertificate(Certificate $certificateToRemove): void
{
$this->certificates->detach($certificateToRemove);
}
......@@ -208,9 +196,9 @@ class User extends AbstractEntity
/**
* Returns the certificates
*
* @return ObjectStorage<Certificate> $certificates
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3o\Certifications\Domain\Model\Certificate> $certificates
*/
public function getCertificates()
public function getCertificates(): ObjectStorage
{
return $this->certificates;
}
......@@ -218,10 +206,10 @@ class User extends AbstractEntity
/**
* Sets the certificates
*
* @param ObjectStorage<Certificate> $certificates
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3o\Certifications\Domain\Model\Certificate> $certificates
* @return void
*/
public function setCertificates(ObjectStorage $certificates)
public function setCertificates(ObjectStorage $certificates): void
{
$this->certificates = $certificates;
}
......@@ -232,7 +220,7 @@ class User extends AbstractEntity
*
* @return User $feUser
*/
public function getFeUser()
public function getFeUser(): User
{
return $this->feUser;
}
......@@ -244,7 +232,7 @@ class User extends AbstractEntity
* @param User $feUser
* @return void
*/
public function setFeUser($feUser)
public function setFeUser(User $feUser): void
{
$this->feUser = $feUser;
}
......@@ -254,7 +242,7 @@ class User extends AbstractEntity
*
* @return string $certReason
*/
public function getCertReason()
public function getCertReason(): string
{
return $this->certReason;
}
......@@ -265,30 +253,31 @@ class User extends AbstractEntity
* @param string $certReason
* @return void
*/
public function setCertReason($certReason)
public function setCertReason(string $certReason): void
{
$this->certReason = $certReason;
}
/**
* getEmail
* isPublicInformationAvailable
* Returns TRUE if there is at least either a public
* email adress or a public twitter handle
*
* @return string $email
* @return bool
*/
public function getEmail()
public function isPublicInformationAvailable(): bool
{
return $this->email;
return ($this->isPublicEmailAddress() && $this->getEmail()) || ($this->isPublicTwitter() && $this->getTwitter());
}
/**
* setEmail
* Returns the boolean state of publicEmailAddress
*
* @param string $email
* @return void
* @return boolean
*/
public function setEmail($email = '')
public function isPublicEmailAddress(): bool
{
$this->email = $email;
return $this->getPublicEmailAddress();
}
/**
......@@ -296,7 +285,7 @@ class User extends AbstractEntity
*
* @return boolean $publicEmailAddress
*/
public function getPublicEmailAddress()
public function getPublicEmailAddress(): bool
{
return $this->publicEmailAddress;
}
......@@ -307,75 +296,73 @@ class User extends AbstractEntity
* @param boolean $publicEmailAddress
* @return void
*/
public function setPublicEmailAddress($publicEmailAddress)
public function setPublicEmailAddress(bool $publicEmailAddress): void
{
$this->publicEmailAddress = $publicEmailAddress;
}
/**
* Returns the boolean state of publicEmailAddress
* getEmail
*
* @return boolean
* @return string $email
*/