summaryrefslogtreecommitdiffstats
path: root/src/Config
diff options
context:
space:
mode:
Diffstat (limited to 'src/Config')
-rw-r--r--src/Config/Controls.php45
-rw-r--r--src/Config/Output.php32
2 files changed, 21 insertions, 56 deletions
diff --git a/src/Config/Controls.php b/src/Config/Controls.php
index b54d74f..195af6f 100644
--- a/src/Config/Controls.php
+++ b/src/Config/Controls.php
@@ -48,13 +48,6 @@ trait Controls
protected $escape = '\\';
/**
- * the SplFileObject flags holder
- *
- * @var int
- */
- protected $flags;
-
- /**
* newline character
*
* @var string
@@ -133,6 +126,11 @@ trait Controls
}
/**
+ * @inheritdoc
+ */
+ abstract protected function filterInteger($int, $minValue, $errorMessage);
+
+ /**
* Returns the CSV Iterator
*
* @return SplFileObject
@@ -198,39 +196,6 @@ trait Controls
}
/**
- * Sets the Flags associated to the CSV SplFileObject
- *
- * @param int $flags
- *
- * @throws InvalidArgumentException If the argument is not a valid integer
- *
- * @return $this
- */
- public function setFlags($flags)
- {
- $flags = $this->filterInteger($flags, 0, 'you should use a `SplFileObject` Constant');
- $this->flags = $flags | SplFileObject::READ_CSV;
-
- return $this;
- }
-
- /**
- * @inheritdoc
- */
- abstract protected function filterInteger($int, $minValue, $errorMessage);
-
- /**
- * Returns the file Flags
- *
- * @return int
- */
- public function getFlags()
- {
- return $this->flags;
- }
-
-
- /**
* Sets the newline sequence characters
*
* @param string $newline
diff --git a/src/Config/Output.php b/src/Config/Output.php
index 306d3e4..fc0e13a 100644
--- a/src/Config/Output.php
+++ b/src/Config/Output.php
@@ -47,20 +47,6 @@ trait Output
protected $output_bom;
/**
- * Returns the CSV Iterator
- *
- * @return Iterator
- */
- abstract protected function getConversionIterator();
-
- /**
- * Returns the CSV Iterator
- *
- * @return Iterator
- */
- abstract public function getIterator();
-
- /**
* Sets the CSV encoding charset
*
* @param string $str
@@ -146,6 +132,13 @@ trait Output
}
/**
+ * Returns the CSV Iterator
+ *
+ * @return Iterator
+ */
+ abstract public function getIterator();
+
+ /**
* Outputs all data on the CSV file
*
* @param string $filename CSV downloaded name if present adds extra headers
@@ -210,10 +203,17 @@ trait Output
*/
public function jsonSerialize()
{
- return iterator_to_array($this->convertToUtf8($this->getConversionIterator()), false);
+ return iterator_to_array($this->convertToUtf8($this->getCsvIterator()), false);
}
/**
+ * Returns the CSV Iterator
+ *
+ * @return Iterator
+ */
+ abstract protected function getCsvIterator();
+
+ /**
* Convert Csv file into UTF-8
*
* @param Iterator $iterator
@@ -265,7 +265,7 @@ trait Output
{
$doc = new DomDocument('1.0', 'UTF-8');
$root = $doc->createElement($root_name);
- $iterator = $this->convertToUtf8($this->getConversionIterator());
+ $iterator = $this->convertToUtf8($this->getCsvIterator());
foreach ($iterator as $row) {
$item = $doc->createElement($row_name);
array_walk($row, function ($value) use (&$item, $doc, $cell_name) {