Passed
Push — master ( 12242c...e9b436 )
by Iman
08:01
created

ViewNormalizer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 6
dl 0
loc 20
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A normalizeView() 0 7 1
A checkViewExists() 0 4 2
1
<?php
2
3
namespace Imanghafoori\HeyMan\WatchingStrategies\Views;
4
5
final class ViewNormalizer
6
{
7
    /**
8
     * @param $views
9
     *
10
     * @return array
11
     */
12
    public function normalizeView(array $views): array
13
    {
14
        array_walk($views, function ($view) {
15
            $this->checkViewExists($view);
16
        });
17
18
        return $views;
19
    }
20
21
    private function checkViewExists($view)
22
    {
23
        if (strpos($view, '*') === false) {
24
            view()->getFinder()->find($view);
25
        }
26
    }
27
}
28