<?php

namespace Velis\App;

use Velis\App;

/**
 * @author Jan Małysiak <jan.malysiak@velistech.com>
 */
class LoaderFactory
{
    /**
     * @return Loader
     */
    public function createLoader(): Loader
    {
        $version = App::getPhalconMajorVersion();
        if ($version >= PhalconVersion::PHALCON5) {
            $wrapped = new \Phalcon\Autoload\Loader();
        } else {
            $wrapped = new \Phalcon\Loader();
        }

        return new Loader($wrapped, $version);
    }
}
