1.0.0 Alpha Release #59
1 changed files with 30 additions and 1 deletions
|
@ -8,13 +8,16 @@
|
||||||
use ncc\Abstracts\CompilerExtensions;
|
use ncc\Abstracts\CompilerExtensions;
|
||||||
use ncc\Abstracts\Versions;
|
use ncc\Abstracts\Versions;
|
||||||
use ncc\Classes\PhpExtension\PhpRuntime;
|
use ncc\Classes\PhpExtension\PhpRuntime;
|
||||||
|
use ncc\Exceptions\ConstantReadonlyException;
|
||||||
use ncc\Exceptions\ImportException;
|
use ncc\Exceptions\ImportException;
|
||||||
|
use ncc\Exceptions\InvalidConstantNameException;
|
||||||
use ncc\Exceptions\PackageLockException;
|
use ncc\Exceptions\PackageLockException;
|
||||||
use ncc\Exceptions\PackageNotFoundException;
|
use ncc\Exceptions\PackageNotFoundException;
|
||||||
use ncc\Exceptions\VersionNotFoundException;
|
use ncc\Exceptions\VersionNotFoundException;
|
||||||
use ncc\Managers\PackageManager;
|
use ncc\Managers\PackageManager;
|
||||||
use ncc\Objects\PackageLock\VersionEntry;
|
use ncc\Objects\PackageLock\VersionEntry;
|
||||||
use ncc\Objects\ProjectConfiguration\Dependency;
|
use ncc\Objects\ProjectConfiguration\Dependency;
|
||||||
|
use ncc\Runtime\Constants;
|
||||||
|
|
||||||
class Runtime
|
class Runtime
|
||||||
{
|
{
|
||||||
|
@ -133,7 +136,6 @@
|
||||||
throw new ImportException(sprintf('Failed to import package %s', $package), $e);
|
throw new ImportException(sprintf('Failed to import package %s', $package), $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
self::addImport($package, $version);
|
self::addImport($package, $version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,4 +178,31 @@
|
||||||
{
|
{
|
||||||
return array_keys(self::$imported_packages);
|
return array_keys(self::$imported_packages);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a registered constant
|
||||||
|
*
|
||||||
|
* @param string $package
|
||||||
|
* @param string $name
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
|
public static function getConstant(string $package, string $name): ?string
|
||||||
|
{
|
||||||
|
return Constants::get($package, $name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a new constant
|
||||||
|
*
|
||||||
|
* @param string $package
|
||||||
|
* @param string $name
|
||||||
|
* @param string $value
|
||||||
|
* @return void
|
||||||
|
* @throws ConstantReadonlyException
|
||||||
|
* @throws InvalidConstantNameException
|
||||||
|
*/
|
||||||
|
public static function setConstant(string $package, string $name, string $value): void
|
||||||
|
{
|
||||||
|
Constants::register($package, $name, $value);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue