Skip to content

Commit

Permalink
Merge pull request #14 from byjg/5.0.0
Browse files Browse the repository at this point in the history
Documentation Change
  • Loading branch information
byjg authored Jan 3, 2024
2 parents 9623098 + dcdc122 commit aee3d9e
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 40 deletions.
22 changes: 9 additions & 13 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ on:
pull_request:
branches:
- master
schedule:
- cron: "0 8 * * 1"

jobs:
Build:
Expand All @@ -18,25 +16,23 @@ jobs:
strategy:
matrix:
php-version:
- "8.2"
- "8.1"
- "8.0"
- "7.4"
- "7.3"
- "7.2"
- "7.1"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- run: composer install
- run: ./vendor/bin/phpunit
- run: ./vendor/bin/psalm

Documentation:
runs-on: 'ubuntu-latest'
needs: Build
if: github.ref == 'refs/heads/master'
env:
DOC_GITHUB_TOKEN: '${{ secrets.DOC_TOKEN }}'
steps:
- uses: actions/checkout@v2
- run: curl https://opensource.byjg.com/add-doc.sh | bash /dev/stdin php anydataset
needs: Build
uses: byjg/byjg.github.io/.github/workflows/add-doc.yaml@master
with:
folder: php
project: ${{ github.event.repository.name }}
secrets: inherit

50 changes: 26 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# AnyDataset

