PHP Classes

File: tests/bootstrap.php

Recommend this page to a friend!
  Classes of Jericko Tejido   Geodesy PHP   tests/bootstrap.php   Download  
File: tests/bootstrap.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Geodesy PHP
Get distance between places with their coordinates
Author: By
Last change:
Date: 6 years ago
Size: 697 bytes
 

Contents

Class file image Download
<?php

error_reporting
(E_ALL);
ini_set('display_startup_errors', 1);

include(
__DIR__.'/../autoload.php');

// tests autoloader
spl_autoload_register(function ($className) {
   
$className = ltrim($className,'\\');
   
$fileName = __DIR__.DIRECTORY_SEPARATOR;
   
$namespace = '';
   
$lastNsPos = strrpos($className,'\\');
    if (
$lastNsPos!==false) {
       
$namespace = substr($className,0,$lastNsPos);
       
$className = substr($className,$lastNsPos+1);
       
$fileName .= str_replace('\\',DIRECTORY_SEPARATOR,$namespace).DIRECTORY_SEPARATOR;
    }
   
$fileName .= str_replace('_',DIRECTORY_SEPARATOR,$className).'.php';

    if (
file_exists($fileName))
        require(
$fileName);
});