| Total Complexity | 4 |
| Complexity/F | 4 |
| Lines of Code | 30 |
| Function Count | 1 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import JsonRequestAdapter from "./Adapter/JsonRequestAdapter"; |
||
| 2 | import LocalStorageAdapter from "./Adapter/LocalStorageAdapter"; |
||
| 3 | import LocalArrayAdapter from "./Adapter/LocalArrayAdapter"; |
||
| 4 | import ConnectionSettings from "./ConnectionSettings"; |
||
| 5 | import {AdapterInterface} from "../../JeloquentInterfaces"; |
||
| 6 | |||
| 7 | class ConnectionAdapterFactory { |
||
| 8 | static getAdapter (name: string, connectionSettings: ConnectionSettings): AdapterInterface { |
||
| 9 | if (name === 'jsonRequest') { |
||
| 10 | return new JsonRequestAdapter(connectionSettings); |
||
| 11 | } |
||
| 12 | |||
| 13 | if (name === 'localStorage') { |
||
| 14 | return new LocalStorageAdapter(connectionSettings); |
||
| 15 | } |
||
| 16 | |||
| 17 | if (name === 'localArray') { |
||
| 18 | return new LocalArrayAdapter(connectionSettings); |
||
| 19 | } |
||
| 20 | |||
| 21 | return new JsonRequestAdapter(connectionSettings); |
||
| 22 | } |
||
| 23 | } |
||
| 24 | |||
| 25 | export { |
||
| 26 | ConnectionAdapterFactory, |
||
| 27 | LocalStorageAdapter, |
||
| 28 | LocalArrayAdapter, |
||
| 29 | JsonRequestAdapter |
||
| 30 | } |