Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

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"; } }

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

OOP TIPS

Slide 7

Slide 7 text

OOP TIPS

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

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 ================================================================================

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

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

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

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.

Slide 29

Slide 29 text

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.

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

$a = 3; $b = 5; $c = $a + $b;

Slide 37

Slide 37 text

$a = 3; $b = 5; $c = $a + $b;

Slide 38

Slide 38 text

$a = 3; $b = 5; $c = $a + $b;

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

$a = 0b0011; $b = 0b0101; $c = $a + $b;

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

$bottom = 3; $height = 6; $area = $bottom * $height / 2;

Slide 43

Slide 43 text

$bottom = 3; $height = 6; $area = $bottom * $height / 2;

Slide 44

Slide 44 text

$bottom = 3; $height = 6; $area = $bottom * $height / 2;

Slide 45

Slide 45 text

$bottom = 3; $height = 6; $area = $bottom * $height / 2;

Slide 46

Slide 46 text

$bottom = 3; $height = 6; $area = $bottom * $height / 2;

Slide 47

Slide 47 text

$bottom = 3; $height = 6; $area = $bottom * $height / 2;

Slide 48

Slide 48 text

$bottom = 3; $height = 6; $area = $bottom * $height / 2;

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

$area = calculate_area_of_triangle(3, 6); function calculate_area_of_triangle(int $bottom, int $height) { return $bottom * $height / 2; }

Slide 51

Slide 51 text

$area = calculate_area_of_triangle(3, 6); function calculate_area_of_triangle(int $bottom, int $height) { return $bottom * $height / 2; }

Slide 52

Slide 52 text

$area = calculate_area_of_triangle(3, 6); function calculate_area_of_triangle(int $bottom, int $height) { return $bottom * $height / 2; }

Slide 53

Slide 53 text

$area = calculate_area_of_triangle(3, 6); function calculate_area_of_triangle(int $bottom, int $height) { return $bottom * $height / 2; }

Slide 54

Slide 54 text

$area = calculate_area_of_triangle(3, 6); function calculate_area_of_triangle(int $bottom, int $height) { return $bottom * $height / 2; }

Slide 55

Slide 55 text

function crypt_password(string $password) { return password_hash($password, PASSWORD_DEFAULT); }

Slide 56

Slide 56 text

function crypt_password(string $password) { return password_hash($password, PASSWORD_DEFAULT, ["cost" => 12]); }

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

No content

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

function play(int $left_hand, int $right_hand) { $result = judge($left_hand, $right_hand); show_result($result); }

Slide 62

Slide 62 text

function play(int $left_hand, int $right_hand) { $result = judge($left_hand, $right_hand); show_result($result); }

Slide 63

Slide 63 text

function play(int $left_hand, int $right_hand) { $result = judge($left_hand, $right_hand); show_result($result); }

Slide 64

Slide 64 text

function play(int $left_hand, int $right_hand) { $result = judge($left_hand, $right_hand); show_result($result); }

Slide 65

Slide 65 text

function play(int $left_hand, int $right_hand) { $result = judge($left_hand, $right_hand); show_result($result); }

Slide 66

Slide 66 text

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; } } }

Slide 67

Slide 67 text

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; } } }

Slide 68

Slide 68 text

function play(int $left_hand, int $right_hand) { $result = judge($left_hand, $right_hand); show_result($result); }

Slide 69

Slide 69 text

function play(int $left_hand, int $right_hand) { $result = judge($left_hand, $right_hand); show_result($result); }

Slide 70

Slide 70 text

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

Slide 71

Slide 71 text

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

Slide 72

Slide 72 text

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; } } }

Slide 73

Slide 73 text

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; } } }

Slide 74

Slide 74 text

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"; } } }

Slide 75

Slide 75 text

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"; } } }

Slide 76

Slide 76 text

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"; } } }

Slide 77

Slide 77 text

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 "敗北"; } }

Slide 78

Slide 78 text

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 "敗北"; } }

Slide 79

Slide 79 text

No content

Slide 80

Slide 80 text

No content

Slide 81

Slide 81 text

No content

Slide 82

Slide 82 text

No content

Slide 83

Slide 83 text

No content

Slide 84

Slide 84 text

OOP TIPS

Slide 85

Slide 85 text

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 "敗北"; } }

Slide 86

Slide 86 text

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 "敗北"; } }

Slide 87

Slide 87 text

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 "敗北"; } }

Slide 88

Slide 88 text

No content

Slide 89

Slide 89 text

No content

Slide 90

Slide 90 text

No content

Slide 91

Slide 91 text

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 "敗北"; } }

Slide 92

Slide 92 text

No content

Slide 93

Slide 93 text

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; } } }

Slide 94

Slide 94 text

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; } } } }

Slide 95

