Skip to content

Commit

Permalink
change variables names
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdullahKaram-Dev committed Jul 29, 2023
1 parent 6ddd37a commit f5eef21
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/Services/LaravelSvg.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@ public function svgFor(string $words): self
}


private function setCountWords(string $userFullName): void
private function setCountWords(string $words): void
{
if ($this->isArabicWords($userFullName)) {
$words = explode(' ', $userFullName);
foreach ($words as $word) {
if ($this->isArabicWords($words)) {
$ArabicWords = explode(' ', $words);
foreach ($ArabicWords as $word) {
$this->wordsCount++;
}
} else {
$this->wordsCount = Str::wordCount($userFullName);
$this->wordsCount = Str::wordCount($words);
}
}

private function isArabicWords(string $userFullName): bool
private function isArabicWords(string $words): bool
{
$arabic = preg_match('/\p{Arabic}/u', $userFullName);
$arabic = preg_match('/\p{Arabic}/u', $words);
return $arabic;
}

Expand Down Expand Up @@ -93,22 +93,21 @@ protected function saveSvg(): array
} else {
$svgName = $this->firstWord . '-' . $this->lastWord . '.svg';
}
Storage::disk($disk)->put($svgPath . '/' . $svgName, $this->svgTemplate);
Storage::disk($this->getSetting('disk'))->put($svgPath . '/' . $svgName, $this->svgTemplate);
return [
'name' => $svgName,
'path' => $this->getSetting('default_svg_path') . '/' . $svgName,
'full_path' => Storage::disk($disk)->url($svgPath . '/' . $svgName),
'full_path' => Storage::disk($this->getSetting('disk'))->url($svgPath . '/' . $svgName),
'mime_type' => self::DEFAULT_SVG_TYPE,
'size' => Storage::disk($disk)->size($svgPath . '/' . $svgName),
'size' => Storage::disk($this->getSetting('disk'))->size($svgPath . '/' . $svgName),
'disk' => $this->getSetting('disk')
];
}

protected function checkDisk(): void
{
$disk = $this->getSetting('disk');
if (!Storage::disk($disk)->exists($this->getSetting('default_svg_path'))) {
Storage::disk($disk)->makeDirectory($this->getSetting('default_svg_path'));
if (!Storage::disk($this->getSetting('disk'))->exists($this->getSetting('default_svg_path'))) {
Storage::disk($this->getSetting('disk'))->makeDirectory($this->getSetting('default_svg_path'));
}
}

Expand Down

0 comments on commit f5eef21

Please sign in to comment.