Skip to content

Commit fd89d75

Browse files
committed
run php-cs-fixer with nextcloud config
Signed-off-by: Robin Appelman <[email protected]>
1 parent 249b46e commit fd89d75

File tree

11 files changed

+32
-38
lines changed

11 files changed

+32
-38
lines changed

lib/AppInfo/Application.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24
/**
35
* @copyright Copyright (c) 2018 Robin Appelman <[email protected]>
46
*
@@ -37,7 +39,7 @@ public function register(IRegistrationContext $context): void {
3739
}
3840

3941
public function boot(IBootContext $context): void {
40-
$context->getAppContainer()->registerService(Formatter::class, function(IAppContainer $c) {
42+
$context->getAppContainer()->registerService(Formatter::class, function (IAppContainer $c) {
4143
return new Formatter(\OC::$SERVERROOT);
4244
});
4345
}

lib/Command/Tail.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24
/**
35
* @copyright Copyright (c) 2018 Robin Appelman <[email protected]>
46
*
@@ -33,7 +35,7 @@
3335
use Symfony\Component\Console\Terminal;
3436

3537
class Tail extends Base {
36-
const LEVELS = ['Debug', 'Info', 'Warning', 'Error', 'Fatal'];
38+
public const LEVELS = ['Debug', 'Info', 'Warning', 'Error', 'Fatal'];
3739

3840
private $formatter;
3941
private $logIteratorFactory;
@@ -42,7 +44,6 @@ public function __construct(Formatter $formatter, LogIteratorFactory $logIterato
4244
parent::__construct();
4345
$this->formatter = $formatter;
4446
$this->logIteratorFactory = $logIteratorFactory;
45-
4647
}
4748

4849
protected function configure() {

lib/Command/Watch.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24
/**
35
* @copyright Copyright (c) 2018 Robin Appelman <[email protected]>
46
*
@@ -25,15 +27,13 @@
2527
use OC\Core\Command\InterruptedException;
2628
use OCA\LogReader\Log\Formatter;
2729
use OCA\LogReader\Log\LogIteratorFactory;
28-
use Symfony\Component\Console\Input\InputArgument;
2930
use Symfony\Component\Console\Input\InputInterface;
3031
use Symfony\Component\Console\Output\OutputInterface;
31-
use Symfony\Component\Console\Style\SymfonyStyle;
3232
use Symfony\Component\Console\Terminal;
3333

3434
class Watch extends Base {
35-
const LEVELS = ['Debug', 'Info', 'Warning', 'Error', 'Fatal'];
36-
const ALL_LEVELS = '11111';
35+
public const LEVELS = ['Debug', 'Info', 'Warning', 'Error', 'Fatal'];
36+
public const ALL_LEVELS = '11111';
3737

3838
private $formatter;
3939
private $logIteratorFactory;
@@ -42,7 +42,6 @@ public function __construct(Formatter $formatter, LogIteratorFactory $logIterato
4242
parent::__construct();
4343
$this->formatter = $formatter;
4444
$this->logIteratorFactory = $logIteratorFactory;
45-
4645
}
4746

4847
protected function configure() {

lib/Controller/LogController.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,13 @@
2121

2222
namespace OCA\LogReader\Controller;
2323

24-
use OCA\LogReader\Log\LogIterator;
2524
use OCA\LogReader\Log\LogIteratorFactory;
2625
use OCA\LogReader\Log\SearchFilter;
2726
use OCP\AppFramework\Controller;
2827
use OCP\AppFramework\Http\JSONResponse;
2928
use OCP\AppFramework\Http\TemplateResponse;
3029
use OCP\IConfig;
3130
use OCP\IRequest;
32-
use OCP\Log\IFileBased;
33-
use OCP\Log\ILogFactory;
3431

3532
/**
3633
* Class LogController
@@ -71,7 +68,6 @@ private function getLastItem($levels) {
7168
$iterator = $this->logIteratorFactory->getLogIterator($levels);
7269
$iterator->next();
7370
return $iterator->current();
74-
7571
}
7672

7773
/**
@@ -93,7 +89,6 @@ private function getLastItem($levels) {
9389
* @return JSONResponse
9490
*/
9591
public function poll($lastReqId, $levels = '11111') {
96-
9792
$cycles = 0;
9893
$maxCycles = 20;
9994

@@ -186,7 +181,6 @@ public function setLevels($levels) {
186181
}
187182

188183
protected function responseFromIterator(\Iterator $iterator, $count, $offset) {
189-
190184
$iterator->rewind();
191185
for ($i = 0; $i < $offset; $i++) {
192186
$iterator->next();

lib/Controller/PageController.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class PageController extends Controller {
3636
* @return TemplateResponse
3737
*/
3838
public function index() {
39-
4039
$response = new TemplateResponse(
4140
$this->appName,
4241
'index',
@@ -48,6 +47,4 @@ public function index() {
4847

4948
return $response;
5049
}
51-
52-
5350
}

lib/Log/Formatter.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24
/**
35
* @copyright Copyright (c) 2018 Robin Appelman <[email protected]>
46
*
@@ -21,7 +23,6 @@
2123

2224
namespace OCA\LogReader\Log;
2325

24-
2526
class Formatter {
2627
private $root;
2728

@@ -84,7 +85,7 @@ private function formatArgument($argument, int $whiteSpace, int $depth = 0, bool
8485
$className = $argument['__class__'];
8586
unset($argument['__class__']);
8687
return $leadingSpace . $className . ' ' . trim($this->formatArgument($argument, $whiteSpace, $depth, true));
87-
} else if (is_array($argument)) {
88+
} elseif (is_array($argument)) {
8889
if (count($argument) === 0) {
8990
return $leadingSpace . ($forceObject ? '{}' : '[]');
9091
}
@@ -93,13 +94,13 @@ private function formatArgument($argument, int $whiteSpace, int $depth = 0, bool
9394
$keyWhitespace = str_repeat(' ', $whiteSpace * ($depth + 1));
9495
return $leadingSpace . "{\n" .
9596
implode($glue, array_map(function ($key, $value) use ($whiteSpace, $depth, $keyWhitespace) {
96-
return $keyWhitespace . $key . ':' . trim($this->formatArgument($value, $whiteSpace, $depth + 1));
97-
}, array_keys($argument), array_values($argument))) . ($whiteSpace ? "\n" : '') . $leadingSpace . '}';
97+
return $keyWhitespace . $key . ':' . trim($this->formatArgument($value, $whiteSpace, $depth + 1));
98+
}, array_keys($argument), array_values($argument))) . ($whiteSpace ? "\n" : '') . $leadingSpace . '}';
9899
} else {
99100
return $leadingSpace . "[\n" .
100101
implode($glue, array_map(function ($value) use ($whiteSpace, $depth) {
101-
return $this->formatArgument($value, $whiteSpace, $depth + 1);
102-
}, $argument)) . ($whiteSpace ? "\n" : '') . $leadingSpace . ']';
102+
return $this->formatArgument($value, $whiteSpace, $depth + 1);
103+
}, $argument)) . ($whiteSpace ? "\n" : '') . $leadingSpace . ']';
103104
}
104105
} else {
105106
$value = json_encode($argument, $whiteSpace ? JSON_PRETTY_PRINT : 0);

lib/Log/LogIterator.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class LogIterator implements \Iterator {
5151

5252
private $timezone;
5353

54-
const CHUNK_SIZE = 100; // how many chars do we try at once to find a new line
54+
public const CHUNK_SIZE = 100; // how many chars do we try at once to find a new line
5555

5656
/**
5757
* @param resource $handle
@@ -66,13 +66,13 @@ public function __construct($handle, $dateFormat, $timezone) {
6666
$this->next();
6767
}
6868

69-
function rewind() {
69+
public function rewind() {
7070
fseek($this->handle, 0, SEEK_END);
7171
$this->position = ftell($this->handle) - self::CHUNK_SIZE;
7272
$this->currentKey = 0;
7373
}
7474

75-
function current() {
75+
public function current() {
7676
$entry = json_decode($this->lastLine, true);
7777
if ($this->dateFormat !== \DateTime::ATOM) {
7878
if (isset($entry['time'])) {
@@ -85,11 +85,11 @@ function current() {
8585
return $entry;
8686
}
8787

88-
function key() {
88+
public function key() {
8989
return $this->currentKey;
9090
}
9191

92-
function next() {
92+
public function next() {
9393
$this->currentLine = '';
9494

9595
// Loop through each character of the file looking for new lines
@@ -119,7 +119,7 @@ function next() {
119119
}
120120
}
121121

122-
function valid() {
122+
public function valid() {
123123
if (!is_resource($this->handle)) {
124124
return false;
125125
}

lib/Log/LogIteratorFactory.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24
/**
35
* @copyright Copyright (c) 2018 Robin Appelman <[email protected]>
46
*
@@ -21,7 +23,6 @@
2123

2224
namespace OCA\LogReader\Log;
2325

24-
2526
use OCP\IConfig;
2627
use OCP\Log\IFileBased;
2728
use OCP\Log\ILogFactory;

lib/Log/SearchFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function accept() {
6363
private function inMessage($message, $query) {
6464
if (is_string($message)) {
6565
return stripos($message, $query) !== false;
66-
} else if (isset($message['Exception'])) {
66+
} elseif (isset($message['Exception'])) {
6767
return stripos($message['Exception'], $query) !== false
6868
|| stripos($message['Message'], $query) !== false;
6969
}

lib/Settings/Admin.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,4 @@ public function getSection() {
5252
public function getPriority() {
5353
return 90;
5454
}
55-
5655
}

0 commit comments

Comments
 (0)