コード例 #1
0
 public function testMap()
 {
     $this->coll->add(1)->add(2)->add(3);
     $coll = $this->coll->map(function ($item) {
         return $item * 2;
     });
     $expected = new ArrayList([2, 4, 6]);
     $this->assertSame($expected->toArray(), $coll->toArray());
 }
コード例 #2
0
ファイル: TaskService.php プロジェクト: italolelis/wunderlist
 public function allWithSubtasks(WList $list)
 {
     $tasks = new ArrayList($this->all($list));
     $tasksWithSubtaks = $tasks->map(function (Task $task) {
         return $task->setSubtasks($this->subtaskService->forTask($task));
     });
     return $tasksWithSubtaks;
 }
コード例 #3
0
ファイル: Document.php プロジェクト: hellofresh/ausraster
 /**
  * {@inheritdoc}
  */
 public static function open(string $filepath) : DocumentInterface
 {
     $document = new static();
     $document->documentAdapter = PHPExcel_IOFactory::load($filepath);
     $worksheets = new ArrayList($document->documentAdapter->getSheetNames());
     $document->worksheets = $worksheets->map(function (string $sheetName) use($document) {
         return new Worksheet($document->documentAdapter->getSheetByName($sheetName));
     });
     return $document;
 }