protected function mediaParent(OutputBlock $scope) { while (!empty($scope->parent)) { if (!empty($scope->type) && $scope->type !== Type::T_MEDIA) { break; } $scope = $scope->parent; } return $scope; }