• R/O
  • SSH
  • HTTPS

jinrousiki: コミット


コミットメタ情報

リビジョン2106 (tree)
日時2018-01-03 20:44:38
作者umethyl

ログメッセージ

Loader::LoadClass(): func_get_args() 廃止

変更サマリ

差分

--- trunk/include/loader_class.php (revision 2105)
+++ trunk/include/loader_class.php (revision 2106)
@@ -114,7 +114,7 @@
114114 } elseif (false === self::IsLoaded($name)) {
115115 self::LoadDependence($name);
116116 if (false === LoadManager::RegisterFile(self::$file, $name, self::GetPath($name))) {
117- throw new RuntimeException("Load failed: {$name}");
117+ throw new RuntimeException("Load file failed: {$name}");
118118 }
119119 }
120120 }
@@ -121,23 +121,20 @@
121121 }
122122
123123 //クラスロード
124- public static function LoadClass($name) {
125- $name_list = func_get_args();
126- if (is_array($name_list[0])) {
124+ public static function LoadClass(...$name_list) {
125+ if (true === is_array($name_list[0])) {
127126 $name_list = $name_list[0];
128127 }
129- if (count($name_list) > 1) {
130- foreach ($name_list as $name) self::LoadClass($name);
131- return true;
132- }
133128
134- if (is_null($name)) {
135- return false;
136- } elseif (LoadManager::IsClass(self::$class, $name)) {
137- return true;
138- } else {
139- self::LoadDependence($name);
140- return LoadManager::RegisterClass(self::$class, $name);
129+ foreach ($name_list as $name) {
130+ if (true === is_null($name)) {
131+ throw new InvalidArgumentException("Argument is NULL: {$name}");
132+ } elseif (false === LoadManager::IsClass(self::$class, $name)) {
133+ self::LoadDependence($name);
134+ if (false === LoadManager::RegisterClass(self::$class, $name)) {
135+ throw new RuntimeException("Load class failed: {$name}");
136+ }
137+ }
141138 }
142139 }
143140
旧リポジトリブラウザで表示