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 FirstTrait
{
* Returns the first element of this iterable or
* returns $DEFAULT when this iterable is empty
*
* @param mixed $default
* @return mixed
public function first($default = null)
return iter\first($this, $default);
}
* Returns the key of the first element of this iterable or
public function firstKey($default = null)
$key = $default;
foreach ($this as $key => $value) {
$this
this<Zicht\Itertools\lib\Traits\FirstTrait>
break;
return $key;