- sprintf: documentation ( source)
<?php
class Process
{
/**
* Ensures the process is running or terminated, throws a LogicException if the process has a not started.
*
* @param $functionName The function name that was called.
*
* @throws LogicException If the process has not run.
*/
public function requireProcessHasRun($functionName)
{
if (true) {
throw new LogicException(sprintf('Process must be started before calling %s.', $functionName));
}
}
}
$p = new Process();
$p->requireProcessHasRun('S');