Function getRssClient
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function getRssClient(string $url): SimplePie
{
$feed = new SimplePie();
if (!empty(\Config\Security::$proxyConnection)) {
$proxy = [];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Missing class import via use statement (line '208', column '20'). Open
$recordId = (new \App\Db\Query())->select(['rssid'])->from('vtiger_rss')->where(['starred' => 1])->scalar();
- 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
Missing class import via use statement (line '148', column '19'). Open
$rowData = (new \App\Db\Query())->from('vtiger_rss')->where(['rssid' => $recordId])->one();
- 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
Missing class import via use statement (line '226', column '15'). Open
$feed = new SimplePie();
- 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
Missing class import via use statement (line '190', column '15'). Open
$feed = new SimplePie();
- 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
Missing class import via use statement (line '212', column '21'). Open
$recordId = (new \App\Db\Query())->select(['rssid'])->from('vtiger_rss')->scalar();
- 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 assigning values to variables in if clauses and the like (line '197', column '7'). Open
public function validateRssUrl($url)
{
$feed = new SimplePie();
$feed->set_cache_location(ROOT_DIRECTORY . '/cache/rss_cache');
$feed->set_feed_url($url);
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class '\App\Purifier' in method 'setRssChannel'. Open
$this->set('rsstitle', App\Purifier::decodeHtml(\App\Purifier::purify(App\Purifier::decodeHtml($rss->get_title()))));
- 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 'App\Purifier' in method 'setRssItems'. Open
$title = App\Purifier::decodeHtml(\App\Purifier::purify(App\Purifier::decodeHtml($announcement->get_title())));
- 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 '\App\Validator' in method 'setRssChannel'. Open
if (\App\Validator::url($rss->get_link())) {
- 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 assigning values to variables in if clauses and the like (line '158', column '14'). Open
public static function getInstanceById($recordId, $qualifiedModuleName = null)
{
$rowData = (new \App\Db\Query())->from('vtiger_rss')->where(['rssid' => $recordId])->one();
if ($rowData) {
$recordModel = new self();
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class '\App\TextUtils' in method 'setRssItems'. Open
'title' => \App\TextUtils::textTruncate($title, 100),
- 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 '\App\Purifier' in method 'setRssChannel'. Open
$this->set('url', \App\Purifier::purifyByType($rss->get_link(), \App\Purifier::URL));
- 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 'App\Purifier' in method 'setRssItems'. Open
'link' => App\Purifier::decodeHtml($announcement->get_link()),
- 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 '\App\Fields\DateTime' in method 'setRssItems'. Open
'date' => \App\Fields\DateTime::formatToViewDate($announcement->get_date('Y-m-d H:i:s')),
- 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 'App\Purifier' in method 'setRssChannel'. Open
$this->set('rsstitle', App\Purifier::decodeHtml(\App\Purifier::purify(App\Purifier::decodeHtml($rss->get_title()))));
- 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 '\App\Log' in method 'getInstanceById'. Open
\App\Log::warning($error, 'RSS');
- 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 '\App\Purifier' in method 'setRssItems'. Open
$title = App\Purifier::decodeHtml(\App\Purifier::purify(App\Purifier::decodeHtml($announcement->get_title())));
- 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 '\App\Db' in method 'saveRecord'. Open
$db = \App\Db::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
The method getDefaultRss uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$recordId = (new \App\Db\Query())->select(['rssid'])->from('vtiger_rss')->scalar();
$this->setId($recordId);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'App\Purifier' in method 'setRssChannel'. Open
$this->set('rsstitle', App\Purifier::decodeHtml(\App\Purifier::purify(App\Purifier::decodeHtml($rss->get_title()))));
- 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 'App\Purifier' in method 'setRssItems'. Open
$title = App\Purifier::decodeHtml(\App\Purifier::purify(App\Purifier::decodeHtml($announcement->get_title())));
- 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 '\App\Validator' in method 'setRssItems'. Open
if (!\App\Validator::url((string) $announcement->get_link())) {
- 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 '\App\Log' in method 'validateRssUrl'. Open
\App\Log::warning($error, 'RSS');
- 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
Define a constant instead of duplicating this literal "starred" 3 times. Open
$dbCommand->update('vtiger_rss', ['starred' => 0])->execute();
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "rsstitle" 3 times. Open
return $this->get('rsstitle');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "rssid" 7 times. Open
return $this->get('rssid');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "vtiger_rss" 7 times. Open
$insert = $db->createCommand()->insert('vtiger_rss', ['rssurl' => $url, 'rsstitle' => $title])->execute();
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Call to method error
from undeclared class \SimplePie
Open
if ($error = $feed->error()) {
- Exclude checks
Call to method set_feed_url
from undeclared class \SimplePie
Open
$feed->set_feed_url($url);
- Exclude checks
Call to method get_items
from undeclared class \SimplePie
Open
foreach ($rss->get_items() as $announcement) {
- Exclude checks
Call to method get_link
from undeclared class \SimplePie
Open
if (\App\Validator::url($rss->get_link())) {
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$dbCommand = \App\Db::getInstance()->createCommand();
- Exclude checks
Parameter $rss
has undeclared type \SimplePie
Open
public function setRssItems(SimplePie $rss): void
- Exclude checks
Call to method get_link
from undeclared class \SimplePie
Open
$this->set('url', \App\Purifier::purifyByType($rss->get_link(), \App\Purifier::URL));
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()->delete('vtiger_rss', ['rssid' => $this->getId()])->execute();
- Exclude checks
Call to method set_cache_location
from undeclared class \SimplePie
Open
$feed->set_cache_location(ROOT_DIRECTORY . '/cache/rss_cache');
- Exclude checks
Call to method url
from undeclared class \App\Validator
(Did you mean class \Tests\App\Validator) Open
if (\App\Validator::url($rss->get_link())) {
- Exclude checks
Returning type false
but getInstanceById()
is declared to return \Rss_Record_Model
Open
return false;
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$recordId = (new \App\Db\Query())->select(['rssid'])->from('vtiger_rss')->scalar();
- Exclude checks
Call to method get_title
from undeclared class \SimplePie
Open
$this->set('rsstitle', App\Purifier::decodeHtml(\App\Purifier::purify(App\Purifier::decodeHtml($rss->get_title()))));
- Exclude checks
Call to method init
from undeclared class \SimplePie
Open
if ($feed->init()) {
- Exclude checks
Call to method warning
from undeclared class \App\Log
Open
\App\Log::warning($error, 'RSS');
- Exclude checks
Return type of getRssClient()
is undeclared type \SimplePie
Open
public static function getRssClient(string $url): SimplePie
- Exclude checks
Parameter $rss
has undeclared type \SimplePie
Open
public function setRssChannel(SimplePie $rss): void
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$insert = $db->createCommand()->insert('vtiger_rss', ['rssurl' => $url, 'rsstitle' => $title])->execute();
- Exclude checks
Declaration of function getCleanInstance($qualifiedModuleName)
should be compatible with function getCleanInstance(string $moduleName)
(parameter #1 with no type cannot replace original parameter with type 'string')
defined in /code/modules/Vtiger/models/Record.php:734
Open
* @param string $qualifiedModuleName
- Exclude checks
Call to method __construct
from undeclared class \SimplePie
Open
$feed = new SimplePie();
- Exclude checks
Call to method warning
from undeclared class \App\Log
Open
\App\Log::warning($error, 'RSS');
- Exclude checks
Call to method __construct
from undeclared class \SimplePie
Open
$feed = new SimplePie();
- Exclude checks
Call to method set_cache_location
from undeclared class \SimplePie
Open
$feed->set_cache_location(ROOT_DIRECTORY . '/cache/rss_cache');
- Exclude checks
Argument 1 (value)
is string
but \Rss_Record_Model::setId()
takes int
defined at /code/modules/Rss/models/Record.php:31
Open
$this->setId($id);
- Exclude checks
Call to method error
from undeclared class \SimplePie
Open
} elseif ($error = $feed->error()) {
- Exclude checks
Call to method init
from undeclared class \SimplePie
Open
if ($feed->init()) {
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$rowData = (new \App\Db\Query())->from('vtiger_rss')->where(['rssid' => $recordId])->one();
- Exclude checks
Call to method set_feed_url
from undeclared class \SimplePie
Open
$feed->set_feed_url($url);
- Exclude checks
Call to method set_curl_options
from undeclared class \SimplePie
Open
$feed->set_curl_options($proxy);
- Exclude checks
Call to method url
from undeclared class \App\Validator
(Did you mean class \Tests\App\Validator) Open
if (!\App\Validator::url((string) $announcement->get_link())) {
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$recordId = (new \App\Db\Query())->select(['rssid'])->from('vtiger_rss')->where(['starred' => 1])->scalar();
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Rss_Record_Model extends Vtiger_Record_Model
- Exclude checks
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = \App\Db::getInstance();
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
The class Rss_Record_Model is not named in CamelCase. Open
class Rss_Record_Model extends Vtiger_Record_Model
{
/**
* Function to get the id of the Record.
*
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Avoid variables with short names like $id. Configured minimum length is 3. Open
$id = $db->getLastInsertID('vtiger_rss_rssid_seq');
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->get('rssid');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getRssItems(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get Rss fetched object.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the id of the Record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->get('rsstitle');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function setRssItems(SimplePie $rss): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function setId($value)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$items = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int - Report Id
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to set the id of the Record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->set('rssid', $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getName(): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getId()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param SimplePie $rss - Rss fetched object
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\App\Validator::url((string) $announcement->get_link())) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
continue;
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
$title = App\Purifier::decodeHtml(\App\Purifier::purify(App\Purifier::decodeHtml($announcement->get_title())));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->set('url', \App\Purifier::purifyByType($rss->get_link(), \App\Purifier::URL));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $id;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->update('vtiger_rss', ['starred' => 1], ['rssid' => $recordId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = \App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to delete a record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordId = $this->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = new self();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($feed->init()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Rss_Record_Model
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$feed = new SimplePie();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$feed->set_cache_location(ROOT_DIRECTORY . '/cache/rss_cache');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getDefaultRss()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rowData = (new \App\Db\Query())->from('vtiger_rss')->where(['rssid' => $recordId])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('error', $error);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'date' => \App\Fields\DateTime::formatToViewDate($announcement->get_date('Y-m-d H:i:s')),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $url
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function saveRecord($url)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$title = $this->getName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->update('vtiger_rss', ['starred' => 0])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getInstanceById($recordId, $qualifiedModuleName = null)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->setData($rowData);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'link' => App\Purifier::decodeHtml($announcement->get_link()),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to save the record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$title = $url;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$insert = $db->createCommand()->insert('vtiger_rss', ['rssurl' => $url, 'rsstitle' => $title])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance()->createCommand()->delete('vtiger_rss', ['rssid' => $this->getId()])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'fullTitle' => $title
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to validate the rss url.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordId = (new \App\Db\Query())->select(['rssid'])->from('vtiger_rss')->where(['starred' => 1])->scalar();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return SimplePie
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the Name of the record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to set Rss Object.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->get('rss') ?: [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $value - id value
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Rss_Record_Model - current instance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string - Entity Name of the record
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($rss->get_items() as $announcement) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to make a record default for an rss record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand = \App\Db::getInstance()->createCommand();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $recordId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($rowData) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ($error = $feed->error()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getCleanInstance($qualifiedModuleName)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get rss client.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$proxy = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$feed->set_feed_url($url);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function delete()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $qualifiedModuleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setRssChannel($feed);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($recordId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$login .= ':' . \Config\Security::$proxyPassword;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$feed->set_cache_location(ROOT_DIRECTORY . '/cache/rss_cache');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'title' => \App\TextUtils::textTruncate($title, 100),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to set Rss values.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
$this->set('rsstitle', App\Purifier::decodeHtml(\App\Purifier::purify(App\Purifier::decodeHtml($rss->get_title()))));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get record instance by using id and moduleName.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get clean record instance by using moduleName.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $recordModel->setModule($qualifiedModuleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the default rss.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$login = \Config\Security::$proxyLogin ?? '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty(\Config\Security::$proxyPort)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$items[] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->set('rsstitle', App\Purifier::decodeHtml(\App\Purifier::purify(App\Purifier::decodeHtml($rss->get_title()))));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $recordModel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function validateRssUrl($url)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty(\Config\Security::$proxyPassword)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Validator::url($rss->get_link())) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$id = $db->getLastInsertID('vtiger_rss_rssid_seq');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$feed = self::getRssClient($recordModel->get('rssurl'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $qualifiedModuleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $url
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$feed->set_feed_url($url);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$proxy[CURLOPT_PROXYPORT] = \Config\Security::$proxyPort;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param SimplePie $rss - Rss fetched object
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($insert) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$feed = new SimplePie();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setId($id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->setModule($qualifiedModuleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->setRssChannel($feed);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($error = $feed->error()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::warning($error, 'RSS');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setId($recordId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Rss_Record_Model RecordModel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::warning($error, 'RSS');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordId = (new \App\Db\Query())->select(['rssid'])->from('vtiger_rss')->scalar();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$feed->set_curl_options($proxy);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('' === $title) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function makeDefault()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->setRssItems($feed);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = new self();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setId($recordId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $url
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getRssClient(string $url): SimplePie
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty(\Config\Security::$proxyConnection)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$title = App\Purifier::decodeHtml(\App\Purifier::purify(App\Purifier::decodeHtml($announcement->get_title())));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->set('rss', $items);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function setRssChannel(SimplePie $rss): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($feed->init()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$proxy[CURLOPT_PROXY] = \Config\Security::$proxyHost;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty(\Config\Security::$proxyLogin) || !empty(\Config\Security::$proxyPassword)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$proxy[CURLOPT_PROXYUSERPWD] = $login;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $feed;
- Exclude checks
Class name "Rss_Record_Model" is not in camel caps format Open
class Rss_Record_Model extends Vtiger_Record_Model
- Exclude checks