Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
#!/usr/bin/env php
2
<?php declare(strict_types=1);
3
/*
4
 * This file is part of resource-operations.
5
 *
6
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
 
12
$functions         = require __DIR__ . '/FunctionSignatureMap.php';
13
$resourceFunctions = [];
14
 
15
foreach ($functions as $function => $arguments) {
16
    foreach ($arguments as $argument) {
17
        if (strpos($argument, '?') === 0) {
18
            $argument = substr($argument, 1);
19
        }
20
 
21
        if ($argument === 'resource') {
22
            $resourceFunctions[] = explode('\'', $function)[0];
23
        }
24
    }
25
}
26
 
27
$resourceFunctions = array_unique($resourceFunctions);
28
sort($resourceFunctions);
29
 
30
$buffer = <<<EOT
31
<?php declare(strict_types=1);
32
/*
33
 * This file is part of resource-operations.
34
 *
35
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
36
 *
37
 * For the full copyright and license information, please view the LICENSE
38
 * file that was distributed with this source code.
39
 */
40
namespace SebastianBergmann\ResourceOperations;
41
 
42
final class ResourceOperations
43
{
44
    /**
45
     * @return string[]
46
     */
47
    public static function getFunctions(): array
48
    {
49
        return [
50
 
51
EOT;
52
 
53
foreach ($resourceFunctions as $function) {
54
    $buffer .= sprintf("            '%s',\n", $function);
55
}
56
 
57
$buffer .= <<< EOT
58
        ];
59
    }
60
}
61
 
62
EOT;
63
 
64
file_put_contents(__DIR__ . '/../src/ResourceOperations.php', $buffer);
65