Updated autloader generation process

This commit is contained in:
Netkas 2022-08-11 14:04:33 -04:00
parent e52a05bc8f
commit 8f32ad0076
12 changed files with 297 additions and 162 deletions

View file

@ -1,7 +1,46 @@
autoload:
phpab --output src/ncc/autoload.php src/ncc
# Generates/creates all the autoloader files
make src/ncc/ThirdParty/defuse/php-encryption/autoload_spl.php
make src/ncc/ThirdParty/Symfony/polyfill-ctype/autoload_spl.php
make src/ncc/ThirdParty/Symfony/polyfill-mbstring/autoload_spl.php
make src/ncc/ThirdParty/Symfony/Process/autoload_spl.php
make src/ncc/ThirdParty/Symfony/uid/autoload_spl.php
make src/ncc/autoload_spl.php
cp src/autoload/autoload.php src/ncc/autoload.php
redist:
src/ncc/ThirdParty/defuse/php-encryption/autoload_spl.php:
phpab --output src/ncc/ThirdParty/defuse/php-encryption/autoload_spl.php \
src/ncc/ThirdParty/defuse/php-encryption
src/ncc/ThirdParty/Symfony/polyfill-ctype/autoload_spl.php:
phpab --output src/ncc/ThirdParty/Symfony/polyfill-ctype/autoload_spl.php \
src/ncc/ThirdParty/Symfony/polyfill-ctype
src/ncc/ThirdParty/Symfony/polyfill-mbstring/autoload_spl.php:
phpab --output src/ncc/ThirdParty/Symfony/polyfill-mbstring/autoload_spl.php \
src/ncc/ThirdParty/Symfony/polyfill-mbstring
src/ncc/ThirdParty/Symfony/Process/autoload_spl.php:
phpab --output src/ncc/ThirdParty/Symfony/Process/autoload_spl.php \
src/ncc/ThirdParty/Symfony/Process
src/ncc/ThirdParty/Symfony/uid/autoload_spl.php:
phpab --output src/ncc/ThirdParty/Symfony/uid/autoload_spl.php \
src/ncc/ThirdParty/Symfony/uid
src/ncc/autoload_spl.php:
phpab --output src/ncc/autoload_spl.php \
src/ncc/Abstracts \
src/ncc/CLI \
src/ncc/Exceptions \
src/ncc/Extensions \
src/ncc/Managers \
src/ncc/Objects \
src/ncc/Runtime \
src/ncc/Utilities \
src/ncc/ncc.php
redist: autoload
rm -rf build
mkdir build build/src
cp -rf src/ncc/* build/src
@ -10,7 +49,16 @@ redist:
cp LICENSE build/src/LICENSE
cp README.md build/src/README.md
cp src/installer/hash_check.php build/src/hash_check.php; php build/src/hash_check.php; rm build/src/hash_check.php
cp src/installer/generate_build_files.php build/src/generate_build_files.php; php build/src/generate_build_files.php; rm build/src/generate_build_files.php
tar:
rm -f build/ncc.tar.gz
cd build/src; tar -czvf ../ncc.tar.gz *
clean:
rm -rf build
rm -f src/ncc/autoload_spl.php
rm -f src/ncc/ThirdParty/defuse/php-encryption/autoload_spl.php
rm -f src/ncc/ThirdParty/Symfony/polyfill-ctype/autoload_spl.php
rm -f src/ncc/ThirdParty/Symfony/polyfill-mbstring/autoload_spl.php
rm -f src/ncc/ThirdParty/Symfony/Process/autoload_spl.php
rm -f src/ncc/ThirdParty/Symfony/uid/autoload_spl.php

32
src/autoload/autoload.php Normal file
View file

@ -0,0 +1,32 @@
<?php
/**
* NCC Autoloader file v1.0
*
* This file attempts to autoload all the required files for NCC and
* initialize NCC immediately, this file checks for initialization
* before proceeding to improve performance.
*/
if(defined('NCC_INIT') == false)
{
$third_party_path = __DIR__ . DIRECTORY_SEPARATOR . 'ThirdParty' . DIRECTORY_SEPARATOR;
$target_files = [
__DIR__ . DIRECTORY_SEPARATOR . 'autoload_spl.php',
$third_party_path . 'defuse' . DIRECTORY_SEPARATOR . 'php-encryption' . DIRECTORY_SEPARATOR . 'autoload_spl.php',
$third_party_path . 'Symfony' . DIRECTORY_SEPARATOR . 'polyfill-ctype' . DIRECTORY_SEPARATOR . 'autoload_spl.php',
$third_party_path . 'Symfony' . DIRECTORY_SEPARATOR . 'polyfill-mbstring' . DIRECTORY_SEPARATOR . 'autoload_spl.php',
$third_party_path . 'Symfony' . DIRECTORY_SEPARATOR . 'Process' . DIRECTORY_SEPARATOR . 'autoload_spl.php',
$third_party_path . 'Symfony' . DIRECTORY_SEPARATOR . 'uid' . DIRECTORY_SEPARATOR . 'autoload_spl.php',
];
foreach($target_files as $file)
{
require_once($file);
}
if(\ncc\ncc::initialize() == false)
{
trigger_error('NCC Failed to initialize', E_USER_WARNING);
}
}

