‪TYPO3CMS  ‪main
Demand.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
24 class ‪Demand
25 {
26  public const ‪ALL = 0;
27 
28  public const ‪USERTYPE_ADMINONLY = 1;
29  public const ‪USERTYPE_USERONLY = 2;
30 
31  public const ‪STATUS_ACTIVE = 1;
32  public const ‪STATUS_INACTIVE = 2;
33 
34  public const ‪LOGIN_SOME = 1;
35  public const ‪LOGIN_NONE = 2;
36 
37  protected string ‪$userName = '';
38  protected int ‪$userType = ‪self::ALL;
39  protected int ‪$status = ‪self::ALL;
40  protected int ‪$logins = 0;
41  protected int ‪$backendUserGroup = 0;
42 
43  public static function ‪fromUc(array $uc): self
44  {
45  $demand = new self();
46  $demand->userName = (string)($uc['userName'] ?? '');
47  $demand->userType = (int)($uc['userType'] ?? 0);
48  $demand->status = (int)($uc['status'] ?? 0);
49  $demand->logins = (int)($uc['logins'] ?? 0);
50  $demand->backendUserGroup = (int)($uc['backendUserGroup'] ?? 0);
51  return $demand;
52  }
53 
54  public function ‪forUc(): array
55  {
56  return [
57  'userName' => $this->‪getUserName(),
58  'userType' => $this->‪getUserType(),
59  'status' => $this->‪getStatus(),
60  'logins' => $this->‪getLogins(),
61  'backendUserGroup' => $this->‪getBackendUserGroup(),
62  ];
63  }
64 
65  public function ‪setUserName(string $userName): void
66  {
67  $this->userName = ‪$userName;
68  }
69 
70  public function ‪getUserName(): string
71  {
72  return ‪$this->userName;
73  }
74 
75  public function ‪setUserType(int ‪$userType): void
76  {
77  $this->userType = ‪$userType;
78  }
79 
80  public function ‪getUserType(): int
81  {
82  return ‪$this->userType;
83  }
84 
85  public function ‪setStatus(int ‪$status): void
86  {
87  $this->status = ‪$status;
88  }
89 
90  public function ‪getStatus(): int
91  {
92  return ‪$this->status;
93  }
94 
95  public function ‪setLogins(int ‪$logins): void
96  {
97  $this->logins = ‪$logins;
98  }
99 
100  public function ‪getLogins(): int
101  {
102  return ‪$this->logins;
103  }
104 
105  public function ‪setBackendUserGroup(int ‪$backendUserGroup): void
106  {
107  $this->backendUserGroup = ‪$backendUserGroup;
108  }
109 
110  public function ‪getBackendUserGroup(): int
111  {
113  }
114 }
‪TYPO3\CMS\Beuser\Domain\Model\Demand\$logins
‪int $logins
Definition: Demand.php:40
‪TYPO3\CMS\Beuser\Domain\Model
Definition: BackendUser.php:18
‪TYPO3\CMS\Beuser\Domain\Model\Demand\$backendUserGroup
‪int $backendUserGroup
Definition: Demand.php:41
‪TYPO3\CMS\Beuser\Domain\Model\Demand\setBackendUserGroup
‪setBackendUserGroup(int $backendUserGroup)
Definition: Demand.php:105
‪TYPO3\CMS\Beuser\Domain\Model\Demand\getUserName
‪getUserName()
Definition: Demand.php:70
‪TYPO3\CMS\Beuser\Domain\Model\Demand\USERTYPE_ADMINONLY
‪const USERTYPE_ADMINONLY
Definition: Demand.php:28
‪TYPO3\CMS\Beuser\Domain\Model\Demand\getLogins
‪getLogins()
Definition: Demand.php:100
‪TYPO3\CMS\Beuser\Domain\Model\Demand\setUserName
‪setUserName(string $userName)
Definition: Demand.php:65
‪TYPO3\CMS\Beuser\Domain\Model\Demand\$userName
‪string $userName
Definition: Demand.php:37
‪TYPO3\CMS\Beuser\Domain\Model\Demand\forUc
‪forUc()
Definition: Demand.php:54
‪TYPO3\CMS\Beuser\Domain\Model\Demand\LOGIN_NONE
‪const LOGIN_NONE
Definition: Demand.php:35
‪TYPO3\CMS\Beuser\Domain\Model\Demand\$status
‪int $status
Definition: Demand.php:39
‪TYPO3\CMS\Beuser\Domain\Model\Demand\getStatus
‪getStatus()
Definition: Demand.php:90
‪TYPO3\CMS\Beuser\Domain\Model\Demand\getBackendUserGroup
‪getBackendUserGroup()
Definition: Demand.php:110
‪TYPO3\CMS\Beuser\Domain\Model\Demand\setStatus
‪setStatus(int $status)
Definition: Demand.php:85
‪TYPO3\CMS\Beuser\Domain\Model\Demand\setUserType
‪setUserType(int $userType)
Definition: Demand.php:75
‪TYPO3\CMS\Beuser\Domain\Model\Demand\$userType
‪int $userType
Definition: Demand.php:38
‪TYPO3\CMS\Beuser\Domain\Model\Demand\LOGIN_SOME
‪const LOGIN_SOME
Definition: Demand.php:34
‪TYPO3\CMS\Beuser\Domain\Model\Demand\fromUc
‪static fromUc(array $uc)
Definition: Demand.php:43
‪TYPO3\CMS\Beuser\Domain\Model\Demand\STATUS_INACTIVE
‪const STATUS_INACTIVE
Definition: Demand.php:32
‪TYPO3\CMS\Beuser\Domain\Model\Demand\ALL
‪const ALL
Definition: Demand.php:26
‪TYPO3\CMS\Beuser\Domain\Model\Demand
Definition: Demand.php:25
‪TYPO3\CMS\Beuser\Domain\Model\Demand\getUserType
‪getUserType()
Definition: Demand.php:80
‪TYPO3\CMS\Beuser\Domain\Model\Demand\USERTYPE_USERONLY
‪const USERTYPE_USERONLY
Definition: Demand.php:29
‪TYPO3\CMS\Beuser\Domain\Model\Demand\STATUS_ACTIVE
‪const STATUS_ACTIVE
Definition: Demand.php:31
‪TYPO3\CMS\Beuser\Domain\Model\Demand\setLogins
‪setLogins(int $logins)
Definition: Demand.php:95