33
44namespace Litipk \JupyterPHP \Handlers ;
55
6-
76use Litipk \JupyterPHP \Actions \ExecuteAction ;
87use Litipk \JupyterPHP \Actions \HistoryAction ;
98use Litipk \JupyterPHP \Actions \KernelInfoAction ;
1514use Psy \Shell ;
1615use React \ZMQ \SocketWrapper ;
1716
18-
1917final class ShellMessagesHandler
2018{
2119 /** @var ExecuteAction */
@@ -44,23 +42,25 @@ final class ShellMessagesHandler
4442 * @param Logger $logger
4543 */
4644 public function __construct (
47- JupyterBroker $ broker , SocketWrapper $ iopubSocket , SocketWrapper $ shellSocket , Logger $ logger
48- )
49- {
45+ JupyterBroker $ broker ,
46+ SocketWrapper $ iopubSocket ,
47+ SocketWrapper $ shellSocket ,
48+ Logger $ logger
49+ ) {
5050 $ this ->shellSoul = new Shell ();
51-
51+
5252 $ this ->executeAction = new ExecuteAction ($ broker , $ iopubSocket , $ shellSocket , $ this ->shellSoul );
5353 $ this ->historyAction = new HistoryAction ($ broker , $ shellSocket );
5454 $ this ->kernelInfoAction = new KernelInfoAction ($ broker , $ shellSocket , $ iopubSocket );
55- $ this ->shutdownAction = new ShutdownAction ($ broker , $ shellSocket );
56-
55+ $ this ->shutdownAction = new ShutdownAction ($ broker , $ iopubSocket , $ shellSocket );
56+
5757 $ this ->logger = $ logger ;
5858
5959 $ broker ->send (
6060 $ iopubSocket , 'status ' , ['execution_state ' => 'starting ' ], []
6161 );
6262
63- $ this ->shellSoul ->setOutput ( new KernelOutput ($ this ->executeAction , $ this ->logger ->withName ('KernelOutput ' )));
63+ $ this ->shellSoul ->setOutput (new KernelOutput ($ this ->executeAction , $ this ->logger ->withName ('KernelOutput ' )));
6464 }
6565
6666 /**
@@ -74,14 +74,14 @@ public function __invoke(array $msg)
7474 $ content = json_decode ($ content , true );
7575
7676 $ this ->logger ->debug ('Received message ' , [
77- 'processId ' => getmypid (),
78- 'zmqId ' => htmlentities ($ zmqId , ENT_COMPAT , "UTF-8 " ),
79- 'delim ' => $ delim ,
80- 'hmac ' => $ hmac ,
81- 'header ' => $ header ,
77+ 'processId ' => getmypid (),
78+ 'zmqId ' => htmlentities ($ zmqId , ENT_COMPAT , "UTF-8 " ),
79+ 'delim ' => $ delim ,
80+ 'hmac ' => $ hmac ,
81+ 'header ' => $ header ,
8282 'parentHeader ' => $ parentHeader ,
83- 'metadata ' => $ metadata ,
84- 'content ' => $ content
83+ 'metadata ' => $ metadata ,
84+ 'content ' => $ content
8585 ]);
8686
8787 if ('kernel_info_request ' === $ header ['msg_type ' ]) {
0 commit comments