ViewFactory::make()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Coderello\Laraflash\Tests\Support;
4
5
use Illuminate\Contracts\View\Factory;
6
7
class ViewFactory implements Factory
8
{
9
    const MADE_CONTENT = 'MADE CONTENT';
10
11
    public $exists = true;
12
13
    public function exists($view)
14
    {
15
        return $this->exists;
16
    }
17
18
    public function file($path, $data = [], $mergeData = [])
19
    {
20
        //
21
    }
22
23
    public function make($view, $data = [], $mergeData = [])
24
    {
25
        return self::MADE_CONTENT;
0 ignored issues
show
Bug Best Practice introduced by
The expression return self::MADE_CONTENT returns the type string which is incompatible with the return type mandated by Illuminate\Contracts\View\Factory::make() of Illuminate\Contracts\View\View.

In the issue above, the returned value is violating the contract defined by the mentioned interface.

Let's take a look at an example:

interface HasName {
    /** @return string */
    public function getName();
}

class Name {
    public $name;
}

class User implements HasName {
    /** @return string|Name */
    public function getName() {
        return new Name('foo'); // This is a violation of the ``HasName`` interface
                                // which only allows a string value to be returned.
    }
}
Loading history...
26
    }
27
28
    public function share($key, $value = null)
29
    {
30
        //
31
    }
32
33
    public function composer($views, $callback)
34
    {
35
        //
36
    }
37
38
    public function creator($views, $callback)
39
    {
40
        //
41
    }
42
43
    public function addNamespace($namespace, $hints)
44
    {
45
        //
46
    }
47
48
    public function replaceNamespace($namespace, $hints)
49
    {
50
        //
51
    }
52
}
53