View file

@ -0,0 +1,60 @@
<?php
// Check for NCC
if(!file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'autoload.php'))
{
print('Could not find \'autoload.php\', this script is intended to be executed during the redistribution process');
exit(1);
}
require(__DIR__ . DIRECTORY_SEPARATOR . 'autoload.php');
// Start script
function scanContents($dir, &$results = array())
{
$files = scandir($dir);
foreach ($files as $key => $value)
{
$path = realpath($dir . DIRECTORY_SEPARATOR . $value);
if (!is_dir($path))
{
$results[] = str_ireplace(__DIR__ . DIRECTORY_SEPARATOR, (string)null, $path);
}
else if ($value != '.' && $value != '..')
{
$results[] = str_ireplace(__DIR__ . DIRECTORY_SEPARATOR, (string)null, $path);
scanContents($path, $results);
}
}
return $results;
}
$excluded_files = [
'hash_check.php',
'generate_build_files.php',
'installer',
'checksum.bin'.
'build_files'
];
ncc\Utilities\Console::out('Creating build_files ...');
if(file_exists('build_files'))
{
unlink('build_files');
}
$build_files_content = [];
foreach(scanContents(__DIR__) as $path)
{
if(!in_array($path, $excluded_files))
{
$build_files_content[] = $path;
}
}
$build_files = fopen(__DIR__ . DIRECTORY_SEPARATOR . 'build_files', 'a+');
fwrite($build_files, implode("\n", $build_files_content));
fclose($build_files);
ncc\Utilities\Console::out('Created build_files');
exit(0);

View file

@ -33,7 +33,9 @@
$excluded_files = [
'hash_check.php',
'checksum.bin'
'generate_build_files.php',
'checksum.bin',
'build_files'
];
$hash_values = [];

View file

