PHP Classes

File: tests/bootstrap.php

Recommend this page to a friend!
  Classes of Jorge Castro   PHP AMP Page Generator   tests/bootstrap.php   Download  
File: tests/bootstrap.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: PHP AMP Page Generator
Generate HTML for using as Google AMP site
Author: By
Last change:
Date: 4 years ago
Size: 604 bytes
 

Contents

Class file image Download
<?php


   
function create_autoloader($prefix, $base_dir) {
        return function (
$class) use ($prefix, $base_dir) {
            if (
strncmp($prefix, $class, strlen($prefix)) !== 0) {
                return;
            }

           
$file = $base_dir . str_replace('\\', '/', substr($class, strlen($prefix))) . '.php';

            if (
file_exists($file)) {
                require
$file;
            }
        };
    }

   
spl_autoload_register(create_autoloader("eftec\\AmpGeneratorOne\\", __DIR__ . '/../lib/'));
   
spl_autoload_register(create_autoloader("eftec\\tests\\", __DIR__ . '/'));