Skip to content

Commit d3d6ae5

Browse files
committed
Update doc blocks
Fixes #22
1 parent 3169362 commit d3d6ae5

11 files changed

+173
-22
lines changed

Generator/AbstractPasswordGenerator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function setOption($option, $optionSettings)
6464
/**
6565
* Remove Option.
6666
*
67-
* @param $option
67+
* @param string $option
6868
*
6969
* @return $this
7070
*/

Generator/HumanPasswordGenerator.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ public function __construct()
3434
}
3535

3636
/**
37-
* Generate character list for us in generating passwords.
37+
* Generate word list for us in generating passwords.
3838
*
39-
* @return string[] Character list
39+
* @return string[] Words
4040
*
4141
* @throws WordsNotFoundException
4242
*/

Generator/PasswordGeneratorInterface.php

+96
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,119 @@
22

33
namespace Hackzilla\PasswordGenerator\Generator;
44

5+
use Hackzilla\PasswordGenerator\Exception\InvalidOptionException;
6+
use Hackzilla\PasswordGenerator\Exception\InvalidOptionTypeException;
7+
use Hackzilla\PasswordGenerator\Model\Option\Option;
8+
use Hackzilla\PasswordGenerator\RandomGenerator\RandomGeneratorInterface;
9+
510
interface PasswordGeneratorInterface
611
{
12+
/**
13+
* Possible options.
14+
*
15+
* @return array
16+
*/
717
public function getOptions();
818

19+
/**
20+
* Set password generator option.
21+
*
22+
* @param string $option
23+
* @param array $optionSettings
24+
*
25+
* @return $this
26+
* @throws InvalidOptionTypeException
27+
*/
928
public function setOption($option, $optionSettings);
1029

30+
/**
31+
* Get option.
32+
*
33+
* @param $option
34+
*
35+
* @return mixed
36+
*/
1137
public function getOption($option);
1238

39+
// /**
40+
// * Remove Option.
41+
// *
42+
// * @param string $option
43+
// *
44+
// * @return $this
45+
// */
46+
// public function removeOption($option);
47+
48+
/**
49+
* Set password generator option value.
50+
*
51+
* @param string $option
52+
* @param $value
53+
*
54+
* @return $this
55+
*/
1356
public function setOptionValue($option, $value);
1457

58+
/**
59+
* Get option value.
60+
*
61+
* @param $option
62+
*
63+
* @return mixed
64+
*/
1565
public function getOptionValue($option);
1666

67+
/**
68+
* @param string $parameter
69+
* @param mixed $value
70+
*
71+
* @return $this
72+
*/
1773
public function setParameter($parameter, $value);
1874

75+
/**
76+
* @param string $parameter
77+
* @param mixed $default
78+
*
79+
* @return null|mixed
80+
*/
1981
public function getParameter($parameter);
2082

83+
/**
84+
* Generate $count number of passwords.
85+
*
86+
* @param int $count Number of passwords to return
87+
*
88+
* @return string[]
89+
*
90+
* @throws \InvalidArgumentException
91+
*/
2192
public function generatePasswords($count = 1);
2293

94+
/**
95+
* Generate one password based on options.
96+
*
97+
* @return string password
98+
*/
2399
public function generatePassword();
100+
101+
102+
// /**
103+
// * Set source of randomness.
104+
// *
105+
// * @param RandomGeneratorInterface $randomGenerator
106+
// *
107+
// * @return $this
108+
// */
109+
// public function setRandomGenerator(RandomGeneratorInterface $randomGenerator);
110+
111+
// /**
112+
// * Generate a random value
113+
// *
114+
// * @param int $min
115+
// * @param int $max
116+
// *
117+
// * @return int
118+
// */
119+
// public function randomInteger($min, $max);
24120
}

Generator/RequirementPasswordGenerator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public function validLimits()
195195
}
196196

197197
/**
198-
* @param $option
198+
* @param string $option
199199
*
200200
* @return bool
201201
*/

Model/CharacterSet.php

