Passed
Push — main ( 2ad3f1...bfb9d3 )
by Miaad
01:30
created
1
<?php
2
3
namespace BPT;
4
5
class lock {
6
    public static function exist(string $name): bool {
7
        return file_exists("$name.lock");
8
    }
9
10
    public static function set(string $name): bool {
11
        return touch("$name.lock");
12
    }
13
14
    public static function save(string $name, string $data): bool {
15
        return file_put_contents("$name.lock", $data);
0 ignored issues
show
Bug Best Practice introduced by
The expression return file_put_contents($name.'.lock', $data) returns the type integer which is incompatible with the type-hinted return boolean.
Loading history...
16
17
    }
18
19
    public static function read(string $name): bool|string {
20
        return file_get_contents("$name.lock");
21
    }
22
23
    public static function mtime(string $name): bool|int {
24
        return filemtime("$name.lock");
25
    }
26
27
    public static function delete(string $name): bool {
28
        return unlink("$name.lock");
29
    }
30
}