Skip to content

Commit

Permalink
Change property names to camel case
Browse files Browse the repository at this point in the history
  • Loading branch information
haszi authored and Girgias committed Dec 29, 2024
1 parent e66f34e commit b80ae36
Show file tree
Hide file tree
Showing 65 changed files with 288 additions and 288 deletions.
108 changes: 54 additions & 54 deletions phpdotnet/phd/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,61 +7,61 @@ class Config
public readonly string $copyright;

/** @var array<string, string> */
public array $output_format = [];
public bool $no_index = false;
public bool $force_index = false;
public bool $no_toc = false;
public string $xml_root = '.';
public string $xml_file = './.manual.xml';
public string $history_file = './fileModHistory.php';
public string $lang_dir = './';
public array $outputFormat = [];
public bool $noIndex = false;
public bool $forceIndex = false;
public bool $noToc = false;
public string $xmlRoot = '.';
public string $xmlFile = './.manual.xml';
public string $historyFile = './fileModHistory.php';
public string $langDir = './';
public string $language = 'en';
public string $fallback_language = 'en';
public string $fallbackLanguage = 'en';
public int $verbose = VERBOSE_DEFAULT;
public string $date_format = 'H:i:s';
public string $dateFormat = 'H:i:s';
/** @var array<string> */
public array $render_ids = [];
public array $renderIds = [];
/** @var array<string> */
public array $skip_ids = [];
private bool $color_output = true;
public string $output_dir = './output/';
public string $output_filename = '';
public array $skipIds = [];
private bool $colorOutput = true;
public string $outputDir = './output/';
public string $outputFilename = '';
/** @var resource */
public $php_error_output = \STDERR;
public string $php_error_color = '01;31'; // Red
public $phpErrorOutput = \STDERR;
public string $phpErrorColor = '01;31'; // Red
/** @var resource */
public $user_error_output = \STDERR;
public string $user_error_color = '01;33'; // Yellow
public $userErrorOutput = \STDERR;
public string $userErrorColor = '01;33'; // Yellow
/** @var resource */
public $phd_info_output = \STDOUT;
public string $phd_info_color = '01;32'; // Green
public $phdInfoOutput = \STDOUT;
public string $phdInfoColor = '01;32'; // Green
/** @var resource */
public $phd_warning_output = \STDOUT;
public string $phd_warning_color = '01;35'; // Magenta
public $phdWarningOutput = \STDOUT;
public string $phdWarningColor = '01;35'; // Magenta
public string $highlighter = 'phpdotnet\\phd\\Highlighter';
/** @var array<string> */
public array $package =['Generic'];
/** @var array<string> $css */
public array $css = [];
public bool $process_xincludes = false;
public bool $processXincludes = false;
public ?string $ext = null;
/** @var array<string> */
public array $package_dirs = [__INSTALLDIR__];
public bool $saveconfig = false;
public array $packageDirs = [__INSTALLDIR__];
public bool $saveConfig = false;
public bool $quit = false;
public ?IndexRepository $indexcache = null;
public bool $memoryindex = false;
public ?IndexRepository $indexCache = null;
public bool $memoryIndex = false;

public string $phpweb_version_filename = '';
public string $phpweb_acronym_filename = '';
public string $phpweb_sources_filename = '';
public string $phpweb_history_filename = '';
public string $phpwebVersionFilename = '';
public string $phpwebAcronymFilename = '';
public string $phpwebSourcesFilename = '';
public string $phpwebHistoryFilename = '';

public function __construct() {
$this->copyright = 'Copyright(c) 2007-' . \date('Y') . ' The PHP Documentation Group';

if('WIN' === \strtoupper(\substr(\PHP_OS, 0, 3))) {
$this->color_output = false;
$this->colorOutput = false;
}
}

