# auto-alt-text/2.4.0/src/App/Utilities/AssetsManager.php

Auto Alt Text, version 2.4.0. 37 lines.

- Page: https://pluginprobe.com/plugins/auto-alt-text/2.4.0/code/src/App/Utilities/AssetsManager.php
- Raw: https://pluginprobe.com/plugins/auto-alt-text/2.4.0/raw/src/App/Utilities/AssetsManager.php
- Modified: 2024-03-10T14:55:34+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/auto-alt-text/2.4.0/code/src/App/Utilities/AssetsManager.php#L10-L20`.

```php
<?php

namespace AATXT\App\Utilities;

final class AssetsManager
{
    public function __construct()
    {
    }

    public static function make(): AssetsManager
    {
        return new self();
    }

    public function getAssetUrl(string $filename, bool $isStyle = false): string
    {
        $manifestPath = AATXT_ABSPATH . '/dist/.vite/manifest.json';

        if (!file_exists($manifestPath)) {
            return '';
        }

        $manifest = json_decode(file_get_contents($manifestPath), true);

        $entry = $manifest[$filename] ?? null;

        if (!$entry) {
            return '';
        }
        $file = $isStyle && isset($entry['css']) ? $entry['css'][0] : $entry['file'];

        return AATXT_URL . 'dist/' . $file;
    }

}

```
