-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautoload.php
27 lines (21 loc) · 1013 Bytes
/
autoload.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
spl_autoload_register(function ($class) {
$deprecationMap = [
'Dystcz\\LunarApiProductViews' => 'Dystore\\ProductViews',
'Dystcz\\LunarApiProductViews\\LunarApiProductViewsServiceProvider' => 'Dystore\\ProductViews\\ProductViewsServiceProvider',
'Dystcz\\LunarApiProductViews\\LunarApiProductViews' => 'Dystore\\ProductViews\\ProductViews',
'Dystcz\\LunarApiProductViews\\LunarApiProductViewsFacade' => 'Dystore\\ProductViews\\Facades\\ProductViews',
];
foreach ($deprecationMap as $oldNamespace => $newNamespace) {
if (strpos($class, $oldNamespace) !== 0) {
continue;
}
$newClass = str_replace($oldNamespace, $newNamespace, $class);
if (! class_exists($newClass)) {
break;
}
$message = __('Class %1$s is <strong>deprecated</strong>! Use %2$s instead.');
trigger_error(sprintf($message, $class, $newClass), E_USER_DEPRECATED);
class_alias($newClass, $class);
}
});