[![Opensource ByJG](https://img.shields.io/badge/opensource-byjg-success.svg)](http://opensource.byjg.com)
[![Build Status](https://github.com/byjg/anydataset/actions/workflows/phpunit.yml/badge.svg?branch=master)](https://github.com/byjg/anydataset/actions/workflows/phpunit.yml)
[![Build Status](https://github.com/byjg/php-anydataset/actions/workflows/phpunit.yml/badge.svg?branch=master)](https://github.com/byjg/php-anydataset/actions/workflows/phpunit.yml)
[![Opensource ByJG](https://img.shields.io/badge/opensource-byjg-success.svg)](http://opensource.byjg.com)
[![GitHub source](https://img.shields.io/badge/Github-source-informational?logo=github)](https://github.com/byjg/anydataset/)
[![GitHub source](https://img.shields.io/badge/Github-source-informational?logo=github)](https://github.com/byjg/php-anydataset/)
[![GitHub license](https://img.shields.io/github/license/byjg/anydataset.svg)](https://opensource.byjg.com/opensource/licensing.html)
[![GitHub release](https://img.shields.io/github/release/byjg/anydataset.svg)](https://github.com/byjg/anydataset/releases/)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/byjg/anydataset/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/byjg/anydataset/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/byjg/anydataset/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/byjg/anydataset/?branch=master)
[![GitHub release](https://img.shields.io/github/release/byjg/anydataset.svg)](https://github.com/byjg/php-anydataset/releases/)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/byjg/php-anydataset/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/byjg/php-anydataset/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/byjg/php-anydataset/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/byjg/php-anydataset/?branch=master)

Anydataset Core Module. Anydataset is an agnostic data source abstraction layer in PHP.

Expand All @@ -21,18 +21,18 @@ Anydataset Core Module. Anydataset is an agnostic data source abstraction layer

{:.table}

| Object | Data Source | Read | Write | Reference |
| ---------------------- | --------------------- |:----:|:-----:| ----------------------- |
| DbDriverInterface | Relational DB | yes | yes | [Github](https://github.com/byjg/anydataset-db) |
| AnyDataSet | Anydataset | yes | yes | [Github](https://github.com/byjg/anydataset) |
| ArrayDataSet | Array | yes | no | [Github](https://github.com/byjg/anydataset-array) |
| TextFileDataSet | Delimited Fields | yes | no | [Github](https://github.com/byjg/anydataset-text) |
| FixedTextFileDataSet | Fixed Size fields | yes | no | [Github](https://github.com/byjg/anydataset-text) |
| XmlDataSet | Xml | yes | no | [Github](https://github.com/byjg/anydataset-xml) |
| JSONDataSet | Json | yes | no | [Github](https://github.com/byjg/anydataset-json) |
| SparQLDataSet | SparQl Repositories | yes | no | [Github](https://github.com/byjg/anydataset-sparql) |
| NoSqlDocumentInterface | NoSql Document Based | yes | yes | [Github](https://github.com/byjg/anydataset-nosql) |
| KeyValueInterface | NoSql Key/Value Based | yes | yes | [Github](https://github.com/byjg/anydataset-nosql) |
| Object | Data Source | Read | Write | Reference |
|------------------------|-----------------------|:----:|:-----:|-----------------------------------------------------|
| DbDriverInterface | Relational DB | yes | yes | [Github](https://github.com/byjg/anydataset-db) |
| AnyDataSet | Anydataset | yes | yes | [Github](https://github.com/byjg/anydataset) |
| ArrayDataSet | Array | yes | no | [Github](https://github.com/byjg/anydataset-array) |
| TextFileDataSet | Delimited Fields | yes | no | [Github](https://github.com/byjg/anydataset-text) |
| FixedTextFileDataSet | Fixed Size fields | yes | no | [Github](https://github.com/byjg/anydataset-text) |
| XmlDataSet | Xml | yes | no | [Github](https://github.com/byjg/anydataset-xml) |
| JSONDataSet | Json | yes | no | [Github](https://github.com/byjg/anydataset-json) |
| SparQLDataSet | SparQl Repositories | yes | no | [Github](https://github.com/byjg/anydataset-sparql) |
| NoSqlDocumentInterface | NoSql Document Based | yes | yes | [Github](https://github.com/byjg/anydataset-nosql) |
| KeyValueInterface | NoSql Key/Value Based | yes | yes | [Github](https://github.com/byjg/anydataset-nosql) |

## Examples

Expand Down Expand Up @@ -72,7 +72,7 @@ print_r($iterator->toArray());
$iterator = $dataset->getIterator();
while ($iterator->hasNext()) {
$row = $iterator->moveNext();

print_r($row->get("field1"));
}
```
Expand All @@ -97,7 +97,7 @@ $output = RowOutput::getInstance()
->addFormat("field1", "Test {field1}")
->addFormat("field2", "Showing {} and {field3}");
->addCustomFormat("field3", function ($row, $field, $value) {
// return the formatted output.
// return the formatted output.
// $row: The row object with all values
// $field: The field has been processed
// $value: The field value
Expand Down Expand Up @@ -126,10 +126,10 @@ $validator = RowValidator::getInstance()
->regexValidation("field4", '/\d{4}-\d{2}-\d{2}/')
->customValidation("field3", function($value) {
// Return any string containing the error message if validation FAILS
// otherwise, just return null and the valition will pass.
// otherwise, just return null and the valition will pass.
});

$validator->validate($row) // Will return an array with the error messages. Empty array if not errors.
$validator->validate($row) // Will return an array with the error messages. Empty array if not errors.
```

## Formatters
Expand All @@ -139,7 +139,7 @@ AnyDataset comes with an extensible set to format the AnyDataset. The interface
```php
namespace ByJG\AnyDataset\Core\Formatter;

interface FormatterInterface
interface FormatterInterface
{
/**
* Return the object in your original format, normally as object
Expand Down Expand Up @@ -177,12 +177,14 @@ Example:
$formatter = new XmlFormatter($anydataset->getIterator());
$formatter->raw(); // Return a DOM object
$formatter->toText(); // Return the XML as a text
$formatter->saveToFile("/path/to/file.xml"); // Save the XML Text to a file.
$formatter->saveToFile("/path/to/file.xml"); // Save the XML Text to a file.
```

## Install

Just type: `composer require "byjg/anydataset=4.1.*"`
```bash
composer require "byjg/anydataset"
```

## Running Unit tests

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
"prefer-stable": true,
"minimum-stability": "dev",
"require": {
"php": ">=5.6.0",
"php": ">=7.4",
"byjg/xmlutil": "4.9.*",
"byjg/serializer": "4.9.*"
},
"suggest": {
"ext-dom": "*"
},
"require-dev": {
"phpunit/phpunit": "5.7.*|7.4.*|^9.5",
"phpunit/phpunit": "^9.6",
"vimeo/psalm": "^4.24"
},
"license": "MIT"
Expand Down
2 changes: 1 addition & 1 deletion src/IteratorFilterFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ abstract public function getRelation($name, $relation, $value, &$param);
abstract public function format($filters, $tableName = null, &$params = [], $returnFields = "*");

/**
* Get Filter
* Get Filter
*
* @param array $filters
* @param array $param
Expand Down

0 comments on commit aee3d9e

Please sign in to comment.