22
33namespace Lkrms \Sync \Concept ;
44
5- use Lkrms \Container \Container ;
5+ use Lkrms \Concept \Provider ;
6+ use Lkrms \Contract \IContainer ;
67use Lkrms \Contract \IPipeline ;
78use Lkrms \Contract \IService ;
8- use Lkrms \Support \DateFormatter ;
99use Lkrms \Support \Pipeline ;
1010use Lkrms \Sync \Contract \ISyncContext ;
11- use Lkrms \Sync \Contract \ISyncDefinition ;
1211use Lkrms \Sync \Contract \ISyncEntity ;
1312use Lkrms \Sync \Contract \ISyncProvider ;
1413use Lkrms \Sync \Support \SyncContext ;
2423 * Base class for providers that sync entities to and from third-party backends
2524 *
2625 */
27- abstract class SyncProvider implements ISyncProvider, IService
26+ abstract class SyncProvider extends Provider implements ISyncProvider, IService
2827{
29- /**
30- * Get a DateFormatter to work with the backend's date format and timezone
31- *
32- * The {@see DateFormatter} returned by this method is cached for the
33- * lifetime of the {@see SyncProvider} instance.
34- */
35- abstract protected function getDateFormatter (): DateFormatter ;
36-
3728 /**
3829 * Get a dependency subtitution map for the class
3930 *
@@ -59,24 +50,6 @@ public static function getContextualBindings(): array
5950 return [];
6051 }
6152
62- /**
63- * @inheritDoc
64- */
65- public function description (): ?string
66- {
67- return null ;
68- }
69-
70- /**
71- * @var Container
72- */
73- protected $ App ;
74-
75- /**
76- * @var Env
77- */
78- protected $ Env ;
79-
8053 /**
8154 * @var SyncStore
8255 */
@@ -87,20 +60,14 @@ public function description(): ?string
8760 */
8861 private $ Id ;
8962
90- /**
91- * @var DateFormatter|null
92- */
93- private $ DateFormatter ;
94-
9563 /**
9664 * @var array<string,Closure>
9765 */
9866 private $ MagicMethodClosures = [];
9967
100- public function __construct (Container $ app , Env $ environment , SyncStore $ store )
68+ public function __construct (IContainer $ app , Env $ env , SyncStore $ store )
10169 {
102- $ this ->App = $ app ;
103- $ this ->Env = $ environment ;
70+ parent ::__construct ($ app , $ env );
10471 $ this ->Store = $ store ;
10572
10673 $ this ->Store ->provider ($ this );
@@ -113,21 +80,6 @@ final public function setProviderId(int $providerId)
11380 return $ this ;
11481 }
11582
116- final public function app (): Container
117- {
118- return $ this ->App ;
119- }
120-
121- final public function container (): Container
122- {
123- return $ this ->App ;
124- }
125-
126- final public function env (): Env
127- {
128- return $ this ->Env ;
129- }
130-
13183 final public function store (): SyncStore
13284 {
13385 return $ this ->Store ;
@@ -156,15 +108,6 @@ final protected function buildSerializeRules(string $entity): SerializeRulesBuil
156108 ->entity ($ entity );
157109 }
158110
159- /**
160- * @inheritDoc
161- */
162- final public function dateFormatter (): DateFormatter
163- {
164- return $ this ->DateFormatter
165- ?? ($ this ->DateFormatter = $ this ->getDateFormatter ());
166- }
167-
168111 final public static function getServices (): array
169112 {
170113 return SyncIntrospector::get (static ::class)->getSyncProviderInterfaces ();
0 commit comments