Method getArticle
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getArticle(Item $itemObj, Category $categoryObj, \XoopsUser $xoopsUser, Helper $helper)
{
$itemImage = $itemObj->getVar('image');
if (isset($itemImage)) {
$imageHandler = xoops_getHandler('image');
Avoid using undefined variables such as '$schema' which will lead to PHP notices. Open
$ret = '<script type="application/ld+json">' . json_encode($schema, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_UNICODE | \JSON_UNESCAPED_SLASHES) . '</script>';
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$schema' which will lead to PHP notices. Open
$schema['@type'] = 'Article';
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$schema' which will lead to PHP notices. Open
$schema['@context'] = 'https://schema.org/';
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$schema' which will lead to PHP notices. Open
$schema['publisher'] = self::getOrganization($xoopsConfig, $xoops_url);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$schema' which will lead to PHP notices. Open
$schema['author'] = self::getAuthor($xoopsUser);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Missing class import via use statement (line '66', column '33'). Open
$criteria = new \Criteria('image_id', $itemObj->getVar('image'));
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid using static access to class 'XoopsModules\Publisher\Helper' in method 'getItem'. Open
$helper = Helper::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'XoopsModules\Publisher\Helper' in method 'getAuthoritem'. Open
$helper = Helper::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'XoopsModules\Publisher\Helper' in method 'getIndex'. Open
$helper = Helper::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'XoopsModules\Publisher\Helper' in method 'getCategory'. Open
$helper = Helper::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid unused parameters such as '$settings'. Open
public static function getBreadcrumbs(?array $data, $settings = null)
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused parameters such as '$data'. Open
public static function getBreadcrumbs(?array $data, $settings = null)
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused local variables such as '$xoopsUser'. Open
global $xoopsConfig, $xoopsUser, $xoops_url;
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
The parameter $xoops_url is not named in camelCase. Open
public static function getWebsite($xoopsConfig, $xoops_url)
{
$website = [
"@context" => "https://schema.org",
"@type" => "WebSite",
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $xoops_url is not named in camelCase. Open
public static function getAuthoritem($xoopsUser, array $xoopsConfig, string $xoops_url)
{
$ret = '';
$helper = Helper::getInstance();
if ($helper->getConfig('generate_jsonld')) {
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $xoops_url is not named in camelCase. Open
public static function getIndex($xoopsConfig, $xoopsUser, $xoops_url)
{
$ret = '';
$helper = Helper::getInstance();
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $xoops_url is not named in camelCase. Open
public static function getOrganization(array $xoopsConfig, string $xoops_url)
{
$organization = [
"@context" => "https://schema.org",
"@type" => "Organization",
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
Expected 1 blank line at end of file; 2 found Open
}
- Exclude checks
The variable $xoops_url is not named in camelCase. Open
public static function getOrganization(array $xoopsConfig, string $xoops_url)
{
$organization = [
"@context" => "https://schema.org",
"@type" => "Organization",
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $xoops_url is not named in camelCase. Open
public static function getItem(Item $itemObj, Category $categoryObj): string
{
$ret = '';
$helper = Helper::getInstance();
if ($helper->getConfig('generate_jsonld')) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $xoops_url is not named in camelCase. Open
public static function getIndex($xoopsConfig, $xoopsUser, $xoops_url)
{
$ret = '';
$helper = Helper::getInstance();
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $xoops_url is not named in camelCase. Open
public static function getItem(Item $itemObj, Category $categoryObj): string
{
$ret = '';
$helper = Helper::getInstance();
if ($helper->getConfig('generate_jsonld')) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $xoops_url is not named in camelCase. Open
public static function getCategory(Category $categoryObj)
{
$ret = '';
$helper = Helper::getInstance();
if ($helper->getConfig('generate_jsonld')) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $xoops_url is not named in camelCase. Open
public static function getOrganization(array $xoopsConfig, string $xoops_url)
{
$organization = [
"@context" => "https://schema.org",
"@type" => "Organization",
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $xoops_url is not named in camelCase. Open
public static function getCategory(Category $categoryObj)
{
$ret = '';
$helper = Helper::getInstance();
if ($helper->getConfig('generate_jsonld')) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $xoops_url is not named in camelCase. Open
public static function getWebsite($xoopsConfig, $xoops_url)
{
$website = [
"@context" => "https://schema.org",
"@type" => "WebSite",
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $xoops_url is not named in camelCase. Open
public static function getAuthoritem($xoopsUser, array $xoopsConfig, string $xoops_url)
{
$ret = '';
$helper = Helper::getInstance();
if ($helper->getConfig('generate_jsonld')) {
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}