Slide 95 text

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; } } } }

Slide 96

Slide 96 text

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; } } } }

Slide 97

Slide 97 text

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; } } } }

Slide 98

Slide 98 text

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; } } } }

Slide 99

Slide 99 text

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; } } } }

Slide 100

Slide 100 text

$game = new JankenGame(); $game->play(1, 2);

Slide 101

Slide 101 text

$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 "敗北"; } } :

Slide 102

Slide 102 text

$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 "敗北"; } } :

Slide 103

Slide 103 text

$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 "敗北"; } } :

Slide 104

Slide 104 text

$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 "敗北"; } } :

Slide 105

Slide 105 text

$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 "敗北"; } } :

Slide 106

Slide 106 text

$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 "敗北"; } } :

Slide 107

Slide 107 text

$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 "敗北"; } } :

Slide 108

Slide 108 text

$message = "hello";

Slide 109

Slide 109 text

$message = "hello"; $message = new String(['h', 'e', 'l', 'l', 'o'])

Slide 110

Slide 110 text

$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 "敗北"; } } :

Slide 111

Slide 111 text

$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 "敗北"; } } :

Slide 112

Slide 112 text

$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 "敗北"; } } :

Slide 113

Slide 113 text

$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 "敗北"; } } :

Slide 114

Slide 114 text

$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 "敗北"; } } :

Slide 115

Slide 115 text

$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 "敗北"; } } :

Slide 116

Slide 116 text

No content

Slide 117

Slide 117 text

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; } } }

Slide 118

Slide 118 text

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; } } }

Slide 119

Slide 119 text

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"; } } }

Slide 120

Slide 120 text

No content

Slide 121

Slide 121 text

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

Slide 122

Slide 122 text

No content

Slide 123

Slide 123 text

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; } } } }

Slide 124

Slide 124 text

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; } } } }

Slide 125

Slide 125 text

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"; } } } }

Slide 126

Slide 126 text

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"; } } } }

Slide 127

Slide 127 text

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"; } } } }

Slide 128

Slide 128 text

class JankenGame { function play(int $leftHand, int $rightHand) { $game = new JankenGame(); $game->play(1, 2);

Slide 129

Slide 129 text

class JankenGame { function play(int $leftHand, int $rightHand) { $game = new JankenGame(); $game->play(1, 2);

Slide 130

Slide 130 text

class JankenGame { function play(int $leftHand, int $rightHand) { $game = new JankenGame(); $game->play(1, 2);

Slide 131

Slide 131 text

No content

Slide 132

Slide 132 text

OOP TIPS

Slide 133

Slide 133 text

No content

Slide 134

Slide 134 text

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"; } }

Slide 135

Slide 135 text

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"; } } }

Slide 136

Slide 136 text

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"; } } }

Slide 137

Slide 137 text

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"; } } }

Slide 138

Slide 138 text

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"; } } }

Slide 139

Slide 139 text

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"; } } }

Slide 140

Slide 140 text

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"; } } }

Slide 141

Slide 141 text

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"; } } }

Slide 142

Slide 142 text

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"; } } }

Slide 143

Slide 143 text

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"; } } }

Slide 144

Slide 144 text

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"; } } }

Slide 145

Slide 145 text

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"; } } }

Slide 146

Slide 146 text

No content

Slide 147

Slide 147 text

No content

Slide 148

Slide 148 text

No content

Slide 149

Slide 149 text

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"; } } }

Slide 150

Slide 150 text

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"; } } }

Slide 151

Slide 151 text

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"; } } }

Slide 152

Slide 152 text

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"; } } }

Slide 153

Slide 153 text

No content

Slide 154

Slide 154 text

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

Slide 155

Slide 155 text

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"; } } }

Slide 156

Slide 156 text

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); } }

Slide 157

Slide 157 text

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); } }

Slide 158

Slide 158 text

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

Slide 159

Slide 159 text

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

Slide 160

Slide 160 text

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

Slide 161

Slide 161 text

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

Slide 162

Slide 162 text

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

Slide 163

Slide 163 text

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

Slide 164

Slide 164 text

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

Slide 165

Slide 165 text

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

Slide 166

Slide 166 text

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

Slide 167

Slide 167 text

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 "負け"; } } }

Slide 168

Slide 168 text

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

Slide 169

Slide 169 text

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"; } } }

Slide 170

Slide 170 text

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); }

Slide 171

Slide 171 text

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); }

Slide 172

Slide 172 text

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); }

Slide 173

Slide 173 text

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(); } }

Slide 174

Slide 174 text

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(); } }

Slide 175

Slide 175 text

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(); } }

Slide 176

Slide 176 text

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(); } }

Slide 177

Slide 177 text

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(); } }

Slide 178

Slide 178 text

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(); } }

Slide 179

Slide 179 text

