You are here

private function BrowscapImporter::findIniDivisionEnd in Browscap 8.3

Finds the offset of the end of the INI division.

Parameters

string $ini: Browscap INI.

int $division_begin: Offset of the beginning of the INI division.

Return value

int Offset of the end of the INI division.

1 call to BrowscapImporter::findIniDivisionEnd()
BrowscapImporter::getNextIniDivision in src/BrowscapImporter.php
Gets next division of Browscap INI.

File

src/BrowscapImporter.php, line 314

Class

BrowscapImporter
Class BrowscapImporter.

Namespace

Drupal\browscap

Code

private function findIniDivisionEnd(&$ini, $division_begin) {
  $header_prefix = ';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;';

  // Start search from one character after offset so the header at the
  // beginning of the part is not matched.
  $offset = $division_begin + 1;
  $division_end = strpos($ini, $header_prefix, $offset);

  // When the beginning of the next division cannot be found, the end of the
  // INI string has been reached.
  if ($division_end === FALSE) {
    $division_end = strlen($ini) - 1;
  }
  return $division_end;
}