File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
chapter-04-the-interface-segregation-principle/refactor Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * In order to improve the understanding of this code, this file it is supposing to implement the following interfaces:
3+ *
4+ * interface PersistsEntitiesInterface {
5+ * function persist(entity);
6+ *
7+ * function flush();
8+ * }
9+ *
10+ * interface HasUnitOfWorkInterface {
11+ * function getUnitOfWork(name);
12+ * }
13+ *
14+ * interface EntityManagerInterface extends PersistsEntitiesInterface, HasUnitOfWorkInterface {
15+ *
16+ * }
17+ *
18+ * Quack Quack Quack 🦆 typing :D
19+ */
20+
21+ /**
22+ * @implements {EntityManagerInterface}
23+ */
24+ function entityManager ( ) {
25+ function persist ( entity ) {
26+ // make something here...
27+ }
28+
29+ function flush ( ) {
30+ // make something here
31+ }
32+
33+ function getUnitOfWork ( ) {
34+ // make something here
35+ }
36+
37+ return {
38+ persist,
39+ flush,
40+ getUnitOfWork,
41+ } ;
42+ }
43+
44+ module . exports = entityManager ;
You can’t perform that action at this time.
0 commit comments