Page MenuHomeDevCentral

No OneTemporary

diff --git a/src/IO/File.php b/src/IO/File.php
index 7303ace..8638c42 100644
--- a/src/IO/File.php
+++ b/src/IO/File.php
@@ -1,89 +1,71 @@
<?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;
}
public static function from (string $path) : self {
- return new self($path);
+ 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);
}
- ///
- /// Include methods
- ///
-
- public function tryInclude () : bool {
- if (!$this->canBeIncluded()) {
- return false;
- }
-
- include($this->path);
-
- return true;
- }
-
- public function canBeIncluded () : bool {
- return $this->exists() &&$this->isReadable();
- }
-
}
diff --git a/src/Reflection/CodeFile.php b/src/Reflection/CodeFile.php
index 05abc84..bf344ee 100644
--- a/src/Reflection/CodeFile.php
+++ b/src/Reflection/CodeFile.php
@@ -1,27 +1,27 @@
<?php
namespace Keruald\OmniTools\Reflection;
use Keruald\OmniTools\IO\File;
class CodeFile extends File {
///
/// Include methods
///
public function tryInclude () : bool {
if (!$this->canBeIncluded()) {
return false;
}
- include($this->getFilename());
+ include($this->getPath());
return true;
}
public function canBeIncluded () : bool {
return $this->exists() && $this->isReadable();
}
}

File Metadata

Mime Type
text/x-diff
Expires
Fri, Sep 19, 03:23 (1 d, 1 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2988314
Default Alt Text
(2 KB)

Event Timeline