TYPO3 CMS  TYPO3_6-2
DocbookGeneratorService.php
Go to the documentation of this file.
1 <?php
3 
4 /* *
5  * This script is part of the TYPO3 project - inspiring people to share! *
6  * *
7  * TYPO3 is free software; you can redistribute it and/or modify it under *
8  * the terms of the GNU General Public License version 2 as published by *
9  * the Free Software Foundation. *
10  * *
11  * This script is distributed in the hope that it will be useful, but *
12  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
13  * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
14  * Public License for more details. *
15  * */
16 
30 
35  protected $objectManager;
36 
42  public function userFunc() {
43  $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
44  $this->injectDocCommentParser($this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\DocCommentParser'));
45  $this->injectReflectionService($this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService'));
46  return $this->generateDocbook('TYPO3\CMS\Fluid\ViewHelpers');
47  }
48 
55  protected function getClassNamesInNamespace($namespace) {
56  $namespaceParts = explode('\\', $namespace);
57  if ($namespaceParts[count($namespaceParts) - 1] == '') {
58  }
59  $classFilePathAndName = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(\TYPO3\CMS\Core\Utility\GeneralUtility::camelCaseToLowerCaseUnderscored($namespaceParts[2])) . 'Classes/';
60  $classFilePathAndName .= implode(array_slice($namespaceParts, 3, -1), '/') . '/';
61  $classNames = array();
62  $this->recursiveClassNameSearch($namespace, $classFilePathAndName, $classNames);
63  sort($classNames);
64  return $classNames;
65  }
66 
75  private function recursiveClassNameSearch($namespace, $directory, &$classNames) {
76 
77  $dh = opendir($directory);
78  $counter = 0;
79  while (($file = readdir($dh)) !== FALSE) {
80  if ($file == '.' || $file == '..' || $file == '.svn') {
81  continue;
82  }
83  if (is_file($directory . $file)) {
84  if (substr($file, 0, 8) == 'Abstract') {
85  continue;
86  }
87  $classNames[] = $namespace . substr($file, 0, -4);
88  } elseif (is_dir($directory . $file)) {
89  $this->recursiveClassNameSearch($namespace . $file . '\\', $directory . $file . '/', $classNames);
90  }
91  }
92  closedir($dh);
93  }
94 
95 }
recursiveClassNameSearch($namespace, $directory, &$classNames)