ignoreBom = $ignoreBom; if ($input === null) { $fd = STDIN; $close = false; } elseif (is_resource($input)) { $fd = $input; $close = false; } else { $file = $input; if ($mode === null) $mode = static::DEFAULT_MODE; $this->file = $file; $this->mode = $mode; $fd = $this->open(); $close = true; } parent::__construct($fd, $close, $throwOnError, $allowLocking); } /** @return resource */ protected function open() { $fd = parent::open(); $this->haveBom = false; if ($this->ignoreBom) { $bom = fread($fd, 3); if ($bom === "\xEF\xBB\xBF") $this->seekOffset = 3; else rewind($fd); } return $fd; } function haveBom(): bool { return $this->seekOffset !== 0; } }