refactor: Cleanup git state - commit all staged changes

Major refactoring cleanup:
- Add new controller architecture (class-controller-*.php)
- Add new settings-v2 UI (views/settings-v2/)
- Add new CSS architecture (agentic-sidebar.css, tokens)
- Add esbuild build pipeline (scripts/build.js, package.json)
- Add composer dependencies (vendor/)
- Add frontend src directory (assets/js/src/index.jsx)
- Add documentation files
- Remove old/obsolete files (class-settings.php, old CSS)

This commits all pending changes from previous refactoring efforts.
This commit is contained in:
Dwindi Ramadhana
2026-06-17 05:27:58 +07:00
parent d3f142222c
commit 690991c526
7963 changed files with 941566 additions and 67372 deletions

View File

@@ -0,0 +1,34 @@
.. _extending:
Extend the library
==================
The model exposed by this library is closed for inheritance. We did this to ensure the model is stable and does not
change via external factors. The complexity of this project makes it hard to keep all the internal classes stable.
The model is designed to be cached and constructed very carefully to ensure performance and memory usage are optimal.
Metadata
--------
Metadata is a way to extend the model with additional information. We call this metadata, as all first class
elements in the reflected codebase are part of the model. Extra data can be added to these elements using metadata.
Elements supporting metadata are:
.. phpdoc:class-list:: [?(@.interfaces contains "\phpDocumentor\Reflection\Metadata\MetaDataContainer")]
.. phpdoc:name::
.. warning::
Adding metadata might break the posibilty to cache the model. Be carefull with circular references and large
objects. We do recommend to keep the metadata small and simple.
Continue reading :doc:`Creating your first metadata <meta-data>`_ to learn how to create your own metadata.
.. toctree::
:maxdepth: 1
:titlesonly:
:hidden:
meta-data

View File

@@ -0,0 +1,77 @@
Metadata
=====
The model of this library is as closed as possible.
Main reason is because consumers of the library should rely on cache.
A mutable and flexible interface of the model would most likely break the caching.
However after some time the users to this library started requesting for a more flexible format.
This is why metadata was introduced.
Create your first metadata
--------------------------
First step is to create your own metadata implementation.
.. code:: php
final class Hook implements \phpDocumentor\Reflection\Metadata\Metadata
{
private string $hook;
public function __construct(string $hook)
{
$this->hook = $hook;
}
public function key(): string
{
return "project-metadata";
}
public function hook(): string
{
return $this->hook;
}
}
.. note::
We do highly recommend to keep your metadata objects small.
When reflecting a large project the number of objects will grow fast.
Now we have an class that can be used it is time to create a :php:class:`\phpDocumentor\Reflection\Php\ProjectFactoryStrategy`.
Strategies are used to reflect nodes in the AST of `phpparser`_.
In the example below we are adding the Hook metadata to any functions containing a function call.
.. code:: php
use \phpDocumentor\Reflection\Php\Function;
final class HookStrategy implements \phpDocumentor\Reflection\Php\ProjectFactoryStrategy
{
public function matches(ContextStack $context, object $object): bool
{
return $this->context->peek() instanceof Function_ &&
$object instanceof \PhpParser\Node\Expr\FuncCall &&
((string)$object->name) === 'hook'
}
public function create(ContextStack $context, object $object, StrategyContainer $strategies): void
{
$method = $context->peek();
$method->addMetadata(new Hook($object->args[0]->value));
}
}
.. note::
To speed up the reflection of your project the default factory instance has a Noop strategy. This strategy will
ignore all statements that are not handled by any strategy. Keep this in mind when implementing your own strategies
especially the statements you are looking for are nested in other statements like a ``while`` loop.
Finally add your new strategy to the project factory.
.. code:: php
$factory = \phpDocumentor\Reflection\Php\ProjectFactory::createInstance();
$factory->addStrategy(new HookStrategy());
.. _phpparser: https://github.com/nikic/PHP-Parser/