ViewOverrides   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 21
loc 21
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A put() 10 10 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php namespace Anomaly\Streams\Platform\View;
2
3
use Illuminate\Support\Collection;
4
5
/**
6
 * Class ViewOverrides
7
 *
8
 * @link   http://pyrocms.com/
9
 * @author PyroCMS, Inc. <[email protected]>
10
 * @author Ryan Thompson <[email protected]>
11
 */
12 View Code Duplication
class ViewOverrides extends Collection
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...
13
{
14
15
    /**
16
     * When putting overrides replace "/" with "."
17
     * to match the way Laravel interprets views.
18
     *
19
     * @param mixed $key
20
     * @param mixed $value
21
     */
22
    public function put($key, $value)
23
    {
24
        $overrides = [];
25
26
        foreach ($value as $view => $override) {
27
            $overrides[str_replace('/', '.', $view)] = $override;
28
        }
29
30
        parent::put($key, $overrides);
31
    }
32
}
33