‪TYPO3CMS  ‪main
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 
22 
28 {
37  public function ‪__construct(array $structure, ‪NodeInterface ‪$parent = null)
38  {
39  if (‪$parent !== null) {
40  throw new ‪RootNodeException(
41  'Root node must not have parent',
42  1366140117
43  );
44  }
45 
46  if (!isset($structure['name'])
47  || ($this->‪isWindowsOs() && substr($structure['name'], 1, 2) !== ':/')
48  || (!$this->‪isWindowsOs() && $structure['name'][0] !== '/')
49  ) {
51  'Root node expects absolute path as name',
52  1366141329
53  );
54  }
55  $this->name = $structure['name'];
56 
57  if (isset($structure['targetPermission'])) {
58  $this->‪setTargetPermission($structure['targetPermission']);
59  }
60 
61  if (array_key_exists('children', $structure)) {
62  $this->‪createChildren($structure['children']);
63  }
64  }
65 
71  public function ‪getStatus(): array
72  {
73  $result = [];
74  if (!$this->‪exists()) {
75  $result[] = new ‪FlashMessage(
76  '',
77  $this->‪getAbsolutePath() . ' does not exist',
78  ContextualFeedbackSeverity::ERROR
79  );
80  } else {
81  $result = $this->‪getSelfStatus();
82  }
83  $result = array_merge($result, $this->‪getChildrenStatus());
84  return $result;
85  }
86 
92  public function ‪getAbsolutePath()
93  {
94  return ‪$this->name;
95  }
96 }
‪TYPO3\CMS\Install\FolderStructure\AbstractNode\exists
‪bool exists()
Definition: AbstractNode.php:127
‪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:37
‪TYPO3\CMS\Install\FolderStructure\RootNodeInterface
Definition: RootNodeInterface.php:21
‪TYPO3\CMS\Install\FolderStructure\DirectoryNode
Definition: DirectoryNode.php:28
‪TYPO3\CMS\Install\FolderStructure
Definition: AbstractNode.php:16
‪TYPO3\CMS\Install\FolderStructure\RootNode\getAbsolutePath
‪string getAbsolutePath()
Definition: RootNode.php:92
‪TYPO3\CMS\Core\Type\ContextualFeedbackSeverity
‪ContextualFeedbackSeverity
Definition: ContextualFeedbackSeverity.php:25
‪TYPO3\CMS\Install\FolderStructure\Exception\InvalidArgumentException
Definition: InvalidArgumentException.php:23
‪TYPO3\CMS\Install\FolderStructure\Exception\RootNodeException
Definition: RootNodeException.php:23
‪TYPO3\CMS\Install\FolderStructure\RootNode
Definition: RootNode.php:28
‪TYPO3\CMS\Install\FolderStructure\AbstractNode\$name
‪string $name
Definition: AbstractNode.php:31
‪TYPO3\CMS\Core\Messaging\FlashMessage
Definition: FlashMessage.php:27
‪TYPO3\CMS\Install\FolderStructure\AbstractNode\setTargetPermission
‪setTargetPermission($permission)
Definition: AbstractNode.php:72
‪TYPO3\CMS\Install\FolderStructure\AbstractNode\$parent
‪NodeInterface null $parent
Definition: AbstractNode.php:39
‪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\Install\FolderStructure\RootNode\getStatus
‪FlashMessage[] getStatus()
Definition: RootNode.php:71