public function runlevelFromString($runlevel) { // query whether the passed string representation is a valid runlevel if (Runlevels::singleton()->isRunlevel($runlevel)) { return Runlevels::singleton()->getRunlevel($runlevel); } // throw an exception if the runlevel is unknown throw new \Exception(sprintf('Request invalid runlevel to string conversion for %s', $runlevel)); }