@ -11,12 +11,16 @@
# ------------------------------------------------------------------
<?PHP
// TODO: Check for root before proceeding
# Global Variables
$NCC_INSTALL_PATH='/etc/ncc';
$NCC_INSTALL_PATH='/etc/ncc-lib';
$NCC_DATA_PATH='/etc/ncc';
$NCC_UPDATE_SOURCE='https://updates.nosial.com/ncc/check_updates?current_version=$VERSION'; # Unused
$NCC_CHECKSUM=__DIR__ . DIRECTORY_SEPARATOR . 'checksum.bin';
$NCC_AUTOLOAD=__DIR__ . DIRECTORY_SEPARATOR . 'autoload.php';
// Require NCC
if(!file_exists($NCC_AUTOLOAD))
{
print('The file \'autoload.php\' was not found, installation cannot proceed.' . PHP_EOL);
@ -24,6 +28,20 @@
}
require($NCC_AUTOLOAD);
// Check for the required files
$required_files = [
'LICENSE',
'build_files'
];
foreach($required_files as $file)
{
if(!file_exists($file))
{
\ncc\Utilities\Console::outError('Missing file \'' . $file . '\', installation failed.', true, 1);
}
}
// Preform the checksum validation
if(!file_exists($NCC_CHECKSUM))
{
\ncc\Utilities\Console::outWarning('The file \'checksum.bin\' was not found, the contents of the program cannot be verified to be safe');
@ -37,7 +55,12 @@
foreach($checksum as $file => $hash)
{
if(hash_file('sha256', __DIR__ . DIRECTORY_SEPARATOR . $file) !== $hash)
if(file_exists(__DIR__ . DIRECTORY_SEPARATOR . $file) == false)
{
\ncc\Utilities\Console::outError('Cannot check file, \'' . $file . '\' not found.');
$checksum_failed = true;
}
elseif(hash_file('sha256', __DIR__ . DIRECTORY_SEPARATOR . $file) !== $hash)
{
\ncc\Utilities\Console::outWarning('The file \'' . $file . '\' does not match the original checksum');
$checksum_failed = true;
@ -55,6 +78,62 @@
}
}
// Check for required extensions
foreach(\ncc\Utilities\Validate::requiredExtensions() as $ext => $installed)
{
if(!$installed)
{
\ncc\Utilities\Console::outWarning('The extension \'' . $ext . '\' is not installed, compatibility without it is not guaranteed');
}
}
// Start of installer
\ncc\Utilities\Console::out('Started NCC installer');
// Determine the installation path
// TODO: Add the ability to change the data path as well
while(true)
{
$user_input = null;
$user_input = \ncc\Utilities\Console::getInput("Installation Path (Default: $NCC_INSTALL_PATH): ");
if(strlen($user_input) > 0)
{
if(file_exists($user_input))
{
if(file_exists($user_input . DIRECTORY_SEPARATOR . 'ncc'))
{
\ncc\Utilities\Console::out('NCC Seems to already be installed, the installer will repair/upgrade your current install');
break;
}
else
{
\ncc\Utilities\Console::outError('The given directory already exists, it must be deleted before proceeding');
}
}
else
{
break;
}
}
else
{
break;
}
}
\ncc\Utilities\Console::out("Note: This doesn't affect your current install of composer (if you have composer installed)");
$update_composer = \ncc\Utilities\Console::getBooleanInput('Do you want to install composer for NCC? (Recommended)');
// Prepare installation
if(file_exists($NCC_INSTALL_PATH))
{
// TODO: Implement recursive directory removal
}
mkdir($NCC_INSTALL_PATH);
mkdir($NCC_DATA_PATH);
// Install composer
// Install NCC
?>

View file

@ -17,4 +17,8 @@
const PythonVersionFormat = '/^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/';
const SemanticVersioning2 = '/^(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/m';
const UnixPath = '/^(((?:\.\/|\.\.\/|\/)?(?:\.?\w+\/)*)(\.?\w+\.?\w+))$/m';
const WindowsPath = '/^(([%][^\/:*?<>""|]*[%])|([a-zA-Z][:])|(\\\\))((\\\\{1})|((\\\\{1})[^\\\\]([^\/:*?<>""|]*))+)$/m';
}

View file

@ -176,8 +176,7 @@
print($prompt);
}
$handle = fopen ("php://stdin","r");
return fgets($handle);
return rtrim(fgets(STDIN), "\n");
}
/**
@ -209,15 +208,16 @@
{
if($display_options)
{
$r = self::getInput($prompt . ' (Y/N): ', false);
$r = self::getInput($prompt . ' (Y/N): ');
}
else
{
$r = self::getInput($prompt, false);
$r = self::getInput($prompt);
}
if(strlen($r) > 0)
{
print($r);
switch(strtoupper($r))
{
case '1':

View file

@ -155,4 +155,35 @@
return true;
}
/**
* Determines if a Unix filepath is valid
*
* @param $input
* @return bool
*/
public static function unixFilepath($input): bool
{
if(preg_match(RegexPatterns::UnixPath, $input))
{
return true;
}
return false;
}
/**
* Determines if a Windows filepath is valid
*
* @param $input
* @return bool
*/
public static function windowsFilepath($input): bool
{
if(preg_match(RegexPatterns::WindowsPath, $input))
{
return true;
}
return false;
}
}

View file

