Repository: phpDocumentor/phpDocumentor (language: php)

Issue:
Disable application cache with `APP_CACHE_DIR` and `APP_LOG_DIR` ?
Hello,

I'm in the process of integrating `phpDocumentor` into Nix. While a detailed explanation of how Nix functions isn't necessary for this discussion, don't hesitate to ask any questions in the thread if this is not the case, I'll be glad to answer them.

When `phpDocumentor` is installed using Nix, the files are placed into an immutable (read-only) store. This results in all files and directories of the application being read-only.

As `phpDocumentor` is a Symfony-based application, it necessitates the creation of a `var/` directory to store cache when running.

Users can modify the cache directory by altering the `APP_CACHE_DIR` environment variable, and the log directory by changing the `APP_LOG_DIR` variable.

I've attempted to run `phpDocumentor` while adjusting the location of these variables. However, it persistently defaults to using `var/`.

This make sense since it is hardcoded in [`kernel.php`](https://github.com/phpDocumentor/phpDocumentor/blob/master/src/phpDocumentor/Kernel.php#L67).

In the default Symfony [kernel](https://github.com/symfony/symfony/blob/6.4/src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php#L107), those environment variables are not ignored.

I guess adding a very simple condition should fix the issue.

## Expected behavior

The application should use `APP_CACHE_DIR` and `APP_CACHE_LOG`.

## Actual behavior

The application keeps writing in its own `var/` directory and ignore `APP_CACHE_DIR` and `APP_CACHE_LOG`.

## Steps to reproduce the problem

You can test by yourself by doing:

```
APP_CACHE_DIR=/tmp/foo/cache APP_LOG_DIR=/tmp/foo/log ./bin/phpdoc
```

## Your environment

Linux

* Version used: 3.3.1
* Install method: git clone
* PHP version: 8.1
* Operating system and version (e.g. Ubuntu 20.04, Windows 10): NixOS 23.05



Discussion / hints:

Fix patch:
diff --git a/src/phpDocumentor/Kernel.php b/src/phpDocumentor/Kernel.php
index 5c742d4e6..9f2fa3b07 100644
--- a/src/phpDocumentor/Kernel.php
+++ b/src/phpDocumentor/Kernel.php
@@ -66,11 +66,19 @@ public function getWorkingDir(): string
 
     public function getCacheDir(): string
     {
+        if (isset($_SERVER['APP_CACHE_DIR'])) {
+            return $_SERVER['APP_CACHE_DIR'] . '/' . $this->environment;
+        }
+
         return $this->getProjectDir() . '/var/cache/' . $this->environment;
     }
 
     public function getLogDir(): string
     {
+        if (isset($_SERVER['APP_LOG_DIR'])) {
+            return $_SERVER['APP_LOG_DIR'];
+        }
+
         if (self::isPhar()) {
             return '/tmp/php-doc/log';
         }


Test patch: