public function testMap() { $this->assertSame(['foofoofoo', 'bar' => 'bazbazbaz'], ArrayUtils::map('str_repeat', array('foo', 'bar' => 'baz'), 3)); $this->assertSame(['1', '2'], ArrayUtils::map(function ($number) { return $number . ""; }, [1, 2])); }
/** * Strips keys and removes slashes off supplied data and replaces current result * with it. * @param array $table multi-dimensional table-like array * @return DataScript self * @see setOutput() */ protected final function setOutputTable($table) { $table = ArrayUtils::stripKeys($table); foreach ($table as &$row) { foreach ($row as &$cell) { if (is_string($cell)) { $cell = stripslashes($cell); } } } $this->setOutput($table); return $this; }