@ -1,143 +1,26 @@
<?php
// @codingStandardsIgnoreFile
// @codeCoverageIgnoreStart
// this is an autogenerated file - do not edit
spl_autoload_register(
function($class) {
static $classes = null;
if ($classes === null) {
$classes = array(
'ncc\\abstracts\\authenticationsource' => '/Abstracts/AuthenticationSource.php',
'ncc\\abstracts\\consolecolors' => '/Abstracts/ConsoleColors.php',
'ncc\\abstracts\\exceptioncodes' => '/Abstracts/ExceptionCodes.php',
'ncc\\abstracts\\nccbuildflags' => '/Abstracts/NccBuildFlags.php',
'ncc\\abstracts\\options\\initializeprojectoptions' => '/Abstracts/Options/InitializeProjectOptions.php',
'ncc\\abstracts\\regexpatterns' => '/Abstracts/RegexPatterns.php',
'ncc\\abstracts\\remoteauthenticationtype' => '/Abstracts/RemoteAuthenticationType.php',
'ncc\\abstracts\\remotesource' => '/Abstracts/RemoteSource.php',
'ncc\\abstracts\\scopes' => '/Abstracts/Scopes.php',
'ncc\\abstracts\\stringpaddingmethod' => '/Abstracts/StringPaddingMethod.php',
'ncc\\abstracts\\versions' => '/Abstracts/Versions.php',
'ncc\\cli\\credentialmenu' => '/CLI/CredentialMenu.php',
'ncc\\cli\\functions' => '/CLI/Functions.php',
'ncc\\cli\\helpmenu' => '/CLI/HelpMenu.php',
'ncc\\cli\\main' => '/CLI/Main.php',
'ncc\\cli\\projectmenu' => '/CLI/ProjectMenu.php',
'ncc\\defuse\\crypto\\core' => '/ThirdParty/defuse/php-encryption/Core.php',
'ncc\\defuse\\crypto\\crypto' => '/ThirdParty/defuse/php-encryption/Crypto.php',
'ncc\\defuse\\crypto\\derivedkeys' => '/ThirdParty/defuse/php-encryption/DerivedKeys.php',
'ncc\\defuse\\crypto\\encoding' => '/ThirdParty/defuse/php-encryption/Encoding.php',
'ncc\\defuse\\crypto\\exception\\badformatexception' => '/ThirdParty/defuse/php-encryption/Exception/BadFormatException.php',
'ncc\\defuse\\crypto\\exception\\cryptoexception' => '/ThirdParty/defuse/php-encryption/Exception/CryptoException.php',
'ncc\\defuse\\crypto\\exception\\environmentisbrokenexception' => '/ThirdParty/defuse/php-encryption/Exception/EnvironmentIsBrokenException.php',
'ncc\\defuse\\crypto\\exception\\ioexception' => '/ThirdParty/defuse/php-encryption/Exception/IOException.php',
'ncc\\defuse\\crypto\\exception\\wrongkeyormodifiedciphertextexception' => '/ThirdParty/defuse/php-encryption/Exception/WrongKeyOrModifiedCiphertextException.php',
'ncc\\defuse\\crypto\\file' => '/ThirdParty/defuse/php-encryption/File.php',
'ncc\\defuse\\crypto\\key' => '/ThirdParty/defuse/php-encryption/Key.php',
'ncc\\defuse\\crypto\\keyorpassword' => '/ThirdParty/defuse/php-encryption/KeyOrPassword.php',
'ncc\\defuse\\crypto\\keyprotectedbypassword' => '/ThirdParty/defuse/php-encryption/KeyProtectedByPassword.php',
'ncc\\defuse\\crypto\\runtimetests' => '/ThirdParty/defuse/php-encryption/RuntimeTests.php',
'ncc\\exceptions\\accessdeniedexception' => '/Exceptions/AccessDeniedException.php',
'ncc\\exceptions\\componentversionnotfoundexception' => '/Exceptions/ComponentVersionNotFoundException.php',
'ncc\\exceptions\\constantreadonlyexception' => '/Exceptions/ConstantReadonlyException.php',
'ncc\\exceptions\\directorynotfoundexception' => '/Exceptions/DirectoryNotFoundException.php',
'ncc\\exceptions\\filenotfoundexception' => '/Exceptions/FileNotFoundException.php',
'ncc\\exceptions\\invalidcredentialsentryexception' => '/Exceptions/InvalidCredentialsEntryException.php',
'ncc\\exceptions\\invalidpackagenameexception' => '/Exceptions/InvalidPackageNameException.php',
'ncc\\exceptions\\invalidprojectconfigurationexception' => '/Exceptions/InvalidProjectConfigurationException.php',
'ncc\\exceptions\\invalidprojectnameexception' => '/Exceptions/InvalidProjectNameException.php',
'ncc\\exceptions\\invalidscopeexception' => '/Exceptions/InvalidScopeException.php',
'ncc\\exceptions\\invalidversionnumberexception' => '/Exceptions/InvalidVersionNumberException.php',
'ncc\\exceptions\\malformedjsonexception' => '/Exceptions/MalformedJsonException.php',
'ncc\\exceptions\\projectalreadyexistsexception' => '/Exceptions/ProjectAlreadyExistsException.php',
'ncc\\exceptions\\runtimeexception' => '/Exceptions/RuntimeException.php',
'ncc\\managers\\credentialmanager' => '/Managers/CredentialManager.php',
'ncc\\managers\\projectmanager' => '/Managers/ProjectManager.php',
'ncc\\ncc' => '/ncc.php',
'ncc\\ncc\\ziproto\\typetransformer\\binarytransformer' => '/Extensions/ZiProto/TypeTransformer/BinaryTransformer.php',
'ncc\\ncc\\ziproto\\typetransformer\\extension' => '/Extensions/ZiProto/TypeTransformer/Extension.php',
'ncc\\ncc\\ziproto\\typetransformer\\validator' => '/Extensions/ZiProto/TypeTransformer/Validator.php',
'ncc\\objects\\clihelpsection' => '/Objects/CliHelpSection.php',
'ncc\\objects\\constant' => '/Objects/Constant.php',
'ncc\\objects\\nccupdateinformation' => '/Objects/NccUpdateInformation.php',
'ncc\\objects\\nccversioninformation' => '/Objects/NccVersionInformation.php',
'ncc\\objects\\nccversioninformation\\component' => '/Objects/NccVersionInformation/Component.php',
'ncc\\objects\\projectconfiguration' => '/Objects/ProjectConfiguration.php',
'ncc\\objects\\projectconfiguration\\assembly' => '/Objects/ProjectConfiguration/Assembly.php',
'ncc\\objects\\projectconfiguration\\build' => '/Objects/ProjectConfiguration/Build.php',
'ncc\\objects\\projectconfiguration\\buildconfiguration' => '/Objects/ProjectConfiguration/BuildConfiguration.php',
'ncc\\objects\\projectconfiguration\\compiler' => '/Objects/ProjectConfiguration/Compiler.php',
'ncc\\objects\\projectconfiguration\\dependency' => '/Objects/ProjectConfiguration/Dependency.php',
'ncc\\objects\\projectconfiguration\\project' => '/Objects/ProjectConfiguration/Project.php',
'ncc\\objects\\vault' => '/Objects/Vault.php',
'ncc\\objects\\vault\\defaultentry' => '/Objects/Vault/DefaultEntry.php',
'ncc\\objects\\vault\\entry' => '/Objects/Vault/Entry.php',
'ncc\\runtime\\constants' => '/Runtime/Constants.php',
'ncc\\symfony\\component\\process\\exception\\exceptioninterface' => '/ThirdParty/Symfony/Process/Exception/ExceptionInterface.php',
'ncc\\symfony\\component\\process\\exception\\invalidargumentexception' => '/ThirdParty/Symfony/Process/Exception/InvalidArgumentException.php',
'ncc\\symfony\\component\\process\\exception\\logicexception' => '/ThirdParty/Symfony/Process/Exception/LogicException.php',
'ncc\\symfony\\component\\process\\exception\\processfailedexception' => '/ThirdParty/Symfony/Process/Exception/ProcessFailedException.php',
'ncc\\symfony\\component\\process\\exception\\processsignaledexception' => '/ThirdParty/Symfony/Process/Exception/ProcessSignaledException.php',
'ncc\\symfony\\component\\process\\exception\\processtimedoutexception' => '/ThirdParty/Symfony/Process/Exception/ProcessTimedOutException.php',
'ncc\\symfony\\component\\process\\exception\\runtimeexception' => '/ThirdParty/Symfony/Process/Exception/RuntimeException.php',
'ncc\\symfony\\component\\process\\executablefinder' => '/ThirdParty/Symfony/Process/ExecutableFinder.php',
'ncc\\symfony\\component\\process\\inputstream' => '/ThirdParty/Symfony/Process/InputStream.php',
'ncc\\symfony\\component\\process\\phpexecutablefinder' => '/ThirdParty/Symfony/Process/PhpExecutableFinder.php',
'ncc\\symfony\\component\\process\\phpprocess' => '/ThirdParty/Symfony/Process/PhpProcess.php',
'ncc\\symfony\\component\\process\\pipes\\abstractpipes' => '/ThirdParty/Symfony/Process/Pipes/AbstractPipes.php',
'ncc\\symfony\\component\\process\\pipes\\pipesinterface' => '/ThirdParty/Symfony/Process/Pipes/PipesInterface.php',
'ncc\\symfony\\component\\process\\pipes\\unixpipes' => '/ThirdParty/Symfony/Process/Pipes/UnixPipes.php',
'ncc\\symfony\\component\\process\\pipes\\windowspipes' => '/ThirdParty/Symfony/Process/Pipes/WindowsPipes.php',
'ncc\\symfony\\component\\process\\process' => '/ThirdParty/Symfony/Process/Process.php',
'ncc\\symfony\\component\\process\\processutils' => '/ThirdParty/Symfony/Process/ProcessUtils.php',
'ncc\\symfony\\component\\uid\\abstractuid' => '/ThirdParty/Symfony/uid/AbstractUid.php',
'ncc\\symfony\\component\\uid\\binaryutil' => '/ThirdParty/Symfony/uid/BinaryUtil.php',
'ncc\\symfony\\component\\uid\\factory\\namebaseduuidfactory' => '/ThirdParty/Symfony/uid/Factory/NameBasedUuidFactory.php',
'ncc\\symfony\\component\\uid\\factory\\randombaseduuidfactory' => '/ThirdParty/Symfony/uid/Factory/RandomBasedUuidFactory.php',
'ncc\\symfony\\component\\uid\\factory\\timebaseduuidfactory' => '/ThirdParty/Symfony/uid/Factory/TimeBasedUuidFactory.php',
'ncc\\symfony\\component\\uid\\factory\\ulidfactory' => '/ThirdParty/Symfony/uid/Factory/UlidFactory.php',
'ncc\\symfony\\component\\uid\\factory\\uuidfactory' => '/ThirdParty/Symfony/uid/Factory/UuidFactory.php',
'ncc\\symfony\\component\\uid\\nilulid' => '/ThirdParty/Symfony/uid/NilUlid.php',
'ncc\\symfony\\component\\uid\\niluuid' => '/ThirdParty/Symfony/uid/NilUuid.php',
'ncc\\symfony\\component\\uid\\ulid' => '/ThirdParty/Symfony/uid/Ulid.php',
'ncc\\symfony\\component\\uid\\uuid' => '/ThirdParty/Symfony/uid/Uuid.php',
'ncc\\symfony\\component\\uid\\uuidv1' => '/ThirdParty/Symfony/uid/UuidV1.php',
'ncc\\symfony\\component\\uid\\uuidv3' => '/ThirdParty/Symfony/uid/UuidV3.php',
'ncc\\symfony\\component\\uid\\uuidv4' => '/ThirdParty/Symfony/uid/UuidV4.php',
'ncc\\symfony\\component\\uid\\uuidv5' => '/ThirdParty/Symfony/uid/UuidV5.php',
'ncc\\symfony\\component\\uid\\uuidv6' => '/ThirdParty/Symfony/uid/UuidV6.php',
'ncc\\symfony\\polyfill\\ctype\\ctype' => '/ThirdParty/Symfony/polyfill-ctype/Ctype.php',
'ncc\\symfony\\polyfill\\mbstring\\mbstring' => '/ThirdParty/Symfony/polyfill-mbstring/Mbstring.php',
'ncc\\utilities\\console' => '/Utilities/Console.php',
'ncc\\utilities\\functions' => '/Utilities/Functions.php',
'ncc\\utilities\\pathfinder' => '/Utilities/PathFinder.php',
'ncc\\utilities\\resolver' => '/Utilities/Resolver.php',
'ncc\\utilities\\security' => '/Utilities/Security.php',
'ncc\\utilities\\validate' => '/Utilities/Validate.php',
'ncc\\ziproto\\abstracts\\options' => '/Extensions/ZiProto/Abstracts/Options.php',
'ncc\\ziproto\\abstracts\\regex' => '/Extensions/ZiProto/Abstracts/Regex.php',
'ncc\\ziproto\\bufferstream' => '/Extensions/ZiProto/BufferStream.php',
'ncc\\ziproto\\decodingoptions' => '/Extensions/ZiProto/DecodingOptions.php',
'ncc\\ziproto\\encodingoptions' => '/Extensions/ZiProto/EncodingOptions.php',
'ncc\\ziproto\\exception\\decodingfailedexception' => '/Extensions/ZiProto/Exception/DecodingFailedException.php',
'ncc\\ziproto\\exception\\encodingfailedexception' => '/Extensions/ZiProto/Exception/EncodingFailedException.php',
'ncc\\ziproto\\exception\\insufficientdataexception' => '/Extensions/ZiProto/Exception/InsufficientDataException.php',
'ncc\\ziproto\\exception\\integeroverflowexception' => '/Extensions/ZiProto/Exception/IntegerOverflowException.php',
'ncc\\ziproto\\exception\\invalidoptionexception' => '/Extensions/ZiProto/Exception/InvalidOptionException.php',
'ncc\\ziproto\\ext' => '/Extensions/ZiProto/Ext.php',
'ncc\\ziproto\\packet' => '/Extensions/ZiProto/Packet.php',
'ncc\\ziproto\\type\\binary' => '/Extensions/ZiProto/Type/Binary.php',
'ncc\\ziproto\\type\\map' => '/Extensions/ZiProto/Type/Map.php',
'ncc\\ziproto\\typetransformer\\maptransformer' => '/Extensions/ZiProto/TypeTransformer/MapTransformer.php',
'ncc\\ziproto\\ziproto' => '/Extensions/ZiProto/ZiProto.php'
);
/**
* NCC Autoloader file v1.0
*
* This file attempts to autoload all the required files for NCC and
* initialize NCC immediately, this file checks for initialization
* before proceeding to improve performance.
*/
if(defined('NCC_INIT') == false)
{
// polyfill-mbstring
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'ThirdParty' . DIRECTORY_SEPARATOR . 'Symfony' . DIRECTORY_SEPARATOR . 'polyfill-mbstring' . DIRECTORY_SEPARATOR . 'bootstrap.php');
// polyfill-ctype
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'ThirdParty' . DIRECTORY_SEPARATOR . 'Symfony' . DIRECTORY_SEPARATOR . 'polyfill-ctype' . DIRECTORY_SEPARATOR . 'bootstrap.php');
// Generated SPL file
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'autoload_spl.php');
if(\ncc\ncc::initialize() == false)
{
trigger_error('NCC Failed to initialize', E_USER_WARNING);
}
$cn = strtolower($class);
if (isset($classes[$cn])) {
require __DIR__ . $classes[$cn];
}
},
true,
false
);
// @codeCoverageIgnoreEnd

