2 namespace wcf\data\devtools\missing\language\item;
3 use wcf\data\DatabaseObject;
4 use wcf\data\language\Language;
5 use wcf\system\language\LanguageFactory;
10 * Represents a missing language item log entry.
12 * @author Matthias Schmidt
13 * @copyright 2001-2020 WoltLab GmbH
14 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
15 * @package WoltLabSuite\Core\Devtools\Missing\Language\Item
18 * @property-read integer $itemID unique id of the missing language item log entry
19 * @property-read integer $languageID id of the language the missing language item was requested for
20 * @property-read string $languageItem name of the missing language item
21 * @property-read integer $lastTime timestamp of the last time the missing language item was requested
22 * @property-read string $stackTrace stack trace of how the missing language item was requested for the last time
24 class DevtoolsMissingLanguageItem extends DatabaseObject {
26 * Returns the language the missing language item was requested for or `null` if the language
27 * does not exist anymore.
29 * @return null|Language
31 public function getLanguage() {
32 if ($this->languageID === null) {
36 return LanguageFactory::getInstance()->getLanguage($this->languageID);
40 * Returns the formatted stack trace of how the missing language item was requested for the
45 public function getStackTrace() {
46 $stackTrace = JSON::decode($this->stackTrace);
47 foreach ($stackTrace as &$stackEntry) {
48 foreach ($stackEntry['args'] as &$stackEntryArg) {
49 if (gettype($stackEntryArg) === 'string') {
50 $stackEntryArg = str_replace(["\n", "\t"], ['\n', '\t'], $stackEntryArg);
53 unset($stackEntryArg);
57 return WCF::getTPL()->fetch('__devtoolsMissingLanguageItemStackTrace', 'wcf', [
58 'stackTrace' => $stackTrace,