Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions src/BrowscapUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function convertFile(string $iniFile): void
$iniString = file_get_contents($iniFile);

if ($iniString === false) {
throw new ErrorReadingFileException('an error occured while converting the local file into the cache');
throw new ErrorReadingFileException('an error occurred while converting the local file into the cache');
}

$this->convertString($iniString);
Expand All @@ -116,7 +116,7 @@ public function convertString(string $iniString): void
try {
$cachedVersion = $this->cache->getItem('browscap.version', false, $success);
} catch (InvalidArgumentException $e) {
$this->logger->error(new \InvalidArgumentException('an error occured while reading the data version from the cache', 0, $e));
$this->logger->error(new \InvalidArgumentException('an error occurred while reading the data version from the cache', 0, $e));

return;
}
Expand Down Expand Up @@ -161,7 +161,7 @@ public function fetch(string $file, string $remoteFile = IniLoaderInterface::PHP
} catch (GuzzleException $e) {
throw new FetcherException(
sprintf(
'an error occured while fetching remote data from URI %s',
'an error occurred while fetching remote data from URI %s',
$uri,
),
0,
Expand All @@ -172,7 +172,7 @@ public function fetch(string $file, string $remoteFile = IniLoaderInterface::PHP
if ($response->getStatusCode() !== 200) {
throw new FetcherException(
sprintf(
'an error occured while fetching remote data from URI %s: StatusCode was %d',
'an error occurred while fetching remote data from URI %s: StatusCode was %d',
$uri,
$response->getStatusCode(),
),
Expand All @@ -182,7 +182,7 @@ public function fetch(string $file, string $remoteFile = IniLoaderInterface::PHP
try {
$content = $response->getBody()->getContents();
} catch (Throwable $e) {
throw new FetcherException('an error occured while fetching remote data', 0, $e);
throw new FetcherException('an error occurred while fetching remote data', 0, $e);
}

if (empty($content)) {
Expand All @@ -194,7 +194,7 @@ public function fetch(string $file, string $remoteFile = IniLoaderInterface::PHP

throw FetcherException::httpError(
$uri,
'an error occured while fetching remote data, but no error was raised',
'an error occurred while fetching remote data, but no error was raised',
);
}

Expand All @@ -212,7 +212,7 @@ public function fetch(string $file, string $remoteFile = IniLoaderInterface::PHP
try {
$fs->dumpFile($file, $content);
} catch (IOException $exception) {
throw new FetcherException('an error occured while writing fetched data to local file', 0, $exception);
throw new FetcherException('an error occurred while writing fetched data to local file', 0, $exception);
}
}

Expand Down Expand Up @@ -253,7 +253,7 @@ public function update(string $remoteFile = IniLoaderInterface::PHP_INI): void
} catch (GuzzleException $e) {
throw new FetcherException(
sprintf(
'an error occured while fetching remote data from URI %s',
'an error occurred while fetching remote data from URI %s',
$uri,
),
0,
Expand All @@ -264,7 +264,7 @@ public function update(string $remoteFile = IniLoaderInterface::PHP_INI): void
if ($response->getStatusCode() !== 200) {
throw new FetcherException(
sprintf(
'an error occured while fetching remote data from URI %s: StatusCode was %d',
'an error occurred while fetching remote data from URI %s: StatusCode was %d',
$uri,
$response->getStatusCode(),
),
Expand All @@ -274,7 +274,7 @@ public function update(string $remoteFile = IniLoaderInterface::PHP_INI): void
try {
$content = $response->getBody()->getContents();
} catch (Throwable $e) {
throw new FetcherException('an error occured while fetching remote data', 0, $e);
throw new FetcherException('an error occurred while fetching remote data', 0, $e);
}

if (empty($content)) {
Expand Down Expand Up @@ -309,7 +309,7 @@ public function checkUpdate(): ?int
try {
$cachedVersion = $this->cache->getItem('browscap.version', false, $success);
} catch (InvalidArgumentException $e) {
throw new ErrorCachedVersionException('an error occured while reading the data version from the cache', 0, $e);
throw new ErrorCachedVersionException('an error occurred while reading the data version from the cache', 0, $e);
}

assert($cachedVersion === null || is_int($cachedVersion));
Expand All @@ -327,7 +327,7 @@ public function checkUpdate(): ?int
} catch (GuzzleException $e) {
throw new FetcherException(
sprintf(
'an error occured while fetching version data from URI %s',
'an error occurred while fetching version data from URI %s',
$uri,
),
0,
Expand All @@ -338,7 +338,7 @@ public function checkUpdate(): ?int
if ($response->getStatusCode() !== 200) {
throw new FetcherException(
sprintf(
'an error occured while fetching version data from URI %s: StatusCode was %d',
'an error occurred while fetching version data from URI %s: StatusCode was %d',
$uri,
$response->getStatusCode(),
),
Expand All @@ -350,7 +350,7 @@ public function checkUpdate(): ?int
} catch (Throwable $e) {
throw new FetcherException(
sprintf(
'an error occured while fetching version data from URI %s: StatusCode was %d',
'an error occurred while fetching version data from URI %s: StatusCode was %d',
$uri,
$response->getStatusCode(),
),
Expand Down
6 changes: 3 additions & 3 deletions src/Cache/BrowscapCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function getVersion(): ?int
try {
$cachedVersion = $this->getItem('browscap.version', false, $success);
} catch (InvalidArgumentException $e) {
$this->logger->error(new \InvalidArgumentException('an error occured while reading the data version from the cache', 0, $e));
$this->logger->error(new \InvalidArgumentException('an error occurred while reading the data version from the cache', 0, $e));
$cachedVersion = null;
}

Expand All @@ -95,7 +95,7 @@ public function getReleaseDate(): ?string
try {
$releaseDate = $this->getItem('browscap.releaseDate', false, $success);
} catch (InvalidArgumentException $e) {
$this->logger->error(new \InvalidArgumentException('an error occured while reading the data release date from the cache', 0, $e));
$this->logger->error(new \InvalidArgumentException('an error occurred while reading the data release date from the cache', 0, $e));
$releaseDate = null;
}

Expand All @@ -122,7 +122,7 @@ public function getType(): ?string
try {
$type = $this->getItem('browscap.type', false, $success);
} catch (InvalidArgumentException $e) {
$this->logger->error(new \InvalidArgumentException('an error occured while reading the data type from the cache', 0, $e));
$this->logger->error(new \InvalidArgumentException('an error occurred while reading the data type from the cache', 0, $e));
$type = null;
}

Expand Down
12 changes: 6 additions & 6 deletions src/Helper/Converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function convertString(string $iniString): void
$this->logger->error('could not write pattern data "' . $subkey . '" to the cache');
}
} catch (InvalidArgumentException $e) {
$this->logger->error(new \InvalidArgumentException('an error occured while writing pattern data into the cache', 0, $e));
$this->logger->error(new \InvalidArgumentException('an error occurred while writing pattern data into the cache', 0, $e));
}
}

Expand All @@ -129,23 +129,23 @@ public function convertString(string $iniString): void
$this->logger->error('could not write property data "' . $subkey . '" to the cache');
}
} catch (InvalidArgumentException $e) {
$this->logger->error(new \InvalidArgumentException('an error occured while writing property data into the cache', 0, $e));
$this->logger->error(new \InvalidArgumentException('an error occurred while writing property data into the cache', 0, $e));
}
}
} catch (OutOfRangeException | UnexpectedValueException | JsonException | \InvalidArgumentException $e) {
$this->logger->error(new \InvalidArgumentException('an error occured while writing property data into the cache', 0, $e));
$this->logger->error(new \InvalidArgumentException('an error occurred while writing property data into the cache', 0, $e));
}

try {
$this->cache->setItem('browscap.releaseDate', $this->getIniReleaseDate($iniString), false);
} catch (InvalidArgumentException $e) {
$this->logger->error(new \InvalidArgumentException('an error occured while writing data release date into the cache', 0, $e));
$this->logger->error(new \InvalidArgumentException('an error occurred while writing data release date into the cache', 0, $e));
}

try {
$this->cache->setItem('browscap.type', $this->getIniType($iniString), false);
} catch (InvalidArgumentException $e) {
$this->logger->error(new \InvalidArgumentException('an error occured while writing the data type into the cache', 0, $e));
$this->logger->error(new \InvalidArgumentException('an error occurred while writing the data type into the cache', 0, $e));
}

$this->logger->info('finished creating data from the ini data');
Expand Down Expand Up @@ -192,7 +192,7 @@ public function storeVersion(): void
try {
$this->cache->setItem('browscap.version', $this->iniVersion, false);
} catch (InvalidArgumentException $e) {
$this->logger->error(new \InvalidArgumentException('an error occured while writing the data version into the cache', 0, $e));
$this->logger->error(new \InvalidArgumentException('an error occurred while writing the data version into the cache', 0, $e));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Helper/Quoter.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function pregUnQuote(string $pattern): string

if ($pattern === null) {
throw new UnexpectedValueException(
sprintf('an error occured while handling pattern %s', $origPattern),
sprintf('an error occurred while handling pattern %s', $origPattern),
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/IniParser/IniParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function createIniParts(string $content): Generator
// pattern (filtered in the previous step)
$iniParts = preg_split('/\[[^\r\n]+\]/', $content);
if ($iniParts === false) {
throw new UnexpectedValueException('an error occured while splitting content into parts');
throw new UnexpectedValueException('an error occurred while splitting content into parts');
}

$contents = [];
Expand Down
4 changes: 2 additions & 2 deletions src/Parser/Helper/GetData.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private function getIniPart(string $pattern): array
$this->logger->error(
new \InvalidArgumentException(
sprintf(
'an error occured while checking inipart "browscap.iniparts.%s" in the cache',
'an error occurred while checking inipart "browscap.iniparts.%s" in the cache',
$subkey,
),
0,
Expand All @@ -151,7 +151,7 @@ private function getIniPart(string $pattern): array
$this->logger->error(
new \InvalidArgumentException(
sprintf(
'an error occured while reading inipart "browscap.iniparts.%s" from the cache',
'an error occurred while reading inipart "browscap.iniparts.%s" from the cache',
$subkey,
),
0,
Expand Down
4 changes: 2 additions & 2 deletions src/Parser/Helper/GetPattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function getPatterns(string $userAgent): Generator
$this->logger->error(
new \InvalidArgumentException(
sprintf(
'an error occured while checking pattern "browscap.patterns.%s" in the cache',
'an error occurred while checking pattern "browscap.patterns.%s" in the cache',
$tmpSubkey,
),
0,
Expand All @@ -98,7 +98,7 @@ public function getPatterns(string $userAgent): Generator
$this->logger->error(
new \InvalidArgumentException(
sprintf(
'an error occured while reading pattern "browscap.patterns.%s" from the cache',
'an error occurred while reading pattern "browscap.patterns.%s" from the cache',
$tmpSubkey,
),
0,
Expand Down
4 changes: 2 additions & 2 deletions tests/BrowscapUpdaterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ public function testFetchFail(): void

$this->expectException(BrowscapException\FetcherException::class);
$this->expectExceptionMessage(
'an error occured while fetching version data from URI http://browscap.org/version-number: StatusCode was 500',
'an error occurred while fetching version data from URI http://browscap.org/version-number: StatusCode was 500',
);
$this->object->fetch(IniLoaderInterface::PHP_INI);
}
Expand Down Expand Up @@ -1099,7 +1099,7 @@ public function testCheckUpdateWithException(): void

$this->expectException(BrowscapException\FetcherException::class);
$this->expectExceptionMessage(
'an error occured while fetching version data from URI http://browscap.org/version-number: StatusCode was 200',
'an error occurred while fetching version data from URI http://browscap.org/version-number: StatusCode was 200',
);
$this->object->checkUpdate();
}
Expand Down