Piwik\DataTable\Row::addColumn PHP Méthode

addColumn() public méthode

Add a new column to the row. If the column already exists, throws an exception.
public addColumn ( string $name, mixed $value )
$name string name of the column to add.
$value mixed value of the column to set or a PHP callable.
    public function addColumn($name, $value)
    {
        if (isset($this[$name])) {
            throw new Exception("Column {$name} already in the array!");
        }
        $this->setColumn($name, $value);
    }

Usage Example

Exemple #1
0
 public function test_getColumn_shouldPassRowToCallable()
 {
     $callbackRow = null;
     $this->row->addColumn('testClosure', function (Row $row) use(&$callbackRow) {
         $callbackRow = $row;
         return $row;
     });
     $returnedRow = $this->row->getColumn('testClosure');
     $this->assertNotEmpty($callbackRow);
     $this->assertSame($returnedRow, $callbackRow);
 }
All Usage Examples Of Piwik\DataTable\Row::addColumn