for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @author Boudewijn Schoon <[email protected]>
* @copyright Zicht Online <http://zicht.nl>
*/
namespace Zicht\Itertools\lib\Traits;
use Zicht\Itertools as iter;
trait LastTrait
{
* Returns the last element of this iterable or
* returns $DEFAULT when this iterable is empty
*
* @param mixed $default
* @return mixed
public function last($default = null)
return iter\last($this, $default);
}
* Returns the key of the last element of this iterable or
public function lastKey($default = null)
$key = $default;
foreach ($this as $key => $value) {
$this
this<Zicht\Itertools\lib\Traits\LastTrait>
foreach
This check looks for foreach loops that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.
Consider removing the loop.
return $key;