api de gestion de ticket, basé sur php-crud-api. Le but est de décorrélé les outils de gestion des données, afin
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

build.php 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. function runDir(String $base, String $dir, array &$lines): int
  3. {
  4. $count = 0;
  5. $entries = scandir($dir);
  6. sort($entries);
  7. foreach ($entries as $entry) {
  8. if ($entry === '.' || $entry === '..') {
  9. continue;
  10. }
  11. $filename = "$base/$dir/$entry";
  12. if (is_dir($filename)) {
  13. $count += runDir($base, "$dir/$entry", $lines);
  14. }
  15. }
  16. foreach ($entries as $entry) {
  17. $filename = "$base/$dir/$entry";
  18. if (is_file($filename)) {
  19. if (substr($entry, -4) != '.php') {
  20. continue;
  21. }
  22. $data = file_get_contents($filename);
  23. array_push($lines, "// file: $dir/$entry");
  24. foreach (explode("\n", $data) as $line) {
  25. if (!preg_match('/^<\?php|^namespace |^use |spl_autoload_register|declare\s*\(\s*strict_types\s*=\s*1|^\s*\/\//', $line)) {
  26. array_push($lines, $line);
  27. }
  28. }
  29. $count++;
  30. }
  31. }
  32. return $count;
  33. }
  34. function addHeader(array &$lines)
  35. {
  36. $head = <<<EOF
  37. <?php
  38. /**
  39. * PHP-CRUD-API v2 License: MIT
  40. * Maurits van der Schee: maurits@vdschee.nl
  41. * https://github.com/mevdschee/php-crud-api
  42. **/
  43. namespace Tqdev\PhpCrudApi;
  44. EOF;
  45. foreach (explode("\n", $head) as $line) {
  46. array_push($lines, $line);
  47. }
  48. }
  49. function run(String $base, String $dir, String $filename)
  50. {
  51. $lines = [];
  52. $start = microtime(true);
  53. addHeader($lines);
  54. $count = runDir($base, 'src/Psr', $lines);
  55. $count += runDir($base, 'src/Nyholm', $lines);
  56. $count += runDir($base, 'src/Tqdev', $lines);
  57. $data = implode("\n", $lines);
  58. $data = preg_replace('/\n\s*\n\s*\n/', "\n\n", $data);
  59. file_put_contents('tmp_' . $filename, $data);
  60. ob_start();
  61. include 'tmp_' . $filename;
  62. ob_end_clean();
  63. rename('tmp_' . $filename, $filename);
  64. $end = microtime(true);
  65. $time = ($end - $start) * 1000;
  66. echo sprintf("%d files combined in %d ms into '%s'\n", $count, $time, $filename);
  67. }
  68. run(__DIR__, 'src', 'api.php');