Skip to content

Commit 89c819e

Browse files
author
Fredrick Peter
committed
update
1 parent a01e22d commit 89c819e

File tree

1 file changed

+2
-38
lines changed

1 file changed

+2
-38
lines changed

Slugify.php

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44

55
namespace Tamedevelopers\Support;
66

7-
use Exception;
87
use Cocur\Slugify\Slugify as CocurSlugify;
9-
use Tamedevelopers\Support\Capsule\Manager;
10-
use Tamedevelopers\Support\Capsule\CustomException;
8+
119

1210
/**
1311
* Cocur\Slugify\Slugify Wrapper
@@ -22,7 +20,6 @@ class Slugify{
2220
* @var string
2321
*/
2422
static private $language;
25-
2623

2724
/**
2825
* slug
@@ -35,8 +32,6 @@ class Slugify{
3532
*/
3633
static public function slug($word, $language = null, $separator = "-", $case = true)
3734
{
38-
self::isSlugifyInstalled();
39-
4035
// get language
4136
$language = self::switchLanguage($language);
4237

@@ -65,7 +60,7 @@ static public function slug($word, $language = null, $separator = "-", $case = t
6560
* @param string|null $language
6661
* @return string
6762
*/
68-
static protected function switchLanguage($language = null)
63+
static private function switchLanguage($language = null)
6964
{
7065
return [
7166
'ar' => 'arabic',
@@ -156,35 +151,4 @@ static private function supportedLanguage()
156151
];
157152
}
158153

159-
/**
160-
* Check If DOM PDF has been installed
161-
*
162-
* @return mixed
163-
*/
164-
static private function isSlugifyInstalled()
165-
{
166-
try {
167-
if (class_exists('Cocur\Slugify\Slugify')) {
168-
return true;
169-
} else {
170-
throw new CustomException(
171-
"Class Cocur\Slugify\Slugify not found: \nRequire the package by running: `composer require cocur/slugify`\n" .
172-
(new Exception)->getTraceAsString()
173-
);
174-
}
175-
} catch (CustomException $e) {
176-
// Handle the exception silently (turn off error reporting)
177-
error_reporting(0);
178-
179-
Manager::setHeaders(404, function() use($e){
180-
181-
// create error logger
182-
Env::bootLogger();
183-
184-
// Trigger a custom error
185-
trigger_error($e->getMessage(), E_USER_ERROR);
186-
});
187-
}
188-
}
189-
190154
}

0 commit comments

Comments
 (0)