예제 #1
0
파일: DataTest.php 프로젝트: zweifisch/zf
 public function testTransform()
 {
     $input = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
     $this->assertSame(Data::transform($input), [[1, 4, 7], [2, 5, 8], [3, 6, 9]]);
 }
예제 #2
0
파일: CliRouter.php 프로젝트: zweifisch/zf
 private function column($rows)
 {
     $cols = Data::transform($rows);
     $lens = array_map(function ($col) {
         return max(array_map('strlen', $col));
     }, $cols);
     return array_map(function ($row) use($lens) {
         return implode("\t", array_map('str_pad', $row, $lens));
     }, $rows);
 }