HEX
Server: Apache
System: Linux webd006.cluster128.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: zwafgyp (177615)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/zwafgyp/lacalita/wp-content/plugins/woo-poly-integration/src/Hyyan/WPI/Autoloader.php
<?php

/**
 * This file is part of the hyyan/woo-poly-integration plugin.
 * (c) Hyyan Abo Fakher <hyyanaf@gmail.com>.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Hyyan\WPI;

/**
 * Plugin Namespace Autoloader.
 *
 * @author Hyyan Abo Fakher <hyyanaf@gmail.com>
 */
final class Autoloader
{
    /**
     * @var string
     */
    private $base;

    /**
     * Construct the autoloader class.
     *
     * @param string $base the base path to use
     *
     * @throws \Exception when the autloader can not register itself
     */
    public function __construct($base)
    {
        $this->base = $base;
        spl_autoload_register(array($this, 'handle'), true, true);
    }

    /**
     * Handle autoloading.
     *
     * @param string $className class or inteface name
     *
     * @return bool true if class or interface exists , false otherwise
     */
    public function handle($className)
    {
        if (stripos($className, "Hyyan\WPI") === false) {
            return;
        }

        $filename = $this->base.str_replace('\\', '/', $className).'.php';
        if (file_exists($filename)) {
            require_once $filename;
            if (
                    class_exists($className) ||
                    interface_exists($className)
            ) {
                return true;
            }
        }

        return false;
    }
}