File: update-suffix.php

package info (click to toggle)
php-embed 4.4.17-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,728 kB
  • sloc: php: 40,309; makefile: 23
file content (16 lines) | stat: -rw-r--r-- 517 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
declare(strict_types = 1);

require dirname(__DIR__).'/vendor/autoload.php';

use Brick\VarExporter\VarExporter;

$lines = file(__DIR__.'/suffix.dat', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$lines = array_filter($lines, fn ($line) => $line[0] !== '/');

file_put_contents(
    dirname(__DIR__).'/src/resources/suffix.php',
    sprintf("<?php\ndeclare(strict_types = 1);\n\nreturn %s;\n", VarExporter::export(array_values($lines), VarExporter::TRAILING_COMMA_IN_ARRAY))
);

echo 'Suffix saved'.PHP_EOL;