diff --git a/.idea/ncc.iml b/.idea/ncc.iml
index 2c5c861..f554332 100644
--- a/.idea/ncc.iml
+++ b/.idea/ncc.iml
@@ -8,6 +8,8 @@
+
+
diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md
index 629dfaa..d8f9515 100644
--- a/DOCUMENTATION.md
+++ b/DOCUMENTATION.md
@@ -9,10 +9,10 @@ NCC, from basic installation, basic usage, standards and much more.
- What is NCC?
- Advantages over other software
- ------------------------------------------------------------------------------------
+------------------------------------------------------------------------------------
-# Introduction (May 24, 2022)
+# Introduction
This section serves the basic introduction of NCC, what it's used for and how you can
use it in your own projects or use it to run and build other projects that are designed
diff --git a/README.md b/README.md
index 9e9d0cf..0f1c508 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ Nosial Code Compiler is a program written in PHP designed to be a multi-purpose
This program is a complete re-write of the now defunct [PHP Package Manager (PPM)](https://git.n64.cc/intellivoid/ppm)
toolkit offering more features, security and proper code licensing and copyrighting for the components used for the project.
-### Alpha Stage
+## Alpha Stage
NCC is currently in alpha stage, meaning that it's not fully functional and may not work on your system. If you find any bugs
or issues please report them to the [GitHub Issue Tracker](https://git.n64.cc/intellivoid/ncc/issues).
@@ -12,28 +12,12 @@ or issues please report them to the [GitHub Issue Tracker](https://git.n64.cc/in
At the moment NCC is currently being used while developing other software, this serves as a test run to
improve on changes for the next version.
-### Version History
+## Version History
- 1.0.0 Alpha - Initial release ([changelog](changelog/v1.0.0_alpha.md))
-## Authors
-
- - Zi Xing Narrakas (netkas) <[netkas@n64.cc](mailto:netkas@64.cc)>
-
-
-## Special Thanks
-
- - Marc Gutt (mgutt) <[marc@gutt.it](mailto:marc@gutt.it)>
- - Debusschère Alexandre ([debuss](https://github.com/debuss))
-
-
-## Copyright
-
-- Copyright (c) 2022-2022, Nosial - All Rights Reserved
-
-
-## Contributing
+# Contributing
We welcome contributions to NCC! If you have an idea for how to improve the project, please don't hesitate to reach out.
There are many ways to contribute, and we appreciate all forms of support.
@@ -41,11 +25,26 @@ There are many ways to contribute, and we appreciate all forms of support.
For more information on how to contribute, please read the [CONTRIBUTING.md](CONTRIBUTING.md) file.
-## Code of Conduct
+# Code of Conduct
We are committed to maintaining a welcoming and inclusive environment for all contributors. Please read and follow our
[Code of Conduct](CODE_OF_CONDUCT.md).
+# Authors
+
+- Zi Xing Narrakas (netkas) <[netkas@n64.cc](mailto:netkas@64.cc)>
+
+
+# Special Thanks
+
+- Marc Gutt (mgutt) <[marc@gutt.it](mailto:marc@gutt.it)>
+- Debusschère Alexandre ([debuss](https://github.com/debuss))
+
+
+# Copyright
+
+- Copyright (c) 2022-2023, Nosial - All Rights Reserved
+
# Licenses
diff --git a/src/ncc/Abstracts/ConstantReferences.php b/src/ncc/Abstracts/ConstantReferences.php
index 43cf7ae..b2b7303 100644
--- a/src/ncc/Abstracts/ConstantReferences.php
+++ b/src/ncc/Abstracts/ConstantReferences.php
@@ -11,4 +11,6 @@
const DateTime = 'date_time';
const Install = 'install';
+
+ const Runtime = 'runtime';
}
\ No newline at end of file
diff --git a/src/ncc/CLI/Commands/BuildMenu.php b/src/ncc/CLI/Commands/BuildCommand.php
similarity index 96%
rename from src/ncc/CLI/Commands/BuildMenu.php
rename to src/ncc/CLI/Commands/BuildCommand.php
index 15d3411..b6573f4 100644
--- a/src/ncc/CLI/Commands/BuildMenu.php
+++ b/src/ncc/CLI/Commands/BuildCommand.php
@@ -7,8 +7,9 @@
use ncc\Managers\ProjectManager;
use ncc\Objects\CliHelpSection;
use ncc\Utilities\Console;
+ use ncc\Utilities\Functions;
- class BuildMenu
+ class BuildCommand
{
/**
* Displays the main help menu
@@ -103,7 +104,7 @@
new CliHelpSection(['build', '--config'], 'Builds the current project with a specified build configuration')
];
- $options_padding = \ncc\Utilities\Functions::detectParametersPadding($options) + 4;
+ $options_padding = Functions::detectParametersPadding($options) + 4;
Console::out('Usage: ncc build [options]');
Console::out('Options:' . PHP_EOL);
diff --git a/src/ncc/CLI/Commands/ExecCommand.php b/src/ncc/CLI/Commands/ExecCommand.php
new file mode 100644
index 0000000..a5d3171
--- /dev/null
+++ b/src/ncc/CLI/Commands/ExecCommand.php
@@ -0,0 +1,155 @@
+ $value)
+ {
+ if(!in_array($key, $whitelist_arguments))
+ $arguments[$key] = $value;
+ }
+
+ $execution_pointer_manager = new ExecutionPointerManager();
+
+ try
+ {
+ $units = $execution_pointer_manager->getUnits($package, $version);
+ }
+ catch(Exception $e)
+ {
+ Console::outException(sprintf('Cannot load execution units for package \'%s\'', $package), $e, 1);
+ return;
+ }
+
+ if(!isset($units[$entry]))
+ {
+ Console::outError(sprintf('Cannot find execution point \'%s\' in package \'%s\'', $entry, $package), true, 1);
+ return;
+ }
+
+ /** @var ExecutionUnit $exec_unit */
+ $exec_unit = $units[$entry];
+ $exec_path = '';
+
+ $process = new Process(array_merge([$exec_path], $arguments));
+ if($exec_unit->ExecutionPolicy->Execute->Pty !== null)
+ $process->setPty($exec_unit->ExecutionPolicy->Execute->Pty);
+
+ if($exec_unit->ExecutionPolicy->Execute->Tty !== null)
+ {
+ $process->setTty($exec_unit->ExecutionPolicy->Execute->Tty);
+ $process->setPty(false);
+ }
+
+ if($exec_unit->ExecutionPolicy->Execute->WorkingDirectory !== null)
+ $process->setWorkingDirectory($exec_unit->ExecutionPolicy->Execute->WorkingDirectory);
+ if($exec_unit->ExecutionPolicy->Execute->EnvironmentVariables !== null)
+ $process->setEnv($exec_unit->ExecutionPolicy->Execute->EnvironmentVariables);
+ if($exec_unit->ExecutionPolicy->Execute->Timeout !== null)
+ $process->setTimeout($exec_unit->ExecutionPolicy->Execute->Timeout);
+ if($exec_unit->ExecutionPolicy->Execute->IdleTimeout !== null)
+ $process->setIdleTimeout($exec_unit->ExecutionPolicy->Execute->IdleTimeout);
+ if($exec_unit->ExecutionPolicy->Execute->Options !== null)
+ $process->setOptions($exec_unit->ExecutionPolicy->Execute->Options);
+
+ if($process->isTty() || $process->isPty())
+ {
+ $process->start();
+ $process->wait();
+ }
+ else
+ {
+ $process->start();
+
+ while($process->isRunning())
+ {
+ if($exec_unit->ExecutionPolicy->Execute->Silent)
+ {
+ $process->wait();
+ }
+ else
+ {
+ $process->waitUntil(function($type, $buffer)
+ {
+ if($type == Process::ERR)
+ {
+ Console::outError($buffer);
+ }
+ else
+ {
+ Console::out($buffer);
+ }
+ });
+ }
+ }
+ }
+
+ exit(0);
+ }
+
+ /**
+ * Displays the main options section
+ *
+ * @return void
+ */
+ private static function displayOptions(): void
+ {
+ $options = [
+ new CliHelpSection(['help'], 'Displays this help menu about the value command'),
+ new CliHelpSection(['exec', '--package'], '(Required) The package to execute'),
+ new CliHelpSection(['--version'], '(default: latest) The version of the package to execute'),
+ new CliHelpSection(['--entry'], '(default: main) The entry point of the package to execute'),
+ ];
+
+ $options_padding = Functions::detectParametersPadding($options) + 4;
+
+ Console::out('Usage: ncc exec --package [options] [arguments]');
+ Console::out('Options:' . PHP_EOL);
+ foreach($options as $option)
+ {
+ Console::out(' ' . $option->toString($options_padding));
+ }
+
+ Console::out(PHP_EOL . 'Arguments:' . PHP_EOL);
+ Console::out(' The arguments to pass to the program');
+ Console::out(PHP_EOL . 'Example Usage:' . PHP_EOL);
+ Console::out(' ncc exec --package com.example.program');
+ Console::out(' ncc exec --package com.example.program --version 1.0.0');
+ Console::out(' ncc exec --package com.example.program --version 1.0.0 --entry setup');
+ Console::out(' ncc exec --package com.example.program --foo --bar --extra=test');
+ }
+ }
\ No newline at end of file
diff --git a/src/ncc/CLI/Main.php b/src/ncc/CLI/Main.php
index dc87436..a0f03d0 100644
--- a/src/ncc/CLI/Main.php
+++ b/src/ncc/CLI/Main.php
@@ -7,7 +7,7 @@
use Exception;
use ncc\Abstracts\LogLevel;
use ncc\Abstracts\NccBuildFlags;
- use ncc\CLI\Commands\BuildMenu;
+ use ncc\CLI\Commands\BuildCommand;
use ncc\CLI\Management\ConfigMenu;
use ncc\CLI\Management\CredentialMenu;
use ncc\CLI\Management\PackageManagerMenu;
@@ -114,7 +114,7 @@
exit(0);
case 'build':
- BuildMenu::start(self::$args);
+ BuildCommand::start(self::$args);
exit(0);
case 'cred':
diff --git a/src/ncc/CLI/Management/CredentialMenu.php b/src/ncc/CLI/Management/CredentialMenu.php
index d01e84d..7b75272 100644
--- a/src/ncc/CLI/Management/CredentialMenu.php
+++ b/src/ncc/CLI/Management/CredentialMenu.php
@@ -163,9 +163,10 @@
return;
}
+ Console::out('Entries:');
foreach($entries as $entry)
{
- Console::out(sprintf('%s%s', $entry->getName(), ($entry->isEncrypted() ? ' (encrypted)' : '')));
+ Console::out(sprintf(' - %s (%s)', $entry->getName(), $entry->isEncrypted() ? ' (encrypted)' : ''));
}
Console::out('Total: ' . count($entries));
diff --git a/src/ncc/Classes/NccExtension/PackageCompiler.php b/src/ncc/Classes/NccExtension/PackageCompiler.php
index 459afc4..5d824ff 100644
--- a/src/ncc/Classes/NccExtension/PackageCompiler.php
+++ b/src/ncc/Classes/NccExtension/PackageCompiler.php
@@ -185,17 +185,25 @@
*/
public static function writePackage(string $path, Package $package, ProjectConfiguration $configuration, string $build_configuration=BuildConfigurationValues::DefaultConfiguration): string
{
+ Console::outVerbose(sprintf('Writing package to %s', $path));
+
// Write the package to disk
$FileSystem = new Filesystem();
$BuildConfiguration = $configuration->Build->getBuildConfiguration($build_configuration);
if(!$FileSystem->exists($path . $BuildConfiguration->OutputPath))
+ {
+ Console::outDebug(sprintf('creating output directory %s', $path . $BuildConfiguration->OutputPath));
$FileSystem->mkdir($path . $BuildConfiguration->OutputPath);
+ }
// Finally write the package to the disk
$FileSystem->mkdir($path . $BuildConfiguration->OutputPath);
$output_file = $path . $BuildConfiguration->OutputPath . DIRECTORY_SEPARATOR . $package->Assembly->Package . '.ncc';
if($FileSystem->exists($output_file))
+ {
+ Console::outDebug(sprintf('removing existing package %s', $output_file));
$FileSystem->remove($output_file);
+ }
$FileSystem->touch($output_file);
try
@@ -210,35 +218,13 @@
return $output_file;
}
- /**
- * Compiles the special formatted constants
- *
- * @param Package $package
- * @param int $timestamp
- * @return array
- */
- public static function compileRuntimeConstants(Package $package, int $timestamp): array
- {
- $compiled_constants = [];
-
- foreach($package->Header->RuntimeConstants as $name => $value)
- {
- $compiled_constants[$name] = self::compileConstants($value, [
- ConstantReferences::Assembly => $package->Assembly,
- ConstantReferences::DateTime => $timestamp,
- ConstantReferences::Build => null
- ]);
- }
-
- return $compiled_constants;
- }
-
/**
* Compiles the constants in the package object
*
* @param Package $package
* @param array $refs
* @return void
+ * @noinspection PhpParameterByRefIsNotUsedAsReferenceInspection
*/
public static function compilePackageConstants(Package &$package, array $refs): void
{
@@ -247,6 +233,7 @@
$assembly = [];
foreach($package->Assembly->toArray() as $key => $value)
{
+ Console::outDebug(sprintf('compiling consts Assembly.%s (%s)', $key, implode(', ', array_keys($refs))));
$assembly[$key] = self::compileConstants($value, $refs);
}
$package->Assembly = Assembly::fromArray($assembly);
@@ -258,11 +245,29 @@
$units = [];
foreach($package->ExecutionUnits as $executionUnit)
{
+ Console::outDebug(sprintf('compiling execution unit consts %s (%s)', $executionUnit->Name, implode(', ', array_keys($refs))));
$units[] = self::compileExecutionUnitConstants($executionUnit, $refs);
}
$package->ExecutionUnits = $units;
unset($units);
}
+
+ $compiled_constants = [];
+ foreach($package->Header->RuntimeConstants as $name => $value)
+ {
+ Console::outDebug(sprintf('compiling runtime const %s (%s)', $name, implode(', ', array_keys($refs))));
+ $compiled_constants[$name] = self::compileConstants($value, $refs);
+ }
+
+ $options = [];
+ foreach($package->Header->Options as $name => $value)
+ {
+ Console::outDebug(sprintf('compiling options const %s (%s)', $name, implode(', ', array_keys($refs))));
+ $options[$name] = self::compileConstants($value, $refs);
+ }
+ $package->Header->Options = $options;
+
+ $package->Header->RuntimeConstants = $compiled_constants;
}
/**
@@ -344,6 +349,9 @@
if(isset($refs[ConstantReferences::Install]))
$value = ConstantCompiler::compileInstallConstants($value, $refs[ConstantReferences::Install]);
+ if(isset($refs[ConstantReferences::Runtime]))
+ $value = ConstantCompiler::compileRuntimeConstants($value);
+
return $value;
}
}
\ No newline at end of file
diff --git a/src/ncc/Classes/PhpExtension/PhpCompiler.php b/src/ncc/Classes/PhpExtension/PhpCompiler.php
index f594ef9..f9a74e9 100644
--- a/src/ncc/Classes/PhpExtension/PhpCompiler.php
+++ b/src/ncc/Classes/PhpExtension/PhpCompiler.php
@@ -23,7 +23,6 @@
use ncc\Exceptions\VersionNotFoundException;
use ncc\Interfaces\CompilerInterface;
use ncc\Managers\PackageLockManager;
- use ncc\ncc;
use ncc\Objects\Package;
use ncc\Objects\ProjectConfiguration;
use ncc\ThirdParty\nikic\PhpParser\ParserFactory;
@@ -92,6 +91,10 @@
$this->package->Dependencies = $this->project->Build->Dependencies;
$this->package->MainExecutionPolicy = $this->project->Build->Main;
+ // Add the option to create a symbolic link to the package
+ if($this->project->Build->CreateSymlink)
+ $this->package->Header->Options['create_symlink'] = true;
+
// Add both the defined constants from the build configuration and the global constants.
// Global constants are overridden
$this->package->Header->RuntimeConstants = [];
@@ -105,6 +108,7 @@
$this->package->Header->CompilerVersion = NCC_VERSION_NUMBER;
$this->package->Header->Options = $this->project->Project->Options;
+
Console::outDebug('scanning project files');
Console::outDebug('theseer\DirectoryScanner - Copyright (c) 2009-2014 Arne Blankerts All rights reserved.');
diff --git a/src/ncc/Interfaces/RunnerInterface.php b/src/ncc/Interfaces/RunnerInterface.php
index 4d118c4..1d92644 100644
--- a/src/ncc/Interfaces/RunnerInterface.php
+++ b/src/ncc/Interfaces/RunnerInterface.php
@@ -7,7 +7,6 @@
use ncc\Exceptions\IOException;
use ncc\Exceptions\RunnerExecutionException;
use ncc\Objects\ExecutionPointers\ExecutionPointer;
- use ncc\Objects\InstallationPaths;
use ncc\Objects\Package\ExecutionUnit;
use ncc\Objects\ProjectConfiguration\ExecutionPolicy;
use ncc\ThirdParty\Symfony\Process\Process;
diff --git a/src/ncc/Interfaces/RuntimeInterface.php b/src/ncc/Interfaces/RuntimeInterface.php
index 7b70e51..55cb1c5 100644
--- a/src/ncc/Interfaces/RuntimeInterface.php
+++ b/src/ncc/Interfaces/RuntimeInterface.php
@@ -2,7 +2,6 @@
namespace ncc\Interfaces;
- use ncc\Abstracts\Versions;
use ncc\Exceptions\MissingDependencyException;
use ncc\Exceptions\PackageLockException;
use ncc\Exceptions\PackageNotFoundException;
diff --git a/src/ncc/Managers/ExecutionPointerManager.php b/src/ncc/Managers/ExecutionPointerManager.php
index 0132fb8..9b89551 100644
--- a/src/ncc/Managers/ExecutionPointerManager.php
+++ b/src/ncc/Managers/ExecutionPointerManager.php
@@ -155,7 +155,8 @@
}
$bin_file = $package_bin_path . DIRECTORY_SEPARATOR . hash('haval128,4', $unit->ExecutionPolicy->Name);
- $bin_file .= match ($unit->ExecutionPolicy->Runner) {
+ $bin_file .= match ($unit->ExecutionPolicy->Runner)
+ {
Runners::bash => BashRunner::getFileExtension(),
Runners::php => PhpRunner::getFileExtension(),
Runners::perl => PerlRunner::getFileExtension(),
@@ -183,6 +184,7 @@
if($temporary)
{
+ Console::outVerbose(sprintf('Adding temporary ExecutionUnit \'%s\' for %s', $unit->ExecutionPolicy->Name, $package));
$this->TemporaryUnits[] = [
'package' => $package,
'version' => $version,
@@ -275,6 +277,22 @@
return $results;
}
+ public function getUnit(string $package, string $version, string $name): ExecutionUnit
+ {
+ Console::outVerbose(sprintf('getting execution unit %s for %s', $name, $package));
+
+ $package_id = $this->getPackageId($package, $version);
+ $package_config_path = $this->RunnerPath . DIRECTORY_SEPARATOR . $package_id . '.inx';
+
+ if(!file_exists($package_config_path))
+ throw new NoAvailableUnitsException('No ExecutionUnits available for ' . $package);
+
+ $execution_pointers = ExecutionPointers::fromArray(ZiProto::decode(IO::fread($package_config_path)));
+ $unit = $execution_pointers->getUnit($name);
+
+
+ }
+
/**
* Executes a unit
*
diff --git a/src/ncc/Managers/PackageManager.php b/src/ncc/Managers/PackageManager.php
index 0475a4d..aafa985 100644
--- a/src/ncc/Managers/PackageManager.php
+++ b/src/ncc/Managers/PackageManager.php
@@ -309,7 +309,6 @@
}
// Install execution units
- // TODO: Implement symlink support
if(count($package->ExecutionUnits) > 0)
{
$execution_pointer_manager = new ExecutionPointerManager();
@@ -325,6 +324,13 @@
IO::fwrite($installation_paths->getDataPath() . DIRECTORY_SEPARATOR . 'exec', ZiProto::encode($unit_paths));
}
+ if(isset($package->Header->Options['create_symlink']) && $package->Header->Options['create_symlink'])
+ {
+ $paths = [
+ DIRECTORY_SEPARATOR . 'usr' . DIRECTORY_SEPARATOR . 'bin'
+ ];
+ }
+
// Execute the post-installation stage after the installation is complete
try
{
diff --git a/src/ncc/Objects/Package/MagicBytes.php b/src/ncc/Objects/Package/MagicBytes.php
index 3e86446..6ed89ae 100644
--- a/src/ncc/Objects/Package/MagicBytes.php
+++ b/src/ncc/Objects/Package/MagicBytes.php
@@ -6,6 +6,7 @@
use ncc\Abstracts\EncoderType;
use ncc\Abstracts\Versions;
+ use ncc\Utilities\Console;
class MagicBytes
{
diff --git a/src/ncc/Objects/PackageLock.php b/src/ncc/Objects/PackageLock.php
index 0655682..604987e 100644
--- a/src/ncc/Objects/PackageLock.php
+++ b/src/ncc/Objects/PackageLock.php
@@ -81,7 +81,6 @@
$this->Packages[$package->Assembly->Package]->UpdateSource = $package->Header->UpdateSource;
$this->Packages[$package->Assembly->Package]->addVersion($package, $install_path, true);
- $this->Packages[$package->Assembly->Package]->addVersion($package, $install_path, true);
$this->Packages[$package->Assembly->Package]->getDataPath();
$this->update();
}
@@ -127,6 +126,7 @@
if(isset($this->Packages[$package]))
{
unset($this->Packages[$package]);
+ $this->update();
return true;
}
diff --git a/src/ncc/Objects/ProjectConfiguration/ExecutionPolicy/Execute.php b/src/ncc/Objects/ProjectConfiguration/ExecutionPolicy/Execute.php
index 8fe5b02..b9184e6 100644
--- a/src/ncc/Objects/ProjectConfiguration/ExecutionPolicy/Execute.php
+++ b/src/ncc/Objects/ProjectConfiguration/ExecutionPolicy/Execute.php
@@ -30,6 +30,13 @@
*/
public $Options;
+ /**
+ * An array of environment variables to pass on to the process
+ *
+ * @var array|null
+ */
+ public $EnvironmentVariables;
+
/**
* Indicates if the output should be displayed or suppressed
*
@@ -38,20 +45,32 @@
public $Silent;
/**
- * Indicates if the process should run in Tty mode (Overrides Silent mode)
+ * Indicates if the process should run in Tty mode (Overrides Silent & Pty mode)
*
* @var bool|null
*/
public $Tty;
+ /**
+ * Indicates if the process should run in Pty mode (Overrides Silent mode)
+ *
+ * @var bool|null
+ */
+ public $Pty;
+
/**
* The number of seconds to wait before giving up on the process, will automatically execute the error handler
* if one is set.
*
- * @var int
+ * @var int|null
*/
public $Timeout;
+ /**
+ * @var int|null
+ */
+ public $IdleTimeout;
+
/**
* Public Constructor
*/
@@ -60,6 +79,7 @@
$this->Tty = false;
$this->Silent = false;
$this->Timeout = null;
+ $this->IdleTimeout = null;
$this->WorkingDirectory = "%CWD%";
}
@@ -82,6 +102,9 @@
if($this->Options !== null)
$results[($bytecode ? Functions::cbc("options") : "options")] = $this->Options;
+ if($this->EnvironmentVariables !== null)
+ $results[($bytecode ? Functions::cbc("environment_variables") : "environment_variables")] = $this->EnvironmentVariables;
+
if($this->Silent !== null)
$results[($bytecode ? Functions::cbc("silent") : "silent")] = (bool)$this->Silent;
@@ -91,6 +114,9 @@
if($this->Timeout !== null)
$results[($bytecode ? Functions::cbc("timeout") : "timeout")] = (int)$this->Timeout;
+ if($this->IdleTimeout !== null)
+ $results[($bytecode ? Functions::cbc("idle_timeout") : "idle_timeout")] = (int)$this->IdleTimeout;
+
return $results;
}
@@ -107,9 +133,11 @@
$object->Target = Functions::array_bc($data, 'target');
$object->WorkingDirectory = Functions::array_bc($data, 'working_directory');
$object->Options = Functions::array_bc($data, 'options');
+ $object->EnvironmentVariables = Functions::array_bc($data, 'environment_variables');
$object->Silent = Functions::array_bc($data, 'silent');
$object->Tty = Functions::array_bc($data, 'tty');
$object->Timeout = Functions::array_bc($data, 'timeout');
+ $object->IdleTimeout = Functions::array_bc($data, 'idle_timeout');
return $object;
}
diff --git a/src/ncc/Utilities/Functions.php b/src/ncc/Utilities/Functions.php
index 7c9c568..5ce0129 100644
--- a/src/ncc/Utilities/Functions.php
+++ b/src/ncc/Utilities/Functions.php
@@ -929,7 +929,7 @@
{
if (is_numeric($input))
{
- if (strpos($input, '.') !== false)
+ if (str_contains($input, '.'))
return (float)$input;
if (ctype_digit($input))
diff --git a/src/ncc/Utilities/RuntimeCache.php b/src/ncc/Utilities/RuntimeCache.php
index 0371b03..a948333 100644
--- a/src/ncc/Utilities/RuntimeCache.php
+++ b/src/ncc/Utilities/RuntimeCache.php
@@ -32,7 +32,6 @@
*/
public static function set($key, $value): mixed
{
- Console::outDebug($key);
self::$cache[$key] = $value;
return $value;
}
@@ -45,7 +44,6 @@
*/
public static function get($key): mixed
{
- Console::outDebug($key);
if(isset(self::$cache[$key]))
return self::$cache[$key];
diff --git a/tests/example_project/scripts/unit.bash b/tests/example_project/scripts/unit.bash
index cf03e95..9a59108 100644
--- a/tests/example_project/scripts/unit.bash
+++ b/tests/example_project/scripts/unit.bash
@@ -1,3 +1,3 @@
echo "Hello World!"
-read -p "What is your name? " name
+read -r -p "What is your name? " name
echo "Hello $name"
\ No newline at end of file