for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Ddeboer\DataImport\Writer;
use Ddeboer\DataImport\Writer;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Helper\Table;
/**
* @author Igor Mukhin <[email protected]>
*/
class ConsoleTableWriter implements Writer
{
use WriterTemplate;
* @var OutputInterface
private $output;
* @var Table
private $table;
* @var array
private $firstItem;
* @param OutputInterface $output
* @param Table $table
public function __construct(OutputInterface $output, Table $table) {
$this->output = $output;
$this->table = $table;
}
* {@inheritdoc}
public function writeItem(array $item) {
// Save first item to get keys to display at header
if (is_null($this->firstItem)) {
$this->firstItem = $item;
$this->table->addRow($item);
public function finish() {
$this->table->setHeaders(array_keys($this->firstItem));
$this->table->render();
$this->firstItem = null;
null
array
$firstItem
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..
* @return Table
public function getTable()
return $this->table;
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..