RecoverControllerTrait::index()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 7
c 1
b 0
f 1
dl 0
loc 14
rs 10
ccs 0
cts 8
cp 0
cc 2
nc 2
nop 0
crap 6
1
<?php
2
3
namespace ByTIC\Hello\Modules\Frontend\Controllers\Traits;
4
5
use ByTIC\Hello\Models\Users\User;
6
use ByTIC\Hello\Modules\AbstractModule\Forms\Users\RecoverPasswordFormTrait;
7
use Nip\Form\Form;
8
use Nip\Records\Record;
9
use Nip\View;
10
11
/**
12
 * Trait RecoverControllerTrait
13
 * @package ByTIC\Hello\Modules\Frontend\Controllers\Traits
14
 *
15
 * @method View getView()
16
 * @method Record|User _getUser()
17
 */
18
trait RecoverControllerTrait
19
{
20
    public function index()
21
    {
22
        $this->getView()->set('headerTitle', $this->_getUser()->getManager()->getLabel('recoverPassword'));
0 ignored issues
show
Bug introduced by
The method getLabel() does not exist on ByTIC\Hello\Models\Users\Users. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

22
        $this->getView()->set('headerTitle', $this->_getUser()->getManager()->/** @scrutinizer ignore-call */ getLabel('recoverPassword'));
Loading history...
Bug introduced by
The method getLabel() does not exist on Nip\Records\Traits\Relat...asRelationsRecordsTrait. Did you maybe mean getTable()? ( Ignorable by Annotation )

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

22
        $this->getView()->set('headerTitle', $this->_getUser()->getManager()->/** @scrutinizer ignore-call */ getLabel('recoverPassword'));

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
23
24
        /** @var RecoverPasswordFormTrait|Form $formsRecover */
25
        $formsRecover = $this->_getUser()->getForm('recoverPassword');
0 ignored issues
show
Bug introduced by
The method getForm() does not exist on ByTIC\Hello\Models\Users\User. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

25
        $formsRecover = $this->_getUser()->/** @scrutinizer ignore-call */ getForm('recoverPassword');
Loading history...
26
27
        if ($formsRecover->execute()) {
0 ignored issues
show
Bug introduced by
It seems like execute() 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

27
        if ($formsRecover->/** @scrutinizer ignore-call */ execute()) {
Loading history...
28
            $redirect = $this->Url()->assemble('frontend.recover', $this->getRequest()->query->all());
0 ignored issues
show
Bug introduced by
It seems like Url() 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

28
            $redirect = $this->/** @scrutinizer ignore-call */ Url()->assemble('frontend.recover', $this->getRequest()->query->all());
Loading history...
Bug introduced by
It seems like getRequest() 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

28
            $redirect = $this->Url()->assemble('frontend.recover', $this->/** @scrutinizer ignore-call */ getRequest()->query->all());
Loading history...
29
            $this->flashRedirect($this->getModelManager()->getMessage('recoverPassword.success'), $redirect);
0 ignored issues
show
Bug introduced by
It seems like flashRedirect() 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

29
            $this->/** @scrutinizer ignore-call */ 
30
                   flashRedirect($this->getModelManager()->getMessage('recoverPassword.success'), $redirect);
Loading history...
Bug introduced by
It seems like getModelManager() 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

29
            $this->flashRedirect($this->/** @scrutinizer ignore-call */ getModelManager()->getMessage('recoverPassword.success'), $redirect);
Loading history...
30
        }
31
32
        $this->forms['recover'] = $formsRecover;
0 ignored issues
show
Bug Best Practice introduced by
The property forms does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
33
        $this->_setMeta('recoverPassword');
0 ignored issues
show
Bug introduced by
It seems like _setMeta() 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

33
        $this->/** @scrutinizer ignore-call */ 
34
               _setMeta('recoverPassword');
Loading history...
34
    }
35
}
36