@@ -88,33 +88,46 @@ public function getCallsCount(): int
88
88
return $ i ;
89
89
}
90
90
91
+ public function hash (string $ string ): string
92
+ {
93
+ return hash ('xxh128 ' , $ string );
94
+ }
95
+
96
+ public function buildMermaidLiveLink (string $ name ): string
97
+ {
98
+ $ payload = [
99
+ 'code ' => $ this ->data ['workflows ' ][$ name ]['dump ' ],
100
+ 'mermaid ' => '{"theme": "default"} ' ,
101
+ 'autoSync ' => false ,
102
+ ];
103
+
104
+ $ compressed = zlib_encode (json_encode ($ payload ), ZLIB_ENCODING_DEFLATE );
105
+
106
+ $ suffix = rtrim (strtr (base64_encode ($ compressed ), '+/ ' , '-_ ' ), '= ' );
107
+
108
+ return "https://mermaid.live/edit#pako: {$ suffix }" ;
109
+ }
110
+
91
111
protected function getCasters (): array
92
112
{
93
113
return [
94
114
...parent ::getCasters (),
95
- TransitionBlocker::class => function ($ v , array $ a , Stub $ s , $ isNested ) {
96
- unset(
97
- $ a [\sprintf (Caster::PATTERN_PRIVATE , $ v ::class, 'code ' )],
98
- $ a [\sprintf (Caster::PATTERN_PRIVATE , $ v ::class, 'parameters ' )],
99
- );
115
+ TransitionBlocker::class => static function ($ v , array $ a , Stub $ s ) {
116
+ unset($ a [\sprintf (Caster::PATTERN_PRIVATE , $ v ::class, 'code ' )]);
117
+ unset($ a [\sprintf (Caster::PATTERN_PRIVATE , $ v ::class, 'parameters ' )]);
100
118
101
119
$ s ->cut += 2 ;
102
120
103
121
return $ a ;
104
122
},
105
- Marking::class => function ($ v , array $ a, Stub $ s , $ isNested ) {
123
+ Marking::class => static function ($ v , array $ a ) {
106
124
$ a [Caster::PREFIX_VIRTUAL .'.places ' ] = array_keys ($ v ->getPlaces ());
107
125
108
126
return $ a ;
109
127
},
110
128
];
111
129
}
112
130
113
- public function hash (string $ string ): string
114
- {
115
- return hash ('xxh128 ' , $ string );
116
- }
117
-
118
131
private function getEventListeners (WorkflowInterface $ workflow ): array
119
132
{
120
133
$ listeners = [];
0 commit comments