-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path04-sample-phpdoc-layout-using-glob.php
36 lines (32 loc) · 1.22 KB
/
04-sample-phpdoc-layout-using-glob.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
require_once(__DIR__ . '/../vendor/autoload.php');
use Flyfinder\Specification\Glob;
use League\Flysystem\Filesystem;
use League\Flysystem\Local\LocalFilesystemAdapter as Local;
use Flyfinder\Finder;
use Flyfinder\Path;
use Flyfinder\Specification\IsHidden;
use Flyfinder\Specification\HasExtension;
use Flyfinder\Specification\InPath;
use Flyfinder\Specification\AndSpecification;
// (03-sample-files based on some phpDocumentor2 src files)
$filesystem = new Filesystem(new Local(__DIR__ . '/03-sample-files'));
$finder = new Finder();
$finder->setFilesystem($filesystem);
/*
* "phpdoc -d src -i src/phpDocumentor/DomainModel"
* should result in src/Cilex and src/phpDocumentor/. files being found,
* but src/phpDocumentor/DomainModel files being left out
*/
$dashDirectoryPath = new Glob('/src/**/*');
$dashIgnorePath = new InPath(new Path('src/phpDocumentor/DomainModel'));
$isHidden = new IsHidden();
$isPhpFile = new HasExtension(['php']);
$spec = new AndSpecification($dashDirectoryPath, $dashIgnorePath->notSpecification());
$spec->andSpecification($isHidden->notSpecification());
$spec->andSpecification($isPhpFile);
$generator = $finder->find($spec);
$result = [];
foreach($generator as $value) {
$result[] = $value;
}