Last active
December 15, 2015 23:20
-
-
Save chanmix51/5339848 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Entity extends \Pomm\Object\BaseObject | |
{ | |
public function getMeFive() | |
{ | |
return 5; | |
} | |
} | |
// bugged version | |
$entity = new Entity(); | |
$entity->hasMeFive(); // true | |
$entity->has('me_five'); // true | |
$entity->clearMeFive(); // ERROR | |
// fixed version | |
$entity = new Entity(); | |
$entity->hasMeFive(); // false | |
$entity->has('me_five'); // false | |
$entity->clearMeFive(); // null | |
This file contains hidden or 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 Entity extends \Pomm\Object\BaseObject | |
{ | |
public function getMeMore() | |
{ | |
return $this->getA() / $this->getB(); | |
} | |
public function hasMeMore() | |
{ | |
return $this->hasA() and $this->hasB() and $this->getB() !== 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment