Skip to content

Commit

Permalink
Added FormatterInterface::getSupportedFileExtensions() method, depr…
Browse files Browse the repository at this point in the history
…ecated `getFileExtension()`
  • Loading branch information
mahagr committed Aug 3, 2018
1 parent 76fb113 commit ca3cf2e
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

1. [](#new)
* Added `Uri::method()` to get current HTTP method (GET/POST etc)
* Added `FormatterInterface::getSupportedFileExtensions()` method, deprecated `getFileExtension()`

# v1.5.0-rc.1
## 07/31/2018
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
interface FormatterInterface
{
/**
* Get file extension with dot.
* Get file extensions supported by current formatter (with dot).
*
* @return string
* @return string[]
*/
public function getFileExtension();
public function getSupportedFileExtensions();

/**
* Encode data into a string.
Expand Down
13 changes: 11 additions & 2 deletions system/src/Grav/Framework/File/Formatter/IniFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,20 @@ public function __construct(array $config = [])
}

/**
* {@inheritdoc}
* @deprecated
* @internal
*/
public function getFileExtension()
{
return $this->config['file_extension'];
return $this->getSupportedFileExtensions()[0];
}

/**
* {@inheritdoc}
*/
public function getSupportedFileExtensions()
{
return (array) $this->config['file_extension'];
}

/**
Expand Down
13 changes: 11 additions & 2 deletions system/src/Grav/Framework/File/Formatter/JsonFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,20 @@ public function __construct(array $config = [])
}

/**
* {@inheritdoc}
* @deprecated
* @internal
*/
public function getFileExtension()
{
return $this->config['file_extension'];
return $this->getSupportedFileExtensions()[0];
}

/**
* {@inheritdoc}
*/
public function getSupportedFileExtensions()
{
return (array) $this->config['file_extension'];
}

/**
Expand Down
13 changes: 11 additions & 2 deletions system/src/Grav/Framework/File/Formatter/MarkdownFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,20 @@ public function __construct(array $config = [], FormatterInterface $headerFormat
}

/**
* {@inheritdoc}
* @deprecated
* @internal
*/
public function getFileExtension()
{
return $this->config['file_extension'];
return $this->getSupportedFileExtensions()[0];
}

/**
* {@inheritdoc}
*/
public function getSupportedFileExtensions()
{
return (array) $this->config['file_extension'];
}

/**
Expand Down
13 changes: 11 additions & 2 deletions system/src/Grav/Framework/File/Formatter/SerializeFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,20 @@ public function __construct(array $config = [])
}

/**
* {@inheritdoc}
* @deprecated
* @internal
*/
public function getFileExtension()
{
return $this->config['file_extension'];
return $this->getSupportedFileExtensions()[0];
}

/**
* {@inheritdoc}
*/
public function getSupportedFileExtensions()
{
return (array) $this->config['file_extension'];
}

/**
Expand Down
13 changes: 11 additions & 2 deletions system/src/Grav/Framework/File/Formatter/YamlFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,20 @@ public function __construct(array $config = [])
}

/**
* {@inheritdoc}
* @deprecated
* @internal
*/
public function getFileExtension()
{
return $this->config['file_extension'];
return $this->getSupportedFileExtensions()[0];
}

/**
* {@inheritdoc}
*/
public function getSupportedFileExtensions()
{
return (array) $this->config['file_extension'];
}

/**
Expand Down

0 comments on commit ca3cf2e

Please sign in to comment.