Add wrappers around XMLReader and SimpleXMLElement to improve error handling
This commit is contained in:
1 parent
be3932af18
commit
1ba10ed2b0
16 files changed
+789
-155
No files matched your search
@@ -40,7 +40,7 @@ class FileSystemHelper
|
||||
|
||||
$wasCreationSuccessful = mkdir($folderPath, 0777, true);
|
||||
if (!$wasCreationSuccessful) {
|
||||
throw new IOException('Unable to create folder: ' . $folderPath);
|
||||
throw new IOException("Unable to create folder: $folderPath");
|
||||
}
|
||||
|
||||
return $folderPath;
|
||||
@@ -64,7 +64,7 @@ class FileSystemHelper
|
||||
|
||||
$wasCreationSuccessful = file_put_contents($filePath, $fileContents);
|
||||
if ($wasCreationSuccessful === false) {
|
||||
throw new IOException('Unable to create file: ' . $filePath);
|
||||
throw new IOException("Unable to create file: $filePath");
|
||||
}
|
||||
|
||||
return $filePath;
|
||||
@@ -126,7 +126,7 @@ class FileSystemHelper
|
||||
{
|
||||
$isInBaseFolder = (strpos($operationFolderPath, $this->baseFolderPath) === 0);
|
||||
if (!$isInBaseFolder) {
|
||||
throw new IOException('Cannot perform I/O operation outside of the base folder: ' . $this->baseFolderPath);
|
||||
throw new IOException("Cannot perform I/O operation outside of the base folder: {$this->baseFolderPath}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user