[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: ResponseFactory.php
<?php namespace Illuminate\Routing; use Illuminate\Contracts\Routing\ResponseFactory as FactoryContract; use Illuminate\Contracts\View\Factory as ViewFactory; use Illuminate\Http\JsonResponse; use Illuminate\Http\Response; use Illuminate\Routing\Exceptions\StreamedResponseException; use Illuminate\Support\Str; use Illuminate\Support\Traits\Macroable; use Symfony\Component\HttpFoundation\BinaryFileResponse; use Symfony\Component\HttpFoundation\StreamedJsonResponse; use Symfony\Component\HttpFoundation\StreamedResponse; use Throwable; class ResponseFactory implements FactoryContract { use Macroable; /** * The view factory instance. * * @var \Illuminate\Contracts\View\Factory */ protected $view; /** * The redirector instance. * * @var \Illuminate\Routing\Redirector */ protected $redirector; /** * Create a new response factory instance. * * @param \Illuminate\Contracts\View\Factory $view * @param \Illuminate\Routing\Redirector $redirector * @return void */ public function __construct(ViewFactory $view, Redirector $redirector) { $this->view = $view; $this->redirector = $redirector; } /** * Create a new response instance. * * @param mixed $content * @param int $status * @param array $headers * @return \Illuminate\Http\Response */ public function make($content = '', $status = 200, array $headers = []) { return new Response($content, $status, $headers); } /** * Create a new "no content" response. * * @param int $status * @param array $headers * @return \Illuminate\Http\Response */ public function noContent($status = 204, array $headers = []) { return $this->make('', $status, $headers); } /** * Create a new response for a given view. * * @param string|array $view * @param array $data * @param int $status * @param array $headers * @return \Illuminate\Http\Response */ public function view($view, $data = [], $status = 200, array $headers = []) { if (is_array($view)) { return $this->make($this->view->first($view, $data), $status, $headers); } return $this->make($this->view->make($view, $data), $status, $headers); } /** * Create a new JSON response instance. * * @param mixed $data * @param int $status * @param array $headers * @param int $options * @return \Illuminate\Http\JsonResponse */ public function json($data = [], $status = 200, array $headers = [], $options = 0) { return new JsonResponse($data, $status, $headers, $options); } /** * Create a new JSONP response instance. * * @param string $callback * @param mixed $data * @param int $status * @param array $headers * @param int $options * @return \Illuminate\Http\JsonResponse */ public function jsonp($callback, $data = [], $status = 200, array $headers = [], $options = 0) { return $this->json($data, $status, $headers, $options)->setCallback($callback); } /** * Create a new streamed response instance. * * @param callable $callback * @param int $status * @param array $headers * @return \Symfony\Component\HttpFoundation\StreamedResponse */ public function stream($callback, $status = 200, array $headers = []) { return new StreamedResponse($callback, $status, $headers); } /** * Create a new streamed response instance. * * @param array $data * @param int $status * @param array $headers * @param int $encodingOptions * @return \Symfony\Component\HttpFoundation\StreamedJsonResponse */ public function streamJson($data, $status = 200, $headers = [], $encodingOptions = JsonResponse::DEFAULT_ENCODING_OPTIONS) { return new StreamedJsonResponse($data, $status, $headers, $encodingOptions); } /** * Create a new streamed response instance as a file download. * * @param callable $callback * @param string|null $name * @param array $headers * @param string|null $disposition * @return \Symfony\Component\HttpFoundation\StreamedResponse * * @throws \Illuminate\Routing\Exceptions\StreamedResponseException */ public function streamDownload($callback, $name = null, array $headers = [], $disposition = 'attachment') { $withWrappedException = function () use ($callback) { try { $callback(); } catch (Throwable $e) { throw new StreamedResponseException($e); } }; $response = new StreamedResponse($withWrappedException, 200, $headers); if (! is_null($name)) { $response->headers->set('Content-Disposition', $response->headers->makeDisposition( $disposition, $name, $this->fallbackName($name) )); } return $response; } /** * Create a new file download response. * * @param \SplFileInfo|string $file * @param string|null $name * @param array $headers * @param string|null $disposition * @return \Symfony\Component\HttpFoundation\BinaryFileResponse */ public function download($file, $name = null, array $headers = [], $disposition = 'attachment') { $response = new BinaryFileResponse($file, 200, $headers, true, $disposition); if (! is_null($name)) { return $response->setContentDisposition($disposition, $name, $this->fallbackName($name)); } return $response; } /** * Convert the string to ASCII characters that are equivalent to the given name. * * @param string $name * @return string */ protected function fallbackName($name) { return str_replace('%', '', Str::ascii($name)); } /** * Return the raw contents of a binary file. * * @param \SplFileInfo|string $file * @param array $headers * @return \Symfony\Component\HttpFoundation\BinaryFileResponse */ public function file($file, array $headers = []) { return new BinaryFileResponse($file, 200, $headers); } /** * Create a new redirect response to the given path. * * @param string $path * @param int $status * @param array $headers * @param bool|null $secure * @return \Illuminate\Http\RedirectResponse */ public function redirectTo($path, $status = 302, $headers = [], $secure = null) { return $this->redirector->to($path, $status, $headers, $secure); } /** * Create a new redirect response to a named route. * * @param string $route * @param mixed $parameters * @param int $status * @param array $headers * @return \Illuminate\Http\RedirectResponse */ public function redirectToRoute($route, $parameters = [], $status = 302, $headers = []) { return $this->redirector->route($route, $parameters, $status, $headers); } /** * Create a new redirect response to a controller action. * * @param array|string $action * @param mixed $parameters * @param int $status * @param array $headers * @return \Illuminate\Http\RedirectResponse */ public function redirectToAction($action, $parameters = [], $status = 302, $headers = []) { return $this->redirector->action($action, $parameters, $status, $headers); } /** * Create a new redirect response, while putting the current URL in the session. * * @param string $path * @param int $status * @param array $headers * @param bool|null $secure * @return \Illuminate\Http\RedirectResponse */ public function redirectGuest($path, $status = 302, $headers = [], $secure = null) { return $this->redirector->guest($path, $status, $headers, $secure); } /** * Create a new redirect response to the previously intended location. * * @param string $default * @param int $status * @param array $headers * @param bool|null $secure * @return \Illuminate\Http\RedirectResponse */ public function redirectToIntended($default = '/', $status = 302, $headers = [], $secure = null) { return $this->redirector->intended($default, $status, $headers, $secure); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.57 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002