Authority\RuleRepository::first PHP Méthode

first() public méthode

Return the first element in the array or null if empty
public first ( ) : Rule | null
Résultat 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());
 }