-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathautoload.php
More file actions
27 lines (21 loc) · 869 Bytes
/
autoload.php
File metadata and controls
27 lines (21 loc) · 869 Bytes
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\\LunarApi' => 'Dystore\\Api',
'Dystcz\\LunarApi\\LunarApiServiceProvider' => 'Dystore\\Api\\ApiServiceProvider',
'Dystcz\\LunarApi\\LunarApi' => 'Dystore\\Api\\Api',
'Dystcz\\LunarApi\\Facades\\LunarApi' => 'Dystore\\Api\\Facades\\Api',
];
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);
}
});