Removed unused methods from Validate.php

This commit is contained in:
netkas 2024-09-18 13:10:24 -04:00
parent 836d0f33eb
commit 04a85900fd

View file

@ -1,5 +1,5 @@
<?php <?php
/* /*
* Copyright (c) Nosial 2022-2023, all rights reserved. * Copyright (c) Nosial 2022-2023, all rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
@ -20,7 +20,7 @@
* *
*/ */
namespace ncc\Utilities; namespace ncc\Utilities;
use ncc\Enums\LogLevel; use ncc\Enums\LogLevel;
use ncc\Enums\RegexPatterns; use ncc\Enums\RegexPatterns;
@ -141,48 +141,6 @@ namespace ncc\Utilities;
return true; return true;
} }
/**
* Validates the name of the project
*
* @param $input
* @return bool
*/
public static function projectName($input): bool
{
if($input === null)
{
return false;
}
if($input === '')
{
return false;
}
if(strlen($input) > 126)
{
return false;
}
return true;
}
/**
* Determines if a Unix filepath is valid
*
* @param $input
* @return bool
*/
public static function unixFilepath($input): bool
{
if(preg_match(RegexPatterns::UNIX_PATH->value, $input))
{
return true;
}
return false;
}
/** /**
* Validates if the constant name is valid * Validates if the constant name is valid
* *
@ -204,51 +162,6 @@ namespace ncc\Utilities;
return true; return true;
} }
/**
* Validates the execution policy name
*
* @param string $input
* @return bool
*/
public static function executionPolicyName(string $input): bool
{
if(!preg_match(RegexPatterns::EXECUTION_POLICY_NAME->value, $input))
{
return false;
}
return true;
}
/**
* Determines if the given log level is valid or not
*
* @param string $input
* @return bool
*/
public static function checkLogLevel(string|LogLevel $input): bool
{
if($input instanceof LogLevel)
{
return true;
}
return in_array(strtolower($input), array_map(
fn($case) => $case->value, LogLevel::cases()), true
);
}
/**
* Determines if given input exceeds the path length limit
*
* @param string $input
* @return bool
*/
public static function exceedsPathLength(string $input): bool
{
return strlen($input) > 4096;
}
/** /**
* Determines if the input is considered "name friendly" and does not * Determines if the input is considered "name friendly" and does not
* contain any special characters, spaces or weird prefixes * contain any special characters, spaces or weird prefixes
@ -301,20 +214,4 @@ namespace ncc\Utilities;
return true; return true;
} }
/***
* Returns True if the given remote package input is valid
*
* @param string $input
* @return bool
*/
public static function remotePackageInput(string $input): bool
{
if(preg_match(RegexPatterns::REMOTE_PACKAGE->value, $input))
{
return true;
}
return false;
}
} }