1
0
This repository has been archived on 2023-11-30. You can view files and clone it, but cannot push or open issues or pull requests.
dtux__serveur-vote-lalis/include/condorcet/Dev/update-documentation.php
2022-09-21 14:01:45 +02:00

41 lines
988 B
PHP

<?php
declare(strict_types=1);
use CondorcetPHP\Condorcet\Dev\CondorcetDocumentationGenerator\Generate;
require_once __DIR__.str_replace('/', \DIRECTORY_SEPARATOR, '/../vendor/../vendor/autoload.php');
// Build command
$path = mb_substr(__DIR__, 0, mb_strlen(__DIR__) - 4);
$path .= \DIRECTORY_SEPARATOR.'Documentation';
// Clear folder
function rrmdir(string $dir, string $path): void
{
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object !== '.' && $object !== '..') {
if (filetype($dir.\DIRECTORY_SEPARATOR.$object) === 'dir') {
rrmdir($dir.\DIRECTORY_SEPARATOR.$object, $path);
} else {
unlink($dir.\DIRECTORY_SEPARATOR.$object);
}
}
}
reset($objects);
if ($dir !== $path) {
rmdir($dir);
}
}
}
rrmdir($path, $path);
// Execute command
new Generate($path);