Completed
Push — master ( 04f83a...b71153 )
by Alex
09:15
created

AbstractPresenter::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Mezon\Application;
3
4
/**
5
 * Interface PresenterInterface
6
 *
7
 * @package Application
8
 * @subpackage PresenterInterface
9
 * @author Dodonov A.A.
10
 * @version v.1.0 (2020/06/23)
11
 * @copyright Copyright (c) 2020, aeon.org
12
 */
13
14
// TODO move all methods of the Presenter method after the Controller class will be removed
15
16
/**
17
 * Base class for all presenters
18
 */
19
abstract class AbstractPresenter implements PresenterInterface
20
{
21
22
    /**
23
     * Presenter's name
24
     *
25
     * @var string
26
     */
27
    private $presenterName = '';
28
29
    /**
30
     * View object
31
     *
32
     * @var ViewInterface
33
     */
34
    private $view = null;
35
36
    /**
37
     * Constructor
38
     *
39
     * @param ViewInterface $view
40
     *            view object
41
     */
42
    public function __construct(ViewInterface $view)
43
    {
44
        $this->view = $view;
45
    }
46
47
    /**
48
     * Method returns presenter's name
49
     *
50
     * @return string presenter's name
51
     */
52
    public function getPresenterName(): string
53
    {
54
        return $this->presenterName;
55
    }
56
57
    /**
58
     * Method returns presenter's name
59
     *
60
     * @return string presenter's name
61
     */
62
    public function setPresenterName(string $presenterName): void
63
    {
64
        $this->presenterName = $presenterName;
65
    }
66
67
    /**
68
     * Method returns code of the last error
69
     *
70
     * @return int code of the last error
71
     * @codeCoverageIgnore
72
     */
73
    public function getErrorCode(): int
74
    {
75
        return $this->view->getErrorCode();
76
    }
77
78
    /**
79
     * Method sets code of the last error
80
     *
81
     * @param int $code
82
     *            code of the last error
83
     * @codeCoverageIgnore
84
     */
85
    public function setErrorCode(int $errorCode): void
86
    {
87
        $this->view->setErrorCode($errorCode);
88
    }
89
90
    /**
91
     * Method return last error description
92
     *
93
     * @return string last error description
94
     * @codeCoverageIgnore
95
     */
96
    public function getErrorMessage(): string
97
    {
98
        return $this->view->getErrorMessage();
99
    }
100
101
    /**
102
     * Method sets last error description
103
     *
104
     * @param
105
     *            string last error description
106
     * @codeCoverageIgnore
107
     */
108
    public function setErrorMessage(string $errorMessage): void
109
    {
110
        $this->view->setErrorMessage($errorMessage);
111
    }
112
}
113