コード例 #1
0
ファイル: Main.php プロジェクト: luijar/fp-php
 public function __invoke() : View
 {
     $extractShorName = function ($item) {
         return $item->state->getShortName();
     };
     $allItems = Item::all();
     $newItems = P::pipe(P::filter(P::pipe($extractShorName, P::eq('new'))), 'P::size');
     return view('main')->with('items', $allItems)->with('remaining_item_count', $newItems($allItems));
 }
コード例 #2
0
ファイル: pramda.php プロジェクト: kapolos/pramda
 public function testEq()
 {
     $this->assertEquals(TRUE, P::eq(1, 1));
     $this->assertEquals(FALSE, P::eq(1, 2));
 }