Update autoloader to only load a class if it has not already been loaded.

Hopefully this will help keep the memory usage down.

Signed-off-by: Se7enChat <e5dc7202134ade0d04c45466a5972470210b05f6@zoho.com>
<?php
namespace Se7enChat\src;

class Autoloader
{
    private $projectRoot;

    public function __construct($projectRoot)
    {
        $this->projectRoot = $projectRoot;
    }

    public function load()
    {
        // Load the libraries included by Composer.
        require __DIR__ . '/../vendor/autoload.php';

        spl_autoload_register(array($this, 'requireFile'));
    }

    private function requireFile($className)
    {
        $path = sprintf('%s%s.php',
            $this->projectRoot, str_replace('\\', '/', $className));
        if (preg_match('/^Se7enChat/', $className) && !class_exists($className)) {
            require $path;
        }
    }
}

<?php
namespace Se7enChat\src;

class Autoloader
{
    private $projectRoot;

    public function __construct($projectRoot)
    {
        $this->projectRoot = $projectRoot;
    }

    public function load()
    {
        // Load the libraries included by Composer.
        require __DIR__ . '/../vendor/autoload.php';

        spl_autoload_register(array($this, 'requireFile'));
    }

    private function requireFile($className)
    {
        $path = sprintf('%s%s.php',
            $this->projectRoot, str_replace('\\', '/', $className));
        if (preg_match('/^Se7enChat/', $className)) {
            require $path;
        }
    }
}
