Server IP : 172.67.157.199 / Your IP : 18.191.129.237 [ Web Server : Apache System : Linux b70eb322-3aee-0c53-7c82-0db91281f2c6.secureserver.net 6.1.90-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 2 12:09:22 EDT 2024 x86_64 User : root ( 0) PHP Version : 8.0.30.2 Disable Function : NONE Domains : 0 Domains MySQL : ON | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/wp-content/plugins/defender-security/vendor/gettext/gettext/src/ |
Upload File : |
<?php declare(strict_types = 1); namespace Gettext; use ArrayIterator; use Countable; use IteratorAggregate; use JsonSerializable; /** * Class to manage the references of a translation. */ class References implements JsonSerializable, Countable, IteratorAggregate { protected $references = []; public static function __set_state(array $state): References { $references = new static(); $references->references = $state['references']; return $references; } public function __debugInfo() { return $this->toArray(); } public function add(string $filename, int $line = null): self { $fileReferences = $this->references[$filename] ?? []; if (isset($line) && !in_array($line, $fileReferences)) { $fileReferences[] = $line; } $this->references[$filename] = $fileReferences; return $this; } public function jsonSerialize() { return $this->toArray(); } public function getIterator() { return new ArrayIterator($this->references); } public function count(): int { return array_reduce($this->references, function ($carry, $item) { return $carry + (count($item) ?: 1); }, 0); } public function toArray(): array { return $this->references; } public function mergeWith(References $references): References { $merged = clone $this; foreach ($references as $filename => $lines) { //Set filename always to string $filename = (string) $filename; if (empty($lines)) { $merged->add($filename); continue; } foreach ($lines as $line) { $merged->add($filename, $line); } } return $merged; } }