Skip to content
This repository was archived by the owner on Sep 20, 2021. It is now read-only.

Commit a17f541

Browse files
committed
Move to PSR-1 and PSR-2.
1 parent 7b97f14 commit a17f541

File tree

15 files changed

+478
-595
lines changed

15 files changed

+478
-595
lines changed

Bin/Client.php

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
* New BSD License
1010
*
11-
* Copyright © 2007-2015, Ivan Enderlin. All rights reserved.
11+
* Copyright © 2007-2015, Hoa community. All rights reserved.
1212
*
1313
* Redistribution and use in source and binary forms, with or without
1414
* modification, are permitted provided that the following conditions are met:
@@ -45,17 +45,15 @@
4545
*
4646
* Basic WebSocket client.
4747
*
48-
* @author Ivan Enderlin <[email protected]>
49-
* @copyright Copyright © 2007-2015 Ivan Enderlin.
48+
* @copyright Copyright © 2007-2015 Hoa community
5049
* @license New BSD License
5150
*/
52-
53-
class Client extends Console\Dispatcher\Kit {
54-
51+
class Client extends Console\Dispatcher\Kit
52+
{
5553
/**
5654
* Options description.
5755
*
58-
* @var \Hoa\Websocket\Bin\Client array
56+
* @var array
5957
*/
6058
protected $options = [
6159
['server', Console\GetOption::REQUIRED_ARGUMENT, 's'],
@@ -68,27 +66,28 @@ class Client extends Console\Dispatcher\Kit {
6866
/**
6967
* The entry method.
7068
*
71-
* @access public
7269
* @return int
7370
*/
74-
public function main ( ) {
75-
71+
public function main()
72+
{
7673
$server = '127.0.0.1:8889';
7774

78-
while(false !== $c = $this->getOption($v)) switch($c) {
75+
while (false !== $c = $this->getOption($v)) {
76+
switch ($c) {
77+
case 's':
78+
$server = $v;
7979

80-
case 's':
81-
$server = $v;
82-
break;
80+
break;
8381

84-
case 'h':
85-
case '?':
86-
return $this->usage();
87-
break;
82+
case 'h':
83+
case '?':
84+
return $this->usage();
8885

89-
case '__ambiguous':
90-
$this->resolveOptionAmbiguity($v);
91-
break;
86+
case '__ambiguous':
87+
$this->resolveOptionAmbiguity($v);
88+
89+
break;
90+
}
9291
}
9392

9493

@@ -100,15 +99,14 @@ public function main ( ) {
10099
$client->connect();
101100

102101
do {
103-
104102
$line = $readline->readLine('> ');
105103

106-
if(false === $line || 'quit' === $line)
104+
if (false === $line || 'quit' === $line) {
107105
break;
106+
}
108107

109108
$client->send($line);
110-
111-
} while(true);
109+
} while (true);
112110

113111
$client->close();
114112

@@ -118,17 +116,17 @@ public function main ( ) {
118116
/**
119117
* The command usage.
120118
*
121-
* @access public
122119
* @return int
123120
*/
124-
public function usage ( ) {
125-
126-
echo 'Usage : websocket:client <options>', "\n",
127-
'Options :', "\n",
128-
$this->makeUsageOptionsList([
129-
's' => 'Server URI (default: 127.0.0.1:8889).',
130-
'help' => 'This help.'
131-
]), "\n";
121+
public function usage()
122+
{
123+
echo
124+
'Usage : websocket:client <options>', "\n",
125+
'Options :', "\n",
126+
$this->makeUsageOptionsList([
127+
's' => 'Server URI (default: 127.0.0.1:8889).',
128+
'help' => 'This help.'
129+
]), "\n";
132130

133131
return;
134132
}

0 commit comments

Comments
 (0)