Skip to content

Commit

Permalink
patch
Browse files Browse the repository at this point in the history
  • Loading branch information
AnourValar committed Feb 28, 2023
1 parent 906c1c7 commit 6331f9b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Helpers/ArrayHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ function ($item) use ($attributes) {
};

if ($data instanceof \Illuminate\Database\Eloquent\Model) {
return $apply($data)->toJson(JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
return $apply($data)->toJson(JSON_UNESCAPED_UNICODE);
}

return $data
Expand All @@ -269,7 +269,7 @@ function ($item) use ($attributes) {
return $apply($item);
}
})
->toJson(JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
->toJson(JSON_UNESCAPED_UNICODE);
}

/**
Expand Down
20 changes: 18 additions & 2 deletions src/Helpers/StringHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,15 @@ public function canonizeEmail(?string $email): string
* Generates code
*
* @param int $length
* @param bool $debug
* @return string
*/
public function generateCode(int $length): string
public function generateCode(int $length, bool $debug = false): string
{
$code = '';

while (mb_strlen($code) < $length) {
if (config('app.debug')) {
if (config('app.debug') || $debug) {
$code .= '0';
} else {
$code .= random_int(0, 9);
Expand All @@ -73,4 +74,19 @@ public function generateCode(int $length): string

return $code;
}

/**
* Cleans tags and its innerhtml
*
* @param string|null $content
* @return string|null
*/
/*public function stripTags(?string $content): ?string
{
if (is_null($content)) {
return $content;
}
return preg_replace('#<\/?[a-z\d]+(>|\s[^>]*>)#iu', '', $content);
}*/
}

0 comments on commit 6331f9b

Please sign in to comment.