‪TYPO3CMS  10.4
RootNode.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
21 
27 {
36  public function ‪__construct(array $structure, ‪NodeInterface ‪$parent = null)
37  {
38  if (‪$parent !== null) {
39  throw new ‪RootNodeException(
40  'Root node must not have parent',
41  1366140117
42  );
43  }
44 
45  if (!isset($structure['name'])
46  || ($this->‪isWindowsOs() && substr($structure['name'], 1, 2) !== ':/')
47  || (!$this->‪isWindowsOs() && $structure['name'][0] !== '/')
48  ) {
50  'Root node expects absolute path as name',
51  1366141329
52  );
53  }
54  $this->name = $structure['name'];
55 
56  if (isset($structure['targetPermission'])) {
57  $this->‪setTargetPermission($structure['targetPermission']);
58  }
59 
60  if (array_key_exists('children', $structure)) {
61  $this->‪createChildren($structure['children']);
62  }
63  }
64 
70  public function ‪getStatus(): array
71  {
72  $result = [];
73  if (!$this->‪exists()) {
74  $result[] = new ‪FlashMessage(
75  '',
76  $this->‪getAbsolutePath() . ' does not exist',
78  );
79  } else {
80  $result = $this->‪getSelfStatus();
81  }
82  $result = array_merge($result, $this->‪getChildrenStatus());
83  return $result;
84  }
85 
91  public function ‪getAbsolutePath()
92  {
93  return ‪$this->name;
94  }
95 }
‪TYPO3\CMS\Install\FolderStructure\AbstractNode\exists
‪bool exists()
Definition: AbstractNode.php:126
‪TYPO3\CMS\Install\FolderStructure\DirectoryNode\getSelfStatus
‪FlashMessage[] getSelfStatus()
Definition: DirectoryNode.php:202
‪TYPO3\CMS\Install\FolderStructure\RootNode\__construct
‪__construct(array $structure, NodeInterface $parent=null)
Definition: RootNode.php:36
‪TYPO3\CMS\Install\FolderStructure\RootNodeInterface
Definition: RootNodeInterface.php:22
‪TYPO3\CMS\Install\FolderStructure\DirectoryNode
Definition: DirectoryNode.php:27
‪TYPO3\CMS\Install\FolderStructure
Definition: AbstractNode.php:16
‪TYPO3\CMS\Install\FolderStructure\RootNode\getAbsolutePath
‪string getAbsolutePath()
Definition: RootNode.php:91
‪TYPO3\CMS\Install\FolderStructure\Exception\InvalidArgumentException
Definition: InvalidArgumentException.php:24
‪TYPO3\CMS\Install\FolderStructure\Exception\RootNodeException
Definition: RootNodeException.php:24
‪TYPO3\CMS\Install\FolderStructure\RootNode
Definition: RootNode.php:27
‪TYPO3\CMS\Install\FolderStructure\AbstractNode\$name
‪string $name
Definition: AbstractNode.php:30
‪TYPO3\CMS\Core\Messaging\FlashMessage
Definition: FlashMessage.php:24
‪TYPO3\CMS\Install\FolderStructure\AbstractNode\setTargetPermission
‪setTargetPermission($permission)
Definition: AbstractNode.php:71
‪TYPO3\CMS\Install\FolderStructure\AbstractNode\$parent
‪NodeInterface null $parent
Definition: AbstractNode.php:38
‪TYPO3\CMS\Install\FolderStructure\DirectoryNode\createChildren
‪createChildren(array $structure)
Definition: DirectoryNode.php:282
‪TYPO3\CMS\Install\FolderStructure\DirectoryNode\getChildrenStatus
‪FlashMessage[] getChildrenStatus()
Definition: DirectoryNode.php:240
‪TYPO3\CMS\Install\FolderStructure\AbstractNode\isWindowsOs
‪bool isWindowsOs()
Definition: AbstractNode.php:195
‪TYPO3\CMS\Install\FolderStructure\NodeInterface
Definition: NodeInterface.php:24
‪TYPO3\CMS\Core\Messaging\AbstractMessage\ERROR
‪const ERROR
Definition: AbstractMessage.php:31
‪TYPO3\CMS\Install\FolderStructure\RootNode\getStatus
‪FlashMessage[] getStatus()
Definition: RootNode.php:70