| | } |
| | |
| | - private function extractAuthorAndTime( string $data, string $pattern |
| | - ): array { |
| | + private function extractAuthorAndTime( string $data, string $pattern ): array { |
| | $matches = []; |
| | $found = preg_match( $pattern, $data, $matches ); |
| | $author = $found ? trim( $matches[1] ) : ''; |
| | - $timestamp = $found && isset( $matches[3] ) |
| | - ? (int)$matches[3] |
| | - : $found && isset( $matches[2] ? (int)$matches[2] : 0 ); |
| | + |
| | + // Clean up the logic to check indices safely |
| | + $timestamp = 0; |
| | + |
| | + if( $found ) { |
| | + if( isset( $matches[3] ) ) { |
| | + $timestamp = (int)$matches[3]; |
| | + } elseif( isset( $matches[2] ) ) { |
| | + $timestamp = (int)$matches[2]; |
| | + } |
| | + } |
| | |
| | return [ $author, $timestamp ]; |