Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F11726190
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/IO/File.php b/src/IO/File.php
index 8638c42..e382294 100644
--- a/src/IO/File.php
+++ b/src/IO/File.php
@@ -1,71 +1,74 @@
<?php
declare(strict_types=1);
namespace Keruald\OmniTools\IO;
class File {
/**
* @var string
*/
private $path;
///
/// Constructors
///
public function __construct (string $path = null) {
$this->path = $path;
}
+ /**
+ * @return static
+ */
public static function from (string $path) : self {
return new static($path);
}
///
/// Getters and setters
///
public function getPath () : string {
return $this->path;
}
public function setPath (string $path) : self {
$this->path = $path;
return $this;
}
///
/// File properties methods
///
public function exists () : bool {
return file_exists($this->path);
}
public function isReadable () : bool {
return is_readable($this->path);
}
public function getPathInfo () : array {
return pathinfo($this->path);
}
public function getDirectory () : string {
return pathinfo($this->path, PATHINFO_DIRNAME);
}
public function getFileName () : string {
return pathinfo($this->path, PATHINFO_BASENAME);
}
public function getFileNameWithoutExtension () : string {
return pathinfo($this->path, PATHINFO_FILENAME);
}
public function getExtension () : string {
return pathinfo($this->path, PATHINFO_EXTENSION);
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Fri, Sep 19, 00:59 (11 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2992017
Default Alt Text
(1 KB)
Attached To
Mode
rKERUALD Keruald libraries development repository
Attached
Detach File
Event Timeline
Log In to Comment