Created
August 1, 2020 10:11
-
-
Save PJZ9n/58073321aedd15ef417f0fcce3dc49f9 to your computer and use it in GitHub Desktop.
メインクラスに静的なメンバ変数としてConfigを持つ
This file contains hidden or 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
<?php | |
declare(strict_types=1); | |
use pocketmine\utils\Config; | |
class aClass | |
{ | |
private static $config; | |
public static function getConfig(): Config | |
{ | |
return self::$config; | |
} | |
public function onEnable(): void | |
{ | |
self::$config = new Config("path"); | |
} | |
} | |
class bClass | |
{ | |
public function __construct() | |
{ | |
$config = aClass::getConfig(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment