Skip to content

Commit

Permalink
Apply php-cs-fixer changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndr-w authored and github-actions[bot] committed Sep 17, 2023
1 parent 798c223 commit d11e74c
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 33 deletions.
61 changes: 34 additions & 27 deletions lib/qanda.php
Original file line number Diff line number Diff line change
@@ -1,81 +1,88 @@
<?php


class qanda extends \rex_yform_manager_dataset
{
public function getCategory()
{
return $this->getCategories()[0];
}

public function getCategories()
{
return $this->getRelatedCollection('category_ids');
}
public function getQuestion($lang = null) :string

public function getQuestion($lang = null): string
{
if($lang) {
return $this->getTranslation($lang)->getValue("question");
if ($lang) {
return $this->getTranslation($lang)->getValue('question');
}
return $this->getValue("question");
return $this->getValue('question');
}

public static function findByIds(array $ids, float $status = 1)
{
$ids = implode(",", $ids);
return qanda::query()->whereRaw('status >= '.$status.' AND FIND_IN_SET(id, "'.$ids.'")')->find();
$ids = implode(',', $ids);
return self::query()->whereRaw('status >= ' . $status . ' AND FIND_IN_SET(id, "' . $ids . '")')->find();
}

public static function findByCategoryIds(array $category_ids, float $status = 1)
{
$ids = implode(',', $category_ids);
return self::query()->whereRAW('status >= ' . $status . ' AND FIND_IN_SET(category_ids, "' . $ids . '")')->find();
}
public function getAnswer($lang = null) :string

public function getAnswer($lang = null): string
{
if($lang) {
return $this->getTranslation($lang)->getValue("answer");
if ($lang) {
return $this->getTranslation($lang)->getValue('answer');
}
return $this->getValue("answer");
return $this->getValue('answer');
}
public function getAnswerAsPlaintext($lang = null) :string

public function getAnswerAsPlaintext($lang = null): string
{
if($lang) {
return strip_tags($this->getTranslation($lang)->getValue("answer"));
if ($lang) {
return strip_tags($this->getTranslation($lang)->getValue('answer'));
}
return strip_tags($this->getValue("answer"));
return strip_tags($this->getValue('answer'));
}

public function getTranslation($lang = null) :mixed
public function getTranslation($lang = null): mixed
{
if($lang) {
if ($lang) {
return qanda_lang::getTranslation($this->getId(), $lang);
}
return $this->getRelatedCollection("lang");
return $this->getRelatedCollection('lang');
}
public function getAuthor() :string

public function getAuthor(): string
{
return $this->getValue("author");
return $this->getValue('author');
}
public function getUrl($param = "question-header-")

public function getUrl($param = 'question-header-')
{
if (rex_addon::get("yrewrite") && rex_addon::get("yrewrite")->isAvailable()) {
if (rex_addon::get('yrewrite') && rex_addon::get('yrewrite')->isAvailable()) {
$host = rex_yrewrite::getFullUrlByArticleId(rex_article::getCurrentId(), rex_clang::getCurrentId());
} else {
$host = rtrim(rex::getServer(), '/') . rex_getUrl(rex_article::getCurrentId(), rex_clang::getCurrentId());
}

return rtrim($host, '/') . '#' . $param . $this->getId();
}

public static function showJsonLd($question)
{
$fragment = new rex_fragment;
$fragment->setVar("question", $question);
$fragment = new rex_fragment();
$fragment->setVar('question', $question);
return $fragment->parse('qanda.json-ld.php');
}

public static function showFAQPage($questions)
{
$fragment = new rex_fragment;
$fragment->setVar("questions", $questions);
$fragment = new rex_fragment();
$fragment->setVar('questions', $questions);
return $fragment->parse('FAQPage.json-ld.php');
}
}
14 changes: 8 additions & 6 deletions lib/qanda_lang.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
<?php


class qanda_lang extends \rex_yform_manager_dataset
{
public function getAnswerAsPlaintext() :string
public function getAnswerAsPlaintext(): string
{
return strip_tags($this->getValue("answer"));
return strip_tags($this->getValue('answer'));
}

public function getQuestion()
{
return $this->getValue("question");
return $this->getValue('question');
}

public function getAnswer()
{
return $this->getValue("answer");
return $this->getValue('answer');
}
public static function getTranslation($question, $lang) :qanda_lang

public static function getTranslation($question, $lang): self
{
return self::query()->where('qanda_id', $question)->where('clang_id', $lang)->findOne();
}
Expand Down

0 comments on commit d11e74c

Please sign in to comment.