pssht  latest
SSH server library written in PHP
FAILURE.php
1 <?php
2 
3 /*
4 * This file is part of pssht.
5 *
6 * (c) François Poirotte <clicky@erebot.net>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11 
13 
18 {
20  protected $methods;
21 
23  protected $partial;
24 
35  public function __construct(array $methods, $partial)
36  {
37  if (!is_bool($partial)) {
38  throw new \InvalidArgumentException();
39  }
40 
41  foreach ($methods as $method) {
42  if (!is_string($method)) {
43  throw new \InvalidArgumentException();
44  }
45  }
46 
47  $this->methods = $methods;
48  $this->partial = $partial;
49  }
50 
51  public static function getMessageId()
52  {
53  return 51;
54  }
55 
56  public function serialize(\fpoirotte\Pssht\Wire\Encoder $encoder)
57  {
58  $encoder->encodeNameList($this->methods);
59  $encoder->encodeBoolean($this->partial);
60  return $this;
61  }
62 
63  public static function unserialize(\fpoirotte\Pssht\Wire\Decoder $decoder)
64  {
65  return new static(
66  $decoder->decodeNameList(),
67  $decoder->decodeBoolean()
68  );
69  }
70 }
$methods
List of authentication methods that may continue.
Definition: FAILURE.php:20
static unserialize(\fpoirotte\Pssht\Wire\Decoder $decoder)
Definition: FAILURE.php:63
$partial
Whether a partial success occurred.
Definition: FAILURE.php:23
__construct(array $methods, $partial)
Definition: FAILURE.php:35
serialize(\fpoirotte\Pssht\Wire\Encoder $encoder)
Definition: FAILURE.php:56