HttpResponses   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 22
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A successResponse() 0 9 2
1
<?php
2
3
namespace Sfneal\CrudModelActions\Utils;
4
5
trait HttpResponses
6
{
7
    /**
8
     * @var string Response to be returned on success
9
     */
10
    private $successResponse;
11
12
    /**
13
     * Return the default success response.
14
     *
15
     * @param  string|null  $response
16
     * @return string
17
     */
18
    protected function successResponse(string $response = null): string
19
    {
20
        // Set the response during runtime
21
        if (isset($response)) {
22
            $this->successResponse = $response;
23
        }
24
25
        // Redirect back to previous page
26
        return $this->successResponse ?? redirect()->back();
27
    }
28
}
29