HEX
Server: nginx/1.18.0
System: Linux oas2 6.8.0-1039-oracle #40~22.04.1-Ubuntu SMP Wed Oct 29 05:11:00 UTC 2025 aarch64
User: root (0)
PHP: 8.1.2-1ubuntu2.23
Disabled: NONE
Upload Files
File: /var/www/ecom/wp-content/plugins/payoneer-checkout/vendor/wp-oop/containers/src/Sites.php
<?php

declare (strict_types=1);
namespace Syde\Vendor\WpOop\Containers;

use Syde\Vendor\Dhii\Collection\ContainerInterface;
use Syde\Vendor\Psr\Container\NotFoundExceptionInterface;
use WP_Site;
use Syde\Vendor\WpOop\Containers\Exception\NotFoundException;
use Syde\Vendor\WpOop\Containers\Util\StringTranslatingTrait;
/**
 * Allows retrieval of WP site objects by ID.
 *
 * @package WpOop\Containers
 */
class Sites implements ContainerInterface
{
    use StringTranslatingTrait;
    /**
     * @inheritDoc
     *
     * @param string $id Identifier of the entry to look for.
     *
     * @return WP_Site The site for the specified ID.
     */
    public function get($id)
    {
        $id = intval($id);
        $site = get_site($id);
        if (!$site) {
            throw new NotFoundException((string) $id, $this->__('No site found for ID "%1$d"', [$id]), 0, null, $this);
        }
        return $site;
    }
    /**
     * @inheritDoc
     *
     * @param string $id Identifier of the entry to look for.
     */
    public function has($id)
    {
        /** @psalm-suppress InvalidCatch */
        try {
            $site = $this->get($id);
        } catch (NotFoundExceptionInterface $e) {
            return \false;
        }
        return \true;
    }
}