Skip to content

Commit 5d2be82

Browse files
committed
Replace file/folder manipulation with Flysystem library
1 parent b164263 commit 5d2be82

File tree

5 files changed

+11
-22
lines changed

5 files changed

+11
-22
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Removed
1515

16+
## [3.10.0] - Sunday, 23 June 2019
17+
### Added
18+
- `--verbose` flag to show exception encountered when making response call.
19+
1620
## [3.9.0] - Saturday, 8 June 2019
1721
### Modified
1822
- Postman collections and URLs in example requests now use the `apidoc.base_url` config variable (https://github.com/mpociot/laravel-apidoc-generator/pull/523)

TODO.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
- Replace filesystem manipulation with lib
2-
31
Major
42
- Bring `bindings` outside of `response_calls`
53
- Should `routes.*.apply.response_calls.headers` be replaced by `routes.*.apply.headers`?

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"mpociot/documentarian": "^0.2.0",
2424
"mpociot/reflection-docblock": "^1.0.1",
2525
"ramsey/uuid": "^3.8",
26-
"nunomaduro/collision": "^3.0"
26+
"nunomaduro/collision": "^3.0",
27+
"league/flysystem": "^1.0"
2728
},
2829
"require-dev": {
2930
"orchestra/testbench": "3.5.* || 3.6.* || 3.7.*",

src/Tools/Utils.php

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44

55
use Illuminate\Support\Str;
66
use Illuminate\Routing\Route;
7-
use League\Flysystem\Adapter\Local;
87
use League\Flysystem\Filesystem;
9-
use RecursiveDirectoryIterator;
10-
use RecursiveIteratorIterator;
8+
use League\Flysystem\Adapter\Local;
119

1210
class Utils
1311
{
@@ -70,20 +68,8 @@ public static function replaceUrlParameterBindings(string $uri, array $bindings)
7068

7169
public static function deleteDirectoryAndContents($dir)
7270
{
73-
if (is_dir($dir)) {
74-
$files = new RecursiveIteratorIterator(
75-
new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS),
76-
RecursiveIteratorIterator::CHILD_FIRST
77-
);
78-
79-
foreach ($files as $fileinfo) {
80-
$todo = ($fileinfo->isDir() ? 'rmdir' : 'unlink');
81-
$todo($fileinfo->getRealPath());
82-
}
83-
rmdir($dir);
84-
}
85-
/*
86-
$adapter = new Local(__DIR__.'../../');
87-
$filesystem = new Filesystem($adapter);*/
71+
$adapter = new Local(realpath(__DIR__."/../../"));
72+
$fs = new Filesystem($adapter);
73+
$fs->deleteDir($dir);
8874
}
8975
}

tests/GenerateDocumentationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function setUp()
3131

3232
public function tearDown()
3333
{
34-
Utils::deleteDirectoryAndContents(__DIR__.'/../public/docs');
34+
Utils::deleteDirectoryAndContents('/public/docs');
3535
}
3636

3737
/**

0 commit comments

Comments
 (0)