Commit c4d630c6 authored by Guillaume Perréal's avatar Guillaume Perréal

Correction du DirectoryFilter.

parent 12c17b21
......@@ -40,7 +40,8 @@
"symfony/finder": "^3.0 | ^4.0",
"symfony/framework-bundle": "^3.0 | ^4.0",
"symfony/http-kernel": "^3.0 | ^4.0",
"symfony/security": "^3.0 | ^4.0"
"symfony/security": "^3.0 | ^4.0",
"webmozart/path-util": "^2.3"
},
"config": {
"sort-packages": true
......
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "494a1c8e105df4c7e4e321f93d67cbc3",
"content-hash": "990dc5b362986aa1165a78bc94e7a8de",
"packages": [
{
"name": "doctrine/annotations",
......@@ -2991,6 +2991,103 @@
"serialize"
],
"time": "2019-06-22T08:39:44+00:00"
},
{
"name": "webmozart/assert",
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/webmozart/assert.git",
"reference": "83e253c8e0be5b0257b881e1827274667c5c17a9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9",
"reference": "83e253c8e0be5b0257b881e1827274667c5c17a9",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0",
"symfony/polyfill-ctype": "^1.8"
},
"require-dev": {
"phpunit/phpunit": "^4.6",
"sebastian/version": "^1.0.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
}
},
"autoload": {
"psr-4": {
"Webmozart\\Assert\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bernhard Schussek",
"email": "bschussek@gmail.com"
}
],
"description": "Assertions to validate method input/output with nice error messages.",
"keywords": [
"assert",
"check",
"validate"
],
"time": "2018-12-25T11:19:39+00:00"
},
{
"name": "webmozart/path-util",
"version": "2.3.0",
"source": {
"type": "git",
"url": "https://github.com/webmozart/path-util.git",
"reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozart/path-util/zipball/d939f7edc24c9a1bb9c0dee5cb05d8e859490725",
"reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"webmozart/assert": "~1.0"
},
"require-dev": {
"phpunit/phpunit": "^4.6",
"sebastian/version": "^1.0.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev"
}
},
"autoload": {
"psr-4": {
"Webmozart\\PathUtil\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bernhard Schussek",
"email": "bschussek@gmail.com"
}
],
"description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.",
"time": "2015-12-17T08:42:14+00:00"
}
],
"packages-dev": [
......@@ -5391,57 +5488,6 @@
"homepage": "https://github.com/theseer/fDOMDocument",
"time": "2017-06-30T11:53:12+00:00"
},
{
"name": "webmozart/assert",
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/webmozart/assert.git",
"reference": "83e253c8e0be5b0257b881e1827274667c5c17a9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9",
"reference": "83e253c8e0be5b0257b881e1827274667c5c17a9",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0",
"symfony/polyfill-ctype": "^1.8"
},
"require-dev": {
"phpunit/phpunit": "^4.6",
"sebastian/version": "^1.0.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
}
},
"autoload": {
"psr-4": {
"Webmozart\\Assert\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bernhard Schussek",
"email": "bschussek@gmail.com"
}
],
"description": "Assertions to validate method input/output with nice error messages.",
"keywords": [
"assert",
"check",
"validate"
],
"time": "2018-12-25T11:19:39+00:00"
},
{
"name": "webmozart/glob",
"version": "4.1.0",
......@@ -5488,52 +5534,6 @@
],
"description": "A PHP implementation of Ant's glob.",
"time": "2015-12-29T11:14:33+00:00"
},
{
"name": "webmozart/path-util",
"version": "2.3.0",
"source": {
"type": "git",
"url": "https://github.com/webmozart/path-util.git",
"reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozart/path-util/zipball/d939f7edc24c9a1bb9c0dee5cb05d8e859490725",
"reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"webmozart/assert": "~1.0"
},
"require-dev": {
"phpunit/phpunit": "^4.6",
"sebastian/version": "^1.0.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev"
}
},
"autoload": {
"psr-4": {
"Webmozart\\PathUtil\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bernhard Schussek",
"email": "bschussek@gmail.com"
}
],
"description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.",
"time": "2015-12-17T08:42:14+00:00"
}
],
"aliases": [],
......
......@@ -42,12 +42,16 @@ class ClassFinder implements FinderInterface
*/
private $classes = null;
public function __construct($directories)
/**
* ClassFinder constructor.
* @param string[] $directories
*/
public function __construct(array $directories)
{
$this->directories = $directories;
}
private function initialize()
private function initialize(): void
{
$files = Finder::create()
->in($this->directories)
......@@ -75,6 +79,9 @@ class ClassFinder implements FinderInterface
}
}
/**
* @return ArrayIterator|\Traversable
*/
public function getIterator()
{
if ($this->classes === null) {
......@@ -84,6 +91,9 @@ class ClassFinder implements FinderInterface
return new ArrayIterator($this->classes);
}
/**
* @param array $conf
*/
public function toConfig(array &$conf)
{
$conf['type'] = 'classes';
......
......@@ -21,6 +21,7 @@
namespace Irstea\PlantUmlBundle\Model\Filter;
use ReflectionClass;
use Webmozart\PathUtil\Path;
/**
* Description of DirectoryFilter.
......@@ -41,7 +42,7 @@ class DirectoryFilter extends AbstractListFilter
if ($filename === false) {
return '';
}
return dirname($class->getFileName());
return Path::getDirectory($filename);
}
/**
......@@ -51,6 +52,7 @@ class DirectoryFilter extends AbstractListFilter
*/
protected function matches($tested, $reference): bool
{
dump(compact('tested', 'reference'));
return strpos($tested, $reference) === 0;
}
......@@ -60,6 +62,6 @@ class DirectoryFilter extends AbstractListFilter
*/
protected function normalize($path): string
{
return rtrim(strtr($path, '/\\', DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
return Path::canonicalize($path) . \DIRECTORY_SEPARATOR;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment