Create a file Yii.php in the protected.components folder and create a class called Yii extending the YiiBase

classYiiextendsYiiBase{
}

At the moment Yii::createComponent allows you to pass in constructor arguments as extra arguments in the function. However we want to pass in extra arguments through our configuration array (we will need this for our super simplified UrlRule component later)
This is perfectly fine since you can't have variable with numeric names in PHP.

Our overload looks like this (copy/paste from the createComponent source with a couple of extra lines of code).

classYiiextendsYiiBase{
/**
* Creates an object and initializes it based on the given configuration.
*
* The specified configuration can be either a string or an array.
* If the former, the string is treated as the object type which can
* be either the class name or {@link YiiBase::getPathOfAlias class path alias}.
* If the latter, the 'class' element is treated as the object type,
* and the rest of the name-value pairs in the array are used to initialize
* the corresponding object properties.
*
* Any additional parameters passed to this method will be
* passed to the constructor of the object being created.
*
* @param mixed $config the configuration. It can be either a string or an array.
* @return mixed the created object
* @throws CException if the configuration does not have a 'class' element.
*/publicstaticfunctioncreateComponent($config){
if(is_string($config))
{
$type=$config;
$config=array();
}
elseif(isset($config['class']))
{
$type=$config['class'];
unset($config['class']);
}
elsethrownew CException(Yii::t('yii','Object configuration must be an array containing a "class" element.'));
if(!class_exists($type,false))
$type=Yii::import($type,true);
if(($n=func_num_args())>1)
{
$args=func_get_args();
if($n===2)
$object=new$type($args[1]);
elseif($n===3)
$object=new$type($args[1],$args[2]);
elseif($n===4)
$object=new$type($args[1],$args[2],$args[3]);
else
{
unset($args[0]);
$class=new ReflectionClass($type);
// Note: ReflectionClass::newInstanceArgs() is available for PHP 5.1.3+// $object=$class->newInstanceArgs($args);$object=call_user_func_array(array($class,'newInstance'),$args);
}
}
else
{
$args=array();
foreach($configas$k => $v)
if (is_int($k)) {
$args[] = $v;
unset($config[$k]);
}
$n = count($args);
if ($n===0)
$object=new$type;
elseif ($n===1)
$object = new$type($args[0]);
elseif($n===2)
$object = new$type($args[0], $args[1]);
elseif($n===3)
$object = new$type($args[0], $args[1], $args[2]);
}
foreach($configas$key=>$value)
$object->$key=$value;
return$object;
}
}

Of course we now need to use our Bootstrapping class instead of the default empty class provided by the framework. To do this we need to go to our public folder and edit the index.php