platform/api/laravel/Http/Resources/Json/ResourceResponse.yaml
2024-09-02 10:44:11 -07:00

108 lines
2.3 KiB
YAML

name: ResourceResponse
class_comment: null
dependencies:
- name: Responsable
type: class
source: Illuminate\Contracts\Support\Responsable
- name: Model
type: class
source: Illuminate\Database\Eloquent\Model
- name: Collection
type: class
source: Illuminate\Support\Collection
properties:
- name: resource
visibility: public
comment: '# * The underlying resource.
# *
# * @var mixed'
methods:
- name: __construct
visibility: public
parameters:
- name: resource
comment: "# * The underlying resource.\n# *\n# * @var mixed\n# */\n# public $resource;\n\
# \n# /**\n# * Create a new resource response.\n# *\n# * @param mixed $resource\n\
# * @return void"
- name: toResponse
visibility: public
parameters:
- name: request
comment: '# * Create an HTTP response that represents the object.
# *
# * @param \Illuminate\Http\Request $request
# * @return \Illuminate\Http\JsonResponse'
- name: wrap
visibility: protected
parameters:
- name: data
- name: with
default: '[]'
- name: additional
default: '[]'
comment: '# * Wrap the given data if necessary.
# *
# * @param \Illuminate\Support\Collection|array $data
# * @param array $with
# * @param array $additional
# * @return array'
- name: haveDefaultWrapperAndDataIsUnwrapped
visibility: protected
parameters:
- name: data
comment: '# * Determine if we have a default wrapper and the given data is unwrapped.
# *
# * @param array $data
# * @return bool'
- name: haveAdditionalInformationAndDataIsUnwrapped
visibility: protected
parameters:
- name: data
- name: with
- name: additional
comment: '# * Determine if "with" data has been added and our data is unwrapped.
# *
# * @param array $data
# * @param array $with
# * @param array $additional
# * @return bool'
- name: wrapper
visibility: protected
parameters: []
comment: '# * Get the default data wrapper for the resource.
# *
# * @return string'
- name: calculateStatus
visibility: protected
parameters: []
comment: '# * Calculate the appropriate status code for the response.
# *
# * @return int'
traits:
- Illuminate\Contracts\Support\Responsable
- Illuminate\Database\Eloquent\Model
- Illuminate\Support\Collection
interfaces:
- Responsable