Created
April 15, 2018 04:26
-
-
Save localdisk/833cd43f7cdf9b0ab9c9e424cf1b1a78 to your computer and use it in GitHub Desktop.
Interfaceとclassを1ファイル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace Localdisk\Cart; | |
interface CartInterface | |
{ | |
public function add(Product $product): void; | |
} | |
class SesssionCart implements CartInterface | |
{ | |
public function add(Product $product) | |
{ | |
// 実装 | |
} | |
} | |
// 1. DBに入る Cart も作りたい | |
// 2. んーファイル分割するか | |
// 2-1. Interface は Localdisk\Cart\Interfaces に置くか | |
// use 書き換えるのめんどくさい…(PhpStormさん、ちゃんとやってくれるんだっけ…? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment