Skip to content

Commit

Permalink
update file
Browse files Browse the repository at this point in the history
  • Loading branch information
juancristobalgd1 authored May 24, 2024
1 parent d3818df commit 2d9ea76
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,16 @@ function partials(string $partial_name, array $data = [])
function cleanInput(mixed $data): mixed
{
return match (true) {
is_array($data) => array_map('cleanInput', $data),
is_array($data) => array_map('cleanInput', $data),
is_object($data) => cleanInput((array) $data),
is_email($data) => filter_var($data, FILTER_SANITIZE_EMAIL),
is_url($data) => filter_var($data, FILTER_SANITIZE_URL),
is_ip($data) => filter_var($data, FILTER_VALIDATE_IP),
is_email($data) => filter_var($data, FILTER_SANITIZE_EMAIL),
is_url($data) => filter_var($data, FILTER_SANITIZE_URL),
is_ip($data) => filter_var($data, FILTER_VALIDATE_IP),
is_string($data) => preg_replace('/[\x00-\x1F\x7F]/u', '', filter_var(trim($data), FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_NO_ENCODE_QUOTES)),
is_int($data) => filter_var($data, FILTER_SANITIZE_NUMBER_INT),
is_float($data) => filter_var($data, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION),
is_bool($data) => filter_var($data, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE),
is_null($data) => settype($data, 'NULL'),
is_int($data) => filter_var($data, FILTER_SANITIZE_NUMBER_INT),
is_float($data) => filter_var($data, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION),
is_bool($data) => filter_var($data, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE),
is_null($data) => settype($data, 'NULL'),

default => filter_var($data, FILTER_SANITIZE_SPECIAL_CHARS),
};
Expand Down
4 changes: 2 additions & 2 deletions src/libraries/Console/GeneratorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ protected function execute(array $params): void
$path = $this->buildPath($this->className ?? $class);

// Check if path is empty.
if (empty ($path)) {
if (empty($path)) {
return;
}

Expand Down Expand Up @@ -258,7 +258,7 @@ protected function parseTemplate(string $class, array $replacements = [], array

// Add namespace and class name replacements.
$replacements['{namespace}'] = $namespace;
$replacements['{class}'] = str_replace($namespace . '\\', '', $class);
$replacements['{class}'] = trim(str_replace($namespace . '\\', '', $class), '\\');

// Perform the replacements on the template and return it.
return str_replace(
Expand Down

0 comments on commit 2d9ea76

Please sign in to comment.