The method getInstance has a boolean flag argument $menuModel, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getInstance($name, $menuModel = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '180', column '17'). Open
$query = (new \App\Db\Query())->from(self::$itemsTable)->where(['name' => $name]);
- 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
The method updatePinStatus has a boolean flag argument $pinned, which is a certain sign of a Single Responsibility Principle violation. Open
private function updatePinStatus($pinned = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '224', column '23'). Open
$dataReader = (new App\Db\Query())->from(self::$itemsTable)->where(['active' => $active])->orderBy('sequence')->createCommand()->query();
- 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 '\App\Cache' in method 'getAll'. Open
$menuItemModels = \App\Cache::get($cacheName, $key);
- 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 getInstance uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$menuItem->setMenu($rowData['blockid']);
}
- 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\Cache' in method 'getAll'. Open
if (!\App\Cache::has($cacheName, $key)) {
- 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 'Settings_Vtiger_Menu_Model' in method 'setMenu'. Open
$this->menu = Settings_Vtiger_Menu_Model::getInstanceById($menuId);
- 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\Cache' in method 'getAll'. Open
\App\Cache::save($cacheName, $key, $menuItemModels);
- 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 '\Settings_Vtiger_Menu_Model' in method 'getBlock'. Open
return \Settings_Vtiger_Menu_Model::getInstanceById($this->getBlockId());
- 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 "blockid" 3 times. Open
return $this->get('blockid');
- 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 "pinned" 3 times. Open
$pinStatus = $this->get('pinned');
- 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.
Saw unextractable annotation for comment '* @param <settings_vtiger_menu_model> $menu - Settings Menu Model instance'</settings_vtiger_menu_model>
Open
* @param <Settings_Vtiger_Menu_Model> $menu - Settings Menu Model instance
- Exclude checks
Returning type false
but getInstance()
is declared to return \Settings_Vtiger_MenuItem_Model
Open
return false;
- Exclude checks
Saw unextractable annotation for comment '* @return <number> - Menu Item Id'</number>
Open
* @return <Number> - Menu Item Id
- Exclude checks
Argument 2 (key)
is int
but \App\Cache::has()
takes string
defined at /code/app/Cache.php:74
Open
if (!\App\Cache::has($cacheName, $key)) {
- Exclude checks
Argument 2 (key)
is int
but \App\Cache::get()
takes string
defined at /code/app/Cache.php:61
Open
$menuItemModels = \App\Cache::get($cacheName, $key);
- Exclude checks
Reference to undeclared property \Settings_Vtiger_MenuItem_Model->menu
Open
$this->menu = Settings_Vtiger_Menu_Model::getInstanceById($menuId);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$dataReader = (new App\Db\Query())->from(self::$itemsTable)->where(['active' => $active])->orderBy('sequence')->createCommand()->query();
- Exclude checks
Reference to undeclared property \Settings_Vtiger_MenuItem_Model->menu
(Did you mean $menu) Open
$this->menu = $menu;
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()->update(self::$itemsTable, ['pinned' => $pinnedStaus], [self::$itemId => $this->getId()])->execute();
- Exclude checks
Argument 2 (key)
is int
but \App\Cache::save()
takes string
defined at /code/app/Cache.php:89
Open
\App\Cache::save($cacheName, $key, $menuItemModels);
- Exclude checks
Saw unextractable annotation for comment '* @param <number> $menuId'</number>
Open
* @param <Number> $menuId
- Exclude checks
Argument 1 (pinned)
is 1
but \Settings_Vtiger_MenuItem_Model::updatePinStatus()
takes bool|false
defined at /code/modules/Settings/Vtiger/models/MenuItem.php:133
Open
$this->updatePinStatus(1);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$query = (new \App\Db\Query())->from(self::$itemsTable)->where(['name' => $name]);
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Settings_Vtiger_MenuItem_Model extends Settings_Vtiger_Menu_Model
- Exclude checks
The class Settings_Vtiger_MenuItem_Model is not named in CamelCase. Open
class Settings_Vtiger_MenuItem_Model extends Settings_Vtiger_Menu_Model
{
/**
* Active.
*/
- 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
public static function getInstanceById(int $id)
- 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
* @var 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
return $this->get(self::$itemId);
- 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
* @var string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const ACTIVE = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param <Number> $menuId
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
return 'index.php?module=Vtiger&parent=Settings&action=Basic&mode=updateFieldPinnedStatus&fieldid=' . $this->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function markPinned()
- 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
* Static function to get the list of all the items of the given Menu, all items if Menu is not specified.
- 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 <Number> - Menu Item 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 which will disable the field pinned status.
- 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
$query->andWhere(['blockid' => $menuModel->getId()]);
- 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
* Inactive.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const INACTIVE = 1;
- 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 'index.php?module=Vtiger&parent=Settings&action=Basic&mode=updateFieldPinnedStatus&fieldid=' . $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
{
- 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
$menuItem->setMenu($rowData['blockid']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $menuItem;
- 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
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 bool|Settings_Vtiger_Menu_Model $menuModel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getInstance($name, $menuModel = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($menuModel) {
- 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
* Gets block instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->get('blockid');
- 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 pin and unpin action 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
* Function which will enable the field as pinned.
- 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 setMenu($menuId)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->menu = Settings_Vtiger_Menu_Model::getInstanceById($menuId);
- 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 \Settings_Vtiger_Menu_Model::getInstanceById($this->getBlockId());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to set the Menu to which the Item belongs, given Menu Model instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the module name, to which the Settings Menu Item belongs to.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 'Settings:' . ($this->getParam('module') ?: 'Vtiger');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to verify whether menuitem is pinned or not.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pinStatus = $this->get('pinned');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $pinned - true to enable , false to disable
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pinnedStaus = 1;
- 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 ($rowData) {
- 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 getInstanceById(int $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 get the Id of the menu item.
- 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 new self($valueMap);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$menuItem->setMenuFromInstance($menuModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Table name.
- 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 int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string - Module to which the Menu Item belongs
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updatePinStatus(1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updatePinStatus();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$menuItem = self::getInstanceFromArray($rowData);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $id
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getAll(int $blockId = 0, int $active = self::ACTIVE): 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
protected static $itemId = 'fieldid';
- 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 <Settings_Vtiger_Menu_Model> $menu - Settings Menu Model instance
- 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 true to pinned, false to not pinned
- 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
protected static $itemsTable = 'vtiger_settings_field';
- 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;
- 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 unMarkPinned()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getInstanceFromArray($valueMap)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Settings_Vtiger_MenuItem_Model instance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Settings_Vtiger_MenuItem_Model|null
- 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 int $active
- 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
* Active.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Table index.
- 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
* Function to set the Menu to which the Item belongs, given Menu Id.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Settings_Vtiger_MenuItem_Model
- 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 which will update the pin status.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private function updatePinStatus($pinned = 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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the instance of the Menu Item model given the valuemap 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
$query = (new \App\Db\Query())->from(self::$itemsTable)->where(['name' => $name]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the instance of the Menu Item model, given item id and Menu instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- 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 Settings_Vtiger_MenuItem_Model
- 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 isPinned()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pinnedStaus = 0;
- Exclude checks
Line exceeds 120 characters; contains 149 characters Open
\App\Db::getInstance()->createCommand()->update(self::$itemsTable, ['pinned' => $pinnedStaus], [self::$itemId => $this->getId()])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $valueMap
- 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
$key = $active;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($menuItems[$key]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getBlock(): ?Settings_Vtiger_Menu_Model
- 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
* Gets block 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
public function getPinUnpinActionUrl()
- 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 Settings_Vtiger_MenuItem_Model[]
- 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 Settings_Vtiger_Menu_Model|null
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->menu = $menu;
- 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 '1' == $pinStatus ? true : false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($pinned) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Settings_Vtiger_MenuItem_Model instance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the instance of the Menu Item model, given name and Menu instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($menuModel) {
- 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
return self::getAll()[$id] ?? null;
- 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
$fieldId = (int) $rowData[self::$itemId];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- 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 pinned 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
}
- 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
$dataReader = (new App\Db\Query())->from(self::$itemsTable)->where(['active' => $active])->orderBy('sequence')->createCommand()->query();
- 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 getBlockId()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function setMenuFromInstance($menu)
- 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 getModuleName()
- 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
$rowData = $query->one();
- 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
$menuItemModels = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$menuItem->isPermitted() || 1 !== (int) $menuItem->get('pinned')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$menuItemModels[$menuItem->getBlockId()][$fieldId] = $menuItem;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$menuItem = self::getInstanceFromArray($rowData);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::save($cacheName, $key, $menuItemModels);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($rowData = $dataReader->read()) {
- 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
\App\Db::getInstance()->createCommand()->update(self::$itemsTable, ['pinned' => $pinnedStaus], [self::$itemId => $this->getId()])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $name
- 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 int $blockId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$menuItemModels[0][$fieldId] = $menuItem;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $menuItems;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $menuItemModels[$blockId] ?? [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$menuItems = self::getAll();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return \Settings_Vtiger_MenuItem_Model[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cacheName = 'MenuItemAll';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\App\Cache::has($cacheName, $key)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($menuItems as $key => $menuItem) {
- Exclude checks
Line exceeds 120 characters; contains 149 characters Open
$dataReader = (new App\Db\Query())->from(self::$itemsTable)->where(['active' => $active])->orderBy('sequence')->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$menuItemModels = \App\Cache::get($cacheName, $key);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getPinnedItems(): 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
Class name "Settings_Vtiger_MenuItem_Model" is not in camel caps format Open
class Settings_Vtiger_MenuItem_Model extends Settings_Vtiger_Menu_Model
- Exclude checks