Файловый менеджер - Редактировать - /var/www/html/mediawiki-1.43.1/extensions/FileImporter/src/Data/TextRevisions.php
Ðазад
<?php namespace FileImporter\Data; use Wikimedia\Assert\Assert; /** * @license GPL-2.0-or-later * @author Addshore */ class TextRevisions { /** @var TextRevision[] */ private array $textRevisions; /** @var int|null */ private $latestKey = null; /** * @param TextRevision[] $textRevisions */ public function __construct( array $textRevisions ) { Assert::parameter( $textRevisions !== [], '$textRevisions', 'cannot be empty' ); Assert::parameterElementType( TextRevision::class, $textRevisions, '$textRevisions' ); $this->textRevisions = $textRevisions; } /** * @return TextRevision[] */ public function toArray(): array { return $this->textRevisions; } /** * @return TextRevision|null */ public function getLatest() { $this->latestKey ??= $this->calculateLatestKey(); return $this->latestKey !== null ? $this->textRevisions[$this->latestKey] : null; } private function calculateLatestKey(): ?int { $latestTimestamp = 0; $latestKey = null; foreach ( $this->textRevisions as $key => $revision ) { $timestamp = strtotime( $revision->getField( 'timestamp' ) ); if ( $latestTimestamp < $timestamp ) { $latestTimestamp = $timestamp; $latestKey = $key; } } return $latestKey; } }
| ver. 1.1 | |
.
| PHP 8.4.18 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка