/**
* Create the filename for a resource.
*
* @param string $type The resource type to create the filename for.
* @param array $parts An associative array of filename information. Optional.
*
* @return string The filename.
*
* @since 3.0
*/
public static function createFileName($type, $parts = array())
{
$filename = '';
switch ($type) {
case 'controller':
if (!empty($parts['format'])) {
if ($parts['format'] === 'html') {
$parts['format'] = '';
} else {
$parts['format'] = '.' . $parts['format'];
}
} else {
$parts['format'] = '';
}
$filename = strtolower($parts['name'] . $parts['format'] . '.php');
break;
case 'view':
if (!empty($parts['type'])) {
$parts['type'] = '.' . $parts['type'];
} else {
$parts['type'] = '';
}
$filename = strtolower($parts['name'] . '/view' . $parts['type'] . '.php');
break;
}
return $filename;
}