TYPO3 CMS  TYPO3_7-6
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 
22 class RootNode extends DirectoryNode implements RootNodeInterface
23 {
32  public function __construct(array $structure, NodeInterface $parent = null)
33  {
34  if (!is_null($parent)) {
35  throw new Exception\RootNodeException(
36  'Root node must not have parent',
37  1366140117
38  );
39  }
40 
41  if (!isset($structure['name'])
42  || ($this->isWindowsOs() && substr($structure['name'], 1, 2) !== ':/')
43  || (!$this->isWindowsOs() && $structure['name'][0] !== '/')
44  ) {
45  throw new Exception\InvalidArgumentException(
46  'Root node expects absolute path as name',
47  1366141329
48  );
49  }
50  $this->name = $structure['name'];
51 
52  if (isset($structure['targetPermission'])) {
53  $this->setTargetPermission($structure['targetPermission']);
54  }
55 
56  if (array_key_exists('children', $structure)) {
57  $this->createChildren($structure['children']);
58  }
59  }
60 
66  public function getStatus()
67  {
68  $result = [];
69  if (!$this->exists()) {
70  $status = new Status\ErrorStatus();
71  $status->setTitle($this->getAbsolutePath() . ' does not exist');
72  $result[] = $status;
73  } else {
74  $result = $this->getSelfStatus();
75  }
76  $result = array_merge($result, $this->getChildrenStatus());
77  return $result;
78  }
79 
85  public function getAbsolutePath()
86  {
87  return $this->name;
88  }
89 }
__construct(array $structure, NodeInterface $parent=null)
Definition: RootNode.php:32