HasFormsTrait   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 10
c 1
b 0
f 0
dl 0
loc 37
ccs 0
cts 12
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getOptionsForm() 0 7 2
A initOptionsForm() 0 3 1
A newOptionsForm() 0 8 1
1
<?php
2
3
namespace ByTIC\Payments\Gateways\Providers\AbstractGateway\Traits;
4
5
/**
6
 * Trait HasFormsTrait
7
 * @package ByTIC\Payments\Gateways\Providers\AbstractGateway\Traits
8
 */
9
trait HasFormsTrait
10
{
11
12
    /**
13
     * @var Form
0 ignored issues
show
Bug introduced by
The type ByTIC\Payments\Gateways\...ractGateway\Traits\Form was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
     */
15
    protected $form;
16
17
18
    /**
19
     * @return Form
20
     */
21
    public function getOptionsForm()
22
    {
23
        if (!$this->form) {
24
            $this->initOptionsForm();
25
        }
26
27
        return $this->form;
28
    }
29
30
    public function initOptionsForm()
31
    {
32
        $this->form = $this->newOptionsForm();
33
    }
34
35
    /**
36
     * @return Form
37
     */
38
    public function newOptionsForm()
39
    {
40
        $class = $this->getNamespacePath() . '\Form';
0 ignored issues
show
Bug introduced by
It seems like getNamespacePath() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

40
        $class = $this->/** @scrutinizer ignore-call */ getNamespacePath() . '\Form';
Loading history...
41
        $form = new $class();
42
        /** @var Form $form */
43
        $form->setGateway($this);
44
45
        return $form;
46
    }
47
}
48