ViewFactory   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

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

8 Methods

Rating   Name   Duplication   Size   Complexity  
A exists() 0 3 1
A composer() 0 2 1
A addNamespace() 0 2 1
A replaceNamespace() 0 2 1
A creator() 0 2 1
A file() 0 2 1
A make() 0 3 1
A share() 0 2 1
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