Avoid unused local variables such as '$_item'. Open
foreach ($list as $_item) {
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
The variable $_item is not named in camelCase. Open
public function _arrayCount(&$list)
{
if (is_array($list)) {
return count($list);
}
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The method _current is not named in camelCase. Open
protected function _current()
{
return $this->_arrayCurrent($this->_getCachedItems());
}
- Read upRead up
- 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 _arrayNext is not named in camelCase. Open
protected function _arrayNext(&$array)
{
return $array instanceof \Traversable
? $this->_getIterator($array)->next()
: next($array);
- Read upRead up
- 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 _arrayCount is not named in camelCase. Open
public function _arrayCount(&$list)
{
if (is_array($list)) {
return count($list);
}
- Read upRead up
- 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 _next is not named in camelCase. Open
protected function _next()
{
$this->_arrayNext($this->_getCachedItems());
}
- Read upRead up
- 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 _arrayCurrent is not named in camelCase. Open
protected function _arrayCurrent(&$array)
{
return $array instanceof \Traversable
? $this->_getIterator($array)->current()
: current($array);
- Read upRead up
- 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 _count is not named in camelCase. Open
protected function _count()
{
return $this->_arrayCount($this->_getCachedItems());
}
- Read upRead up
- 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 _arrayRewind is not named in camelCase. Open
protected function _arrayRewind(&$array)
{
return $array instanceof \Traversable
? $this->_getIterator($array)->rewind()
: reset($array);
- Read upRead up
- 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 _arrayKey is not named in camelCase. Open
protected function _arrayKey(&$array)
{
return $array instanceof \Traversable
? $this->_getIterator($array)->key()
: key($array);
- Read upRead up
- 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 _getCachedItems is not named in camelCase. Open
protected function &_getCachedItems()
{
if (is_null($this->cachedItems)) {
$this->cachedItems = $this->_getItemsForCache();
$this->_arrayRewind($this->cachedItems);
- Read upRead up
- 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 _key is not named in camelCase. Open
protected function _key()
{
return $this->_arrayKey($this->_getCachedItems());
}
- Read upRead up
- 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 _rewind is not named in camelCase. Open
protected function _rewind()
{
$this->_clearItemCache();
}
- Read upRead up
- 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 _clearItemCache is not named in camelCase. Open
protected function _clearItemCache()
{
$this->cachedItems = null;
return $this;
- Read upRead up
- 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 _getIterator is not named in camelCase. Open
protected function _getIterator(\Traversable $iterator)
{
if ($iterator instanceof \Iterator) {
return $iterator;
}
- Read upRead up
- 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 _getItemsForCache is not named in camelCase. Open
protected function _getItemsForCache()
{
$items = $this->getItems();
return $items;
- Read upRead up
- 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() {
}
}