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

UserFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 14
rs 10
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A create 0 3 1
A 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