-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.php
More file actions
48 lines (33 loc) · 787 Bytes
/
client.php
File metadata and controls
48 lines (33 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
require 'vendor/autoload.php';
use Scale\Kernel\Core\Environment;
use Scale\Cli\CLI\Command;
use Scale\Cli\CLI\Bin\Run\SocketRunner;
use Scale\Cli\CLI\IO\Provider\Output;
use Scale\Cli\CLI\IO\Provider\Options;
use Scale\Kernel\Core\View;
/**
* Load environment
*/
$env = new Environment;
$input = new Options($env);
$output = new Output;
/**
* Define custom closure for SocketRunner task
*/
$task = function($uri) use ($env, $input, $output) {
$view = function($name){
return new View($name);
};
$r = new SocketRunner($input, $output, $view);
$r->uri = $uri;
return $r;
};
/**
* Instantiate new command
*/
$command = new Command($input, $output, $task);
/**
* Execute non-blocking socket runner
*/
$command->prepare()->execute();