Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Commit 0027304

Browse files
author
mattpass
committed
Set and use func return bools, true if file_put_contents not int
1 parent 39388dd commit 0027304

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

classes/Settings.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function getConfigGlobalSettings()
8484
return $settings;
8585
}
8686

87-
public function setConfigGlobalSettings($settings)
87+
public function setConfigGlobalSettings($settings): bool
8888
{
8989
// Get the global config file details
9090
$fullPath = $this->getConfigGlobalFileDetails()['fullPath'];
@@ -101,12 +101,12 @@ public function setConfigGlobalSettings($settings)
101101
}
102102
}
103103

104-
public function updateConfigGlobalSettings($array): void
104+
public function updateConfigGlobalSettings($array): bool
105105
{
106106
// Update global config settings file
107107
$settingsFromFile = $this->getConfigGlobalSettings();
108108
$settings = array_merge($settingsFromFile, $array);
109-
$this->setConfigGlobalSettings($settings);
109+
return $this->setConfigGlobalSettings($settings);
110110
}
111111

112112
// ============
@@ -152,7 +152,7 @@ public function getConfigUsersSettings($fileName)
152152
return $settingsFromFile;
153153
}
154154

155-
public function setConfigUsersSettings($fileName, $settings)
155+
public function setConfigUsersSettings($fileName, $settings): bool
156156
{
157157
// Get the users config file details
158158
$fullPath = $this->getConfigUsersFileDetails($fileName)['fullPath'];
@@ -163,12 +163,12 @@ public function setConfigUsersSettings($fileName, $settings)
163163
}
164164
}
165165

166-
public function updateConfigUsersSettings($fileName, $array): void
166+
public function updateConfigUsersSettings($fileName, $array): bool
167167
{
168168
// Update users config settings file
169169
$settingsFromFile = $this->getConfigUsersSettings($fileName);
170170
$settings = array_merge($settingsFromFile, $array);
171-
$this->setConfigUsersSettings($fileName, $settings);
171+
return $this->setConfigUsersSettings($fileName, $settings);
172172
}
173173

174174
public function updateConfigUsersCreateDate($fileName): void
@@ -225,7 +225,7 @@ public function serializedFileData($do, $fullPath, $output=null)
225225
if (true === is_array($output)) {
226226
$output = serialize($output);
227227
}
228-
return file_put_contents($fullPath, "<"."?php\n/*\n\n" . $output . "\n\n*/\n?" . ">");
228+
return false !== file_put_contents($fullPath, "<"."?php\n/*\n\n" . $output . "\n\n*/\n?" . ">");
229229
}
230230
}
231231
}

0 commit comments

Comments
 (0)