pssht
latest
SSH server library written in PHP
Main Page
Classes
Files
File List
Fixed.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
12
namespace
fpoirotte\Pssht\Random
;
13
17
class
Fixed
implements
RandomInterface
18
{
20
protected
$data
;
21
28
public
function
__construct
(
$data
)
29
{
30
if
(!is_string(
$data
) || strlen(
$data
) === 0) {
31
throw
new \InvalidArgumentException();
32
}
33
34
$this->data =
$data
;
35
}
36
37
public
function
getBytes
($count)
38
{
39
if
(!is_int($count) || $count <= 0) {
40
throw
new \InvalidArgumentException();
41
}
42
43
return
substr(
44
str_repeat($this->data, (
int
) ($count / strlen($this->data) + 1)),
45
0,
46
$count
47
);
48
}
49
}
fpoirotte\Pssht\Random\Fixed\$data
$data
Fixed data to return.
Definition:
Fixed.php:20
fpoirotte\Pssht\Random\RandomInterface
Definition:
RandomInterface.php:17
fpoirotte\Pssht\Random\Fixed\__construct
__construct($data)
Definition:
Fixed.php:28
fpoirotte\Pssht\Random
Definition:
Fixed.php:12
fpoirotte\Pssht\Random\Fixed\getBytes
getBytes($count)
Definition:
Fixed.php:37
fpoirotte\Pssht\Random\Fixed
Definition:
Fixed.php:17
src
Random
Fixed.php
Generated on Tue May 9 2017 12:09:56 for pssht by
1.8.11