The method jsDropdown has a boolean flag argument $when, which is a certain sign of a Single Responsibility Principle violation. Open
protected function jsDropdown($when = false, $action = null): JsExpressionable
- Read upRead up
- Create a ticketCreate a ticket
- 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
The method _renderItemsForValues uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->_tItem->set('title', $val || is_numeric($val) ? (string) $val : '');
}
- Read upRead up
- Create a ticketCreate a ticket
- 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
The method _renderItemsForValues uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->_tItem->del('Icon');
}
- Read upRead up
- Create a ticketCreate a ticket
- 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
The method htmlRenderValue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if ($this->renderRowFunction) {
foreach ($this->values as $key => $value) {
$this->_addCallBackRow($value, $key);
}
- Read upRead up
- Create a ticketCreate a ticket
- 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
The method _addCallBackRow uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$res = ($this->renderRowFunction)($row, $key);
$this->_tItem->set('value', (string) $res['value']);
}
- Read upRead up
- Create a ticketCreate a ticket
- 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
The method htmlRenderValue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->_renderItemsForValues();
}
- Read upRead up
- Create a ticketCreate a ticket
- 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
The method htmlRenderValue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
// for standard model rendering, only load ID and title field
$this->model->setOnlyFields([$this->model->titleField, $this->model->idField]);
$this->_renderItemsForModel();
}
- Read upRead up
- Create a ticketCreate a ticket
- 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
The property $_tItem is not named in camelCase. Open
class Dropdown extends Input
{
public $defaultTemplate = 'form/control/dropdown.html';
public string $inputType = 'hidden';
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $_tIcon is not named in camelCase. Open
class Dropdown extends Input
{
public $defaultTemplate = 'form/control/dropdown.html';
public string $inputType = 'hidden';
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
Property name "$_tItem" should not be prefixed with an underscore to indicate visibility Open
protected HtmlTemplate $_tItem;
- Create a ticketCreate a ticket
- Exclude checks
Method name "_addCallBackRow" should not be prefixed with an underscore to indicate visibility Open
protected function _addCallBackRow($row, $key = null): void
- Create a ticketCreate a ticket
- Exclude checks
Method name "_renderItemsForModel" should not be prefixed with an underscore to indicate visibility Open
protected function _renderItemsForModel(): void
- Create a ticketCreate a ticket
- Exclude checks
Property name "$_tIcon" should not be prefixed with an underscore to indicate visibility Open
protected HtmlTemplate $_tIcon;
- Create a ticketCreate a ticket
- Exclude checks
Method name "_renderItemsForValues" should not be prefixed with an underscore to indicate visibility Open
protected function _renderItemsForValues(): void
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
* @var \Closure<T of Model>(T): array{title: mixed, icon?: mixed}|\Closure(mixed, array-key): array{value: mixed, title: mixed, icon?: mixed}
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
$this->_tItem->set('value', $this->getApp()->uiPersistence->typecastAttributeSaveField($this->model->getIdField(), $id));
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 143 characters Open
$this->_tItem->set('value', $this->getApp()->uiPersistence->typecastAttributeSaveField($this->model->getIdField(), $row->getId()));
- Create a ticketCreate a ticket
- Exclude checks
The method _addCallBackRow is not named in camelCase. Open
protected function _addCallBackRow($row, $key = null): void
{
if ($this->model !== null) {
$res = ($this->renderRowFunction)($row);
$this->_tItem->set('value', $this->getApp()->uiPersistence->typecastAttributeSaveField($this->model->getIdField(), $row->getId()));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method _renderItemsForValues is not named in camelCase. Open
protected function _renderItemsForValues(): void
{
foreach ($this->values as $key => $val) {
$this->_tItem->set('value', (string) $key);
if (is_array($val)) {
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method _renderItemsForModel is not named in camelCase. Open
protected function _renderItemsForModel(): void
{
foreach ($this->model as $id => $row) {
$title = $row->getTitle();
$this->_tItem->set('value', $this->getApp()->uiPersistence->typecastAttributeSaveField($this->model->getIdField(), $id));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}