@@ -16,37 +16,35 @@ class MainService
1616 */
1717 protected $ responsableClass ;
1818
19- public function __construct (EntityManager $ em ) {
19+ public function __construct (EntityManager $ em )
20+ {
2021 $ this ->em = $ em ;
2122 }
2223
23- public function strategy ($ exportType , array $ dados ) {
24-
25- if ($ exportType != null ) {
24+ public function strategy ($ exportType , array $ data )
25+ {
26+ if ($ exportType != null ) {
2627
2728 $ type = strtoupper ($ exportType );
28- $ class = 'VMBDataExport \\Export \\' . $ type. 'Export ' ;
29+ $ class = 'VMBDataExport \\Export \\' . $ type . 'Export ' ;
2930
30- if (class_exists ($ class )) {
31+ if (class_exists ($ class )) {
3132
32- if (null === $ this ->responsableClass ) {
33+ if (null === $ this ->responsableClass ) {
3334 $ this ->responsableClass = new $ class ($ this ->em );
3435 }
35-
36- if ($ this ->responsableClass instanceof Export \ExportDataServiceInterface) {
37-
38- $ this ->responsableClass ->writeData ($ dados );
36+ if ($ this ->responsableClass instanceof Export \ExportDataServiceInterface) {
37+ if (isset ($ data ['custom ' ]) && $ data ['custom ' ] != null ) {
38+ $ this ->responsableClass ->writeCustomData ($ data );
39+ return $ this ->responsableClass ->exportCustomData ();
40+ }
41+ $ this ->responsableClass ->writeData ($ data );
3942 return $ this ->responsableClass ->export ();
40-
41- }else
42- throw new \Exception ("Class {$ class } must implements 'DataExport \\Export \\ExportDataServiceInterface' " );
43-
44- }else
45- throw new \Exception ("Class {$ class } does not exist " );
46-
47- }else
48- throw new \Exception ("Type can not be null " );
49-
43+ }
44+ throw new \Exception ("Class {$ class } must implements 'VMBDataExport \\Export \\ExportDataServiceInterface' " );
45+ }
46+ throw new \Exception ("Class {$ class } does not exist " );
47+ }
48+ throw new \Exception ("Type can not be null " );
5049 }
51-
5250}
0 commit comments