Completed
Push — dev ( 6a93ce...82e8fe )
by Zach
03:22
created

ProjectImageController::store()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 4
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Larafolio\Http\Controllers;
4
5
use Illuminate\Http\Request;
6
use Larafolio\Models\Project;
7
use Larafolio\Http\Content\ContentImages;
8
9 View Code Duplication
class ProjectImageController extends Controller
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
10
{
11
    /**
12
     * Service class for content images.
13
     *
14
     * @var Larafolio\Http\Content\ContentImages
15
     */
16
    protected $contentImages;
17
18
    /**
19
     * Construct.
20
     *
21
     * @param Larafolio\Http\Content\ContentImages $contentImages Service class for content images.
22
     */
23
    public function __construct(ContentImages $contentImages)
24
    {
25
        parent::__construct();
26
27
        $this->contentImages = $contentImages;
0 ignored issues
show
Documentation Bug introduced by
It seems like $contentImages of type object<Larafolio\Http\Content\ContentImages> is incompatible with the declared type object<Larafolio\Http\Co...\Content\ContentImages> of property $contentImages.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
28
    }
29
30
    /**
31
     * Show images for project.
32
     *
33
     * @param \Illuminate\Http\Request $request Request from user.
34
     * @param Larafolio\Models\Project $project Project to show.
35
     *
36
     * @return \Illuminate\Http\Response
37
     */
38
    public function index(Request $request, Project $project)
39
    {
40
        return $this->contentImages->getImages($request, $project, 'project');
41
    }
42
43
    /**
44
     * Add a new project image to the portfolio.
45
     *
46
     * @param \Illuminate\Http\Request $request Form request.
47
     * @param Larafolio\Models\Project $project The project to add the image too.
48
     */
49
    public function store(Request $request, Project $project)
50
    {
51
        $this->contentImages->store($request, $project, $this->user);
52
    }
53
}
54