Expand Down Expand Up @@ -98,7 +98,7 @@ public function getAllFiltered(): array {
*/
public function getSupportedPackages(): array {
$packageList = [];
foreach($this->package_dirs as $dir) {
foreach($this->packageDirs as $dir) {
foreach (\glob($dir . "/phpdotnet/phd/Package/*", \GLOB_ONLYDIR) as $item) {
$baseitem = \basename($item);
if ($baseitem[0] !== '.') {
Expand All @@ -112,30 +112,30 @@ public function getSupportedPackages(): array {
/**
* Returns whether terminal output supports colors
*/
public function getColor_output(): bool {
return $this->color_output;
public function getColorOutput(): bool {
return $this->colorOutput;
}

/**
* Enables/disables color output on the terminal
*/
public function setColor_output(bool $color_output): void {
public function setColorOutput(bool $colorOutput): void {
// Disable colored output if the terminal doesn't support colors
if ($color_output && function_exists('posix_isatty')) {
if (!posix_isatty($this->phd_info_output)) {
$this->phd_info_color = false;
if ($colorOutput && function_exists('posix_isatty')) {
if (!posix_isatty($this->phdInfoOutput)) {
$this->phdInfoColor = false;
}
if (!posix_isatty($this->phd_warning_output)) {
$this->phd_warning_color = false;
if (!posix_isatty($this->phdWarningOutput)) {
$this->phdWarningColor = false;
}
if (!posix_isatty($this->php_error_output)) {
$this->php_error_color = false;
if (!posix_isatty($this->phpErrorOutput)) {
$this->phpErrorColor = false;
}
if (!posix_isatty($this->user_error_output)) {
$this->user_error_color = false;
if (!posix_isatty($this->userErrorOutput)) {
$this->userErrorColor = false;
}
}
$this->color_output = $color_output;
$this->colorOutput = $colorOutput;
}

/**
Expand All @@ -152,27 +152,27 @@ public function setColor_output(bool $color_output): void {
* @return boolean True if indexing is required.
*/
public function requiresIndexing(): bool {
if (! $this->indexcache) {
$indexfile = $this->output_dir . 'index.sqlite';
if (! $this->indexCache) {
$indexfile = $this->outputDir . 'index.sqlite';
if (!\file_exists($indexfile)) {
return true;
}
}

if ($this->no_index) {
if ($this->noIndex) {
return false;
}

if ($this->force_index) {
if ($this->forceIndex) {
return true;
}

if ($this->indexcache->getIndexingTimeCount() === 0) {
if ($this->indexCache->getIndexingTimeCount() === 0) {
return true;
}

$xmlLastModification = \filemtime($this->xml_file);
if ($this->indexcache->getIndexingTime() > $xmlLastModification) {
$xmlLastModification = \filemtime($this->xmlFile);
if ($this->indexCache->getIndexingTime() > $xmlLastModification) {
return false;
}
return true;
Expand Down
10 changes: 5 additions & 5 deletions phpdotnet/phd/Format.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ abstract class Format extends ObjectStorage
public function __construct(Config $config, OutputHandler $outputHandler) {
$this->config = $config;
$this->outputHandler = $outputHandler;
if ($this->config->indexcache) {
$this->indexRepository = $this->config->indexcache;
if ($this->config->indexCache) {
$this->indexRepository = $this->config->indexCache;
if (!($this instanceof Index)) {
$this->sortIDs();
}
Expand Down Expand Up @@ -337,13 +337,13 @@ final public function autogen($text, $lang = null) {
if (isset($this->autogen[$lang][$text])) {
return $this->autogen[$lang][$text];
}
if ($lang == $this->config->fallback_language) {
if ($lang == $this->config->fallbackLanguage) {
throw new \InvalidArgumentException("Cannot autogenerate text for '$text'");
}
return $this->autogen($text, $this->config->fallback_language);
return $this->autogen($text, $this->config->fallbackLanguage);
}

$filename = $this->config->lang_dir . $lang . ".ini";
$filename = $this->config->langDir . $lang . ".ini";

if (!file_exists($filename) && strncmp(basename($filename), 'doc-', 4) === 0) {
$filename = dirname($filename) . DIRECTORY_SEPARATOR . substr(basename($filename), 4);
Expand Down
4 changes: 2 additions & 2 deletions phpdotnet/phd/Format/Abstract/XHTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ public function CDATA($value) {
* @return void
*/
public function postConstruct() {
$this->mediamanager = new MediaManager($this->config->xml_root);
$this->mediamanager = new MediaManager($this->config->xmlRoot);
$outputdir = $this->getOutputDir();
if (isset($outputdir) && $outputdir) {
$this->mediamanager->output_dir = $outputdir;
} else {
$this->mediamanager->output_dir = $this->config->output_dir . '/' . strtolower($this->getFormatName()) . '-data/';
$this->mediamanager->output_dir = $this->config->outputDir . '/' . strtolower($this->getFormatName()) . '-data/';
$this->mediamanager->relative_ref_path = basename($this->mediamanager->output_dir) . '/';
}
}
Expand Down
Loading

2 comments on commit b80ae36

@Girgias
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@haszi seems the merging of both commits had conflicts :/

@haszi
Copy link
Contributor

@haszi haszi commented on b80ae36 Dec 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@haszi seems the merging of both commits had conflicts :/

The property linking test was using the old Config file. This should fix it.

Please sign in to comment.