Ouzo\Utilities\Arrays::firstOrNull PHP Метод

firstOrNull() публичный статический Метод

Example: $array = array(); $return = Arrays::firstOrNull($array); Result: null
public static firstOrNull ( array $elements ) : mixed | null
$elements array
Результат mixed | null
    public static function firstOrNull(array $elements)
    {
        return empty($elements) ? null : self::first($elements);
    }

Usage Example

Пример #1
0
 public function matches(MethodCall $methodCall)
 {
     if ($methodCall->name != $this->name) {
         return false;
     }
     if (Arrays::firstOrNull($this->arguments) instanceof AnyArgumentList) {
         return true;
     }
     if (count($methodCall->arguments) != count($this->arguments)) {
         return false;
     }
     foreach ($this->arguments as $i => $arg) {
         if (!$this->argMatches($arg, $methodCall->arguments[$i])) {
             return false;
         }
     }
     return true;
 }
All Usage Examples Of Ouzo\Utilities\Arrays::firstOrNull