View file

@ -1,7 +0,0 @@
<?php
// polyfill-mbstring
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'ThirdParty' . DIRECTORY_SEPARATOR . 'Symfony' . DIRECTORY_SEPARATOR . 'polyfill-mbstring' . DIRECTORY_SEPARATOR . 'bootstrap.php');
// polyfill-ctype
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'ThirdParty' . DIRECTORY_SEPARATOR . 'Symfony' . DIRECTORY_SEPARATOR . 'polyfill-ctype' . DIRECTORY_SEPARATOR . 'bootstrap.php');

View file

@ -39,10 +39,10 @@
*/
public static function getVersionInformation(bool $reload=False): NccVersionInformation
{
if(self::$VersionInformation !== null && $reload == False)
if(self::$VersionInformation !== null && !$reload)
return self::$VersionInformation;
if(file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'version.json') == false)
if(!file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'version.json'))
{
throw new RuntimeException('The file \'version.json\' was not found in \'' . __DIR__ . '\'');
}
@ -73,6 +73,8 @@
* Initializes the NCC environment
*
* @return bool
* @throws Exceptions\FileNotFoundException
* @throws RuntimeException
*/
public static function initialize(): bool
{
@ -97,12 +99,13 @@
* Returns the constants set by NCC
*
* @return array
* @throws RuntimeException
*/
public static function getConstants(): array
{
if(defined('NCC_INIT') == false)
{
throw new RuntimeException('NCC Must be initialized before executing ' . get_called_class() . '::getDefinitions()');
throw new RuntimeException('NCC Must be initialized before executing ' . get_called_class() . '::getConstants()');
}
return [