Authority\RuleRepository::last PHP Method

last() public method

Return the last element in the array or null if empty
public last ( ) : Rule | null
return Rule | null
    public function last()
    {
        return count($this->rules) > 0 ? end($this->rules) : null;
    }

Usage Example

 public function testCanReturnEndRules()
 {
     $repo = new RuleRepository($this->rules);
     $this->assertSame($this->rules[0], $repo->first());
     $this->assertSame($this->rules[1], $repo->last());
 }