PHP Classes

File: src/Phabstractic/falcraftLoad.php

Recommend this page to a friend!
  Classes of Asher Wolfstein   PHP Configuration Trait   src/Phabstractic/falcraftLoad.php   Download  
File: src/Phabstractic/falcraftLoad.php
Role: Auxiliary script
Content type: text/plain
Description: class loader
Class: PHP Configuration Trait
Load and save class configuration using a trait
Author: By
Last change:
Date: 7 years ago
Size: 1,039 bytes
 

Contents

Class file image Download
<?php

/**
 * Load PHP Files When Autoloader Doesn't Exist
 *
 * The following uses the patterns namespace to instantiate a registry object
 * and then check that registry object for the standard Falcraft AutoLoader
 * singleton, defined standard in the Loader/Bootstrap.php. These results are
 * cached, but can be refreshed later. If there is no loader we include
 * the files passed to the function.
 *
 * @param array $libraries files to load relative to this file
 * @param string $context the context of the file including
 * @param mixed $refresh refresh the loader contents with another value
 *
 */
function falcraftLoad(array $libraries, $context = 'global', $refresh = false)
{
    foreach (
$libraries as $include ) {
        if (
realpath( __DIR__ . str_replace( '/', DIRECTORY_SEPARATOR, $include ) ) === false )
            throw new \
RuntimeException( "falcraftLoad - $context: include $include not found" );
        require_once(
realpath( __DIR__ . str_replace('/', DIRECTORY_SEPARATOR, $include ) ) );
    }
   
}