src/Mime/MimeDetector.php
protected function checkForBytes(array $bytes, int $offset = 0, array $mask = []): bool
    {
        if (empty($bytes) || empty($this->byteCache)) {
            return false;
        }

        // make sure we have nummeric indices
        $bytes = array_values($bytes);

        foreach ($bytes as $i => $byte) {
            if (!empty($mask)) {
                if (!isset($this->byteCache[$offset + $i]) ||
                    !isset($mask[$i]) ||
                    $byte !== ($mask[$i] & $this->byteCache[$offset + $i])
                ) {
                    return false;
                }
            } elseif (!isset($this->byteCache[$offset + $i]) || $this->byteCache[$offset + $i] != $byte) {
                return false;
            }
        }

        return true;
    }
protected function checkForBytes(array $bytes, int $offset = 0, array $mask = []): bool
    {
        if (empty($bytes) || empty($this->byteCache)) {
            return false;
        }

        // make sure we have nummeric indices
        $bytes = array_values($bytes);

        foreach ($bytes as $i => $byte) {
            if (!empty($mask)) {
                if (!isset($this->byteCache[$offset + $i]) ||
                    !isset($mask[$i]) ||
                    $byte !== ($mask[$i] & $this->byteCache[$offset + $i])
                ) {
                    return false;
                }
            } elseif (!isset($this->byteCache[$offset + $i]) || $this->byteCache[$offset + $i] != $byte) {
                return false;
            }
        }

        return true;
    }
protected function checkForBytes ( array $ bytes , int $ offset = 0 , array $ mask = [ ] ) : bool { if ( empty ( $ bytes ) || empty ( $ this -> byteCache ) ) { return false ; } // make sure we have nummeric indices $ bytes = array_values ( $ bytes ) ; foreach ( $ bytes as $ i => $ byte ) { if ( ! empty ( $ mask ) ) { if ( ! isset ( $ this -> byteCache [ $ offset + $ i ] ) || ! isset ( $ mask [ $ i ] ) || $ byte !== ( $ mask [ $ i ] & $ this -> byteCache [ $ offset + $ i ] ) ) { return false ; } } elseif ( ! isset ( $ this -> byteCache [ $ offset + $ i ] ) || $ this -> byteCache [ $ offset + $ i ] != $ byte ) { return false ; } } return true ; }
Returns true, if a given byte sequence is found at the given offset within the given file.

@param   array $bytes
@param   int   $offset
@param   array $mask
@return  bool
Returns true if a given byte sequence is found at the given offset within the given file .