mirror of
https://github.com/getgrav/grav.git
synced 2025-02-20 19:56:53 +01:00
Improved Framework File classes
This commit is contained in:
parent
3ad68d6d5a
commit
5b84213fce
|
|
@ -28,4 +28,13 @@ class CsvFile extends DataFile
|
|||
{
|
||||
parent::__construct($filepath, $formatter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function load(): array
|
||||
{
|
||||
/** @var array */
|
||||
return parent::load();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,15 +20,6 @@ use function is_string;
|
|||
*/
|
||||
class File extends AbstractFile
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @see FileInterface::load()
|
||||
*/
|
||||
public function load()
|
||||
{
|
||||
return parent::load();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @see FileInterface::save()
|
||||
|
|
|
|||
|
|
@ -75,9 +75,11 @@ class JsonFormatter extends AbstractFormatter
|
|||
if (is_string($options)) {
|
||||
$list = preg_split('/[\s,|]+/', $options);
|
||||
$options = 0;
|
||||
foreach ($list as $option) {
|
||||
if (isset($this->encodeOptions[$option])) {
|
||||
$options += $this->encodeOptions[$option];
|
||||
if ($list) {
|
||||
foreach ($list as $option) {
|
||||
if (isset($this->encodeOptions[$option])) {
|
||||
$options += $this->encodeOptions[$option];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -100,9 +102,11 @@ class JsonFormatter extends AbstractFormatter
|
|||
if (is_string($options)) {
|
||||
$list = preg_split('/[\s,|]+/', $options);
|
||||
$options = 0;
|
||||
foreach ($list as $option) {
|
||||
if (isset($this->decodeOptions[$option])) {
|
||||
$options += $this->decodeOptions[$option];
|
||||
if ($list) {
|
||||
foreach ($list as $option) {
|
||||
if (isset($this->decodeOptions[$option])) {
|
||||
$options += $this->decodeOptions[$option];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -28,4 +28,13 @@ class IniFile extends DataFile
|
|||
{
|
||||
parent::__construct($filepath, $formatter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function load(): array
|
||||
{
|
||||
/** @var array */
|
||||
return parent::load();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,4 +28,13 @@ class MarkdownFile extends DataFile
|
|||
{
|
||||
parent::__construct($filepath, $formatter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function load(): array
|
||||
{
|
||||
/** @var array */
|
||||
return parent::load();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,4 +28,13 @@ class YamlFile extends DataFile
|
|||
{
|
||||
parent::__construct($filepath, $formatter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function load(): array
|
||||
{
|
||||
/** @var array */
|
||||
return parent::load();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ class Filesystem implements FilesystemInterface
|
|||
|
||||
if (null !== $scheme) {
|
||||
$info['scheme'] = $scheme;
|
||||
$dirname = isset($info['dirname']) && $info['dirname'] !== '.' ? $info['dirname'] : null;
|
||||
$dirname = $info['dirname'] !== '.' ? $info['dirname'] : null;
|
||||
|
||||
if (null !== $dirname) {
|
||||
// In Windows dirname may be using backslashes, fix that.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user