No content

Slide 180

Slide 180 text

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(); } }

Slide 181

Slide 181 text

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(); } }

Slide 182

Slide 182 text

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(); } }

Slide 183

Slide 183 text

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(); } }

Slide 184

Slide 184 text

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

Slide 185

Slide 185 text

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

Slide 186

Slide 186 text

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);

Slide 187

Slide 187 text

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);

Slide 188

Slide 188 text

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);

Slide 189

Slide 189 text

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);

Slide 190

Slide 190 text

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);

Slide 191

Slide 191 text

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);

Slide 192

Slide 192 text

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);

Slide 193

Slide 193 text

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);

Slide 194

Slide 194 text

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);

Slide 195

Slide 195 text

$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);

Slide 196

Slide 196 text

$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);

Slide 197

Slide 197 text

$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);

Slide 198

Slide 198 text

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);

Slide 199

Slide 199 text

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);

Slide 200

Slide 200 text

No content

Slide 201

Slide 201 text

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);

Slide 202

Slide 202 text

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);

Slide 203

Slide 203 text

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"; } } }

Slide 204

Slide 204 text

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"; } } }

Slide 205

Slide 205 text

interface DisplayInterface { function show(int $result); }

Slide 206

Slide 206 text

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"; } } }

Slide 207

Slide 207 text

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"; } } }

Slide 208

Slide 208 text

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"; } } }

Slide 209

Slide 209 text

No content

Slide 210

Slide 210 text

No content

Slide 211

Slide 211 text

OOP TIPS

Slide 212

Slide 212 text

No content

Slide 213

Slide 213 text

No content

Slide 214

Slide 214 text

No content

Slide 215

Slide 215 text

No content

Slide 216

Slide 216 text

No content

Slide 217

Slide 217 text

No content

Slide 218

Slide 218 text

No content

Slide 219

Slide 219 text

No content

Slide 220

Slide 220 text

No content

Slide 221

Slide 221 text

No content

Slide 222

Slide 222 text

No content

Slide 223

Slide 223 text

No content

Slide 224

Slide 224 text

No content

Slide 225

Slide 225 text

No content

Slide 226

Slide 226 text

No content

Slide 227

Slide 227 text

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); } :

Slide 228

Slide 228 text

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); } :

Slide 229

Slide 229 text

interface ResultGateWayInterface { function save(int $leftHand, int $rightHand, int $result); }

Slide 230

Slide 230 text

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 : } }

Slide 231

Slide 231 text

OOP TIPS

Slide 232

Slide 232 text

No content

Slide 233

Slide 233 text

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); } : }

Slide 234

Slide 234 text

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); } : }

Slide 235

Slide 235 text

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); } : }

Slide 236

Slide 236 text

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); } : }

Slide 237

Slide 237 text

No content

Slide 238

Slide 238 text

No content

Slide 239

Slide 239 text

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); } : }

Slide 240

Slide 240 text

interface DisplayInterface { function win(); function draw(); function lose(); } class JapaneseDisplay implements DisplayInterface { function win() { echo "勝ち"; } function draw() { echo "引き分け"; } function lose() { echo "負け"; } }

Slide 241

Slide 241 text

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(); }

Slide 242

Slide 242 text

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(); }

Slide 243

Slide 243 text

interface DisplayInterface { function win(); function draw(); function lose(); } class JapaneseDisplay implements DisplayInterface { function win() { echo "勝ち"; } function draw() { echo "引き分け"; } function lose() { echo "負け"; } }

Slide 244

Slide 244 text

No content

Slide 245

Slide 245 text

No content

Slide 246

Slide 246 text

No content

Slide 247

Slide 247 text

No content

Slide 248

Slide 248 text

No content

Slide 249

Slide 249 text

No content

Slide 250

Slide 250 text

No content

Slide 251

Slide 251 text

No content

Slide 252

Slide 252 text

No content

Slide 253

Slide 253 text

No content

Slide 254

Slide 254 text

No content

Slide 255

Slide 255 text

No content

Slide 256

Slide 256 text

No content

Slide 257

Slide 257 text

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; } }

Slide 258

Slide 258 text

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; } }

Slide 259

Slide 259 text

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; } }

Slide 260

Slide 260 text

No content

Slide 261

Slide 261 text

No content

Slide 262

Slide 262 text

No content

Slide 263

Slide 263 text

No content

Slide 264

Slide 264 text

No content

Slide 265

Slide 265 text

No content

Slide 266

Slide 266 text

No content

Slide 267

Slide 267 text

No content

Slide 268

Slide 268 text

No content

Slide 269

Slide 269 text

No content

Slide 270

Slide 270 text

No content

Slide 271

Slide 271 text

No content

Slide 272

Slide 272 text

No content

Slide 273

Slide 273 text

No content