Microweber\Utils\Import::__construct PHP Method

__construct() public method

public __construct ( $app = null )
    public function __construct($app = null)
    {
        spl_autoload_register(function ($class) {
            $prefix = 'QueryPath';
            if (!substr($class, 0, 8) === $prefix) {
                return;
            }
            $class = substr($class, strlen($prefix));
            $location = __DIR__ . '/lib/QueryPath' . str_replace('\\', '/', $class) . '.php';
            if (is_file($location)) {
                require_once $location;
            }
        });
        if (!defined('USER_IP')) {
            if (isset($_SERVER['REMOTE_ADDR'])) {
                define('USER_IP', $_SERVER['REMOTE_ADDR']);
            } else {
                define('USER_IP', '127.0.0.1');
            }
        }
        if (is_object($app)) {
            $this->app = $app;
        } else {
            $this->app = mw();
        }
    }