Skip to content

Commit

Permalink
Move Formatting functionality from API namespace to its own home now. F…
Browse files Browse the repository at this point in the history
…ixes #451
  • Loading branch information
lonnieezell committed Apr 3, 2017
1 parent b3687c6 commit 78962ab
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions application/Config/API.php → application/Config/Format.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use CodeIgniter\Config\BaseConfig;

class API extends BaseConfig
class Format extends BaseConfig
{
/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -34,8 +34,8 @@ class API extends BaseConfig
|
*/
public $formatters = [
'application/json' => \CodeIgniter\API\JSONFormatter::class,
'application/xml' => \CodeIgniter\API\XMLFormatter::class
'application/json' => \CodeIgniter\Format\JSONFormatter::class,
'application/xml' => \CodeIgniter\Format\XMLFormatter::class
];

//--------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion system/API/ResponseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
* @filesource
*/

use Config\Format;
use CodeIgniter\HTTP\Response;

/**
Expand Down Expand Up @@ -332,7 +333,7 @@ protected function format($data = null)
return $data;
}

$config = new \Config\API();
$config = new Format();

// Determine correct response type through content negotiation
$format = $this->request->negotiate('media', $config->supportedResponseFormats);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php namespace CodeIgniter\API;
<?php namespace CodeIgniter\Format;

/**
* CodeIgniter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php namespace CodeIgniter\API;
<?php namespace CodeIgniter\Format;

/**
* CodeIgniter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php namespace CodeIgniter\API;
<?php namespace CodeIgniter\Format;

/**
* CodeIgniter
Expand Down

0 comments on commit 78962ab

Please sign in to comment.