Lines 100.00% 4 / 4
Methods 100.00% 4 / 4
Classes 100.00% 1 / 1
Covered by tests of size
Name Lines Methods CRAP
 moveTo 100.00% 1 / 1 100.00% 1 / 1 2
 copyTo n/a 0 / 0 n/a 0 / 0 0
 delete n/a 0 / 0 n/a 0 / 0 0
 isEncrypted 100.00% 1 / 1 100.00% 1 / 1 1
 getPath 100.00% 1 / 1 100.00% 1 / 1 1
 __toString 100.00% 1 / 1 100.00% 1 / 1 1
27abstract class AbstractEntry implements \Stringable
28{
29    /**
30     * Path to the entry in the filesystem.
31     */
32    protected string $path;
33
34    /**
35     * This opened handle.
36     *
37     * @var resource
38     */
39    public $handle;
40
41    /**
42     * Move a file to another location.
43     *
44     * @param object|string $entry an entry to move to
45     */
46    public function moveTo(object|string $entry): bool
47    {
48        return $this->copyTo($entry) && $this->delete();
49    }
50
51    /**
52     * Copy file to another location.
53     *
54     * @param object|string $entry an entry to copy to
55     */
56    abstract public function copyTo(object|string $entry): bool;
57
58    /**
59     * Delete this file.
60     */
61    abstract public function delete(): bool;
62
63    /**
64     * Either file is encrypted.
65     */
66    public function isEncrypted(): bool
67    {
68        return false;
69    }
70
71    /**
72     * Return the current file path.
73     */
74    public function getPath(): string
75    {
76        return $this->path;
77    }
78
79    /**
80     * Magic to use in string context.
81     */
82    public function __toString(): string
83    {
84        return $this->path;
85    }
86}