Newscoop\Subscription\Subscription::hasSection PHP Method

hasSection() private method

Test if has given section
private hasSection ( Section $section, array $languages ) : boolean
$section Newscoop\Entity\Section
$languages array
return boolean
    private function hasSection(\Newscoop\Entity\Section $section, array $languages)
    {
        foreach ($this->sections as $s) {
            if ($s->getSectionNumber() == $section->getNumber()) {
                if (!$s->hasLanguage()) {
                    return true;
                } else {
                    if (empty($languages)) {
                        $s->setLanguage(null);
                        return true;
                    } else {
                        if ($s->getLanguage() == $section->getLanguage()) {
                            return true;
                        }
                    }
                }
            }
        }
        return false;
    }