public function runlevelToString($runlevel) { // flip the array with the string => integer runlevel definitions $runlevels = array_flip(Runlevels::singleton()->getRunlevels()); if (isset($runlevels[$runlevel])) { return $runlevels[$runlevel]; } // throw an exception if the runlevel is unknown throw new \Exception(sprintf('Request invalid runlevel to string conversion for %s', $runlevel)); }