41 if ( !file_exists( self::CREDITS ) ) {
45 $lines = explode(
"\n", file_get_contents( self::CREDITS ) );
46 foreach ( $lines as $line ) {
49 $inHeader = $line !== self::START_CONTRIBUTORS;
50 } elseif ( $inFooter ) {
52 } elseif ( $line === self::END_CONTRIBUTORS ) {
56 $name = substr( $line, 2 );
57 $contributors[$name] =
true;
62 $lines = explode(
"\n", (
string)shell_exec(
'git log --format="%aN"' ) );
63 foreach ( $lines as $line ) {
67 if ( str_starts_with( $line,
'[BOT]' ) ) {
70 $contributors[$line] =
true;
73 $contributors = array_keys( $contributors );
74 $collator = Collator::create(
'root' );
75 $collator->setAttribute( Collator::NUMERIC_COLLATION, Collator::ON );
76 $collator->sort( $contributors );
77 array_walk( $contributors,
static function ( &$v, $k ) {
83 implode(
"\n", array_merge( $header, $contributors, $footer ) )
86 $this->
output(
"Done! CREDITS file updated\n" );