Passed
Push — develop ( f0c08b...9e3bd7 )
by Endre
03:40
created

Presenter.present   A

Complexity

Conditions 1

Size

Total Lines 8
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 8
dl 0
loc 8
ccs 5
cts 5
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
import {ILanguageSetup} from '../../../Language/ChangeLanguageSetup';
2
import Translator from '../../../Language/Translator';
3
import {IObserver} from '../../../Observer/Observer';
4
import TopBarPresenter from '../TopBar/Presenter.js';
5
import Model from './Model';
6
7
export default class Presenter {
8
  languageSetupObserver: IObserver<ILanguageSetup>;
9
  topAppBarPresenter: TopBarPresenter;
10
11
  constructor(languageSetupObserver: IObserver<ILanguageSetup>, topAppBarPresenter: TopBarPresenter) {
12 2
    this.languageSetupObserver = languageSetupObserver;
13 2
    this.topAppBarPresenter = topAppBarPresenter;
14
  }
15
16
  present(data: string) {
17 1
    const viewModel: Model = new Model();
18 1
    const translator: Translator = this.languageSetupObserver.value.translator;
19 1
    viewModel.text = data + translator.translate('Application.Test');
20 1
    viewModel.topAppBar = this.topAppBarPresenter.present();
21
22 1
    return viewModel;
23
  }
24
}