Skip to content

Commit 13c5dd1

Browse files
committed
run php-cs-fixer for the src
1 parent 85f7883 commit 13c5dd1

18 files changed

+139
-110
lines changed

src/Dir.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
<?php declare(strict_types=1);
2+
/**
3+
* This file is part of toolkit/fsutil.
4+
*
5+
* @author https://github.com/inhere
6+
* @link https://github.com/toolkit/fsutil
7+
* @license MIT
8+
*/
29

310
namespace Toolkit\FsUtil;
411

@@ -9,5 +16,4 @@
916
*/
1017
final class Dir extends Directory
1118
{
12-
1319
}

src/Directory.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/**
3-
* Created by sublime 3.
4-
* Auth: Inhere
5-
* Date: 15-1-14
6-
* Time: 10:35
3+
* This file is part of toolkit/fsutil.
4+
*
5+
* @author https://github.com/inhere
6+
* @link https://github.com/toolkit/fsutil
7+
* @license MIT
78
*/
89

910
namespace Toolkit\FsUtil;
@@ -82,7 +83,6 @@ public static function isEmpty(string $dir): bool
8283
}
8384

8485
while (($file = readdir($handler)) !== false) {
85-
8686
if ($file !== '.' && $file !== '..') {
8787
closedir($handler);
8888

@@ -222,7 +222,7 @@ public static function simpleInfo(string $dir, $ext = null, bool $recursive = fa
222222
//basename — 返回路径中的 文件名部分
223223
$list[] = basename($file);
224224

225-
// is directory
225+
// is directory
226226
} else {
227227
$list[] = '/' . basename($file);
228228

@@ -270,7 +270,6 @@ public static function getFiles(
270270
// 匹配文件 如果没有传入$ext 则全部遍历,传入了则按传入的类型来查找
271271
if (is_file($v) && (!$ext || preg_match("/\.($ext)$/i", $v))) {
272272
$list[] = $parent . $relatePath;
273-
274273
} elseif ($recursive) {
275274
$list = self::getFiles($v, $ext, $recursive, $relatePath . '/', $list);
276275
}
@@ -311,7 +310,7 @@ public static function getFilesInfo(string $path, $ext = null, bool $recursive =
311310
if (is_file($file) && (!$ext || preg_match("/\.($ext)$/i", $file))) {
312311
$list[$id] = File::info($file);
313312

314-
//是否遍历子目录
313+
//是否遍历子目录
315314
} elseif ($recursive) {
316315
$list = self::getFilesInfo($file, $ext, $recursive, $list);
317316
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/**
3-
* Created by PhpStorm.
4-
* User: Inhere
5-
* Date: 2018/1/29 0029
6-
* Time: 22:58
3+
* This file is part of toolkit/fsutil.
4+
*
5+
* @author https://github.com/inhere
6+
* @link https://github.com/toolkit/fsutil
7+
* @license MIT
78
*/
89

910
namespace Toolkit\FsUtil\Exception;
@@ -17,5 +18,4 @@
1718
*/
1819
class FileNotFoundException extends RuntimeException
1920
{
20-
2121
}

src/Exception/FileReadException.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/**
3-
* Created by PhpStorm.
4-
* User: Inhere
5-
* Date: 2018/1/29 0029
6-
* Time: 23:03
3+
* This file is part of toolkit/fsutil.
4+
*
5+
* @author https://github.com/inhere
6+
* @link https://github.com/toolkit/fsutil
7+
* @license MIT
78
*/
89

910
namespace Toolkit\FsUtil\Exception;
@@ -15,5 +16,4 @@
1516
*/
1617
class FileReadException extends FileSystemException
1718
{
18-
1919
}

src/Exception/FileSystemException.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/**
3-
* Created by PhpStorm.
4-
* User: Inhere
5-
* Date: 2018/1/29 0029
6-
* Time: 22:58
3+
* This file is part of toolkit/fsutil.
4+
*
5+
* @author https://github.com/inhere
6+
* @link https://github.com/toolkit/fsutil
7+
* @license MIT
78
*/
89

910
namespace Toolkit\FsUtil\Exception;
@@ -17,5 +18,4 @@
1718
*/
1819
class FileSystemException extends RuntimeException
1920
{
20-
2121
}

src/Exception/FileWriteException.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/**
3-
* Created by PhpStorm.
4-
* User: Inhere
5-
* Date: 2018/1/29 0029
6-
* Time: 23:03
3+
* This file is part of toolkit/fsutil.
4+
*
5+
* @author https://github.com/inhere
6+
* @link https://github.com/toolkit/fsutil
7+
* @license MIT
78
*/
89

910
namespace Toolkit\FsUtil\Exception;
@@ -15,5 +16,4 @@
1516
*/
1617
class FileWriteException extends FileSystemException
1718
{
18-
1919
}

src/Exception/IOException.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/**
3-
* Created by PhpStorm.
4-
* User: Inhere
5-
* Date: 2018/1/29 0029
6-
* Time: 23:04
3+
* This file is part of toolkit/fsutil.
4+
*
5+
* @author https://github.com/inhere
6+
* @link https://github.com/toolkit/fsutil
7+
* @license MIT
78
*/
89

910
namespace Toolkit\FsUtil\Exception;
@@ -15,5 +16,4 @@
1516
*/
1617
class IOException extends FileSystemException
1718
{
18-
1919
}

src/File.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/**
3-
* Created by sublime 3.
4-
* Auth: Inhere
5-
* Date: 15-1-14
6-
* Name: File.php
7-
* Time: 10:35
8-
* Uesd: 主要功能是 文件相关信息获取
3+
* This file is part of toolkit/fsutil.
4+
*
5+
* @author https://github.com/inhere
6+
* @link https://github.com/toolkit/fsutil
7+
* @license MIT
98
*/
109

1110
namespace Toolkit\FsUtil;
@@ -40,9 +39,13 @@ abstract class File extends FileSystem
4039
use FileSnippetReadTrait;
4140

4241
public const FORMAT_PHP = 'php';
42+
4343
public const FORMAT_JSON = 'json';
44+
4445
public const FORMAT_INI = 'ini';
46+
4547
public const FORMAT_YML = 'yml';
48+
4649
public const FORMAT_YAML = 'yaml';
4750

4851
/**

src/FileFinder.php

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/**
3-
* Created by PhpStorm.
4-
* User: Inhere
5-
* Date: 2018/1/20 0020
6-
* Time: 21:57
3+
* This file is part of toolkit/fsutil.
4+
*
5+
* @author https://github.com/inhere
6+
* @link https://github.com/toolkit/fsutil
7+
* @license MIT
78
*/
89

910
namespace Toolkit\FsUtil;
@@ -57,8 +58,11 @@
5758
final class FileFinder implements IteratorAggregate, Countable
5859
{
5960
public const ONLY_FILE = 1;
61+
6062
public const ONLY_DIR = 2;
63+
6164
public const IGNORE_VCS_FILES = 1;
65+
6266
public const IGNORE_DOT_FILES = 2;
6367

6468
/** @var array */
@@ -470,12 +474,15 @@ private function findInDirectory(string $dir): Iterator
470474
$flags |= RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
471475
}
472476

473-
$iterator = new class ($dir, $flags) extends RecursiveDirectoryIterator
474-
{
477+
$iterator = new class($dir, $flags) extends RecursiveDirectoryIterator {
475478
private $rootPath;
479+
476480
private $subPath;
481+
477482
private $rewindable;
483+
478484
private $directorySeparator = '/';
485+
479486
private $ignoreUnreadableDirs;
480487

481488
public function __construct(string $path, int $flags, bool $ignoreUnreadableDirs = false)
@@ -565,9 +572,9 @@ public function isRewindable()
565572

566573
// exclude directories
567574
if ($this->excludes) {
568-
$iterator = new class ($iterator, $this->excludes) extends FilterIterator implements RecursiveIterator
569-
{
575+
$iterator = new class($iterator, $this->excludes) extends FilterIterator implements RecursiveIterator {
570576
private $excludes;
577+
571578
private $iterator;
572579

573580
public function __construct(RecursiveIterator $iterator, array $excludes)
@@ -605,8 +612,7 @@ public function getChildren()
605612

606613
// mode: find files or dirs
607614
if ($this->mode) {
608-
$iterator = new class ($iterator, $this->mode) extends FilterIterator
609-
{
615+
$iterator = new class($iterator, $this->mode) extends FilterIterator {
610616
private $mode;
611617

612618
public function __construct(Iterator $iterator, int $mode)
@@ -632,9 +638,9 @@ public function accept(): bool
632638
}
633639

634640
if ($this->names || $this->notNames) {
635-
$iterator = new class ($iterator, $this->names, $this->notNames) extends FilterIterator
636-
{
641+
$iterator = new class($iterator, $this->names, $this->notNames) extends FilterIterator {
637642
private $names;
643+
638644
private $notNames;
639645

640646
public function __construct(Iterator $iterator, array $names, array $notNames)
@@ -670,8 +676,7 @@ public function accept(): bool
670676
}
671677

672678
if ($this->filters) {
673-
$iterator = new class ($iterator, $this->filters) extends FilterIterator
674-
{
679+
$iterator = new class($iterator, $this->filters) extends FilterIterator {
675680
private $filters;
676681

677682
public function __construct(Iterator $iterator, array $filters)
@@ -695,9 +700,9 @@ public function accept(): bool
695700
}
696701

697702
if ($this->paths || $this->notPaths) {
698-
$iterator = new class ($iterator, $this->paths, $this->notPaths) extends FilterIterator
699-
{
703+
$iterator = new class($iterator, $this->paths, $this->notPaths) extends FilterIterator {
700704
private $paths;
705+
701706
private $notPaths;
702707

703708
public function __construct(Iterator $iterator, array $paths, array $notPaths)

src/FileSystem.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/**
3-
* Created by sublime 3.
4-
* Auth: Inhere
5-
* Date: 15-1-14
6-
* Time: 10:35
7-
* AbstractFileSystem.php.php
8-
* Uesd: 主要功能是 hi
3+
* This file is part of toolkit/fsutil.
4+
*
5+
* @author https://github.com/inhere
6+
* @link https://github.com/toolkit/fsutil
7+
* @license MIT
98
*/
109

1110
namespace Toolkit\FsUtil;
@@ -320,7 +319,7 @@ public static function pathModeInfo(string $filepath): int
320319

321320
@unlink($test_file);
322321

323-
/* 如果是文件 */
322+
/* 如果是文件 */
324323
} elseif (is_file($filepath)) {
325324
/* 以读方式打开 */
326325
$fp = @fopen($filepath, 'rb');

0 commit comments

Comments
 (0)