Skip to content

Instantly share code, notes, and snippets.

@chanmix51
Last active December 15, 2015 23:20
Show Gist options
  • Save chanmix51/5339848 to your computer and use it in GitHub Desktop.
Save chanmix51/5339848 to your computer and use it in GitHub Desktop.
<?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
<?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