From f6dab7f94d998365853045916f6f2b0f4e4e1c54 Mon Sep 17 00:00:00 2001 From: inhere Date: Mon, 30 Apr 2018 12:18:39 +0800 Subject: [PATCH] update file-utils namespace --- composer.json | 2 +- example/dir-watcher.php | 2 +- example/file-finder.php | 2 +- src/Directory.php | 8 ++++---- src/Exception/FileNotFoundException.php | 4 ++-- src/Exception/FileReadException.php | 4 ++-- src/Exception/FileSystemException.php | 4 ++-- src/Exception/IOException.php | 4 ++-- src/File.php | 12 ++++++------ src/FileFinder.php | 4 ++-- src/FileSystem.php | 8 ++++---- src/ModifyWatcher.php | 2 +- src/ReadTrait.php | 16 ++++++++-------- test/boot.php | 12 ++++++------ 14 files changed, 42 insertions(+), 42 deletions(-) diff --git a/composer.json b/composer.json index 41cddde..b0489f1 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ }, "autoload": { "psr-4": { - "Toolkit\\FileUtil\\" : "src/" + "Toolkit\\File\\" : "src/" } }, "suggest": { diff --git a/example/dir-watcher.php b/example/dir-watcher.php index 8e3d0be..ff37040 100644 --- a/example/dir-watcher.php +++ b/example/dir-watcher.php @@ -8,7 +8,7 @@ require dirname(__DIR__) . '/test/boot.php'; -$mw = new \Toolkit\FileUtil\ModifyWatcher(); +$mw = new \Toolkit\File\ModifyWatcher(); $ret = $mw // ->setIdFile(__DIR__ . '/tmp/dir.id') ->watch(dirname(__DIR__)) diff --git a/example/file-finder.php b/example/file-finder.php index ab58e44..0e519ef 100644 --- a/example/file-finder.php +++ b/example/file-finder.php @@ -11,7 +11,7 @@ // var_dump(fnmatch('.*', ".gitkeep"));die; // var_dump(glob(__DIR__ . '/{t,T}ests', GLOB_BRACE | GLOB_ONLYDIR)); -$finder = \Toolkit\FileUtil\FileFinder::create() +$finder = \Toolkit\File\FileFinder::create() ->files() ->name('*.php') // ->ignoreVCS(false) diff --git a/src/Directory.php b/src/Directory.php index 357424b..d2312dd 100644 --- a/src/Directory.php +++ b/src/Directory.php @@ -7,15 +7,15 @@ * Uesd: 主要功能是 hi */ -namespace Toolkit\FileUtil; +namespace Toolkit\File; use DirectoryIterator; -use Toolkit\FileUtil\Exception\FileSystemException; -use Toolkit\FileUtil\Exception\FileNotFoundException; +use Toolkit\File\Exception\FileSystemException; +use Toolkit\File\Exception\FileNotFoundException; /** * Class Directory - * @package Toolkit\FileUtil + * @package Toolkit\File */ class Directory extends FileSystem { diff --git a/src/Exception/FileNotFoundException.php b/src/Exception/FileNotFoundException.php index b085ad2..3d0d87e 100644 --- a/src/Exception/FileNotFoundException.php +++ b/src/Exception/FileNotFoundException.php @@ -6,11 +6,11 @@ * Time: 22:58 */ -namespace Toolkit\FileUtil\Exception; +namespace Toolkit\File\Exception; /** * Class FileNotFoundException - * @package Toolkit\FileUtil\Exception + * @package Toolkit\File\Exception */ class FileNotFoundException extends \Exception { diff --git a/src/Exception/FileReadException.php b/src/Exception/FileReadException.php index e58b7d0..d474bfe 100644 --- a/src/Exception/FileReadException.php +++ b/src/Exception/FileReadException.php @@ -6,11 +6,11 @@ * Time: 23:03 */ -namespace Toolkit\FileUtil\Exception; +namespace Toolkit\File\Exception; /** * Class FileReadException - * @package Toolkit\FileUtil\Exception + * @package Toolkit\File\Exception */ class FileReadException extends FileSystemException { diff --git a/src/Exception/FileSystemException.php b/src/Exception/FileSystemException.php index 6e46948..0de2af6 100644 --- a/src/Exception/FileSystemException.php +++ b/src/Exception/FileSystemException.php @@ -6,11 +6,11 @@ * Time: 22:58 */ -namespace Toolkit\FileUtil\Exception; +namespace Toolkit\File\Exception; /** * Class FileSystemException - * @package Toolkit\FileUtil\Exception + * @package Toolkit\File\Exception */ class FileSystemException extends \Exception { diff --git a/src/Exception/IOException.php b/src/Exception/IOException.php index 52cabf8..1063424 100644 --- a/src/Exception/IOException.php +++ b/src/Exception/IOException.php @@ -6,11 +6,11 @@ * Time: 23:04 */ -namespace Toolkit\FileUtil\Exception; +namespace Toolkit\File\Exception; /** * Class IOException - * @package Toolkit\FileUtil\Exception + * @package Toolkit\File\Exception */ class IOException extends FileSystemException { diff --git a/src/File.php b/src/File.php index 2850828..bb6aba1 100644 --- a/src/File.php +++ b/src/File.php @@ -8,16 +8,16 @@ * Uesd: 主要功能是 文件相关信息获取 */ -namespace Toolkit\FileUtil; +namespace Toolkit\File; -use Toolkit\FileUtil\Exception\FileNotFoundException; -use Toolkit\FileUtil\Exception\FileReadException; -use Toolkit\FileUtil\Exception\FileSystemException; -use Toolkit\FileUtil\Exception\IOException; +use Toolkit\File\Exception\FileNotFoundException; +use Toolkit\File\Exception\FileReadException; +use Toolkit\File\Exception\FileSystemException; +use Toolkit\File\Exception\IOException; /** * Class File - * @package Toolkit\FileUtil + * @package Toolkit\File */ abstract class File extends FileSystem { diff --git a/src/FileFinder.php b/src/FileFinder.php index 4aaf383..ee59628 100644 --- a/src/FileFinder.php +++ b/src/FileFinder.php @@ -6,7 +6,7 @@ * Time: 21:57 */ -namespace Toolkit\FileUtil; +namespace Toolkit\File; /** * Class FileFinder @@ -23,7 +23,7 @@ * // something ...... * } * ``` - * @package Toolkit\FileUtil + * @package Toolkit\File * @ref \Symfony\Component\Finder\Finder */ final class FileFinder implements \IteratorAggregate, \Countable diff --git a/src/FileSystem.php b/src/FileSystem.php index 160524f..524f013 100644 --- a/src/FileSystem.php +++ b/src/FileSystem.php @@ -8,15 +8,15 @@ * Uesd: 主要功能是 hi */ -namespace Toolkit\FileUtil; +namespace Toolkit\File; -use Toolkit\FileUtil\Exception\IOException; -use Toolkit\FileUtil\Exception\FileNotFoundException; +use Toolkit\File\Exception\IOException; +use Toolkit\File\Exception\FileNotFoundException; use Toolkit\ArrUtil\Arr; /** * Class FileSystem - * @package Toolkit\FileUtil + * @package Toolkit\File */ abstract class FileSystem { diff --git a/src/ModifyWatcher.php b/src/ModifyWatcher.php index 10220e8..1938d1c 100644 --- a/src/ModifyWatcher.php +++ b/src/ModifyWatcher.php @@ -6,7 +6,7 @@ * Time: 20:56 */ -namespace Toolkit\FileUtil; +namespace Toolkit\File; use Inhere\Library\Helpers\Sys; diff --git a/src/ReadTrait.php b/src/ReadTrait.php index fa48747..8f048be 100644 --- a/src/ReadTrait.php +++ b/src/ReadTrait.php @@ -7,18 +7,18 @@ * Time: 10:35 */ -namespace Toolkit\FileUtil; +namespace Toolkit\File; -use Toolkit\FileUtil\Exception\FileNotFoundException; -use Toolkit\FileUtil\Exception\FileSystemException; -use Toolkit\FileUtil\Exception\FileReadException; -use Toolkit\FileUtil\Parsers\IniParser; -use Toolkit\FileUtil\Parsers\JsonParser; -use Toolkit\FileUtil\Parsers\YmlParser; +use Toolkit\File\Exception\FileNotFoundException; +use Toolkit\File\Exception\FileSystemException; +use Toolkit\File\Exception\FileReadException; +use Toolkit\File\Parsers\IniParser; +use Toolkit\File\Parsers\JsonParser; +use Toolkit\File\Parsers\YmlParser; /** * Class Read - * @package Toolkit\FileUtil + * @package Toolkit\File */ trait ReadTrait { diff --git a/test/boot.php b/test/boot.php index b34f0e5..cd62e85 100644 --- a/test/boot.php +++ b/test/boot.php @@ -10,14 +10,14 @@ spl_autoload_register(function ($class) { $file = null; - if (0 === strpos($class,'Toolkit\FileUtil\Example\\')) { - $path = str_replace('\\', '/', substr($class, strlen('Toolkit\FileUtil\Example\\'))); + if (0 === strpos($class,'Toolkit\File\Example\\')) { + $path = str_replace('\\', '/', substr($class, strlen('Toolkit\File\Example\\'))); $file = dirname(__DIR__) . "/example/{$path}.php"; - } elseif (0 === strpos($class,'Toolkit\FileUtil\Test\\')) { - $path = str_replace('\\', '/', substr($class, strlen('Toolkit\FileUtil\Test\\'))); + } elseif (0 === strpos($class,'Toolkit\File\Test\\')) { + $path = str_replace('\\', '/', substr($class, strlen('Toolkit\File\Test\\'))); $file = __DIR__ . "/{$path}.php"; - } elseif (0 === strpos($class,'Toolkit\FileUtil\\')) { - $path = str_replace('\\', '/', substr($class, strlen('Toolkit\FileUtil\\'))); + } elseif (0 === strpos($class,'Toolkit\File\\')) { + $path = str_replace('\\', '/', substr($class, strlen('Toolkit\File\\'))); $file = dirname(__DIR__) . "/src/{$path}.php"; }