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

PageImageController::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 6
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Larafolio\Http\Controllers;
4
5
use Larafolio\Models\Page;
6
use Illuminate\Http\Request;
7
use Larafolio\Http\Content\ContentImages;
8
9 View Code Duplication
class PageImageController 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\Page    $page    Page to show.
35
     *
36
     * @return \Illuminate\Http\Response
37
     */
38
    public function index(Request $request, Page $page)
39
    {
40
        return $this->contentImages->getImages($request, $page, 'page');
41
    }
42
43
    /**
44
     * Add a new page image.
45
     *
46
     * @param \Illuminate\Http\Request $request Form request.
47
     * @param Larafolio\Models\Page    $page    The page to add the image too.
48
     */
49
    public function store(Request $request, Page $page)
50
    {
51
        $this->contentImages->store($request, $page, $this->user);
52
    }
53
}
54