Server IP : 104.21.14.48 / Your IP : 18.226.150.95 [ 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 flags of a translation. */ class Flags implements JsonSerializable, Countable, IteratorAggregate { protected $flags = []; public static function __set_state(array $state): Flags { return new static(...$state['flags']); } public function __construct(string ...$flags) { if (!empty($flags)) { $this->add(...$flags); } } public function __debugInfo() { return $this->toArray(); } public function add(string ...$flags): self { foreach ($flags as $flag) { if (!$this->has($flag)) { $this->flags[] = $flag; } } sort($this->flags); return $this; } public function delete(string ...$flags): self { foreach ($flags as $flag) { $key = array_search($flag, $this->flags); if (is_int($key)) { array_splice($this->flags, $key, 1); } } return $this; } public function has(string $flag): bool { return in_array($flag, $this->flags, true); } public function jsonSerialize() { return $this->toArray(); } public function getIterator() { return new ArrayIterator($this->flags); } public function count(): int { return count($this->flags); } public function toArray(): array { return $this->flags; } public function mergeWith(Flags $flags): Flags { $merged = clone $this; $merged->add(...$flags->flags); return $merged; } }