summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorignace nyamagana butera <nyamsprod@gmail.com>2015-12-03 10:32:15 +0100
committerignace nyamagana butera <nyamsprod@gmail.com>2015-12-03 10:33:22 +0100
commit6baf1f3dbc08275fd4ffe273511ca790360d1754 (patch)
treee055a28953557643336db6bee21ec78c2ee20e53
parentb2cf4d455926e895f470bea7c2fae2fe56b6b37a (diff)
downloadcsv-6baf1f3dbc08275fd4ffe273511ca790360d1754.zip
csv-6baf1f3dbc08275fd4ffe273511ca790360d1754.tar.gz
csv-6baf1f3dbc08275fd4ffe273511ca790360d1754.tar.bz2
Improve Library settings
-rw-r--r--.scrutinizer.yml5
-rw-r--r--.travis.yml11
-rw-r--r--composer.json2
-rw-r--r--src/Config/Output.php21
4 files changed, 14 insertions, 25 deletions
diff --git a/.scrutinizer.yml b/.scrutinizer.yml
index 01a2bf7..46255e4 100644
--- a/.scrutinizer.yml
+++ b/.scrutinizer.yml
@@ -1,6 +1,6 @@
filter:
paths: [src/*]
- excluded_paths: [examples/*, test/*]
+ excluded_paths: [examples, test]
checks:
php:
code_rating: true
@@ -19,5 +19,4 @@ checks:
fix_doc_comments: true
tools:
external_code_coverage:
- timeout: 1200
- runs: 3 \ No newline at end of file
+ timeout: 1200 \ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index 6e9b27c..8b2d2c4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,16 +5,10 @@ sudo: false
matrix:
include:
- php: 5.5
- env:
- - COLLECT_COVERAGE=true
- php: 5.6
- env:
- - COLLECT_COVERAGE=true
- php: 7.0
- env:
- - COLLECT_COVERAGE=true
+ env: COLLECT_COVERAGE=true
- php: hhvm
- fast_finish: true
cache:
directories:
@@ -31,5 +25,4 @@ script:
- composer test
after_script:
- - if [ "$COLLECT_COVERAGE" == "true" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- - if [ "$COLLECT_COVERAGE" == "true" ]; then php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml; fi
+ - if [ "$COLLECT_COVERAGE" == "true" ]; then wget https://scrutinizer-ci.com/ocular.phar; && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml; fi
diff --git a/composer.json b/composer.json
index 90aecb8..5da207e 100644
--- a/composer.json
+++ b/composer.json
@@ -37,7 +37,7 @@
}
},
"scripts": {
- "test": "phpunit; php-cs-fixer fix -v --diff --dry-run;"
+ "test": "phpunit --coverage-text; php-cs-fixer fix -v --diff --dry-run;"
},
"extra": {
"branch-alias": {
diff --git a/src/Config/Output.php b/src/Config/Output.php
index 8ae235e..cab87da 100644
--- a/src/Config/Output.php
+++ b/src/Config/Output.php
@@ -196,9 +196,7 @@ trait Output
}
/**
- * JsonSerializable Interface
- *
- * @return array
+ * @inheritdoc
*/
public function jsonSerialize()
{
@@ -239,14 +237,14 @@ trait Output
/**
* Returns a HTML table representation of the CSV Table
*
- * @param string $class_name optional classname
+ * @param string $class_attr optional classname
*
* @return string
*/
- public function toHTML($class_name = 'table-csv-data')
+ public function toHTML($class_attr = 'table-csv-data')
{
$doc = $this->toXML('table', 'tr', 'td');
- $doc->documentElement->setAttribute('class', $class_name);
+ $doc->documentElement->setAttribute('class', $class_attr);
return $doc->saveHTML($doc->documentElement);
}
@@ -264,16 +262,15 @@ trait Output
{
$doc = new DomDocument('1.0', 'UTF-8');
$root = $doc->createElement($root_name);
- $iterator = $this->convertToUtf8($this->getQueryIterator());
- foreach ($iterator as $row) {
- $item = $doc->createElement($row_name);
- array_walk($row, function ($value) use (&$item, $doc, $cell_name) {
+ foreach ($this->convertToUtf8($this->getQueryIterator()) as $row) {
+ $row = $doc->createElement($row_name);
+ array_walk($row, function ($value) use (&$row, $doc, $cell_name) {
$content = $doc->createTextNode($value);
$cell = $doc->createElement($cell_name);
$cell->appendChild($content);
- $item->appendChild($cell);
+ $row->appendChild($cell);
});
- $root->appendChild($item);
+ $root->appendChild($row);
}
$doc->appendChild($root);