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