From 20ebd349482d41b0231b03c71fddc6960d32260b Mon Sep 17 00:00:00 2001 From: Dag Date: Thu, 8 Aug 2024 04:18:15 +0200 Subject: [PATCH] refactor: drop usage of Debug::log --- bridges/AsahiShimbunAJWBridge.php | 1 - bridges/DagensNyheterDirektBridge.php | 5 --- bridges/FicbookBridge.php | 1 - bridges/FolhaDeSaoPauloBridge.php | 4 --- bridges/HackerNewsUserThreadsBridge.php | 2 -- bridges/ItakuBridge.php | 3 +- bridges/JustETFBridge.php | 8 ----- bridges/MastodonBridge.php | 12 ++++--- bridges/PanacheDigitalGamesBridge.php | 2 +- bridges/PresidenciaPTBridge.php | 1 - bridges/SlusheBridge.php | 7 +--- bridges/ThreadsBridge.php | 5 ++- bridges/TwitterBridge.php | 2 +- bridges/TwitterV2Bridge.php | 29 ++-------------- bridges/UnraidCommunityApplicationsBridge.php | 2 -- bridges/XenForoBridge.php | 2 -- lib/BridgeCard.php | 4 +-- lib/Debug.php | 16 --------- lib/FeedItem.php | 33 ++++++++++--------- 19 files changed, 36 insertions(+), 103 deletions(-) diff --git a/bridges/AsahiShimbunAJWBridge.php b/bridges/AsahiShimbunAJWBridge.php index 03bee6ba3c2..873eb351cce 100644 --- a/bridges/AsahiShimbunAJWBridge.php +++ b/bridges/AsahiShimbunAJWBridge.php @@ -45,7 +45,6 @@ public function collectData() foreach ($html->find('#MainInner li a') as $element) { if ($element->parent()->class == 'HeadlineTopImage-S') { - Debug::log('Skip Headline, it is repeated below'); continue; } $item = []; diff --git a/bridges/DagensNyheterDirektBridge.php b/bridges/DagensNyheterDirektBridge.php index 4d1629fbbd5..f0748b76f23 100644 --- a/bridges/DagensNyheterDirektBridge.php +++ b/bridges/DagensNyheterDirektBridge.php @@ -27,11 +27,6 @@ public function collectData() $url = self::BASEURL . $link; $title = $element->find('h2', 0)->plaintext; $author = $element->find('div.ds-byline__titles', 0)->plaintext; - // Debug::log($link); - // Debug::log($datetime); - // Debug::log($title); - // Debug::log($url); - // Debug::log($author); $article_content = $element->find('div.direkt-post__content', 0); $article_html = ''; diff --git a/bridges/FicbookBridge.php b/bridges/FicbookBridge.php index d11015adcd1..3aa7d998427 100644 --- a/bridges/FicbookBridge.php +++ b/bridges/FicbookBridge.php @@ -187,7 +187,6 @@ private function fixDate($date) $fixed_date = str_replace(' г.', '', $fixed_date); if ($fixed_date === $date) { - Debug::log('Unable to fix date: ' . $date); return null; } diff --git a/bridges/FolhaDeSaoPauloBridge.php b/bridges/FolhaDeSaoPauloBridge.php index dba86c52ca7..27713a41b45 100644 --- a/bridges/FolhaDeSaoPauloBridge.php +++ b/bridges/FolhaDeSaoPauloBridge.php @@ -44,8 +44,6 @@ protected function parseItem(array $item) $item['content'] = $text; $item['uri'] = explode('*', $item['uri'])[1]; } - } else { - Debug::log('???: ' . $item['uri']); } } else { $item['uri'] = explode('*', $item['uri'])[1]; @@ -58,13 +56,11 @@ public function collectData() { $feed_input = $this->getInput('feed'); if (substr($feed_input, 0, strlen(self::URI)) === self::URI) { - Debug::log('Input:: ' . $feed_input); $feed_url = $feed_input; } else { /* TODO: prepend `/` if missing */ $feed_url = self::URI . '/' . $this->getInput('feed'); } - Debug::log('URL: ' . $feed_url); $limit = $this->getInput('amount'); $this->collectExpandableDatas($feed_url, $limit); } diff --git a/bridges/HackerNewsUserThreadsBridge.php b/bridges/HackerNewsUserThreadsBridge.php index fee96b61cbf..0ab7445db25 100644 --- a/bridges/HackerNewsUserThreadsBridge.php +++ b/bridges/HackerNewsUserThreadsBridge.php @@ -21,8 +21,6 @@ public function collectData() { $url = 'https://news.ycombinator.com/threads?id=' . $this->getInput('user'); $html = getSimpleHTMLDOM($url); - Debug::log('queried ' . $url); - Debug::log('found ' . $html); $item = []; $articles = $html->find('tr[class*="comtr"]'); diff --git a/bridges/ItakuBridge.php b/bridges/ItakuBridge.php index 506805f7ebb..e6ecbdc84aa 100644 --- a/bridges/ItakuBridge.php +++ b/bridges/ItakuBridge.php @@ -522,7 +522,7 @@ private function getCommission($id, array $metadata = null) { $url = self::URI . '/api/commissions/' . $id . '/?format=json'; $uri = self::URI . '/commissions/' . $id; - // Debug::log(var_dump($metadata)); + $data = $metadata ?? $this->getData($url, true, true) or returnServerError("Could not load $url"); @@ -664,7 +664,6 @@ private function getImage($id /* array $metadata = null */) //$metadata disabled private function getData(string $url, bool $cache = false, bool $getJSON = false, array $httpHeaders = [], array $curlOptions = []) { - // Debug::log($url); if ($getJSON) { //get JSON object if ($cache) { $data = $this->loadCacheValue($url); diff --git a/bridges/JustETFBridge.php b/bridges/JustETFBridge.php index 88920133f4f..bcefe331fcb 100644 --- a/bridges/JustETFBridge.php +++ b/bridges/JustETFBridge.php @@ -138,8 +138,6 @@ private function fixDate($date) date_time_set($df, 0, 0); - // Debug::log(date_format($df, 'U')); - return date_format($df, 'U'); } @@ -216,8 +214,6 @@ private function extractNewsDate($article) $element = $article->find('div.subheadline', 0) or returnServerError('Date not found!'); - // Debug::log($element->plaintext); - $date = trim(explode('|', $element->plaintext)[0]); return $this->fixDate($date); @@ -230,8 +226,6 @@ private function extractNewsDescription($article) $element->find('a', 0)->onclick = ''; - // Debug::log($element->innertext); - return $element->innertext; } @@ -300,8 +294,6 @@ private function extractProfileDate($html) $element = $html->find('div.infobox div.vallabel', 0) or returnServerError('Date not found!'); - // Debug::log($element->plaintext); - $date = trim(explode("\r\n", $element->plaintext)[1]); return $this->fixDate($date); diff --git a/bridges/MastodonBridge.php b/bridges/MastodonBridge.php index e673bf145c0..b98b1135b2f 100644 --- a/bridges/MastodonBridge.php +++ b/bridges/MastodonBridge.php @@ -275,11 +275,13 @@ protected function fetchAP($url) $toSign = '(request-target): get ' . $matches[2] . "\nhost: " . $matches[1] . "\ndate: " . $date; $result = openssl_sign($toSign, $signature, $pkey, 'RSA-SHA256'); if ($result) { - Debug::log($toSign); - $sig = 'Signature: keyId="' . $keyId . '",headers="(request-target) host date",signature="' . - base64_encode($signature) . '"'; - Debug::log($sig); - array_push($headers, $sig); + $sig = sprintf( + 'Signature: keyId="%s",headers="(request-target) host date",signature="%s"', + $keyId, + base64_encode($signature) + ); + + $headers[] = $sig; } } try { diff --git a/bridges/PanacheDigitalGamesBridge.php b/bridges/PanacheDigitalGamesBridge.php index 6f7d8994373..bb0c00b9795 100644 --- a/bridges/PanacheDigitalGamesBridge.php +++ b/bridges/PanacheDigitalGamesBridge.php @@ -38,7 +38,7 @@ public function collectData() $image_html = $element->find('.news-item-thumbnail-image', 0); if ($image_html) { $image_strings = explode('\'', $image_html); - /* Debug::log('S: ' . count($image_strings) . '||' . implode('_ _', $image_strings)); */ + if (count($image_strings) == 4) { $item['content'] = ''; } diff --git a/bridges/PresidenciaPTBridge.php b/bridges/PresidenciaPTBridge.php index 247e8fce5ad..2f55f26278e 100644 --- a/bridges/PresidenciaPTBridge.php +++ b/bridges/PresidenciaPTBridge.php @@ -55,7 +55,6 @@ public function collectData() $contexts = $this->getParameters(); foreach (array_keys($contexts['Section']) as $k) { - Debug::log('Key: ' . var_export($k, true)); if ($this->getInput($k)) { $html = getSimpleHTMLDOMCached($this->getURI() . $k); diff --git a/bridges/SlusheBridge.php b/bridges/SlusheBridge.php index 12bed13a2dc..9d755c71aeb 100644 --- a/bridges/SlusheBridge.php +++ b/bridges/SlusheBridge.php @@ -118,12 +118,8 @@ public function collectData() $html = getSimpleHTMLDOM($uri, $headers); - //Debug::log($html); - //Debug::log($html->find('div.blog-item')[0]); - //Loop on each entry foreach ($html->find('div.blog-item') as $element) { - //Debug::log($element); $title = $element->find('h3.title', 0)->first_child()->innertext; $article_uri = $element->find('h3.title', 0)->first_child()->href; @@ -153,7 +149,6 @@ public function collectData() // Add image thumbnail(s) foreach ($media_uris->find('img') as $media_uri) { $media_html .= '' . $media_uri . ''; - //Debug::log('Adding to enclosures: ' . str_replace(' ', '%20', $media_uri->src)); $item['enclosures'][] = str_replace(' ', '%20', $media_uri->src); } } @@ -165,7 +160,7 @@ public function collectData() foreach ($media_uris->find('img') as $media_uri) { $media_html .= '

Video:

' . $media_uri . ''; - //Debug::log('Adding to enclosures: ' . $media_uri->src); + $item['enclosures'][] = $media_uri->src; } } diff --git a/bridges/ThreadsBridge.php b/bridges/ThreadsBridge.php index b7e5cd1abff..cfcbba0ee75 100644 --- a/bridges/ThreadsBridge.php +++ b/bridges/ThreadsBridge.php @@ -70,9 +70,9 @@ private function recursiveFind($haystack, $needle) public function collectData() { $html = getSimpleHTMLDOMCached($this->getURI(), static::CACHE_TIMEOUT); - Debug::log(sprintf('Fetched: %s', $this->getURI())); + $jsonBlobs = $html->find('script[type="application/json"]'); - Debug::log(sprintf('%d JSON blobs found.', count($jsonBlobs))); + $gatheredCodes = []; $limit = $this->getInput('limit'); foreach ($jsonBlobs as $jsonBlob) { @@ -87,7 +87,6 @@ public function collectData() } } } - Debug::log(sprintf('Candidate codes found in JSON in script tags: %s', print_r($gatheredCodes, true))); $this->feedName = html_entity_decode($html->find('meta[property=og:title]', 0)->content); // todo: meta[property=og:description] could populate the feed description diff --git a/bridges/TwitterBridge.php b/bridges/TwitterBridge.php index 93301038339..800fd63ca82 100644 --- a/bridges/TwitterBridge.php +++ b/bridges/TwitterBridge.php @@ -541,7 +541,7 @@ public function collectData() } break; default: - Debug::log('Missing support for media type: ' . $media->type); + break; } } } diff --git a/bridges/TwitterV2Bridge.php b/bridges/TwitterV2Bridge.php index 07af8301992..afa8f4fb1d1 100644 --- a/bridges/TwitterV2Bridge.php +++ b/bridges/TwitterV2Bridge.php @@ -192,7 +192,6 @@ public function collectData() . $this->getInput('u'), $authHeaders, $params); if (isset($user->errors)) { - Debug::log('User JSON: ' . json_encode($user)); returnServerError('Requested username can\'t be found.'); } @@ -266,7 +265,6 @@ public function collectData() (isset($data->errors) && !isset($data->data)) || (isset($data->meta) && $data->meta->result_count === 0) ) { - Debug::log('Data JSON: ' . json_encode($data)); switch ($this->queriedContext) { case 'By keyword or hashtag': returnServerError('No results for this query.'); @@ -311,7 +309,6 @@ public function collectData() foreach ($includesTweets as $includesTweet) { $includesTweetsIds[] = $includesTweet->id; } - Debug::log('includesTweetsIds: ' . join(',', $includesTweetsIds)); // Set default params for API query $params = [ @@ -336,8 +333,6 @@ public function collectData() // Create output array with all required elements for each tweet foreach ($tweets as $tweet) { - //Debug::log('Tweet JSON: ' . json_encode($tweet)); - // Skip pinned tweet (if selected) if ($hidePinned && $tweet->id === $pinnedTweetId) { continue; @@ -376,12 +371,10 @@ public function collectData() $cleanedQuotedTweet = null; $quotedUser = null; if ($isQuote) { - Debug::log('Tweet is quote'); foreach ($includesTweets as $includesTweet) { if ($includesTweet->id === $tweet->referenced_tweets[0]->id) { $quotedTweet = $includesTweet; $cleanedQuotedTweet = nl2br($quotedTweet->text); - //Debug::log('Found quoted tweet'); break; } } @@ -389,7 +382,6 @@ public function collectData() $quotedUser = $this->getTweetUser($quotedTweet, $retweetedUsers, $includesUsers); } if ($isRetweet || is_null($user)) { - Debug::log('Tweet is retweet, or $user is null'); // Replace tweet object with original retweeted object if ($isRetweet) { foreach ($includesTweets as $includesTweet) { @@ -430,7 +422,6 @@ public function collectData() . $this->item['username'] . ')'; $cleanedTweet = nl2br($tweet->text); - //Debug::log('cleanedTweet: ' . $cleanedTweet); // Perform optional keyword filtering (only keep tweet if keyword is found) if (! empty($tweetFilter)) { @@ -452,7 +443,6 @@ public function collectData() // Search for and replace URLs in Tweet text $cleanedTweet = $this->replaceTweetURLs($tweet, $cleanedTweet); if (isset($cleanedQuotedTweet)) { - Debug::log('Replacing URLs in Quoted Tweet text'); $cleanedQuotedTweet = $this->replaceTweetURLs($quotedTweet, $cleanedQuotedTweet); } @@ -478,9 +468,7 @@ public function collectData() // Get external link info $extURL = null; if (isset($tweet->entities->urls) && strpos($tweet->entities->urls[0]->expanded_url, 'twitter.com') === false) { - Debug::log('Found an external link!'); $extURL = $tweet->entities->urls[0]->expanded_url; - Debug::log($extURL); $extDisplayURL = $tweet->entities->urls[0]->display_url; $extTitle = $tweet->entities->urls[0]->title; $extDesc = $tweet->entities->urls[0]->description; @@ -513,15 +501,12 @@ public function collectData() $ext_media_html = ''; if (!$hideImages) { if (isset($tweet->attachments->media_keys)) { - Debug::log('Generating HTML for tweet media'); $media_html = $this->createTweetMediaHTML($tweet, $includesMedia, $retweetedMedia); } if (isset($quotedTweet->attachments->media_keys)) { - Debug::log('Generating HTML for quoted tweet media'); $quoted_media_html = $this->createTweetMediaHTML($quotedTweet, $includesMedia, $retweetedMedia); } if (isset($extURL)) { - Debug::log('Generating HTML for external link media'); if ($this->getInput('noimgscaling')) { $extMediaURL = $extMediaOrig; } else { @@ -562,7 +547,7 @@ public function collectData() // Add External Link HTML, if relevant if (isset($extURL) && !$this->getInput('noexternallink')) { - Debug::log('Adding HTML for external link'); + $ext_html = << $ext_media_html
@@ -653,21 +638,18 @@ private function getTweetUser($tweetObject, $retweetedUsers, $includesUsers) { $originalUser = new stdClass(); // make the linters stop complaining if (isset($retweetedUsers)) { - Debug::log('Searching for tweet author_id in $retweetedUsers'); foreach ($retweetedUsers as $retweetedUser) { if ($retweetedUser->id === $tweetObject->author_id) { $matchedUser = $retweetedUser; - Debug::log('Found author_id match in $retweetedUsers'); break; } } } if (!isset($matchedUser->username) && isset($includesUsers)) { - Debug::log('Searching for tweet author_id in $includesUsers'); foreach ($includesUsers as $includesUser) { if ($includesUser->id === $tweetObject->author_id) { $matchedUser = $includesUser; - Debug::log('Found author_id match in $includesUsers'); + break; } } @@ -689,7 +671,6 @@ private function createTweetMediaHTML($tweetObject, $includesMedia, $retweetedMe $tweetMedia = []; // Start by checking the original list of tweet Media includes if (isset($includesMedia)) { - Debug::log('Searching for media_key in $includesMedia'); foreach ($includesMedia as $includesMedium) { if ( in_array( @@ -697,14 +678,12 @@ private function createTweetMediaHTML($tweetObject, $includesMedia, $retweetedMe $tweetObject->attachments->media_keys ) ) { - Debug::log('Found media_key in $includesMedia'); $tweetMedia[] = $includesMedium; } } } // If no matches found, check the retweet Media includes if (empty($tweetMedia) && isset($retweetedMedia)) { - Debug::log('Searching for media_key in $retweetedMedia'); foreach ($retweetedMedia as $retweetedMedium) { if ( in_array( @@ -712,7 +691,6 @@ private function createTweetMediaHTML($tweetObject, $includesMedia, $retweetedMe $tweetObject->attachments->media_keys ) ) { - Debug::log('Found media_key in $retweetedMedia'); $tweetMedia[] = $retweetedMedium; } } @@ -760,8 +738,7 @@ private function createTweetMediaHTML($tweetObject, $includesMedia, $retweetedMe EOD; break; default: - Debug::log('Missing support for media type: ' - . $media->type); + break; } } diff --git a/bridges/UnraidCommunityApplicationsBridge.php b/bridges/UnraidCommunityApplicationsBridge.php index 441edb659b3..1295e8278a6 100644 --- a/bridges/UnraidCommunityApplicationsBridge.php +++ b/bridges/UnraidCommunityApplicationsBridge.php @@ -14,14 +14,12 @@ class UnraidCommunityApplicationsBridge extends BridgeAbstract private function fetchApps() { - Debug::log('Fetching all applications/plugins'); $this->apps = getContents(self::APPSURI); $this->apps = json_decode($this->apps, true)['applist']; } private function sortApps() { - Debug::log('Sorting applications/plugins'); usort($this->apps, function ($app1, $app2) { return $app1['FirstSeen'] < $app2['FirstSeen'] ? 1 : -1; }); diff --git a/bridges/XenForoBridge.php b/bridges/XenForoBridge.php index 1ecb1d74e61..d1ecea7415c 100644 --- a/bridges/XenForoBridge.php +++ b/bridges/XenForoBridge.php @@ -436,8 +436,6 @@ private function fixDate($date, $lang = 'en-US') break; } - // Debug::log(date_format($df, 'U')); - return date_format($df, 'U'); } } diff --git a/lib/BridgeCard.php b/lib/BridgeCard.php index d15ac865e0a..27285558697 100644 --- a/lib/BridgeCard.php +++ b/lib/BridgeCard.php @@ -192,7 +192,7 @@ public static function getListInput(array $entry, string $id, string $name): str { $required = $entry['required'] ?? null; if ($required) { - Debug::log('The "required" attribute is not supported for lists.'); + trigger_error('The required attribute is not supported for lists'); unset($entry['required']); } @@ -235,7 +235,7 @@ public static function getCheckboxInput(array $entry, string $id, string $name): { $required = $entry['required'] ?? null; if ($required) { - Debug::log('The "required" attribute is not supported for checkboxes.'); + trigger_error('The required attribute is not supported for checkboxes'); unset($entry['required']); } diff --git a/lib/Debug.php b/lib/Debug.php index ba9e787e18d..630fd8ec4bb 100644 --- a/lib/Debug.php +++ b/lib/Debug.php @@ -15,20 +15,4 @@ public static function isEnabled(): bool } return false; } - - /** - * @deprecated Use $this->logger->debug() - */ - public static function log($message) - { - $e = new \Exception(); - $trace = trace_from_exception($e); - // Drop the current frame - array_pop($trace); - $lastFrame = $trace[array_key_last($trace)]; - $text = sprintf('%s(%s): %s', $lastFrame['file'], $lastFrame['line'], $message); - - $logger = RssBridge::getLogger(); - $logger->debug($text); - } } diff --git a/lib/FeedItem.php b/lib/FeedItem.php index bca06c23937..8c9a60b14c5 100644 --- a/lib/FeedItem.php +++ b/lib/FeedItem.php @@ -12,6 +12,8 @@ class FeedItem protected ?string $uid = null; protected array $misc = []; + private Logger $logger; + public static function fromArray(array $itemArray): self { $item = new self(); @@ -23,6 +25,7 @@ public static function fromArray(array $itemArray): self private function __construct() { + $this->logger = RssBridge::getLogger(); } public function __set($name, $value) @@ -99,17 +102,17 @@ public function setURI($uri) } elseif ($uri->hasAttribute('src')) { // Image $uri = $uri->src; } else { - Debug::log('The item provided as URI is unknown!'); + $this->logger->debug('The item provided as URI is unknown!'); } } if (!is_string($uri)) { - Debug::log(sprintf('Expected $uri to be string but got %s', gettype($uri))); + $this->logger->debug(sprintf('Expected $uri to be string but got %s', gettype($uri))); return; } $uri = trim($uri); // Intentionally doing a weak url validation here because FILTER_VALIDATE_URL is too strict if (!preg_match('#^https?://#i', $uri)) { - Debug::log(sprintf('Not a valid url: "%s"', $uri)); + $this->logger->debug(sprintf('Not a valid url: "%s"', $uri)); return; } $this->uri = $uri; @@ -124,7 +127,7 @@ public function setTitle($title) { $this->title = null; if (!is_string($title)) { - trigger_error('Title must be a string: ' . print_r($title, true)); + $this->logger->debug('Title must be a string: ' . print_r($title, true)); } else { $this->title = truncate(trim($title)); } @@ -143,11 +146,11 @@ public function setTimestamp($datetime) } else { $timestamp = strtotime($datetime); if ($timestamp === false) { - Debug::log('Unable to parse timestamp!'); + $this->logger->debug('Unable to parse timestamp!'); } } if ($timestamp <= 0) { - Debug::log('Timestamp must be greater than zero!'); + $this->logger->debug('Timestamp must be greater than zero!'); } else { $this->timestamp = $timestamp; } @@ -162,7 +165,7 @@ public function setAuthor($author) { $this->author = null; if (!is_string($author)) { - Debug::log('Author must be a string!'); + $this->logger->debug('Author must be a string!'); } else { $this->author = $author; } @@ -190,7 +193,7 @@ public function setContent($content) if (is_string($content)) { $this->content = $content; } else { - Debug::log(sprintf('Unable to convert feed content to string: %s', gettype($content))); + $this->logger->debug(sprintf('Unable to convert feed content to string: %s', gettype($content))); } } @@ -204,7 +207,7 @@ public function setEnclosures($enclosures) $this->enclosures = []; if (!is_array($enclosures)) { - Debug::log('Enclosures must be an array!'); + $this->logger->debug('Enclosures must be an array!'); return; } foreach ($enclosures as $enclosure) { @@ -215,7 +218,7 @@ public function setEnclosures($enclosures) FILTER_FLAG_PATH_REQUIRED ) ) { - Debug::log('Each enclosure must contain a scheme, host and path!'); + $this->logger->debug('Each enclosure must contain a scheme, host and path!'); } elseif (!in_array($enclosure, $this->enclosures)) { $this->enclosures[] = $enclosure; } @@ -232,14 +235,14 @@ public function setCategories($categories) $this->categories = []; if (!is_array($categories)) { - Debug::log('Categories must be an array!'); + $this->logger->debug('Categories must be an array!'); return; } foreach ($categories as $category) { if (is_string($category)) { $this->categories[] = $category; } else { - Debug::log('Category must be a string!'); + $this->logger->debug('Category must be a string!'); } } } @@ -253,7 +256,7 @@ public function setUid($uid): void { $this->uid = null; if (!is_string($uid)) { - Debug::log(sprintf('uid must be string: %s (%s)', (string) $uid, var_export($uid, true))); + $this->logger->debug(sprintf('uid must be string: %s (%s)', (string) $uid, var_export($uid, true))); return; } if (preg_match('/^[a-f0-9]{40}$/', $uid)) { @@ -267,9 +270,9 @@ public function setUid($uid): void public function addMisc($name, $value) { if (!is_string($name)) { - Debug::log('Key must be a string!'); + $this->logger->debug('Key must be a string!'); } elseif (in_array($name, get_object_vars($this))) { - Debug::log('Key must be unique!'); + $this->logger->debug('Key must be unique!'); } else { $this->misc[$name] = $value; }