Skip to content

Commit b5c5045

Browse files
Added some PHPDoc, fixed a lot of typos
1 parent 4741175 commit b5c5045

33 files changed

+445
-205
lines changed

src/App.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ protected function handleBootstrap($filename)
277277
if (!$pathToFile || !is_readable($pathToFile)) {
278278
throw new Exception(sprintf('Cannot open bootstrap file "%s".' . "\n", $filename));
279279
}
280-
280+
281281
require $pathToFile;
282282
}
283283

@@ -298,7 +298,7 @@ protected function handleSelfUpdate()
298298
$phar = file_get_contents($remoteFilename);
299299
error_reporting($old);
300300
if (!$phar) {
301-
print ' failed' . PHP_EOL . 'Couldn\'t reach phpbu update site' . PHP_EOL;
301+
print ' failed' . PHP_EOL . 'Could not reach phpbu update site' . PHP_EOL;
302302
exit(self::EXIT_EXCEPTION);
303303
}
304304
file_put_contents($tempFilename, $phar);

src/App/Args.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<?php
22
namespace phpbu\App;
33

4-
use phpbu\App\Exception;
5-
64
/**
75
* Cli argument parser.
86
*
@@ -63,7 +61,7 @@ public function __construct()
6361
*/
6462
public function getOptions(array $args)
6563
{
66-
// remove scriptname from args
64+
// remove script name from args
6765
if (isset($args[0][0]) && $args[0][0] != '-') {
6866
array_shift($args);
6967
}

src/App/Configuration.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
use DOMElement;
55
use DOMXPath;
6-
use phpbu\App\Exception;
76
use phpbu\Util\Cli;
87
use phpbu\Util\String;
98

@@ -66,14 +65,14 @@
6665
class Configuration
6766
{
6867
/**
69-
* Path to configfile.
68+
* Path to config file.
7069
*
7170
* @var string
7271
*/
7372
private $filename;
7473

7574
/**
76-
* Configfile DOMDocument
75+
* Config file DOMDocument
7776
*
7877
* @var \DOMDocument
7978
*/
@@ -140,6 +139,7 @@ public function getPhpSettings()
140139
}
141140
}
142141
foreach ($this->xpath->query('php/ini') as $ini) {
142+
/** @var DOMElement $ini */
143143
$name = (string) $ini->getAttribute('name');
144144
$value = (string) $ini->getAttribute('value');
145145

@@ -180,12 +180,14 @@ private function getBackupConfig(DOMElement $backupNode)
180180
if ($sources->length !== 1) {
181181
throw new Exception('backup requires exactly one source config');
182182
}
183+
/** @var DOMElement $sourceNode */
183184
$sourceNode = $sources->item(0);
184185
$type = (string) $sourceNode->getAttribute('type');
185186
if (!$type) {
186187
throw new Exception('source requires type attribute');
187188
}
188189
$source['type'] = $type;
190+
/** @var DOMElement $optionNode */
189191
foreach ($sourceNode->getElementsByTagName('option') as $optionNode) {
190192
$name = (string) $optionNode->getAttribute('name');
191193
$value = (string) $optionNode->getAttribute('value');
@@ -197,6 +199,7 @@ private function getBackupConfig(DOMElement $backupNode)
197199
if ($targets->length !== 1) {
198200
throw new Exception('backup requires exactly one target config');
199201
}
202+
/** @var DOMElement $targetNode */
200203
$targetNode = $targets->item(0);
201204
$compress = (string) $targetNode->getAttribute('compress');
202205
$filename = (string) $targetNode->getAttribute('filename');
@@ -211,8 +214,9 @@ private function getBackupConfig(DOMElement $backupNode)
211214
'compress' => $compress,
212215
);
213216

214-
// get check informations
217+
// get check information
215218
$checks = array();
219+
/** @var DOMElement $checkNode */
216220
foreach ($backupNode->getElementsByTagName('check') as $checkNode) {
217221
$type = (string) $checkNode->getAttribute('type');
218222
$value = (string) $checkNode->getAttribute('value');
@@ -225,6 +229,7 @@ private function getBackupConfig(DOMElement $backupNode)
225229

226230
// get sync configurations
227231
$syncs = array();
232+
/** @var DOMElement $syncNode */
228233
foreach ($backupNode->getElementsByTagName('sync') as $syncNode) {
229234
$sync = array(
230235
'type' => (string) $syncNode->getAttribute('type'),
@@ -241,13 +246,15 @@ private function getBackupConfig(DOMElement $backupNode)
241246

242247
// get cleanup configuration
243248
$cleanup = array();
249+
/** @var DOMElement $cleanupNode */
244250
foreach ($backupNode->getElementsByTagName('cleanup') as $cleanupNode) {
245251
$cleanup = array(
246252
'type' => (string) $cleanupNode->getAttribute('type'),
247253
'skipOnCheckFail' => String::toBoolean((string) $cleanupNode->getAttribute('skipOnCheckFail'), true),
248254
'skipOnSyncFail' => String::toBoolean((string) $cleanupNode->getAttribute('skipOnSyncFail'), true),
249255
'options' => array()
250256
);
257+
/** @var DOMElement $optionNode */
251258
foreach ($cleanupNode->getElementsByTagName('option') as $optionNode) {
252259
$name = (string) $optionNode->getAttribute('name');
253260
$value = (string) $optionNode->getAttribute('value');
@@ -273,7 +280,8 @@ private function getBackupConfig(DOMElement $backupNode)
273280
*/
274281
public function getLoggingSettings()
275282
{
276-
$loggers = array();
283+
$loggers = array();
284+
/** @var DOMElement $logNode */
277285
foreach ($this->xpath->query('logging/log') as $logNode) {
278286
$log = array(
279287
'type' => (string) $logNode->getAttribute('type'),
@@ -284,6 +292,7 @@ public function getLoggingSettings()
284292
$log['options']['target'] = $this->toAbsolutePath($tarAtr);
285293
}
286294

295+
/** @var DOMElement $optionNode */
287296
foreach ($logNode->getElementsByTagName('option') as $optionNode) {
288297
$name = (string) $optionNode->getAttribute('name');
289298
$value = (string) $optionNode->getAttribute('value');

src/App/Listener.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,85 +4,120 @@
44
interface Listener
55
{
66
/**
7+
* phpbu start event.
8+
*
79
* @param array $settings
810
*/
911
public function phpbuStart($settings);
1012

1113
/**
14+
* phpbu end event.
15+
*
16+
* @param \phpbu\App\Result $result
1217
*/
1318
public function phpbuEnd(Result $result);
1419

1520
/**
21+
* Backup start event.
22+
*
1623
* @param array $backup
1724
*/
1825
public function backupStart($backup);
1926

2027
/**
28+
* Backup failed event.
29+
*
2130
* @param array $backup
2231
*/
2332
public function backupFailed($backup);
2433

2534
/**
35+
* Backup failed event.
36+
*
2637
* @param array $backup
2738
*/
2839
public function backupEnd($backup);
2940

3041
/**
42+
* Check start event.
43+
*
3144
* @param array $check
3245
*/
3346
public function checkStart($check);
3447

3548
/**
49+
* Check failed event.
50+
*
3651
* @param array $check
3752
*/
3853
public function checkFailed($check);
3954

4055
/**
56+
* Check end event.
57+
*
4158
* @param array $check
4259
*/
4360
public function checkEnd($check);
4461

4562
/**
63+
* Sync start event.
64+
*
4665
* @param array $sync
4766
*/
4867
public function syncStart($sync);
4968

5069
/**
70+
* Sync skipped event.
71+
*
5172
* @param array $sync
5273
*/
5374
public function syncSkipped($sync);
5475

5576
/**
77+
* Sync failed event.
78+
*
5679
* @param array $sync
5780
*/
5881
public function syncFailed($sync);
5982

6083
/**
84+
* Sync end event.
85+
*
6186
* @param array $sync
6287
*/
6388
public function syncEnd($sync);
6489

6590
/**
91+
* Cleanup start event.
92+
*
6693
* @param array $cleanup
6794
*/
6895
public function cleanupStart($cleanup);
6996

7097
/**
98+
* Cleanup skipped event.
99+
*
71100
* @param array $cleanup
72101
*/
73102
public function cleanupSkipped($cleanup);
74103

75104
/**
105+
* Cleanup failed event.
106+
*
76107
* @param array $cleanup
77108
*/
78109
public function cleanupFailed($cleanup);
79110

80111
/**
112+
* Cleanup end event.
113+
*
81114
* @param array $cleanup
82115
*/
83116
public function cleanupEnd($cleanup);
84117

85118
/**
119+
* Store / output some debug information.
120+
*
86121
* @param string $msg
87122
*/
88123
public function debug($msg);

0 commit comments

Comments
 (0)