Passed
Push — master ( cf6673...dc03f9 )
by Miloš
03:30
created

src/factories/user-factory.ts   A

Complexity

Total Complexity 2
Complexity/F 1

Size

Lines of Code 19
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 13
mnd 0
bc 0
fnc 2
dl 0
loc 19
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A UserFactory.create 0 3 1
A UserFactory.privFactoryFunction 0 2 1
1
import { Injectable } from "@angular/core";
2
import { UserModel } from "..";
3
4
@Injectable({
5
    providedIn: "root",
6
})
7
export class UserFactory {
8
    public set factoryFunction(factoryFunction: () => any) {
9
        this.privFactoryFunction = factoryFunction;
10
    }
11
12
    public create() {
13
        return this.privFactoryFunction();
14
    }
15
    private privFactoryFunction: () => any = () => {
16
        return new UserModel();
17
    };
18
}
19