Apply fixes from StyleCI

This commit is contained in:
Daniil Gentili 2017-06-23 20:41:28 +00:00 committed by StyleCI Bot
parent a65b5b18c9
commit f46a006cb3
3 changed files with 20 additions and 22 deletions

View File

@ -523,11 +523,11 @@ class MTProto extends \Volatile
'accept_chats' => true, // Should I accept secret chats? Can be true, false or on array of user ids from which to accept chats 'accept_chats' => true, // Should I accept secret chats? Can be true, false or on array of user ids from which to accept chats
], ],
'calls' => [ 'calls' => [
'accept_calls' => true, // Should I accept calls? Can be true, false or on array of user ids from which to accept calls 'accept_calls' => true, // Should I accept calls? Can be true, false or on array of user ids from which to accept calls
'allow_p2p' => false, // Should I accept p2p calls? 'allow_p2p' => false, // Should I accept p2p calls?
'incoming_callback' => 'default_incoming_call_callback', 'incoming_callback' => 'default_incoming_call_callback',
'network_type' => 7, 'network_type' => 7,
'log_file_path' => '/dev/stdout', 'log_file_path' => '/dev/stdout',
'stats_dump_file_path' => '/dev/stdout', 'stats_dump_file_path' => '/dev/stdout',
], ],
'threading' => [ 'threading' => [

View File

@ -88,19 +88,19 @@ trait AuthKeyHandler
$this->calls[$params['id']] = ['status' => self::READY, 'key' => $key, 'admin' => true, 'user_id' => $params['participant_id'], 'InputPhoneCall' => ['id' => $params['id'], 'access_hash' => $params['access_hash'], '_' => 'inputPhoneCall'], 'in_seq_no_x' => 0, 'out_seq_no_x' => 1, 'layer' => $this->settings['tl_schema']['layer'], 'updated' => time(), 'incoming' => [], 'outgoing' => [], 'created' => time(), 'protocol' => $params['protocol'], 'callbacks' => $this->calls[$params['id']]['callbacks']]; $this->calls[$params['id']] = ['status' => self::READY, 'key' => $key, 'admin' => true, 'user_id' => $params['participant_id'], 'InputPhoneCall' => ['id' => $params['id'], 'access_hash' => $params['access_hash'], '_' => 'inputPhoneCall'], 'in_seq_no_x' => 0, 'out_seq_no_x' => 1, 'layer' => $this->settings['tl_schema']['layer'], 'updated' => time(), 'incoming' => [], 'outgoing' => [], 'created' => time(), 'protocol' => $params['protocol'], 'callbacks' => $this->calls[$params['id']]['callbacks']];
$this->calls[$params['id']]['controller'] = new \danog\MadelineProto\VoIP($this->calls[$params['id']]['callbacks']['set_state'], $this->calls[$params['id']]['callbacks']['incoming'], $this->calls[$params['id']]['callbacks']['outgoing'], $this, $this->calls[$params['id']]['InputPhoneCall']); $this->calls[$params['id']]['controller'] = new \danog\MadelineProto\VoIP($this->calls[$params['id']]['callbacks']['set_state'], $this->calls[$params['id']]['callbacks']['incoming'], $this->calls[$params['id']]['callbacks']['outgoing'], $this, $this->calls[$params['id']]['InputPhoneCall']);
var_dump("key"); var_dump('key');
$this->calls[$params['id']]['controller']->setEncryptionKey($key['auth_key'], true); $this->calls[$params['id']]['controller']->setEncryptionKey($key['auth_key'], true);
var_dump("network"); var_dump('network');
$this->calls[$params['id']]['controller']->setNetworkType($this->settings['calls']['network_type']); $this->calls[$params['id']]['controller']->setNetworkType($this->settings['calls']['network_type']);
var_dump("config"); var_dump('config');
$this->calls[$params['id']]['controller']->setConfig($this->config['call_receive_timeout_ms']/1000, $this->config['call_connect_timeout_ms']/1000, true, true, true, $this->settings['calls']['log_file_path'], $this->settings['calls']['stats_dump_file_path']); $this->calls[$params['id']]['controller']->setConfig($this->config['call_receive_timeout_ms'] / 1000, $this->config['call_connect_timeout_ms'] / 1000, true, true, true, $this->settings['calls']['log_file_path'], $this->settings['calls']['stats_dump_file_path']);
var_dump("shared config"); var_dump('shared config');
$this->calls[$params['id']]['controller']->setSharedConfig($this->method_call('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc])); $this->calls[$params['id']]['controller']->setSharedConfig($this->method_call('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc]));
var_dump("endpoints"); var_dump('endpoints');
$this->calls[$params['id']]['controller']->setRemoteEndpoints(array_merge([$res['connection']], $res['alternative_connections']), $this->settings['calls']['allow_p2p']); $this->calls[$params['id']]['controller']->setRemoteEndpoints(array_merge([$res['connection']], $res['alternative_connections']), $this->settings['calls']['allow_p2p']);
var_dump("start"); var_dump('start');
$this->calls[$params['id']]['controller']->start(); $this->calls[$params['id']]['controller']->start();
$this->handle_pending_updates(); $this->handle_pending_updates();
} }
@ -132,11 +132,10 @@ var_dump("start");
$this->calls[$params['id']]['controller'] = new \danog\MadelineProto\VoIP($this->calls[$params['id']]['callbacks']['set_state'], $this->calls[$params['id']]['callbacks']['incoming'], $this->calls[$params['id']]['callbacks']['outgoing'], $this, $this->calls[$params['id']]['InputPhoneCall']); $this->calls[$params['id']]['controller'] = new \danog\MadelineProto\VoIP($this->calls[$params['id']]['callbacks']['set_state'], $this->calls[$params['id']]['callbacks']['incoming'], $this->calls[$params['id']]['callbacks']['outgoing'], $this, $this->calls[$params['id']]['InputPhoneCall']);
$this->calls[$params['id']]['controller']->setEncryptionKey($key['auth_key'], false); $this->calls[$params['id']]['controller']->setEncryptionKey($key['auth_key'], false);
$this->calls[$params['id']]['controller']->setNetworkType($this->settings['calls']['network_type']); $this->calls[$params['id']]['controller']->setNetworkType($this->settings['calls']['network_type']);
$this->calls[$params['id']]['controller']->setConfig($this->config['call_receive_timeout_ms']/1000, $this->config['call_connect_timeout_ms']/1000, true, true, true, $this->settings['calls']['log_file_path'], $this->settings['calls']['stats_dump_file_path']); $this->calls[$params['id']]['controller']->setConfig($this->config['call_receive_timeout_ms'] / 1000, $this->config['call_connect_timeout_ms'] / 1000, true, true, true, $this->settings['calls']['log_file_path'], $this->settings['calls']['stats_dump_file_path']);
$this->calls[$params['id']]['controller']->setSharedConfig($this->method_call('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc])); $this->calls[$params['id']]['controller']->setSharedConfig($this->method_call('phone.getCallConfig', [], ['datacenter' => $this->datacenter->curdc]));
$this->calls[$params['id']]['controller']->setRemoteEndpoints(array_merge([$params['connection']], $params['alternative_connections']), $this->settings['calls']['allow_p2p']); $this->calls[$params['id']]['controller']->setRemoteEndpoints(array_merge([$params['connection']], $params['alternative_connections']), $this->settings['calls']['allow_p2p']);
$this->calls[$params['id']]['controller']->start(); $this->calls[$params['id']]['controller']->start();
} }
public function call_status($id) public function call_status($id)

