Aerospike\LDT\LList::findFirst PHP Method

findFirst() public method

An optional UDF filter function can be applied to the elements found. The filter function returns nil to filter out the element, otherwise it may transform the element before returning it.
public findFirst ( integer $count, array &$elements, string | null $module = null, string | null $function = null, array $args = [] ) : integer
$count integer
$elements array matched
$module string | null the name of the UDF module containing the optional filter function
$function string | null name of the UDF filter function to apply
$args array optional arguments for the filter function, passed as a map to the filter function
return integer status code of the operation
    public function findFirst($count, &$elements, $module = null, $function = null, array $args = array())
    {
        if (!is_int($count)) {
            $this->errorno = self::ERR_INPUT_PARAM;
            $this->error = self::MSG_TYPE_NOT_SUPPORTED;
            return $this->errorno;
        }
        $elements = array();
        if (!is_null($module) && !is_null($function)) {
            $status = $this->client->apply($this->key, 'llist', 'find_first', array($this->bin, $count, $module, $function, $args), $elements);
        } else {
            $status = $this->client->apply($this->key, 'llist', 'find_first', array($this->bin, $count), $elements);
        }
        $this->processStatusCode($status);
        return $this->errorno;
    }