Authority\RuleRepository::first PHP Method

first() public method

Return the first element in the array or null if empty
public first ( ) : Rule | null
return Rule | null
    public function first()
    {
        return count($this->rules) > 0 ? reset($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());
 }