| Total Complexity | 4 |
| Total Lines | 24 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | 1 | from pyjection.helper import get_service_subject_identifier |
|
| 4 | 1 | class Reference(object): |
|
| 5 | """ |
||
| 6 | Base class used when a service needs to register a dependency to another service |
||
| 7 | """ |
||
| 8 | |||
| 9 | 1 | def __init__(self, name, return_class=False): |
|
| 10 | """ |
||
| 11 | :param name: Name of the reference or a class |
||
| 12 | :type name: mixed |
||
| 13 | :param return_class: Whether the reference is on an instance of the other service or a class |
||
| 14 | :type return_class: bool |
||
| 15 | """ |
||
| 16 | 1 | self._name = name |
|
| 17 | 1 | if isinstance(name, str) is False: |
|
| 18 | 1 | self._name = get_service_subject_identifier(name) |
|
| 19 | 1 | self._return_class = return_class |
|
| 20 | |||
| 21 | 1 | @property |
|
| 22 | def name(self): |
||
| 23 | 1 | return self._name |
|
| 24 | |||
| 25 | 1 | @property |
|
| 26 | def return_class(self): |
||
| 27 | return self._return_class |
||
| 28 |