Skip to content

Commit ea68a28

Browse files
committed
Reverted the autoloader changes in the stub. Unnecessary, due to PEAR2_Autoload conditionally declaring itself, while also unconditionally registering itself;
Minor doc fixes at ResponseCollection.
1 parent cf953e9 commit ea68a28

File tree

2 files changed

+23
-30
lines changed

2 files changed

+23
-30
lines changed

src/PEAR2/Net/RouterOS/ResponseCollection.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,12 @@ class ResponseCollection implements ArrayAccess, SeekableIterator, Countable
6464

6565
/**
6666
* @var array An array with positions of responses, based on an argument
67-
* name. The name of each argument is the array key, and the array value is
68-
* another array where the key is the value for that argument, and the value
69-
* is the posistion of the response. For performance reasons, each key is
70-
* built only when {@link static::setIndex()} is called with that argument,
71-
* and remains available for the lifetime of this collection.
67+
* name. The name of each argument is the array key, and the array value
68+
* is another array where the key is the value for that argument, and
69+
* the value is the posistion of the response. For performance reasons,
70+
* each key is built only when {@link static::setIndex()} is called with
71+
* that argument, and remains available for the lifetime of this
72+
* collection.
7273
*/
7374
protected $responsesIndex = array();
7475

@@ -171,7 +172,7 @@ public function getIndex()
171172
* Gets the whole collection as an array.
172173
*
173174
* @param bool $useIndex Whether to use the index values as keys for the
174-
* resulting array.
175+
* resulting array.
175176
*
176177
* @return array An array with all responses, in network order.
177178
*/
@@ -217,7 +218,7 @@ public function offsetExists($offset)
217218
* Gets a {@link Response} from a specified offset.
218219
*
219220
* @param int|string $offset The offset of the desired response. If the
220-
* collection is indexed, you can also supply the value to search for.
221+
* collection is indexed, you can also supply the value to search for.
221222
*
222223
* @return Response The response at the specified offset.
223224
*/
@@ -274,7 +275,7 @@ public function rewind()
274275
* Moves the position pointer to a specified position.
275276
*
276277
* @param int|string $position The position to move to. If the collection is
277-
* indexed, you can also supply a value to move the pointer to.
278+
* indexed, you can also supply a value to move the pointer to.
278279
*
279280
* @return Response The {@link Response} at the specified position, or FALSE
280281
* if the specified position is not valid.

stub.php

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,34 +15,24 @@
1515
* @link http://pear2.php.net/PEAR2_Net_RouterOS
1616
*/
1717

18-
$isIncluded = count(get_included_files()) > 1;
1918
$hasArgs = $argc > 1;
20-
if ($isIncluded || $hasArgs) {
19+
if (count(get_included_files()) > 1 || $hasArgs) {
2120
Phar::mapPhar();
2221
$pkgDir = 'phar://' . __FILE__ . DIRECTORY_SEPARATOR .
2322
'@PACKAGE_NAME@-@PACKAGE_VERSION@' . DIRECTORY_SEPARATOR;
2423

25-
//Set up autoloader
26-
if (class_exists('PEAR2\Autoload', true)) {
27-
//Called in this fashion to avoid parse errors on PHP =< 5.3.0
28-
call_user_func(
29-
array('PEAR2\Autoload', 'initialize'),
30-
$pkgDir . DIRECTORY_SEPARATOR . 'src'
31-
);
32-
} else {
33-
include_once $pkgDir . DIRECTORY_SEPARATOR
34-
. 'src' . DIRECTORY_SEPARATOR
35-
. 'PEAR2' . DIRECTORY_SEPARATOR
36-
. 'Autoload.php';
37-
}
24+
include_once $pkgDir . DIRECTORY_SEPARATOR
25+
. 'src' . DIRECTORY_SEPARATOR
26+
. 'PEAR2' . DIRECTORY_SEPARATOR
27+
. 'Autoload.php';
3828

3929
//Run console if there are any arguments
4030
if ($hasArgs) {
4131
include_once $pkgDir . DIRECTORY_SEPARATOR
4232
. 'bin' . DIRECTORY_SEPARATOR
4333
. 'roscon.php';
4434
}
45-
unset($pkgDir, $isIncluded, $hasArgs);
35+
unset($pkgDir, $hasArgs);
4636
return;
4737
}
4838

@@ -84,6 +74,7 @@
8474
its autoloader.
8575
8676
Exception details:
77+
8778
HEREDOC
8879
. $e . "\n";
8980
}
@@ -96,12 +87,6 @@
9687
HEREDOC;
9788
}
9889

99-
echo "\n" . str_repeat('=', 80) . "\n";
100-
echo <<<HEREDOC
101-
This package provides a console. To see usage instructions, rerun this file
102-
from the command line with "--help" as an argument.
103-
104-
HEREDOC;
10590
echo "\n" . str_repeat('=', 80) . "\n";
10691
if (extension_loaded('openssl')) {
10792
echo <<<HEREDOC
@@ -168,4 +153,11 @@
168153
HEREDOC;
169154
}
170155

156+
echo "\n" . str_repeat('=', 80) . "\n";
157+
echo <<<HEREDOC
158+
This package provides a console. To see usage instructions, rerun this file
159+
from the command line with "--help" as an argument.
160+
161+
HEREDOC;
162+
171163
__HALT_COMPILER();

0 commit comments

Comments
 (0)