newInstanceArgs($args); } } /** * Exception, thrown when a required file does not exist. * * @package BasicWeb */ class FileNotFoundError extends \RuntimeException { /** * Create a new FileNotFoundError instance. * * Sets an error message of the form 'File "path/to/file.php" does not exist.'. * * @param string $path Path to the file that does not exist. */ function __construct($path) { $this->message = sprintf('File "%s" does not exist.', $path); } } /** * Format a string using parameters in an associative array. * * * echo asprintf('foo %(bar)', array('bar' => 'baz')); // prints 'foo baz' * * * @param string $format The string to format. * @param array $params An associative array with parameters that are used in $format. * @package BasicWeb */ function asprintf($format, array $params) { return preg_replace_callback( '/%\(([a-z-_ ]*)\)/i', function ($matches) use ($params) { return (string)$params[$matches[1]]; }, $format ); } ?>