file_path = $file_path; $this->start_line = $start_line; $this->last_line = $last_line; $this->lines = $lines; $this->file_size = $file_size; $this->last_modified = $last_modified; } /** * Convert object to array format. * * @since 1.0.0 * * @return array File content data as associative array. */ public function to_array() { return array( 'file_path' => $this->file_path, 'start' => $this->start_line, 'end' => $this->last_line, 'lines' => $this->lines, 'file_size' => $this->file_size, // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date -- I intentioanlly want to use the server's timezone. 'last_modified' => date( 'Y-m-d H:i:s', $this->last_modified ), ); } /** * Get file path. * * @since 1.0.0 * * @return string File path. */ public function get_file_path() { return $this->file_path; } /** * Get start line number. * * @since 1.0.0 * * @return int Start line number. */ public function get_start_line() { return $this->start_line; } /** * Get file lines. * * @since 1.0.0 * * @return array Array of file lines. */ public function get_lines() { return $this->lines; } /** * Get file size. * * @since 1.0.0 * * @return int File size in bytes. */ public function get_file_size() { return $this->file_size; } /** * Get last modified timestamp. * * @since 1.0.0 * * @return int Last modified timestamp. */ public function get_last_modified() { return $this->last_modified; } /** * Get last line number. * * @since 1.0.0 * * @return int Last line number. */ public function get_last_line() { return $this->last_line; } }