Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PHPで学ぶオブジェクト指向プログラミング入門 / Introduction to OOP with PHP

nrs
October 02, 2021

PHPで学ぶオブジェクト指向プログラミング入門 / Introduction to OOP with PHP

PHP Conference Japan 2021 で発表した「PHPで学ぶオブジェクト指向プログラミング入門」のスライドです。

# URL
PHP Conference Japan 2021: https://phpcon.php.gr.jp/2021/
CfP: https://fortee.jp/phpcon-2021/proposal/868cc3d1-114d-4543-a59f-e068b0fb8fa5
YouTube: https://www.youtube.com/c/narusemi
HomePage: https://nrslib.com
Twitter: https://twitter.com/nrslib

nrs

October 02, 2021
Tweet

More Decks by nrs

Other Decks in Programming

Transcript

  1. <?php $profile = new Profile(); $profile->present(); class Profile { public

    function present() { echo "Name:"; echo " 成瀬 允宣"; echo "Job:"; echo " プログラマ"; echo "Achievement:"; echo " PHP Conference 2019:" . " 思想と理想の果てに -- クリーンアーキテクチャのWEBフレームワークを作ろう"; echo " PHP Conference 2020:" . " PHP WEBアプリケーション設計入門――10年先を見据えて作る"; echo " Object-Oriented Conference 2020:" . " keynote: Object-Oriented Diversity"; } }
  2. SYMBOL NAMES: 1: _main 2: _@2 3: _printf ================================================================================ SECTION

    SIZE = 0x00000015; NAME = .text DEFINED SYMBOLS: name = _main offset = 0x00000000; type = 0x0020; class = 0x0002 00000000: 55 push ebp 00000001: 89 E5 mov ebp,esp 00000003: 68 00 00 00 00 push offset _@2 00000008: E8 00 00 00 00 call _printf 0000000D: 59 pop ecx 0000000E: B8 00 00 00 00 mov eax,0 00000013: C9 leave 00000014: C3 ret near ================================================================================ SECTION SIZE = 0x0000000E; NAME = .data 00000000: 48 65 6C 6C 6F 20 57 6F 72 6C 64 2E 0A 00 Hello World... DEFINED SYMBOLS: name = _@2 offset = 0x00000000; type = 0x0000; class = 0x0003 ================================================================================
  3. section .data msg db "Hello world!" section .text global _start

    _start: mov rax, 1 mov rdi, 1 mov rsi, msg mov rdx, 12 syscall mov rax, 60 mov rdi, 0 syscall
  4. 000010 IDENTIFICATION DIVISION. 000020 PROGRAM-ID. SAMPLE-01. 000030* 000040 ENVIRONMENT DIVISION.

    000050* 000060 DATA DIVISION. 000070* 000080 PROCEDURE DIVISION. 000090 MAIN. 000100 DISPLAY "Hello world!" UPON CONSOLE. 000110 STOP RUN.
  5. 000010 IDENTIFICATION DIVISION. 000020 PROGRAM-ID. SAMPLE-01. 000030* 000040 ENVIRONMENT DIVISION.

    000050* 000060 DATA DIVISION. 000070* 000080 PROCEDURE DIVISION. 000090 MAIN. 000100 DISPLAY "Hello world!" UPON CONSOLE. 000110 STOP RUN.
  6. function judge(int $left_hand, int $right_hand) { if ($left_hand === 0)

    { // Goo if ($right_hand === 0) { // Goo return 0; } else if ($right_hand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($left_hand === 1) { // Choki if ($right_hand === 0) { // Goo return -1; } else if ($right_hand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($right_hand === 2) { // Goo return 1; } else if ($right_hand === 1) { // Choki return -1; } else { //Par return 0; } } }
  7. function judge(int $left_hand, int $right_hand) { if ($left_hand === 0)

    { // Goo if ($right_hand === 0) { // Goo return 0; } else if ($right_hand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($left_hand === 1) { // Choki if ($right_hand === 0) { // Goo return -1; } else if ($right_hand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($right_hand === 2) { // Goo return 1; } else if ($right_hand === 1) { // Choki return -1; } else { //Par return 0; } } }
  8. function show_result(int $result) { if ($result === 1) { echo

    "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } }
  9. function show_result(int $result) { if ($result === 1) { echo

    "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } }
  10. function judge(int $left_hand, int $right_hand) { if ($left_hand === 0)

    { // Goo if ($right_hand === 0) { // Goo return 0; } else if ($right_hand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($left_hand === 1) { // Choki if ($right_hand === 0) { // Goo return -1; } else if ($right_hand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($right_hand === 2) { // Goo return 1; } else if ($right_hand === 1) { // Choki return -1; } else { //Par return 0; } } }
  11. function judge(int $left_hand, int $right_hand) { if ($left_hand === 0)

    { // Goo if ($right_hand === 0) { // Goo return 0; } else if ($right_hand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($left_hand === 1) { // Choki if ($right_hand === 0) { // Goo return -1; } else if ($right_hand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($right_hand === 2) { // Goo return 1; } else if ($right_hand === 1) { // Choki return -1; } else { //Par return 0; } } }
  12. function judge(int $left_hand, int $right_hand) { if ($left_hand === 0)

    { // Goo if ($right_hand === 0) { // Goo return "draw"; } else if ($right_hand === 1) { // Choki return "win"; } else { //Par return "lose"; } } else if ($left_hand === 1) { // Choki if ($right_hand === 0) { // Goo return "lose"; } else if ($right_hand === 1) { // Choki return "draw"; } else { //Par return "win"; } } else { // Par if ($right_hand === 2) { // Goo return "win"; } else if ($right_hand === 1) { // Choki return "lose"; } else { //Par return "draw"; } } }
  13. function judge(int $left_hand, int $right_hand) { if ($left_hand === 0)

    { // Goo if ($right_hand === 0) { // Goo return "draw"; } else if ($right_hand === 1) { // Choki return "win"; } else { //Par return "lose"; } } else if ($left_hand === 1) { // Choki if ($right_hand === 0) { // Goo return "lose"; } else if ($right_hand === 1) { // Choki return "draw"; } else { //Par return "win"; } } else { // Par if ($right_hand === 2) { // Goo return "win"; } else if ($right_hand === 1) { // Choki return "lose"; } else { //Par return "draw"; } } }
  14. function judge(int $left_hand, int $right_hand) { if ($left_hand === 0)

    { // Goo if ($right_hand === 0) { // Goo return "draw"; } else if ($right_hand === 1) { // Choki return "win"; } else { //Par return "lose"; } } else if ($left_hand === 1) { // Choki if ($right_hand === 0) { // Goo return "lose"; } else if ($right_hand === 1) { // Choki return "draw"; } else { //Par return "win"; } } else { // Par if ($right_hand === 2) { // Goo return "win"; } else if ($right_hand === 1) { // Choki return "lose"; } else { //Par return "draw"; } } }
  15. function judge(int $left_hand, int $right_hand) { if ($left_hand === 0)

    { // Goo if ($right_hand === 0) { // Goo return "draw"; } else if ($right_hand === 1) { // Choki return "win"; } else { //Par return "lose"; } } else if ($left_hand === 1) { // Choki if ($right_hand === 0) { // Goo return "lose"; } else if ($right_hand === 1) { // Choki return "draw"; } else { //Par return "win"; } } else { // Par if ($right_hand === 2) { // Goo return "win"; } else if ($right_hand === 1) { // Choki return "lose"; } else { //Par return "draw"; } } } function show_result(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } }
  16. function judge(int $left_hand, int $right_hand) { if ($left_hand === 0)

    { // Goo if ($right_hand === 0) { // Goo return "draw"; } else if ($right_hand === 1) { // Choki return "win"; } else { //Par return "lose"; } } else if ($left_hand === 1) { // Choki if ($right_hand === 0) { // Goo return "lose"; } else if ($right_hand === 1) { // Choki return "draw"; } else { //Par return "win"; } } else { // Par if ($right_hand === 2) { // Goo return "win"; } else if ($right_hand === 1) { // Choki return "lose"; } else { //Par return "draw"; } } } function show_result(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } }
  17. function judge(int $left_hand, int $right_hand) { if ($left_hand === 0)

    { // Goo if ($right_hand === 0) { // Goo return 0; } else if ($right_hand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($left_hand === 1) { // Choki if ($right_hand === 0) { // Goo return -1; } else if ($right_hand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($right_hand === 2) { // Goo return 1; } else if ($right_hand === 1) { // Choki return -1; } else { //Par return 0; } } } function show_result(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } }
  18. function judge(int $left_hand, int $right_hand) { if ($left_hand === 0)

    { // Goo if ($right_hand === 0) { // Goo return 0; } else if ($right_hand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($left_hand === 1) { // Choki if ($right_hand === 0) { // Goo return -1; } else if ($right_hand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($right_hand === 2) { // Goo return 1; } else if ($right_hand === 1) { // Choki return -1; } else { //Par return 0; } } } function show_result(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } }
  19. function judge(int $left_hand, int $right_hand) { if ($left_hand === 0)

    { // Goo if ($right_hand === 0) { // Goo return 0; } else if ($right_hand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($left_hand === 1) { // Choki if ($right_hand === 0) { // Goo return -1; } else if ($right_hand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($right_hand === 2) { // Goo return 1; } else if ($right_hand === 1) { // Choki return -1; } else { //Par return 0; } } } function show_result(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } }
  20. function judge(int $left_hand, int $right_hand) { if ($left_hand === 0)

    { // Goo if ($right_hand === 0) { // Goo return 0; } else if ($right_hand === 1) { // Choki return 1; } else { //Par return -1; } function show_result(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } }
  21. function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand);

    $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } function judge(int $leftHand, int $rightHand) { if ($leftHand === 0) { // Goo if ($rightHand === 0) { // Goo return 0; } else if ($rightHand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($leftHand === 1) { // Choki if ($rightHand === 0) { // Goo return -1; } else if ($rightHand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($rightHand === 2) { // Goo return 1; } else if ($rightHand === 1) { // Choki return -1; } else { //Par return 0; } } }
  22. class JankenGame { function play(int $leftHand, int $rightHand) { $result

    = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } function judge(int $leftHand, int $rightHand) { if ($leftHand === 0) { // Goo if ($rightHand === 0) { // Goo return 0; } else if ($rightHand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($leftHand === 1) { // Choki if ($rightHand === 0) { // Goo return -1; } else if ($rightHand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($rightHand === 2) { // Goo return 1; } else if ($rightHand === 1) { // Choki return -1; } else { //Par return 0; } } } }
  23. class JankenGame { function play(int $leftHand, int $rightHand) { $result

    = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } function judge(int $leftHand, int $rightHand) { if ($leftHand === 0) { // Goo if ($rightHand === 0) { // Goo return 0; } else if ($rightHand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($leftHand === 1) { // Choki if ($rightHand === 0) { // Goo return -1; } else if ($rightHand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($rightHand === 2) { // Goo return 1; } else if ($rightHand === 1) { // Choki return -1; } else { //Par return 0; } } } }
  24. class JankenGame { function play(int $leftHand, int $rightHand) { $result

    = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } function judge(int $leftHand, int $rightHand) { if ($leftHand === 0) { // Goo if ($rightHand === 0) { // Goo return 0; } else if ($rightHand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($leftHand === 1) { // Choki if ($rightHand === 0) { // Goo return -1; } else if ($rightHand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($rightHand === 2) { // Goo return 1; } else if ($rightHand === 1) { // Choki return -1; } else { //Par return 0; } } } }
  25. class JankenGame { function play(int $leftHand, int $rightHand) { $result

    = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } function judge(int $leftHand, int $rightHand) { if ($leftHand === 0) { // Goo if ($rightHand === 0) { // Goo return 0; } else if ($rightHand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($leftHand === 1) { // Choki if ($rightHand === 0) { // Goo return -1; } else if ($rightHand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($rightHand === 2) { // Goo return 1; } else if ($rightHand === 1) { // Choki return -1; } else { //Par return 0; } } } }
  26. class JankenGame { function play(int $leftHand, int $rightHand) { $result

    = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } function judge(int $leftHand, int $rightHand) { if ($leftHand === 0) { // Goo if ($rightHand === 0) { // Goo return 0; } else if ($rightHand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($leftHand === 1) { // Choki if ($rightHand === 0) { // Goo return -1; } else if ($rightHand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($rightHand === 2) { // Goo return 1; } else if ($rightHand === 1) { // Choki return -1; } else { //Par return 0; } } } }
  27. class JankenGame { function play(int $leftHand, int $rightHand) { $result

    = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } function judge(int $leftHand, int $rightHand) { if ($leftHand === 0) { // Goo if ($rightHand === 0) { // Goo return 0; } else if ($rightHand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($leftHand === 1) { // Choki if ($rightHand === 0) { // Goo return -1; } else if ($rightHand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($rightHand === 2) { // Goo return 1; } else if ($rightHand === 1) { // Choki return -1; } else { //Par return 0; } } } }
  28. $game = new JankenGame(); $game->play(1, 2); class JankenGame { function

    play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } :
  29. $game = new JankenGame(); $game->play(1, 2); class JankenGame { function

    play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } :
  30. $game = new JankenGame(); $game->play(1, 2); class JankenGame { function

    play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } :
  31. $game = new JankenGame(); $game->play(1, 2); class JankenGame { function

    play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } :
  32. $game = new JankenGame(); $game->play(1, 2); class JankenGame { function

    play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } :
  33. $game = new JankenGame(); $game->play(1, 2); class JankenGame { function

    play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } :
  34. $game = new JankenGame(); $game->play(1, 2); class JankenGame { function

    play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } :
  35. $game = new JankenGame(); $game->play(1, 2); class JankenGame { function

    play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } :
  36. $game = new JankenGame(); $game->play(1, 2); class JankenGame { function

    play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } :
  37. $game = new JankenGame(); $game->play(1, 2); class JankenGame { function

    play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } :
  38. $game = new JankenGame(); $game->play(1, 2); class JankenGame { function

    play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } :
  39. $game = new JankenGame(); $game->play(1, 2); class JankenGame { function

    play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } :
  40. $game = new JankenGame(); $game->play(1, 2); class JankenGame { function

    play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } :
  41. function judge(int $left_hand, int $right_hand) { if ($left_hand === 0)

    { // Goo if ($right_hand === 0) { // Goo return 0; } else if ($right_hand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($left_hand === 1) { // Choki if ($right_hand === 0) { // Goo return -1; } else if ($right_hand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($right_hand === 2) { // Goo return 1; } else if ($right_hand === 1) { // Choki return -1; } else { //Par return 0; } } }
  42. function judge(int $left_hand, int $right_hand) { if ($left_hand === 0)

    { // Goo if ($right_hand === 0) { // Goo return 0; } else if ($right_hand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($left_hand === 1) { // Choki if ($right_hand === 0) { // Goo return -1; } else if ($right_hand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($right_hand === 2) { // Goo return 1; } else if ($right_hand === 1) { // Choki return -1; } else { //Par return 0; } } }
  43. function judge(int $left_hand, int $right_hand) { if ($left_hand === 0)

    { // Goo if ($right_hand === 0) { // Goo return "draw"; } else if ($right_hand === 1) { // Choki return "win"; } else { //Par return "lose"; } } else if ($left_hand === 1) { // Choki if ($right_hand === 0) { // Goo return "lose"; } else if ($right_hand === 1) { // Choki return "draw"; } else { //Par return "win"; } } else { // Par if ($right_hand === 2) { // Goo return "win"; } else if ($right_hand === 1) { // Choki return "lose"; } else { //Par return "draw"; } } }
  44. function showResult(int $result) { if ($result === 1) { echo

    "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } }
  45. class JankenGame { function play(int $leftHand, int $rightHand) { $result

    = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } function judge(int $leftHand, int $rightHand) { if ($leftHand === 0) { // Goo if ($rightHand === 0) { // Goo return 0; } else if ($rightHand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($leftHand === 1) { // Choki if ($rightHand === 0) { // Goo return -1; } else if ($rightHand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($rightHand === 2) { // Goo return 1; } else if ($rightHand === 1) { // Choki return -1; } else { //Par return 0; } } } }
  46. class JankenGame { function play(int $leftHand, int $rightHand) { $result

    = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } function judge(int $leftHand, int $rightHand) { if ($leftHand === 0) { // Goo if ($rightHand === 0) { // Goo return 0; } else if ($rightHand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($leftHand === 1) { // Choki if ($rightHand === 0) { // Goo return -1; } else if ($rightHand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($rightHand === 2) { // Goo return 1; } else if ($rightHand === 1) { // Choki return -1; } else { //Par return 0; } } } }
  47. class JankenGame { function play(int $leftHand, int $rightHand) { $result

    = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } function judge(int $leftHand, int $rightHand) { if ($leftHand === 0) { // Goo if ($rightHand === 0) { // Goo return "draw"; } else if ($rightHand === 1) { // Choki return "win"; } else { //Par return "lose"; } } else if ($leftHand === 1) { // Choki if ($rightHand === 0) { // Goo return "lose"; } else if ($rightHand === 1) { // Choki return "draw"; } else { //Par return "win"; } } else { // Par if ($rightHand === 2) { // Goo return "win"; } else if ($rightHand === 1) { // Choki return "lose"; } else { //Par return "draw"; } } } }
  48. class JankenGame { function play(int $leftHand, int $rightHand) { $result

    = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } function judge(int $leftHand, int $rightHand) { if ($leftHand === 0) { // Goo if ($rightHand === 0) { // Goo return "draw"; } else if ($rightHand === 1) { // Choki return "win"; } else { //Par return "lose"; } } else if ($leftHand === 1) { // Choki if ($rightHand === 0) { // Goo return "lose"; } else if ($rightHand === 1) { // Choki return "draw"; } else { //Par return "win"; } } else { // Par if ($rightHand === 2) { // Goo return "win"; } else if ($rightHand === 1) { // Choki return "lose"; } else { //Par return "draw"; } } } }
  49. class JankenGame { function play(int $leftHand, int $rightHand) { $result

    = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === "win") { echo "勝利"; } else if ($result === "draw") { echo "引き分け"; } else { echo "敗北"; } } function judge(int $leftHand, int $rightHand) { if ($leftHand === 0) { // Goo if ($rightHand === 0) { // Goo return "draw"; } else if ($rightHand === 1) { // Choki return "win"; } else { //Par return "lose"; } } else if ($leftHand === 1) { // Choki if ($rightHand === 0) { // Goo return "lose"; } else if ($rightHand === 1) { // Choki return "draw"; } else { //Par return "win"; } } else { // Par if ($rightHand === 2) { // Goo return "win"; } else if ($rightHand === 1) { // Choki return "lose"; } else { //Par return "draw"; } } } }
  50. function judge(int $leftHand, int $rightHand) { if ($leftHand === 0)

    { // Goo if ($rightHand === 0) { // Goo return 0; } else if ($rightHand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($leftHand === 1) { // Choki if ($rightHand === 0) { // Goo return -1; } else if ($rightHand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($rightHand === 2) { // Goo return 1; } else if ($rightHand === 1) { // Choki return -1; } else { //Par return 0; } } } } class JankenGame { function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } } else { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } }
  51. function judge(int $leftHand, int $rightHand) { if ($leftHand === 0)

    { // Goo if ($rightHand === 0) { // Goo return 0; } else if ($rightHand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($leftHand === 1) { // Choki if ($rightHand === 0) { // Goo return -1; } else if ($rightHand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($rightHand === 2) { // Goo return 1; } else if ($rightHand === 1) { // Choki return -1; } else { //Par return 0; } } } } class JankenGame { function play(int $leftHand, int $rightHand, string $lang) { $result = $this->judge($leftHand, $rightHand); $this->showResult($result, $lang); } function showResult(int $result, string $lang) { if ($lang === "ja") { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } else { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } }
  52. function judge(int $leftHand, int $rightHand) { if ($leftHand === 0)

    { // Goo if ($rightHand === 0) { // Goo return 0; } else if ($rightHand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($leftHand === 1) { // Choki if ($rightHand === 0) { // Goo return -1; } else if ($rightHand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($rightHand === 2) { // Goo return 1; } else if ($rightHand === 1) { // Choki return -1; } else { //Par return 0; } } } } class JankenGame { function play(int $leftHand, int $rightHand, string $lang) { $result = $this->judge($leftHand, $rightHand); $this->showResult($result, $lang); } function showResult(int $result, string $lang) { if ($lang === "ja") { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } else { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } }
  53. function judge(int $leftHand, int $rightHand) { if ($leftHand === 0)

    { // Goo if ($rightHand === 0) { // Goo return 0; } else if ($rightHand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($leftHand === 1) { // Choki if ($rightHand === 0) { // Goo return -1; } else if ($rightHand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($rightHand === 2) { // Goo return 1; } else if ($rightHand === 1) { // Choki return -1; } else { //Par return 0; } } } } class JankenGame { function play(int $leftHand, int $rightHand, string $lang) { $result = $this->judge($leftHand, $rightHand); $this->showResult($result, $lang); } function showResult(int $result, string $lang) { if ($lang === "ja") { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } else { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } }
  54. function judge(int $leftHand, int $rightHand) { if ($leftHand === 0)

    { // Goo if ($rightHand === 0) { // Goo return 0; } else if ($rightHand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($leftHand === 1) { // Choki if ($rightHand === 0) { // Goo return -1; } else if ($rightHand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($rightHand === 2) { // Goo return 1; } else if ($rightHand === 1) { // Choki return -1; } else { //Par return 0; } } } } class JankenGame { function play(int $leftHand, int $rightHand, string $lang) { $result = $this->judge($leftHand, $rightHand); $this->showResult($result, $lang); } function showResult(int $result, string $lang) { if ($lang === "ja") { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } else { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } }
  55. function judge(int $leftHand, int $rightHand) { if ($leftHand === 0)

    { // Goo if ($rightHand === 0) { // Goo return 0; } else if ($rightHand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($leftHand === 1) { // Choki if ($rightHand === 0) { // Goo return -1; } else if ($rightHand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($rightHand === 2) { // Goo return 1; } else if ($rightHand === 1) { // Choki return -1; } else { //Par return 0; } } } } class JankenGame { function play(int $leftHand, int $rightHand, string $lang) { $result = $this->judge($leftHand, $rightHand); $this->showResult($result, $lang); } function showResult(int $result, string $lang) { if ($lang === "ja") { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } else { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } }
  56. function judge(int $leftHand, int $rightHand) { if ($leftHand === 0)

    { // Goo if ($rightHand === 0) { // Goo return 0; } else if ($rightHand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($leftHand === 1) { // Choki if ($rightHand === 0) { // Goo return -1; } else if ($rightHand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($rightHand === 2) { // Goo return 1; } else if ($rightHand === 1) { // Choki return -1; } else { //Par return 0; } } } } class JankenGame { function play(int $leftHand, int $rightHand, string $lang) { $result = $this->judge($leftHand, $rightHand); $this->showResult($result, $lang); } function showResult(int $result, string $lang) { if ($lang === "ja") { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } else { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } }
  57. function judge(int $leftHand, int $rightHand) { if ($leftHand === 0)

    { // Goo if ($rightHand === 0) { // Goo return 0; } else if ($rightHand === 1) { // Choki return 1; } else { //Par return -1; } } else if ($leftHand === 1) { // Choki if ($rightHand === 0) { // Goo return -1; } else if ($rightHand === 1) { // Choki return 0; } else { //Par return 1; } } else { // Par if ($rightHand === 2) { // Goo return 1; } else if ($rightHand === 1) { // Choki return -1; } else { //Par return 0; } } } } class JankenGame { function play(int $leftHand, int $rightHand, string $lang) { $result = $this->judge($leftHand, $rightHand); $this->showResult($result, $lang); } function showResult(int $result, string $lang) { if ($lang === "ja") { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } else { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } }
  58. function showResult(int $result, string $lang) { if ($lang === "ja")

    { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } else if ($lang === "en") { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } else if ($lang === "ch") { if ($result === 1) { echo "你赢了"; } else if ($result === 0) { echo "平局"; } else { echo "你失败了"; } } else if ($lang === "fr") { if ($result === 1) { echo "Vous gagnez"; } else if ($result === 0) { echo "Dessiner"; } else { echo "Tu perds"; } } else { if ($result === 1) { echo "Du gewinnst"; } else if ($result === 0) { echo "Zeichnen"; } else { echo "Du verlierst"; } } }
  59. function showResult(int $result, string $lang) { if ($lang === "ja")

    { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } else if ($lang === "en") { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } else if ($lang === "ch") { if ($result === 1) { echo "你赢了"; } else if ($result === 0) { echo "平局"; } else { echo "你失败了"; } } else if ($lang === "fr") { if ($result === 1) { echo "Vous gagnez"; } else if ($result === 0) { echo "Dessiner"; } else { echo "Tu perds"; } } else { if ($result === 1) { echo "Du gewinnst"; } else if ($result === 0) { echo "Zeichnen"; } else { echo "Du verlierst"; } } }
  60. function showResult(int $result, string $lang) { if ($lang === "ja")

    { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } else if ($lang === "en") { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } else if ($lang === "ch") { if ($result === 1) { echo "你赢了"; } else if ($result === 0) { echo "平局"; } else { echo "你失败了"; } } else if ($lang === "fr") { if ($result === 1) { echo "Vous gagnez"; } else if ($result === 0) { echo "Dessiner"; } else { echo "Tu perds"; } } else { if ($result === 1) { echo "Du gewinnst"; } else if ($result === 0) { echo "Zeichnen"; } else { echo "Du verlierst"; } } }
  61. function showResult(int $result, string $lang) { if ($lang === "ja")

    { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } else if ($lang === "en") { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } else if ($lang === "ch") { if ($result === 1) { echo "你赢了"; } else if ($result === 0) { echo "平局"; } else { echo "你失败了"; } } else if ($lang === "fr") { if ($result === 1) { echo "Vous gagnez"; } else if ($result === 0) { echo "Dessiner"; } else { echo "Tu perds"; } } else { if ($result === 1) { echo "Du gewinnst"; } else if ($result === 0) { echo "Zeichnen"; } else { echo "Du verlierst"; } } }
  62. class JankenGame { : function showResult(int $result, string $lang) {

    if ($lang === "ja") { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } else { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } }
  63. class JankenGame { : function showResult(int $result, string $lang) {

    if ($lang === "ja") { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } else { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } }
  64. class JankenGame { : function showResult(int $result, string $lang) {

    if ($lang === "ja") { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } else { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } }
  65. class JankenGame { : function showResult(int $result, string $lang) {

    if ($lang === "ja") { if ($result === 1) { echo "勝利"; } else if ($result === 0) { echo "引き分け"; } else { echo "敗北"; } } else { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } }
  66. class JapaneseDisplay { function show(int $result) { if ($result ===

    1) { echo "勝ち"; } else if ($result === 0) { echo "引き分け"; } else { echo "負け"; } } }
  67. class JapaneseDisplay { function show(int $result) { if ($result ===

    1) { echo "勝ち"; } else if ($result === 0) { echo "引き分け"; } else { echo "負け"; } } } class EnglishDisplay { function show(int $result) { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } }
  68. class JapaneseDisplay { function show(int $result) { if ($result ===

    1) { echo "勝ち"; } else if ($result === 0) { echo "引き分け"; } else { echo "負け"; } } } class EnglishDisplay { function show(int $result) { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } } class JankenGame { : function showResult(int $result, string $lang) { if ($lang === "ja") { $display = new JapaneseDisplay(); $display->show($result); } else { $display = new EnglishDisplay(); $display->show($result); } }
  69. class JapaneseDisplay { function show(int $result) { if ($result ===

    1) { echo "勝ち"; } else if ($result === 0) { echo "引き分け"; } else { echo "負け"; } } } class EnglishDisplay { function show(int $result) { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } } class JankenGame { : function showResult(int $result, string $lang) { if ($lang === "ja") { $display = new JapaneseDisplay(); $display->show($result); } else { $display = new EnglishDisplay(); $display->show($result); } }
  70. class JankenGame { : function showResult(int $result, string $lang) {

    if ($lang === "ja") { $display = new JapaneseDisplay(); $display->show($result); } else { $display = new EnglishDisplay(); $display->show($result); } }
  71. class JankenGame { : function showResult(int $result, string $lang) {

    if ($lang === "ja") { $display = new JapaneseDisplay(); $display->show($result); } else { $display = new EnglishDisplay(); $display->show($result); } }
  72. class JankenGame { : function showResult(int $result, string $lang) {

    if ($lang === "ja") { $display = new JapaneseDisplay(); $display->show($result); } else { $display = new EnglishDisplay(); $display->show($result); } }
  73. class JankenGame { : function showResult(int $result, string $lang) {

    if ($lang === "ja") { $display = new JapaneseDisplay(); } else { $display = new EnglishDisplay(); } $display->show($result); }
  74. class JankenGame { : function showResult(int $result, string $lang) {

    if ($lang === "ja") { $display = new JapaneseDisplay(); } else { $display = new EnglishDisplay(); } $display->show($result); }
  75. class JankenGame { : function showResult(int $result, string $lang) {

    if ($lang === "ja") { $display = new JapaneseDisplay(); } else { $display = new EnglishDisplay(); } $display->show($result); }
  76. class JankenGame { : function showResult(int $result, string $lang) {

    if ($lang === "ja") { $display = new JapaneseDisplay(); } else { $display = new EnglishDisplay(); } $display->show($result); }
  77. class JankenGame { : function showResult(int $result, string $lang) {

    if ($lang === "ja") { $display = new JapaneseDisplay(); } else { $display = new EnglishDisplay(); } $display->show($result); }
  78. class JankenGame { : function showResult(int $result, string $lang) {

    if ($lang === "ja") { $display = new JapaneseDisplay(); } else { $display = new EnglishDisplay(); } $display->show($result); }
  79. class JankenGame { : function showResult(int $result, string $lang) {

    if ($lang === "ja") { $display = new JapaneseDisplay(); } else { $display = new EnglishDisplay(); } $display->show($result); } class JapaneseDisplay { function show(int $result) { if ($result === 1) { echo "勝ち"; } else if ($result === 0) { echo "引き分け"; } else { echo "負け"; } } }
  80. class JankenGame { : function showResult(int $result, string $lang) {

    if ($lang === "ja") { $display = new JapaneseDisplay(); } else { $display = new EnglishDisplay(); } $display->show($result); }
  81. class JankenGame { : function showResult(int $result, string $lang) {

    if ($lang === "ja") { $display = new JapaneseDisplay(); } else { $display = new EnglishDisplay(); } $display->show($result); } class EnglishDisplay { function show(int $result) { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } }
  82. class JankenGame { function play(int $leftHand, int $rightHand, string $lang)

    { $result = $this->judge($leftHand, $rightHand); $this->showResult($result, $lang); } function showResult(int $result, string $lang) { if ($lang === "ja") { $display = new JapaneseDisplay(); } else { $display = new EnglishDisplay(); } $display->show($result); }
  83. class JankenGame { function play(int $leftHand, int $rightHand, string $lang)

    { $result = $this->judge($leftHand, $rightHand); $this->showResult($result, $lang); } function showResult(int $result, string $lang) { if ($lang === "ja") { $display = new JapaneseDisplay(); } else { $display = new EnglishDisplay(); } $display->show($result); }
  84. class JankenGame { function play(int $leftHand, int $rightHand, string $lang)

    { $result = $this->judge($leftHand, $rightHand); $this->showResult($result, $lang); } function showResult(int $result, string $lang) { if ($lang === "ja") { $display = new JapaneseDisplay(); } else { $display = new EnglishDisplay(); } $display->show($result); }
  85. class JankenGame { function play(int $leftHand, int $rightHand, string $lang)

    { $result = $this->judge($leftHand, $rightHand); $display = $this->getDisplay($lang); $display->show($result); } function getDisplay(string $lang) { if ($lang === "ja") { return new JapaneseDisplay(); } else { return new EnglishDisplay(); } }
  86. class JankenGame { function play(int $leftHand, int $rightHand, string $lang)

    { $result = $this->judge($leftHand, $rightHand); $display = $this->getDisplay($lang); $display->show($result); } function getDisplay(string $lang) { if ($lang === "ja") { return new JapaneseDisplay(); } else { return new EnglishDisplay(); } }
  87. class JankenGame { function play(int $leftHand, int $rightHand, string $lang)

    { $result = $this->judge($leftHand, $rightHand); $display = $this->getDisplay($lang); $display->show($result); } function getDisplay(string $lang) { if ($lang === "ja") { return new JapaneseDisplay(); } else { return new EnglishDisplay(); } }
  88. class JankenGame { function play(int $leftHand, int $rightHand, string $lang)

    { $result = $this->judge($leftHand, $rightHand); $display = $this->getDisplay($lang); $display->show($result); } function getDisplay(string $lang) { if ($lang === "ja") { return new JapaneseDisplay(); } else { return new EnglishDisplay(); } }
  89. class JankenGame { function play(int $leftHand, int $rightHand, string $lang)

    { $result = $this->judge($leftHand, $rightHand); $display = $this->getDisplay($lang); $display->show($result); } function getDisplay(string $lang) { if ($lang === "ja") { return new JapaneseDisplay(); } else { return new EnglishDisplay(); } }
  90. class JankenGame { function play(int $leftHand, int $rightHand, string $lang)

    { $result = $this->judge($leftHand, $rightHand); $display = $this->getDisplay($lang); $display->show($result); } function getDisplay(string $lang) { if ($lang === "ja") { return new JapaneseDisplay(); } else { return new EnglishDisplay(); } }
  91. class JankenGame { function play(int $leftHand, int $rightHand, string $lang)

    { $result = $this->judge($leftHand, $rightHand); $display = $this->getDisplay($lang); $display->show($result); } function getDisplay(string $lang) { if ($lang === "ja") { return new JapaneseDisplay(); } else { return new EnglishDisplay(); } }
  92. class JankenGame { function play(int $leftHand, int $rightHand, string $lang)

    { $result = $this->judge($leftHand, $rightHand); $display = $this->getDisplay($lang); $display->show($result); } function getDisplay(string $lang) { if ($lang === "ja") { return new JapaneseDisplay(); } else { return new EnglishDisplay(); } }
  93. class JankenGame { function play(int $leftHand, int $rightHand, string $lang)

    { $result = $this->judge($leftHand, $rightHand); $display = $this->getDisplay($lang); $display->show($result); } function getDisplay(string $lang) { if ($lang === "ja") { return new JapaneseDisplay(); } else { return new EnglishDisplay(); } }
  94. class JankenGame { function play(int $leftHand, int $rightHand, string $lang)

    { $result = $this->judge($leftHand, $rightHand); $display = $this->getDisplay($lang); $display->show($result); } function getDisplay(string $lang) { if ($lang === "ja") { return new JapaneseDisplay(); } else { return new EnglishDisplay(); } }
  95. class JankenGame { function __construct($display) { $this->display = $display; }

    function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->display->show($result); }
  96. class JankenGame { function __construct($display) { $this->display = $display; }

    function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->display->show($result); }
  97. class JankenGame { function __construct($display) { $this->display = $display; }

    function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->display->show($result); } $display = new JapaneseDisplay(); $game = new JankenGame($display); $game->play(1, 2);
  98. class JankenGame { function __construct($display) { $this->display = $display; }

    function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->display->show($result); } $display = new JapaneseDisplay(); $game = new JankenGame($display); $game->play(1, 2);
  99. class JankenGame { function __construct($display) { $this->display = $display; }

    function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->display->show($result); } $display = new JapaneseDisplay(); $game = new JankenGame($display); $game->play(1, 2);
  100. class JankenGame { function __construct($display) { $this->display = $display; }

    function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->display->show($result); } $display = new JapaneseDisplay(); $game = new JankenGame($display); $game->play(1, 2);
  101. class JankenGame { function __construct($display) { $this->display = $display; }

    function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->display->show($result); } $display = new JapaneseDisplay(); $game = new JankenGame($display); $game->play(1, 2);
  102. class JankenGame { function __construct($display) { $this->display = $display; }

    function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->display->show($result); } $display = new JapaneseDisplay(); $game = new JankenGame($display); $game->play(1, 2);
  103. class JankenGame { function __construct($display) { $this->display = $display; }

    function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->display->show($result); } $display = new JapaneseDisplay(); $game = new JankenGame($display); $game->play(1, 2);
  104. class JankenGame { function __construct($display) { $this->display = $display; }

    function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->display->show($result); } $display = new JapaneseDisplay(); $game = new JankenGame($display); $game->play(1, 2);
  105. class JankenGame { function __construct($display) { $this->display = $display; }

    function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->display->show($result); } $display = new JapaneseDisplay(); $game = new JankenGame($display); $game->play(1, 2);
  106. $display = new JapaneseDisplay(); $game = new JankenGame($display); $game->play(1, 2);

    $display = new EnglishDisplay(); $game = new JankenGame($display); $game->play(1, 2); $display = new ChineseDisplay(); $game = new JankenGame($display); $game->play(1, 2);
  107. $display = new JapaneseDisplay(); $game = new JankenGame($display); $game->play(1, 2);

    $display = new EnglishDisplay(); $game = new JankenGame($display); $game->play(1, 2); $display = new ChineseDisplay(); $game = new JankenGame($display); $game->play(1, 2);
  108. $display = new JapaneseDisplay(); $game = new JankenGame($display); $game->play(1, 2);

    $display = new EnglishDisplay(); $game = new JankenGame($display); $game->play(1, 2); $display = new ChineseDisplay(); $game = new JankenGame($display); $game->play(1, 2);
  109. class JankenGame { function __construct($display) { $this->display = $display; }

    function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand $this->display->show($result); } $display = new JapaneseDisplay(); $game = new JankenGame($display); $game->play(1, 2); $display = new EnglishDisplay(); $game = new JankenGame($display); $game->play(1, 2); $display = new ChineseDisplay(); $game = new JankenGame($display); $game->play(1, 2);
  110. class JankenGame { function __construct($display) { $this->display = $display; }

    function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand $this->display->show($result); } $display = new JapaneseDisplay(); $game = new JankenGame($display); $game->play(1, 2); $display = new EnglishDisplay(); $game = new JankenGame($display); $game->play(1, 2); $display = new ChineseDisplay(); $game = new JankenGame($display); $game->play(1, 2);
  111. class JankenGame { function __construct($display) { $this->display = $display; }

    function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand $this->display->show($result); } $display = new JapaneseDisplay(); $game = new JankenGame($display); $game->play(1, 2); $display = new EnglishDisplay(); $game = new JankenGame($display); $game->play(1, 2); $display = new ChineseDisplay(); $game = new JankenGame($display); $game->play(1, 2);
  112. class JankenGame { function __construct($display) { $this->display = $display; }

    function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand $this->display->show($result); } $display = new JapaneseDisplay(); $game = new JankenGame($display); $game->play(1, 2); $display = new EnglishDisplay(); $game = new JankenGame($display); $game->play(1, 2); $display = new ChineseDisplay(); $game = new JankenGame($display); $game->play(1, 2);
  113. class JapaneseDisplay { function show(int $result) { if ($result ===

    1) { echo "勝ち"; } else if ($result === 0) { echo "引き分け"; } else { echo "負け"; } } } class EnglishDisplay { function show(int $result) { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } }
  114. class JapaneseDisplay { function show(int $result) { if ($result ===

    1) { echo "勝ち"; } else if ($result === 0) { echo "引き分け"; } else { echo "負け"; } } } class EnglishDisplay { function show(int $result) { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } }
  115. class JapaneseDisplay implements DisplayInterface { function show(int $result) { if

    ($result === 1) { echo "勝ち"; } else if ($result === 0) { echo "引き分け"; } else { echo "負け"; } } } class EnglishDisplay implements DisplayInterface { function show(int $result) { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } }
  116. class JapaneseDisplay implements DisplayInterface { function show(int $result) { if

    ($result === 1) { echo "勝ち"; } else if ($result === 0) { echo "引き分け"; } else { echo "負け"; } } } class EnglishDisplay implements DisplayInterface { function show(int $result) { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } }
  117. class JapaneseDisplay implements DisplayInterface { function show(int $result) { if

    ($result === 1) { echo "勝ち"; } else if ($result === 0) { echo "引き分け"; } else { echo "負け"; } } } class EnglishDisplay implements DisplayInterface { function show(int $result) { if ($result === 1) { echo "win"; } else if ($result === 0) { echo "draw"; } else { echo "lose"; } } }
  118. class JankenGame { function __construct($display, $resultGateWay) { $this->display = $display;

    $this->resultGateWay = $resultGateWay; } function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->display->show($result); $this->resultGateWay->save($leftHand, $rightHand, $result); } :
  119. class JankenGame { function __construct($display, $resultGateWay) { $this->display = $display;

    $this->resultGateWay = $resultGateWay; } function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->display->show($result); $this->resultGateWay->save($leftHand, $rightHand, $result); } :
  120. class DebugResultGateWay implements ResultGateWayInterface { function save(int $leftHand, int $rightHand,

    int $result) { echo "leftHand:" . $leftHand . ",rightHand:" . $rightHand . ",result:" . $result; } } class ProductionResultGateWay implements ResultGateWayInterface { function save(int $leftHand, int $rightHand, int $result) { // ... save to database : } }
  121. class JapaneseDisplay implements DisplayInterface { function show(int $result) { if

    ($result === 1) { echo "勝ち"; } else if ($result === 0) { echo "引き分け"; } else { echo "負け"; } } } class JankenGame { function __construct($display) { $this->display = $display; } function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->display->show($result); } : }
  122. class JapaneseDisplay implements DisplayInterface { function show(int $result) { if

    ($result === 1) { echo "勝ち"; } else if ($result === 0) { echo "引き分け"; } else { echo "負け"; } } } class JankenGame { function __construct($display) { $this->display = $display; } function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->display->show($result); } : }
  123. class JapaneseDisplay implements DisplayInterface { function show(int $result) { if

    ($result === 1) { echo "勝ち"; } else if ($result === 0) { echo "引き分け"; } else { echo "負け"; } } } class JankenGame { function __construct($display) { $this->display = $display; } function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->display->show($result); } : }
  124. class JapaneseDisplay implements DisplayInterface { function show(int $result) { if

    ($result === 1) { echo "勝ち"; } else if ($result === 0) { echo "引き分け"; } else { echo "負け"; } } } class JankenGame { function __construct($display) { $this->display = $display; } function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->display->show($result); } : }
  125. class JapaneseDisplay implements DisplayInterface { function show(int $result) { if

    ($result === 1) { echo "勝ち"; } else if ($result === 0) { echo "引き分け"; } else { echo "負け"; } } } class JankenGame { function __construct($display) { $this->display = $display; } function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->display->show($result); } : }
  126. interface DisplayInterface { function win(); function draw(); function lose(); }

    class JapaneseDisplay implements DisplayInterface { function win() { echo "勝ち"; } function draw() { echo "引き分け"; } function lose() { echo "負け"; } }
  127. class JankenGame { function __construct($display) { $this->display = $display; }

    function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { $this->display->win(); } else if ($result === 0) { $this->display->draw(); } else { $this->display->lose(); } } : } interface DisplayInterface { function win(); function draw(); function lose(); }
  128. class JankenGame { function __construct($display) { $this->display = $display; }

    function play(int $leftHand, int $rightHand) { $result = $this->judge($leftHand, $rightHand); $this->showResult($result); } function showResult(int $result) { if ($result === 1) { $this->display->win(); } else if ($result === 0) { $this->display->draw(); } else { $this->display->lose(); } } : } interface DisplayInterface { function win(); function draw(); function lose(); }
  129. interface DisplayInterface { function win(); function draw(); function lose(); }

    class JapaneseDisplay implements DisplayInterface { function win() { echo "勝ち"; } function draw() { echo "引き分け"; } function lose() { echo "負け"; } }
  130. class ModelNumber { private string $model; private string $branch; private

    string $lot; /** * ModelNumber constructor. */ public function __construct(string $model, string $branch, string $lot) { $this->model = $model; $this->branch = $branch; $this->lot = $lot; } public function toString() { return $this->model . "-" . $this->branch . "-" . $this->lot; } }
  131. class ModelNumber { private string $model; private string $branch; private

    string $lot; /** * ModelNumber constructor. */ public function __construct(string $model, string $branch, string $lot) { $this->model = $model; $this->branch = $branch; $this->lot = $lot; } public function toString() { return $this->model . "-" . $this->branch . "-" . $this->lot; } }
  132. class ModelNumber { private string $model; private string $branch; private

    string $lot; /** * ModelNumber constructor. */ public function __construct(string $model, string $branch, string $lot) { $this->model = $model; $this->branch = $branch; $this->lot = $lot; } public function toString() { return $this->model . "-" . $this->branch . "-" . $this->lot; } }