1<?php
2/*
3 * This file is part of PHPUnit.
4 *
5 * (c) Sebastian Bergmann <sebastian@phpunit.de>
6 *
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
9 */
10
11/**
12 * Filesystem helpers.
13 */
14class PHPUnit_Util_Filesystem
15{
16    /**
17     * @var array
18     */
19    protected static $buffer = [];
20
21    /**
22     * Maps class names to source file names:
23     *   - PEAR CS:   Foo_Bar_Baz -> Foo/Bar/Baz.php
24     *   - Namespace: Foo\Bar\Baz -> Foo/Bar/Baz.php
25     *
26     * @param string $className
27     *
28     * @return string
29     */
30    public static function classNameToFilename($className)
31    {
32        return str_replace(
33            ['_', '\\'],
34            DIRECTORY_SEPARATOR,
35            $className
36        ) . '.php';
37    }
38}
39