Use a new function to remove duplicated code

Status Job ID Name Coverage
  Test
passed #13963
test:php

00:00:22

passed #13962
allowed to fail
test:typoscript

00:00:24

passed #13964
test:unit

00:03:07

 
  Build
passed #13965
build

00:00:35

 
  Layout
passed #13966
layout

00:01:49