astronati/fantasy-football-quotations-parser

该库允许用户从最重要的体育报纸提供的文档中检索引语。引语包含特定锦标赛比赛日每位足球运动员的投票。

3.2.0 2022-08-24 09:59 UTC

README

Build Status Dependency Status Latest Stable Version License

足球幻想引语解析器

提供了一种解析由主要体育报纸提供的文件的方法,这些文件包含在《Serie A》和《FIFA世界杯》锦标赛后每场足球比赛的球员引语。

支持的报纸

目前,"Gazzetta dello Sport" 是唯一支持的报纸。

注意:要将另一家报纸添加到支持列表中,请提供需要解析以更新php包的新文件类型。

为此,请提交一个新的 问题

安装

您可以通过运行 composer 来安装库及其依赖项。

$ composer require astronati/fantasy-football-quotations-parser

用法

该库允许对每个引语(球员、投票等)返回一个模型。

示例

以下代码片段是从 example/sample.php 文件中提取的,并显示了如何解析2017/2018赛季的Excel文件。

// Obtain a QuotationsParser
$quotationsParser = QuotationsParserFactory::create(GazzettaMapSince2017::class);

// Get the quotations, ready to be used
$quotations = $quotationsParser->getQuotations('example/files/2017_quotazioni_gazzetta_02.xls');

支持的格式

查看 Gazzetta 文件夹 以了解哪些格式受支持,以及在 QuotationsParserFactory 中确定要使用的常量。

引语

一个 Quotation 实例允许映射单行并按以下方式返回信息

$quotations[0]->isWithoutVote();
$quotations[0]->getGoalsMagicPoints();

开发

环境需要 phpunit,它已包含在 dev-dependenciescomposer.json 中。

依赖关系

要安装所有模块,只需运行以下命令

$ composer install

测试

测试文件被创建在专门的文件夹中,这些文件夹模拟 src 结构,如下所示

.
+-- src
|   +-- [folder-name]
|   |   +-- [file-name].php
|   ...
+-- tests
|   +-- [folder-name]
|   |   +-- [file-name]Test.php

运行以下命令以运行测试套件

$ composer test

运行以下命令以查看代码覆盖率

$ composer coverage

许可证

此软件包在 MIT许可证 下发布。