‪TYPO3CMS  ‪main
WorkspaceAspect.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 
21 
31 {
35  protected ‪$workspaceId;
36 
37  public function ‪__construct(int ‪$workspaceId = 0)
38  {
39  $this->workspaceId = ‪$workspaceId;
40  }
41 
48  public function get(string $name)
49  {
50  switch ($name) {
51  case 'id':
52  return ‪$this->workspaceId;
53  case 'isLive':
54  return $this->‪isLive();
55  case 'isOffline':
56  return !$this->‪isLive();
57  }
58  throw new AspectPropertyNotFoundException('Property "' . $name . '" not found in Aspect "' . __CLASS__ . '".', 1527779447);
59  }
60 
64  public function ‪getId(): int
65  {
66  return ‪$this->workspaceId;
67  }
68 
72  public function ‪isLive(): bool
73  {
74  return $this->workspaceId === 0;
75  }
76 }
‪TYPO3\CMS\Core\Context\WorkspaceAspect
Definition: WorkspaceAspect.php:31
‪TYPO3\CMS\Core\Context\WorkspaceAspect\isLive
‪isLive()
Definition: WorkspaceAspect.php:71
‪TYPO3\CMS\Core\Context
Definition: AspectInterface.php:18
‪TYPO3\CMS\Core\Context\WorkspaceAspect\$workspaceId
‪int $workspaceId
Definition: WorkspaceAspect.php:34
‪TYPO3\CMS\Core\Context\WorkspaceAspect\getId
‪getId()
Definition: WorkspaceAspect.php:63
‪TYPO3\CMS\Core\Context\AspectInterface
Definition: AspectInterface.php:27
‪TYPO3\CMS\Core\Context\WorkspaceAspect\__construct
‪__construct(int $workspaceId=0)
Definition: WorkspaceAspect.php:36
‪TYPO3\CMS\Core\Context\Exception\AspectPropertyNotFoundException
Definition: AspectPropertyNotFoundException.php:25