protected function atLeastOneExport(array $chapters) { foreach ($chapters as $key => $val) { if (is_array($val)) { if ($this->atLeastOneExport($val)) { return true; } } elseif ('export' == (string) $key && $val) { return true; } } return false; }