for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace XoopsModules\Xoopsfaq\Common;
use XoopsModules\Xoopsfaq\{
Contents,
ContentsHandler
};
class Jsonld
{
public static function getJsonld(?array $data, $settings = null)
$settings
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public static function getJsonld(?array $data, /** @scrutinizer ignore-unused */ $settings = null)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
$out = '';
$jsonld = [];
$schema = [];
foreach ($data as $key => $value) {
$schema["@context"] = "http://schema.org/";
$schema["@type"] = "FAQPage";
$schema["mainEntity"] = [
'@type' => "Question",
'name' => $value['title'],
'acceptedAnswer' => [
'@type' => 'Answer',
'text' => $value['answer'],
],
];
$jsonld[] = $schema;
}
$out .= '<script type="application/ld+json">' . json_encode($jsonld, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . '</script>';
return $out;
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.