Skip to content

Commit

Permalink
fix: php cs fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
jackd248 committed Aug 1, 2024
1 parent c6bbe84 commit 485e226
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Symfony\Component\ExpressionLanguage\ExpressionFunction;
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;
use Xima\XimaTypo3Toolbox\Configuration;

class TechnicalContextConditionFunctionsProvider implements ExpressionFunctionProviderInterface
Expand Down
26 changes: 15 additions & 11 deletions Documentation/phpdoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
* @param string $file Path to the file
* @return string Content of the file
*/
function readFileContent($file) {
function readFileContent($file)
{
return file_get_contents($file);
}

Expand All @@ -29,17 +30,18 @@ function readFileContent($file) {
* @param string $content Content of the PHP file
* @return array Extracted documentation comments
*/
function extractDocComments($content) {
function extractDocComments($content)
{
$docComments = [
'classes' => []
'classes' => [],
];

// Regex for class documentation
preg_match_all('/\/\*\*(.*?)\*\/\s*class\s+(\w+)/s', $content, $classMatches, PREG_SET_ORDER);
foreach ($classMatches as $match) {
$docComments['classes'][] = [
'name' => $match[2],
'comment' => cleanDocComment($match[1])
'comment' => cleanDocComment($match[1]),
];
}

Expand All @@ -52,7 +54,8 @@ function extractDocComments($content) {
* @param string $comment The comment to clean
* @return string The cleaned comment
*/
function cleanDocComment($comment) {
function cleanDocComment($comment)
{
$comment = preg_replace('/^[ \t]*\*[ \t]?/m', '', $comment);
return trim($comment);
}
Expand All @@ -65,7 +68,8 @@ function cleanDocComment($comment) {
* @param string $outputDir Path to the output directory
* @return string Name of the generated markdown file
*/
function generateMarkdown($className, $docComments, $outputDir) {
function generateMarkdown($className, $docComments, $outputDir)
{
$markdown = "# $className\n\n";

foreach ($docComments['classes'] as $class) {
Expand All @@ -89,7 +93,8 @@ function generateMarkdown($className, $docComments, $outputDir) {
* @param string $outputDir Path to the output directory
* @param string $tocFileName Name of the table of contents file
*/
function processDirectory($directory, $outputDir, $tocFileName) {
function processDirectory($directory, $outputDir, $tocFileName)
{
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory));
$generatedFiles = [];

Expand All @@ -116,7 +121,8 @@ function processDirectory($directory, $outputDir, $tocFileName) {
* @param string $outputDir Path to the output directory
* @param string $tocFileName Name of the table of contents file
*/
function generateTableOfContents($generatedFiles, $outputDir, $tocFileName) {
function generateTableOfContents($generatedFiles, $outputDir, $tocFileName)
{
$toc = "# Table of Contents\n\n";
foreach ($generatedFiles as $file) {
$className = basename($file, '.md');
Expand All @@ -127,7 +133,7 @@ function generateTableOfContents($generatedFiles, $outputDir, $tocFileName) {
}

// Parse command line arguments
$options = getopt("d:o:t::");
$options = getopt('d:o:t::');
if (!isset($options['d'])) {
die("Usage: php script.php -d <directory> -o <output directory> [-t <TOC_FILENAME>]\n");
}
Expand All @@ -150,5 +156,3 @@ function generateTableOfContents($generatedFiles, $outputDir, $tocFileName) {

// Process the directory
processDirectory($directory, $outputDir, $tocFileName);

?>

0 comments on commit 485e226

Please sign in to comment.