-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove unused RedirectException and add some PHPDocs #1497
Remove unused RedirectException and add some PHPDocs #1497
Conversation
*/ | ||
public function getJSON() | ||
{ | ||
$body = $this->body; | ||
|
||
if ($this->bodyFormat !== 'json') | ||
{ | ||
/** | ||
* @var Format $config | ||
*/ | ||
$config = config(Format::class); | ||
$formatter = $config->getFormatter('application/json'); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this file, in the line below, $formatter->format()
is typed to expect an array.
public function format(array $data); |
Removing the type hint in the FormatterInterface allow more flexibility to work with objects, like pass an \CodeIgniter\Entity
directly.
The conversion could be done inside the method, if necessary:
$this->arrayToXML($data, $output); |
JSONFormatter does not needs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting idea, and I'm ok with that. You could easily check if it's an Entity
and call it's toArray()
method to get the values.
*/ | ||
public function deleteCookie($name = '', string $domain = '', string $path = '/', string $prefix = '') | ||
{ | ||
if (empty($name)) | ||
{ | ||
return; | ||
return $this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allow fluent method continues to work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the $name is empty. Should not delete all? - removing the default ''
Description
RedirectException never is thrown. Added some possible throwns.
Checklist: