-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switch from internal api v3 to v5 with a lite analyser:run command wi…
…th only source path (no more json config file required)
- Loading branch information
Showing
9 changed files
with
78 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* Collect and analyse metrics of parsing results. | ||
* | ||
* PHP version 7 | ||
* | ||
* @category PHP | ||
* @package PHP_CompatInfo | ||
* @author Laurent Laville <[email protected]> | ||
* @license https://opensource.org/licenses/BSD-3-Clause The 3-Clause BSD License | ||
*/ | ||
|
||
namespace Bartlett\CompatInfo\Api\V5; | ||
|
||
use Bartlett\CompatInfo\Analyser\CompatibilityAnalyser; | ||
use Bartlett\Reflect; | ||
|
||
use RuntimeException; | ||
|
||
/** | ||
* Collect and analyse metrics of parsing results. | ||
* | ||
* @category PHP | ||
* @package PHP_CompatInfo | ||
* @author Laurent Laville <[email protected]> | ||
* @license https://opensource.org/licenses/BSD-3-Clause The 3-Clause BSD License | ||
* @since Class available since Release 5.4.0 | ||
*/ | ||
class Analyser extends Reflect\Api\V3\Common | ||
{ | ||
/** | ||
* Analyse a data source and display results. | ||
* | ||
* @param string $source Path to the data source or its alias | ||
* | ||
* @return array metrics | ||
*/ | ||
public function run(string $source) | ||
{ | ||
$finder = $this->findProvider($source, false); | ||
|
||
if ($finder === false) { | ||
throw new RuntimeException( | ||
'None data source matching' | ||
); | ||
} | ||
|
||
$parser = new Parser(); | ||
$parser->setEventDispatcher($this->eventDispatcher); | ||
$parser->setDataSourceId($this->dataSourceId); | ||
|
||
$parser->addAnalyser(new CompatibilityAnalyser()); | ||
|
||
return $parser->parse($finder); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/Bartlett/CompatInfo/Api/V3/Parser.php → src/Bartlett/CompatInfo/Api/V5/Parser.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters