Minor changes

This commit is contained in:
Netkas 2022-10-28 01:24:01 -04:00
parent 24fdbd05bf
commit e5491d4ca2
6 changed files with 21 additions and 8 deletions

5
.idea/php.xml generated
View file

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PhpIncludePathManager">
<include_path>
<path value="/usr/share/php" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="8.1">
<option name="suggestChangeDefaultLanguageLevel" value="false" />
</component>

View file

@ -8,7 +8,7 @@
*/
abstract class RegexPatterns
{
const UUIDv4 = '/[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-4[0-9A-Za-z]{3}-[89ABab][0-9A-Za-z]{3}-[0-9A-Za-z]{12}/m';
const UUID = '{^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$}Di';
const PackageNameFormat = '/^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+[0-9a-z_]$/';

View file

@ -9,19 +9,17 @@
/**
* Prepares the package for the build process, this method is called before build()
*
* @param array $options Options to pass on to the compiler
* @param string $path The path that the project file is located in (project.json)
* @param string $build_configuration The build configuration to use to build the project
* @return void
*/
public function prepare(array $options, string $path, string $build_configuration=BuildConfigurationValues::DefaultConfiguration): void;
public function prepare(string $path, string $build_configuration=BuildConfigurationValues::DefaultConfiguration): void;
/**
* Builds the package, returns the output path of the build
*
* @param array $options Options to pass on to the compiler
* @param string $path The path that the project file is located in (project.json)
* @return string Returns the output path of the build
*/
public function build(array $options, string $path): string;
public function build(string $path): string;
}

View file

@ -20,6 +20,13 @@
*/
public $Flags;
/**
* The data type of the component
*
* @var string
*/
public $DataType;
/**
* A sha1 hash checksum of the component, this will be compared against the data to determine
* the integrity of the component to ensure that the component is not corrupted.
@ -66,6 +73,7 @@
return [
($bytecode ? Functions::cbc('name') : 'name') => $this->Name,
($bytecode ? Functions::cbc('flags') : 'flags') => $this->Flags,
($bytecode ? Functions::cbc('data_type') : 'data_type') => $this->DataType,
($bytecode ? Functions::cbc('checksum') : 'checksum') => $this->Checksum,
($bytecode ? Functions::cbc('data') : 'data') => $this->Data,
];
@ -83,6 +91,7 @@
$Object->Name = Functions::array_bc($data, 'name');
$Object->Flags = Functions::array_bc($data, 'flags');
$Object->DataType = Functions::array_bc($data, 'data_type');
$Object->Checksum = Functions::array_bc($data, 'checksum');
$Object->Data = Functions::array_bc($data, 'data');

View file

@ -85,11 +85,10 @@
*/
public function validate(bool $throw_exception=True): bool
{
if(!preg_match(RegexPatterns::UUIDv4, $this->UUID))
if(!preg_match(RegexPatterns::UUID, $this->UUID))
{
if($throw_exception)
throw new InvalidProjectConfigurationException('The UUID is not a valid v4 UUID', 'Assembly.UUID');
return false;
}

View file

@ -11,7 +11,6 @@
/**
* Inline Progress bar, created by dealnews.com.
*
* // TODO: Add non-inline option
* @param int $value
* @param int $total
* @param int $size
@ -21,6 +20,9 @@
*/
public static function inlineProgressBar(int $value, int $total, int $size=38, array $options=[]): void
{
if(!ncc::cliMode())
return;
static $start_time;
// if we go over our bound, just ignore it