Skip to content
This repository has been archived by the owner on Jun 17, 2020. It is now read-only.

Commit

Permalink
update file-utils namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Apr 30, 2018
1 parent b268990 commit f6dab7f
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"autoload": {
"psr-4": {
"Toolkit\\FileUtil\\" : "src/"
"Toolkit\\File\\" : "src/"
}
},
"suggest": {
Expand Down
2 changes: 1 addition & 1 deletion example/dir-watcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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__))
Expand Down
2 changes: 1 addition & 1 deletion example/file-finder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions src/Directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 2 additions & 2 deletions src/Exception/FileNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 2 additions & 2 deletions src/Exception/FileReadException.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 2 additions & 2 deletions src/Exception/FileSystemException.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 2 additions & 2 deletions src/Exception/IOException.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
12 changes: 6 additions & 6 deletions src/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 2 additions & 2 deletions src/FileFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Time: 21:57
*/

namespace Toolkit\FileUtil;
namespace Toolkit\File;

/**
* Class FileFinder
Expand All @@ -23,7 +23,7 @@
* // something ......
* }
* ```
* @package Toolkit\FileUtil
* @package Toolkit\File
* @ref \Symfony\Component\Finder\Finder
*/
final class FileFinder implements \IteratorAggregate, \Countable
Expand Down
8 changes: 4 additions & 4 deletions src/FileSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion src/ModifyWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Time: 20:56
*/

namespace Toolkit\FileUtil;
namespace Toolkit\File;

use Inhere\Library\Helpers\Sys;

Expand Down
16 changes: 8 additions & 8 deletions src/ReadTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
12 changes: 6 additions & 6 deletions test/boot.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

Expand Down

0 comments on commit f6dab7f

Please sign in to comment.