42 if ( !file_exists( self::CREDITS ) ) {
46 $lines = explode(
"\n", file_get_contents( self::CREDITS ) );
47 foreach ( $lines as $line ) {
50 $inHeader = $line !== self::START_CONTRIBUTORS;
51 } elseif ( $inFooter ) {
53 } elseif ( $line === self::END_CONTRIBUTORS ) {
57 $name = substr( $line, 2 );
58 $contributors[$name] =
true;
63 $lines = explode(
"\n", (
string)shell_exec(
'git log --format="%aN"' ) );
64 foreach ( $lines as $line ) {
68 if ( str_starts_with( $line,
'[BOT]' ) ) {
71 $contributors[$line] =
true;
74 $contributors = array_keys( $contributors );
75 $collator = Collator::create(
'root' );
76 $collator->setAttribute( Collator::NUMERIC_COLLATION, Collator::ON );
77 $collator->sort( $contributors );
78 array_walk( $contributors,
static function ( &$v, $k ) {
84 implode(
"\n", array_merge( $header, $contributors, $footer ) )
87 $this->
output(
"Done! CREDITS file updated\n" );