-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add back-compatibility of removed Loader
For case if any project already using `new Loader()` to access plugin internals.
- Loading branch information
1 parent
d684e1e
commit 83c78d9
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
/** | ||
* @package Redbit\SimpleShop\WpPlugin | ||
* @license MIT | ||
* @copyright 2016-2018 Redbit s.r.o. | ||
* @author Redbit s.r.o. <[email protected]> | ||
*/ | ||
|
||
namespace Redbit\SimpleShop\WpPlugin; | ||
|
||
/** | ||
* Back-compatibility of deprecated plugin loader | ||
* @package Redbit\SimpleShop\WpPlugin | ||
*/ | ||
class Loader { | ||
public function __construct() { | ||
$class = SimpleShop::class; | ||
trigger_error( | ||
"Manually start of plugin is deprecated, use '$class::getInstance()' instead", | ||
E_USER_DEPRECATED | ||
); | ||
} | ||
|
||
/** | ||
* @param string $method | ||
* @param array $arguments | ||
* | ||
* @return mixed | ||
*/ | ||
public function __call( $method, array $arguments ) { | ||
$currentClass = self::class; | ||
$class = SimpleShop::class; | ||
trigger_error( | ||
"'$currentClass' is deprecated, use '$class::getInstance()->$method()' instead", | ||
E_USER_DEPRECATED | ||
); | ||
|
||
return call_user_func_array( [ SimpleShop::getInstance(), $method ], $arguments ); | ||
} | ||
} |