pocketmine\inventory\BaseInventory::contains PHP Method

contains() public method

public contains ( Item $item )
$item pocketmine\item\Item
    public function contains(Item $item)
    {
        $count = max(1, $item->getCount());
        $checkDamage = $item->getDamage() === null ? false : true;
        $checkTags = $item->getCompoundTag() === null ? false : true;
        foreach ($this->getContents() as $i) {
            if ($item->equals($i, $checkDamage, $checkTags)) {
                $count -= $i->getCount();
                if ($count <= 0) {
                    return true;
                }
            }
        }
        return false;
    }