Created
February 22, 2012 14:16
文学的PHP ref: http://qiita.com/items/2730
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 | |
/** | |
* 吾輩は猫である | |
* | |
* @author Souseki Natsume | |
* @author Keisuke SATO <riaf@me.com> | |
*/ | |
// 吾輩は猫である | |
$me = new Cat; | |
// 名前はまだ無い | |
if (!$me->getName()) { | |
throw new Exception('undefined name'); | |
} |
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 | |
class Cat | |
{ | |
protected $name; | |
public function getName() | |
{ | |
return $this->name; | |
} | |
public function setName($name) | |
{ | |
$this->name = $name; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment