
| Current Path : /var/www/html/strat/vendor/chi-teck/drupal-code-generator/src/Asset/Resolver/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/strat/vendor/chi-teck/drupal-code-generator/src/Asset/Resolver/PrependResolver.php |
<?php
declare(strict_types=1);
namespace DrupalCodeGenerator\Asset\Resolver;
use DrupalCodeGenerator\Asset\Asset;
use DrupalCodeGenerator\Asset\File;
final class PrependResolver implements ResolverInterface {
/**
* {@inheritdoc}
*/
public function resolve(Asset $asset, string $path): File {
if (!$asset instanceof File) {
throw new \InvalidArgumentException('Wrong asset type.');
}
$new_content = $asset->getContent();
$existing_content = \file_get_contents($path);
return clone $asset->content($new_content . "\n" . $existing_content);
}
}