1
0
mirror of https://github.com/php/phd.git synced 2026-03-24 07:02:07 +01:00
Commit Graph

70 Commits

Author SHA1 Message Date
haszi
b80ae36dba Change property names to camel case 2024-12-29 19:58:10 +00:00
haszi
b8e817b6ff Replace method calls with property access 2024-12-29 19:58:10 +00:00
haszi
15284136ff Separate regular PhD output from error handling (#176)
- Move error handling code into a class and remove PhD message output handling from it.
- Introduce a new class to handle PhD message output.
- Make the implicit dependency on the output functionality of classes explicit.
- Update PEAR package.xml.
- Fix tests.
- Use proper variadic parameters
- Use class constants
- Use first-class callable syntax

---------

Co-authored-by: haszi <haszika80@gmail.com>
2024-11-10 17:57:05 +00:00
haszi
0364e4f969 Use trigger_error for errors (#174)
Co-authored-by: haszi <haszika80@gmail.com>
2024-10-29 14:11:27 +00:00
haszi
543bb5bf25 Move constant definitions to a dedicated file 2024-10-21 14:36:48 +01:00
haszi
49a37c45b3 Move requireIndexing() to Config (#151)
* Move requireIndexing() to Config

* Change method name to requiresIndexing

---------

Co-authored-by: haszi <haszika80@gmail.com>
2024-09-22 19:22:31 +01:00
haszi
8ca0905687 Remove Config from Autoloader (#143)
Remove Config from Autoloader by replacing it with a static array and a setter method.
Update render.php and setup.php to pass package directories to Autoloader.
Add test.

Co-authored-by: haszi <haszika80@gmail.com>
2024-07-09 19:52:23 +01:00
haszi
e948f1040f Add config as a dependency of format (#142)
* Add Config as a dependency to Format and all it subclasses

* Inject Config into every Format subclass at instantiation

---------

Co-authored-by: haszi <haszika80@gmail.com>
2024-07-07 15:58:51 +01:00
haszi
319ec94374 Convert Config in render.php
Instantiate a Config object at the beginning of the script and use that with non-static methods.
2024-06-21 02:50:44 +01:00
haszi
6ebe5fcac3 Remove superfluous database initialization (#128)
Remove superfluous database initialization as database is already initialized during the initialization of Indexing.

Co-authored-by: haszi <haszika80@gmail.com>
2024-05-22 16:18:19 +01:00
haszi
fc84db4987 Move all database access to IndexRepository (#126)
Move all database access to IndexRepository.
Use the same database during the entire indexing-rendering process.
Add a simple smoke test for render.php.

Co-authored-by: haszi <haszika80@gmail.com>
2024-05-20 13:19:31 +01:00
Gina Peter Banyard
b535eebcde Revert "Move all database access code to IndexRepository (#120)"
Still breaks the EN build on the doc rendering server

Indexing...
E_WARNING /local/src/phd/render.php:79 Undefined variable $config
PHP Fatal error:  Uncaught Error: Call to a member function render_ids() on null in /local/src/phd/render.php:79
Stack trace:
 0 /local/src/phd/render.php(129): phpdotnet\phd\make_reader()
 1 {main}   thrown in /local/src/phd/render.php on line 79

This reverts commit 71e6292050.
2024-05-14 00:28:54 +01:00
haszi
71e6292050 Move all database access code to IndexRepository (#120)
Use the same IndexRepository instance everywhere

Co-authored-by: haszi <haszika80@gmail.com>
2024-05-13 23:48:20 +01:00
haszi
415ff438a2 Add directory creation back to render.php with the same output as in Options Handler (#124)
Co-authored-by: haszi <haszika80@gmail.com>
2024-05-10 14:57:22 +01:00
haszi
5c462401bd Remove output directory creation from render.php (#119)
Co-authored-by: haszi <haszika80@gmail.com>
2024-04-28 04:06:57 +01:00
Gina Peter Banyard
f93552ad86 Revert "Use the same indexing database throughout (#118)"
This doesn't seem to create the DB properly and is failing the builds.

This reverts commit ef13e91f06.
2024-04-25 22:38:34 +01:00
haszi
ef13e91f06 Use the same indexing database throughout (#118)
Co-authored-by: haszi <haszika80@gmail.com>
2024-04-25 16:31:56 +01:00
haszi
93a0c11828 Add file modification history to PHP doc pages (#115)
Co-authored-by: haszi <haszika80@gmail.com>
2024-04-20 15:23:32 +01:00
haszi
26bf0c610a Inject database dependency into constructor of Index
Add new IndexRepository class to handle all database access.
Inject IndexRepository as a dependency into the constructor of Index and use that instead of directly accessing the database.
Add basic indexing test.
Fix existing test that uses indexing to use IndexRepository.
2024-04-16 11:23:53 +01:00
haszi
765370f528 Move requireIndexing method out of Index
Move requireIndexing method out of Index.
Pass dependencies to requireIndex as parameters.
2024-04-16 11:23:53 +01:00
haszi
e817ea8c42 Refactor Partial Reader
Inject all dependencies in the constructor.
Add parameter and return type hints.
Remove unused variables.
Add test.
2024-04-16 11:13:06 +01:00
haszi
e6e6847d7b Refactor Options Parser and default Options Handler (#110)
* Refactor Options Parser and default Options Handler

Refactor default Options Handler to accept dependencies through its constructor.
Refactor default Options Handler to return an array of options instead of directly setting options in Config and declare array return types.
Refactor method in Options Parser to return an array of options and declare its return type as array.
Inject all necessary dependencies in render.php.
Refactor two methods in default Options Handler by using match expressions.

* Minor refactor of files used in tests

Inlcude Config with require_once instead of require in Autloader.
Define __INSTALLDIR__ only if it is not defined yet in render.php.
Include Autoloader and functions.php with require_once instead of require.
Remove unnecessary __PHPDIR__ constant, correct path for __INSTALLDIR__ and use that constant in setup.php.

* Remove var_dump from Options Parser

* Fix inconsistent option flags in default Option Handler

* Add default Options Handler tests

---------

Co-authored-by: haszi <haszika80@gmail.com>
2024-03-17 18:29:43 +00:00
haszi
efea0458c0 Refactor Options Handler, Interface and Parser (#107)
Co-authored-by: haszi <haszika80@gmail.com>
2024-03-07 14:29:57 +00:00
haszi
e5b8bf35a9 Remove file ending comment blocks (#92)
Co-authored-by: haszi <haszika80@gmail.com>
2024-02-08 12:46:21 +00:00
Niels Dossche
619c1c1a68 Set LIBXML_PARSEHUGE (#78) 2023-07-31 16:39:53 +01:00
Peter Cowburn
9544a6b72b make objectstorage::attach() compatible with splobjectstorage::attach()
PhD's ObjectStorage::attach() method does not respect the declared
return type from its parent class (SplObjectStorage): the latter
declares the return type as void.

It is currently mitigated via the #[\ReturnTypeWillChange] attribute.

This commit removes that attribute and instead aligns the return type
declaration (to return void), with associated fixes to not return
anything and not try to use a return value.

Since declaring a void return type is only allowed as of PHP 7.1.0, this
raises the minimum required PHP version for phd to that version. Since
PHP 7.1 is super ancient and even PHP 7.3 will become EOL in a few weeks
(at the time of writing) I'm making the executive decision that
requiring 7.1 is fine. :-)
2021-10-29 23:34:41 +01:00
Peter Cowburn
ac96ed9458 add source details to PHP-Web pages (#55) 2021-08-13 12:12:31 +01:00
Peter Kokot
3564283891 Sync final newlines
This patch adds some missing newlines and trims multiple redundant
newlines into a single newline.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-02 06:23:33 +02:00
Peter Kokot
0ca596e64e Trim trailing whitespace 2018-10-02 06:13:46 +02:00
Sobak
aecae4e2c3 Eliminate $ comments 2015-03-09 06:20:39 +01:00
Wing
b8faf2a715 Fix pear doesn't escape \n, \x, ... issue 2014-07-15 10:13:13 +08:00
Hannes Magnusson
6fe84dbd58 Only index the stuff within the partial scope
# This takes rendering book.mysqli down to 7seconds (including indexing)
2011-04-24 09:58:39 +00:00
Richard Quadling
03def3cb58 Allow output directories to be a nested directory. 2011-04-01 16:00:11 +00:00
Richard Quadling
8e9d5c0d65 Added --quit option to quit after processing command line params. Useful when used with --saveconfig to just save the config. 2011-03-16 12:38:23 +00:00
Moacir de Oliveira Miranda Júnior
dfe724d9d0 Using VERBOSE_MESSAGES instead of E_USER_ERROR when logging the output dir creation 2011-03-07 12:35:10 +00:00
Richard Quadling
e3d385e3fb Reorder config loading message so that the message is displayed after the configuration is loaded. 2011-02-03 18:07:01 +00:00
Moacir de Oliveira Miranda Júnior
e832bd9782 adding support for package options 2010-09-09 02:37:28 +00:00
Moacir de Oliveira Miranda Júnior
3678d2acaa removing require Config.php from render, let the Autoloader do it 2010-05-07 19:19:35 +00:00
Paul Jones
435bbad5ef Config::init() now adds the include_path to the package_dirs so that custom packages are recognized. 2010-04-30 16:33:29 +00:00
Hannes Magnusson
d2be54f91b - Add a new verbose level 'messages' (enabled by default)
- Add the possibility to generate a 'phd.config.php' config file (--saveconfig).
  If that file exists in cwd then it will be read and used
  (command line arguments will overwrite the config file though)
- Add a new config option, 'package_dirs'. Used to specify the directory locations to use for autoloading
2010-04-29 19:16:10 +00:00
Hannes Magnusson
2e4270d41c Fixed bug#50668 (add xinclude processing in phd) (Shahar Evron) 2010-01-05 13:23:02 +00:00
Hannes Magnusson
329b9be0dc - Move the autoloader into its own class
- Only autoload classes from our namespace
2009-12-08 19:09:37 +00:00
Hannes Magnusson
2fba999fd3 - Kill double slashes in paths
- Use DIRECTORAKLÆDJFA for consistency
- no point in having a instance of BOP arround
2009-12-08 19:01:07 +00:00
Richard Quadling
23cc38fe0f Make calls to v() consistent by using sprintf() format. 2009-11-05 11:14:27 +00:00
Daniel Convissor
d6d67be2ef use v() instead of exception if file does not exist. 2009-10-30 20:53:27 +00:00
Daniel Convissor
9374d3fde4 Suppress fopen warnings with @. Add comment as to why using fopen at all. 2009-10-30 20:41:42 +00:00
Christian Weiske
f2b4be3953 fopen(,,true) uses include path - is_readable not!
Revert "use is_readable instead of fopen to test file existence because does not produce warning and uses less resources"

This reverts commit b293464a9a7850d1ed9cd2aa9fa30d4b45c39606.
2009-10-30 14:33:34 +00:00
Daniel Convissor
df682b3e53 use is_readable instead of fopen to test file existence because does not produce warning and uses less resources 2009-10-30 14:25:26 +00:00
Christian Weiske
8843ed37bd we do not install into phd/ 2009-09-08 21:18:54 +00:00
Hannes Magnusson
54472d6e36 Make it possible to install via pear 2009-09-04 14:30:50 +00:00