Repository navigation
Expand file tree
/
Copy pathResponseFormat.php
More file actions
82 lines (71 loc) · 1.67 KB
/
Copy pathResponseFormat.php
File metadata and controls
82 lines (71 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
namespace Dingo\Api\Http\ResponseFormat;
abstract class ResponseFormat
{
/**
* Illuminate request instance.
*
* @var \Illuminate\Http\Request
*/
protected $request;
/**
* Illuminate response instance.
*
* @var \Illuminate\Http\Response
*/
protected $response;
/**
* Set the request instance.
*
* @param \Illuminate\Http\Request $request
*
* @return \Dingo\Api\Http\ResponseFormat\ResponseFormat
*/
public function setRequest($request)
{
$this->request = $request;
return $this;
}
/**
* Set the response instance.
*
* @param \Illuminate\Http\Response $response
*
* @return \Dingo\Api\Http\ResponseFormat\ResponseFormat
*/
public function setResponse($response)
{
$this->response = $response;
return $this;
}
/**
* Format an Eloquent model.
*
* @param \Illuminate\Database\Eloquent\Model $model
*
* @return string
*/
abstract public function formatEloquentModel($model);
/**
* Format an Eloquent collection.
*
* @param \Illuminate\Database\Eloquent\Collection $collection
*
* @return string
*/
abstract public function formatEloquentCollection($collection);
/**
* Format an array or instance implementing ArrayableInterface.
*
* @param array|\Illuminate\Support\Contracts\ArrayableInterface $content
*
* @return string
*/
abstract public function formatArray($content);
/**
* Get the response content type.
*
* @return string
*/
abstract public function getContentType();
}