code: public function detect()
      {
          $str = file_get_contents($this->uri);
  
          foreach ($this->getBom('all') as $encoding => $bom) {
              if (0 === strncmp($str, $bom, strlen($bom))) {
                  return $encoding;
              }
          }
      }
docs: Return the BOM if the file if it exists.
  @return int|string