public function withPhoto(string $image, string $link, string $name)
{
$this->photo = [
- 'image' => $image ?? '',
- 'link' => $link ?? '',
- 'name' => $name ?? '',
+ 'image' => $image,
+ 'link' => $link,
+ 'name' => $name,
];
return $this;
return [];
}
- if (empty($curlResult)) {
- return [];
- }
-
if (!$curlResult->isSuccess() || empty($curlResult->getBodyString())) {
Logger::debug('Fetching was unsuccessful', ['url' => $request, 'return-code' => $curlResult->getReturnCode(), 'error-number' => $curlResult->getErrorNumber(), 'error' => $curlResult->getError()]);
return [];
$data = DI::cache()->get($cacheKey);
- if (empty($data) || !is_array($data)) {
+ if (!is_array($data)) {
$data = self::getInfoFromURL($url, $ocr);
DI::cache()->set($cacheKey, $data);
}
- return $data ?? [];
+ return $data;
}
/**
if ($image->isValid()) {
$data['blurhash'] = $image->getBlurHash();
-
+
if ($ocr) {
$media = ['img_str' => $img_str];
Hook::callAll('ocr-detection', $media);
$content = JsonLD::fetchElement($jsonld, 'logo', 'url', '@type', 'ImageObject');
if (!empty($content) && is_string($content)) {
$jsonldinfo['publisher_img'] = trim($content);
- } elseif (!empty($content) && is_array($content)) {
+ } elseif (is_array($content) && array_key_exists(0, $content)) {
$jsonldinfo['publisher_img'] = trim($content[0]);
}