MigrationVersion::_loadFile PHP Method

_loadFile() protected method

Load a file based on name and type
protected _loadFile ( string $name, string $type ) : mixed
$name string File name to be loaded
$type string Can be 'app' or a plugin name
return mixed Throw an exception in case of no file found, array with mapping
    protected function _loadFile($name, $type)
    {
        $path = APP . 'Config' . DS . 'Migration' . DS;
        if ($type !== 'app') {
            $path = CakePlugin::path(Inflector::camelize($type)) . 'Config' . DS . 'Migration' . DS;
        }
        if (!file_exists($path . $name . '.php')) {
            throw new MigrationVersionException(sprintf(__d('migrations', 'File `%1$s` not found in the %2$s.'), $name . '.php', $type === 'app' ? 'Application' : Inflector::camelize($type) . ' Plugin'));
        }
        include $path . $name . '.php';
        return true;
    }