Flow\JSONPath\JSONPath::first PHP Method

first() public method

public first ( ) : mixed
return mixed
    public function first()
    {
        $keys = AccessHelper::collectionKeys($this->data);
        if (empty($keys)) {
            return null;
        }
        $value = isset($this->data[$keys[0]]) ? $this->data[$keys[0]] : null;
        return AccessHelper::isCollectionType($value) ? new static($value, $this->options) : $value;
    }