Completed
Push — master ( d0a237...a1b9c8 )
by Freek
9s
created

ComponentDirectory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
getAbsoluteDirectory() 0 1 ?
A getViewName() 0 6 1
1
<?php
2
3
namespace Spatie\BladeX\ComponentDirectory;
4
5
use Symfony\Component\Finder\SplFileInfo;
6
7
abstract class ComponentDirectory
8
{
9
    abstract function getAbsoluteDirectory(): string;
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
10
11
    public function getViewName(SplFileInfo $viewFile): string
12
    {
13
        $view = str_replace_last('.blade.php', '', $viewFile->getFilename());
14
15
        return "{$this->viewDirectory}.{$view}";
0 ignored issues
show
Bug introduced by
The property viewDirectory does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
16
    }
17
}