54 if ( !file_exists( self::CREDITS ) ) {
58 $lines = explode(
"\n", file_get_contents( self::CREDITS ) );
59 foreach ( $lines as $line ) {
62 $inHeader = $line !== self::START_CONTRIBUTORS;
63 } elseif ( $inFooter ) {
65 } elseif ( $line === self::END_CONTRIBUTORS ) {
69 $name = substr( $line, 2 );
70 $contributors[$name] =
true;
75 $lines = explode(
"\n", (
string)shell_exec(
'git log --format="%aN"' ) );
76 foreach ( $lines as $line ) {
80 if ( str_starts_with( $line,
'[BOT]' ) ) {
83 $contributors[$line] =
true;
86 $contributors = array_keys( $contributors );
87 $collator = Collator::create(
'root' );
88 $collator->setAttribute( Collator::NUMERIC_COLLATION, Collator::ON );
89 $collator->sort( $contributors );
90 array_walk( $contributors,
static function ( &$v, $k ) {
96 implode(
"\n", array_merge( $header, $contributors, $footer ) )
99 $this->
output(
"Done! CREDITS file updated\n" );