1
0
Fork 0
- added missing type-hints
- first access level, then static
- reformatted code following code-style
This commit is contained in:
Roland Häder 2022-08-18 22:05:00 +02:00
commit 4c6940583a
Signed by: roland
GPG key ID: C82EDE5DDFA0BA77
8 changed files with 138 additions and 83 deletions

View file

@ -33,7 +33,8 @@ class PidFile
*
* @return boolean|string PID or "false" if not existent
*/
static private function pidFromFile($file) {
private static function pidFromFile(string $file)
{
if (!file_exists($file)) {
return false;
}
@ -48,7 +49,8 @@ class PidFile
*
* @return boolean Is it running?
*/
static public function isRunningProcess($file) {
public static function isRunningProcess(string $file): bool
{
$pid = self::pidFromFile($file);
if (!$pid) {
@ -72,7 +74,8 @@ class PidFile
*
* @return boolean Was it killed successfully?
*/
static public function killProcess($file) {
public static function killProcess(string $file): bool
{
$pid = self::pidFromFile($file);
// We don't have a process id? then we quit
@ -97,7 +100,7 @@ class PidFile
*
* @return boolean|string PID or "false" if not created
*/
static public function create(string $file)
public static function create(string $file)
{
$pid = self::pidFromFile($file);
@ -120,7 +123,7 @@ class PidFile
*
* @return boolean Is it running?
*/
static public function delete(string $file): bool
public static function delete(string $file): bool
{
return @unlink($file);
}