$array = array(); $return = Arrays::firstOrNull($array);
null
public function matches(MethodCall $methodCall) { if ($methodCall->name != $this->name) { return false; } if (Arrays::firstOrNull($this->arguments) instanceof AnyArgumentList) { return true; } if (count($methodCall->arguments) != count($this->arguments)) { return false; } foreach ($this->arguments as $i => $arg) { if (!$this->argMatches($arg, $methodCall->arguments[$i])) { return false; } } return true; }
public function firstOr($default) { return Arrays::firstOrNull($this->_array) ?: $default; }
/** * @param TokenObject[] $tokens * @param boolean $header * @return Parameter */ public static function fromTokens($tokens, $header = false) { $parser = new Parser($tokens); return new Parameter(Arrays::firstOrNull($parser->S()), $header); }
/** * @return Model|array */ public function fetch() { $result = QueryExecutor::prepare($this->_db, $this->_query)->fetch(); if (!$result) { return null; } return !$this->_selectModel ? $result : Arrays::firstOrNull($this->_processResults(array($result))); }
public function getRawController() { $path = $this->_pathProvider->getPath(); $pathElements = $this->_parsePath($path); return Arrays::firstOrNull($pathElements); }
public function read_kept() { $this->layout->renderAjax(Arrays::firstOrNull(Session::get('messages') ?: array())); $this->layout->unsetLayout(); }
public function delete() { $attributes = Arrays::map($this->whereClauses, Functions::extract()->getParams()); $queryInsert = new QueryInsert(Arrays::firstOrNull($attributes)); $id = $queryInsert->into($this->module->getModuleName()); return !is_null($id); }
/** * @test */ public function shouldReturnNullIfNotFoundFirstElement() { //given $array = array(); //when $return = Arrays::firstOrNull($array); //then $this->assertNull($return); }
public function extractValue($values) { if (!$this->collection) { if (count($values) > 1) { throw new DbException("Expected one result for {$this->name}"); } return Arrays::firstOrNull($values); } return $values; }