+13
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,29 @@ class CharacterSet
66
{
77
private $characters;
88

9+
/**
10+
* CharacterSet constructor.
11+
*
12+
* @param string $characters
13+
*/
914
public function __construct($characters)
1015
{
1116
$this->characters = $characters;
1217
}
1318

19+
/**
20+
* Get Character set
21+
*
22+
* @return string
23+
*/
1424
public function getCharacters()
1525
{
1626
return $this->characters;
1727
}
1828

29+
/**
30+
* @return string
31+
*/
1932
public function __toString()
2033
{
2134
if (!is_string($this->characters)) {

Model/Option/BooleanOption.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
class BooleanOption extends Option
88
{
99
/**
10-
* Set option boolean value.
11-
*
12-
* @param bool $value
13-
*
14-
* @throws \InvalidArgumentException
10+
* {@inheritdoc}
1511
*/
1612
public function setValue($value)
1713
{
@@ -22,6 +18,9 @@ public function setValue($value)
2218
parent::setValue($value);
2319
}
2420

21+
/**
22+
* {@inheritdoc}
23+
*/
2524
public function getType()
2625
{
2726
return self::TYPE_BOOLEAN;

Model/Option/IntegerOption.php

+7-5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ class IntegerOption extends Option
99
private $minRange;
1010
private $maxRange;
1111

12+
/**
13+
* {@inheritdoc}
14+
*/
1215
public function __construct(array $settings = array())
1316
{
1417
parent::__construct($settings);
@@ -18,11 +21,7 @@ public function __construct(array $settings = array())
1821
}
1922

2023
/**
21-
* Set option integer value.
22-
*
23-
* @param int $value
24-
*
25-
* @throws \InvalidArgumentException
24+
* {@inheritdoc}
2625
*/
2726
public function setValue($value)
2827
{
@@ -37,6 +36,9 @@ public function setValue($value)
3736
parent::setValue($value);
3837
}
3938

39+
/**
40+
* {@inheritdoc}
41+
*/
4042
public function getType()
4143
{
4244
return self::TYPE_INTEGER;

Model/Option/Option.php

+10-3
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,35 @@ abstract class Option implements OptionInterface
1010

1111
private $value = null;
1212

13+
/**
14+
* {@inheritdoc}
15+
*/
1316
public function __construct(array $settings = array())
1417
{
1518
if (isset($settings['default'])) {
1619
$this->value = $settings['default'];
1720
}
1821
}
1922

23+
/**
24+
* {@inheritdoc}
25+
*/
2026
public function getValue()
2127
{
2228
return $this->value;
2329
}
2430

2531
/**
26-
* Set option value.
27-
*
28-
* @param mixed $value
32+
* {@inheritdoc}
2933
*/
3034
public function setValue($value)
3135
{
3236
$this->value = $value;
3337
}
3438

39+
/**
40+
* {@inheritdoc}
41+
*/
3542
public static function createFromType($type, array $settings = array())
3643
{
3744
switch ($type) {

Model/Option/OptionInterface.php

+23
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,34 @@
44

55
interface OptionInterface
66
{
7+
/**
8+
* Option settings
9+
* Things like default, min, and max
10+
*
11+
* @param array $settings
12+
*/
713
public function __construct(array $settings);
814

15+
/**
16+
* Get option type
17+
*
18+
* @return string
19+
*/
920
public function getType();
1021

22+
/**
23+
* Get option value
24+
*
25+
* @return mixed
26+
*/
1127
public function getValue();
1228

29+
/**
30+
* Set option string value.
31+
*
32+
* @param string $value
33+
*
34+
* @throws \InvalidArgumentException
35+
*/
1336
public function setValue($value);
1437
}

Model/Option/StringOption.php

+7-5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ class StringOption extends Option
99
private $minRange;
1010
private $maxRange;
1111

12+
/**
13+
* {@inheritdoc}
14+
*/
1215
public function __construct(array $settings = array())
1316
{
1417
parent::__construct($settings);
@@ -18,11 +21,7 @@ public function __construct(array $settings = array())
1821
}
1922

2023
/**
21-
* Set option string value.
22-
*
23-
* @param string $value
24-
*
25-
* @throws \InvalidArgumentException
24+
* {@inheritdoc}
2625
*/
2726
public function setValue($value)
2827
{
@@ -37,6 +36,9 @@ public function setValue($value)
3736
parent::setValue($value);
3837
}
3938

39+
/**
40+
* {@inheritdoc}
41+
*/
4042
public function getType()
4143
{
4244
return self::TYPE_STRING;

RandomGenerator/RandomGeneratorInterface.php

+9
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,14 @@
44

55
interface RandomGeneratorInterface
66
{
7+
/**
8+
* Generates cryptographic random integers that are suitable for use where unbiased results are critical
9+
* (i.e. shuffling a Poker deck).
10+
*
11+
* @param int $min
12+
* @param int $max
13+
*
14+
* @return int
15+
*/
716
public function randomInteger($min, $max);
817
}

0 commit comments

Comments
 (0)