/**
 * Determine if section exists.
 *
 * @param string $section Section name.
 *
 * @return bool Returns true or false section doesnt exists.
 */
public function hasSection(string $section): bool

Examples

if ($view->hasSection('foo')) {
    // do something...
}