Changeset View
Changeset View
Standalone View
Standalone View
src/symbols/PhutilSymbolLoader.php
Show First 20 Lines • Show All 380 Lines • ▼ Show 20 Lines | private function loadSymbol(array $symbol_spec) { | ||||
$bootloader->loadLibrarySource($lib_name, $where); | $bootloader->loadLibrarySource($lib_name, $where); | ||||
// Check that we successfully loaded the symbol from wherever it was | // Check that we successfully loaded the symbol from wherever it was | ||||
// supposed to be defined. | // supposed to be defined. | ||||
$load_failed = null; | $load_failed = null; | ||||
if ($is_function) { | if ($is_function) { | ||||
if (!function_exists($name)) { | if (!function_exists($name)) { | ||||
$load_failed = pht('function'); | $load_failed = 'function'; | ||||
} | } | ||||
} else { | } else { | ||||
if (!class_exists($name, false) && !interface_exists($name, false)) { | if (!class_exists($name, false) && !interface_exists($name, false)) { | ||||
$load_failed = pht('class or interface'); | $load_failed = 'class/interface'; | ||||
} | } | ||||
} | } | ||||
if ($load_failed !== null) { | if ($load_failed !== null) { | ||||
$lib_path = phutil_get_library_root($lib_name); | $lib_path = phutil_get_library_root($lib_name); | ||||
throw new PhutilMissingSymbolException( | throw new PhutilMissingSymbolException( | ||||
$name, | $name, | ||||
$load_failed, | $load_failed, | ||||
pht( | pht( | ||||
"the symbol map for library '%s' (at '%s') claims this %s is ". | 'The symbol map for library "%s" (at "%s") claims this symbol '. | ||||
"defined in '%s', but loading that source file did not cause the ". | '(of type "%s") is defined in "%s", but loading that source file '. | ||||
"%s to become defined.", | 'did not cause the symbol to become defined.', | ||||
$lib_name, | $lib_name, | ||||
$lib_path, | $lib_path, | ||||
$load_failed, | $load_failed, | ||||
$where, | $where)); | ||||
$load_failed)); | |||||
} | } | ||||
} | } | ||||
} | } |