View File

@ -70,7 +70,6 @@ if ($MadelineProto === false) {
} }
$message = (getenv('TRAVIS_COMMIT') == '') ? 'I iz works always (io laborare sembre) (yo lavorar siempre) (mi labori ĉiam) (я всегда работать) (Ik werkuh altijd) (Ngimbonga ngaso sonke isikhathi ukusebenza)' : ('Travis ci tests in progress: commit '.getenv('TRAVIS_COMMIT').', job '.getenv('TRAVIS_JOB_NUMBER').', PHP version: '.getenv('TRAVIS_PHP_VERSION')); $message = (getenv('TRAVIS_COMMIT') == '') ? 'I iz works always (io laborare sembre) (yo lavorar siempre) (mi labori ĉiam) (я всегда работать) (Ik werkuh altijd) (Ngimbonga ngaso sonke isikhathi ukusebenza)' : ('Travis ci tests in progress: commit '.getenv('TRAVIS_COMMIT').', job '.getenv('TRAVIS_JOB_NUMBER').', PHP version: '.getenv('TRAVIS_PHP_VERSION'));
echo 'Serializing MadelineProto to session.madeline...'.PHP_EOL; echo 'Wrote echo 'Serializing MadelineProto to session.madeline...'.PHP_EOL; echo 'Wrote
'.\danog\MadelineProto\Serialization::serialize('session.madeline', $MadelineProto).' bytes'.PHP_EOL; '.\danog\MadelineProto\Serialization::serialize('session.madeline', $MadelineProto).' bytes'.PHP_EOL;
@ -80,10 +79,10 @@ var_dump($id = $MadelineProto->request_call('@danogentili', [
}, },
'incoming' => [ 'incoming' => [
'start' => function ($call) { 'start' => function ($call) {
var_dump("PLEASE START RECEIVING DATA"); var_dump('PLEASE START RECEIVING DATA');
}, },
'stop' => function ($call) { 'stop' => function ($call) {
var_dump("PLEASE STOP RECEIVING DATA"); var_dump('PLEASE STOP RECEIVING DATA');
}, },
'configure' => function ($call, $sampleRate, $bitsPerSample, $channels) { 'configure' => function ($call, $sampleRate, $bitsPerSample, $channels) {
var_dump("incoming sampleRate: $sampleRate, bitsPerSample: $bitsPerSample, channels: $channels"); var_dump("incoming sampleRate: $sampleRate, bitsPerSample: $bitsPerSample, channels: $channels");
@ -91,17 +90,17 @@ var_dump($id = $MadelineProto->request_call('@danogentili', [
], ],
'outgoing' => [ 'outgoing' => [
'start' => function ($call) { 'start' => function ($call) {
var_dump("PLEASE START SENDING DATA"); var_dump('PLEASE START SENDING DATA');
}, },
'stop' => function ($call) { 'stop' => function ($call) {
var_dump("PLEASE STOP SENDING DATA"); var_dump('PLEASE STOP SENDING DATA');
}, },
'configure' => function ($call, $sampleRate, $bitsPerSample, $channels) { 'configure' => function ($call, $sampleRate, $bitsPerSample, $channels) {
var_dump("outgoing sampleRate: $sampleRate, bitsPerSample: $bitsPerSample, channels: $channels"); var_dump("outgoing sampleRate: $sampleRate, bitsPerSample: $bitsPerSample, channels: $channels");
}, },
'get_level' => function ($call) { 'get_level' => function ($call) {
return 1; return 1;
} },
], ],
])); ]));
@ -196,7 +195,7 @@ foreach (glob('gifs/*') as $gif) {
foreach (glob('vids/*') as $vid) { foreach (glob('vids/*') as $vid) {
// GIF // GIF
$inputFile = $MadelineProto->upload($vid); $inputFile = $MadelineProto->upload($vid);
$media['video'] = ['_' => 'inputMediaUploadedDocument', 'file' => $inputFile, 'mime_type' => mime_content_type('tests/swing.mp4'), 'caption' => 'test', 'attributes' => [['_' => 'documentAttributeVideo', 'duration' => 5, 'w' => 1280, 'h' => 720]]]; $media['video'] = ['_' => 'inputMediaUploadedDocument', 'file' => $inputFile, 'mime_type' => mime_content_type('tests/swing.mp4'), 'caption' => 'test', 'attributes' => [['_' => 'documentAttributeVideo', 'duration' => 5, 'w' => 1280, 'h' => 720]]];
$media['gif'] = ['_' => 'inputMediaUploadedDocument', 'file' => $inputFile, 'mime_type' => mime_content_type($gif), 'caption' => '', 'attributes' => [['_' => 'documentAttributeAnimated']]]; $media['gif'] = ['_' => 'inputMediaUploadedDocument', 'file' => $inputFile, 'mime_type' => mime_content_type($gif), 'caption' => '', 'attributes' => [['_' => 'documentAttributeAnimated']]];
} }