This file is indexed.

/usr/share/php/propel/util/PropelAutoloader.php is in php-propel-runtime 1.6.9-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php

/**
 * This file is part of the Propel package.
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @license    MIT License
 */

/**
 * Simple autoloader for Propel generated model classes.
 * This class implements the singleton pattern.
 *
 * @author     Prancois Zaninotto
 * @author     Fabien Potencier
 * @version    $Revision$
 * @package    propel.util
 */
class PropelAutoloader
{

    protected static $instance = null;

    protected $classes = array();

    /**
     * Retrieves the singleton instance of this class.
     *
     * @return PropelAutoloader A PropelAutoloader instance.
     */
    public static function getInstance()
    {
        if (!isset(self::$instance)) {
            self::$instance = new PropelAutoloader();
        }

        return self::$instance;
    }

    /**
     * Register PropelAutoloader in spl autoloader.
     *
     * @return void
     *
     * @throws Exception
     */
    public static function register()
    {
        ini_set('unserialize_callback_func', 'spl_autoload_call');

        if (false === spl_autoload_register(array(self::getInstance(), 'autoload'))) {
            throw new Exception(sprintf('Unable to register %s::autoload as an autoloading method.', get_class(self::getInstance())));
        }
    }

    /**
     * Unregister PropelAutoloader from spl autoloader.
     *
     * @return void
     */
    public static function unregister()
    {
        spl_autoload_unregister(array(self::getInstance(), 'autoload'));
    }

    /**
     * Sets the path for a list of classes.
     *
     * @param array $classMap An associative array $className => $classPath
     */
    public function addClassPaths($classMap)
    {
        $this->classes = array_merge($this->classes, $classMap);
    }

    /**
     * Sets the path for a particular class.
     *
     * @param string $class A PHP class name
     * @param string $path  A path (absolute or relative to the include path)
     */
    public function addClassPath($class, $path)
    {
        $this->classes[$class] = $path;
    }

    /**
     * Returns the path where a particular class can be found.
     *
     * @param string $class A PHP class name
     *
     * @return string|null A path (absolute or relative to the include path)
     */
    public function getClassPath($class)
    {
        return isset($this->classes[$class]) ? $this->classes[$class] : null;
    }

    /**
     * Handles autoloading of classes that have been registered in this instance
     *
     * @param string $class A class name.
     *
     * @return boolean Returns true if the class has been loaded
     */
    public function autoload($class)
    {
        if (isset($this->classes[$class])) {
            require $this->classes[$class];

            return true;
        }
        // fallback for classes defined with leading backslash
        if (strpos($class, '\\') === 0) {
            $class = substr($class, 1);

            return $this->autoload($class);
        }

        return false;
    }
}