Guess the package path for the provider.

@return string
166098
public function guessPackagePath()
    {
        $reflection = new ReflectionClass($this);

        $path = $reflection->getFileName();

        return realpath(dirname($path) .'/../');
    }
340310
public function getPluginPath()
    {
        if (empty($this->_plugin_path)) {
            $this->_plugin_path = $this->getConsoleHome() . '/plugins';
        }

        return $this->_plugin_path;
    }
769462
public function resolve(): string
    {
        $packageType = $this->composer->getPackage()->getType();
        return array_key_exists($packageType, $this->mapping)
            ? $this->mapping[$packageType]
            : 'default';
    }
988155
public function asPath()
    {
        if ($this->isClass() || $this->isInterface() || $this->isTrait() || $this->isException()) {
            return strtolower(str_replace('.', '/', str_replace('\\', '/', $this->_package)).'/'.$this->_name.'.html');
        } elseif ($this->isField()) {
            $class =& $this->containingClass();
            if ($class) {
                return strtolower(str_replace('.', '/', str_replace('\\', '/', $this->_package)).'/'.$class->name().'.html#').$this->_name;
            } else {
                return strtolower(str_replace('.', '/', str_replace('\\', '/', $this->_package)).'/package-globals.html#').$this->_name;
            }
        } elseif ($this->isConstructor() || $this->isMethod()) {
            $class =& $this->containingClass();
            if ($class) {
                return strtolower(str_replace('.', '/', str_replace('\\', '/', $this->_package)).'/'.$class->name().'.html#').$this->_name.'()';
            } else {
                return strtolower(str_replace('.', '/', str_replace('\\', '/', $this->_package)).'/package-functions.html#').$this->_name.'()';
            }
        } elseif ($this->isGlobal()) {
            return strtolower(str_replace('.', '/', str_replace('\\', '/', $this->_package)).'/package-globals.html#').$this->_name;
        } elseif ($this->isFunction()) {
            return strtolower(str_replace('.', '/', str_replace('\\', '/', $this->_package)).'/package-functions.html#').$this->_name.'()';
        }

        return NULL;
    }
1061946
private function getPaths()
    {
        $paths = array_dot(['path' => $this->getLaravelPaths()]);
        collect(array_keys(get_class_vars(get_class($this))))->filter(function ($propertyName) {
            return ends_with($propertyName, 'Path');
        })->each(function ($propertyName) use (&$paths) {
            $paths[ $propertyName ] = $this->{$propertyName};
        });
        $paths[ 'packagePath' ] = $this->getRootDir();

        return $paths;
    }
90106
public function findPackageConfiguration($package)
    {
        $paths = [
            $this->paths->getBasePath().'vendor/%s/src/config',
            $this->paths->getBasePath().'vendor/%s/config',
            $this->paths->getRocketeerPath().'/vendor/%s/src/config',
            $this->paths->getRocketeerPath().'/vendor/%s/config',
            $this->paths->getUserHomeFolder().'/.composer/vendor/%s/src/config',
            $this->paths->getUserHomeFolder().'/.composer/vendor/%s/config',
        ];

        // Check for the first configuration path that exists
        $paths = array_map(function ($path) use ($package) {
            return sprintf($path, $package);
        }, $paths);

        return $paths;
    }
1174876
protected function getMigrationPath()
    {
        $path = $this->input->getOption('path');

        if (!is_null($realPath = $this->input->getOption('realpath'))) {
            return $realPath;
        }

        if (!is_null($package = $this->input->getOption('package'))) {
            is_null($path) && $path = 'resources/migrations';

            return $this->packagePath . '/' . $package . '/' . $path;
        }

        if (!is_null($path)) {
            return $this->laravel['path.base'] . '/' . $path;
        }

        return $this->laravel['path.database'] . '/migrations';
    }
710149
public function getComposerPackageName()
    {
        if (null === $this->packages) {
            $this->initialize();
        }

        return $this->assetType->formatComposerName($this->packageName);
    }
1359706
public function getBlockPath()
    {
        if ($this->getPackageID() > 0) {
            $pkgHandle = $this->getPackageHandle();
            $dirp = (is_dir(DIR_PACKAGES . '/' . $pkgHandle)) ? DIR_PACKAGES : DIR_PACKAGES_CORE;
            $dir = $dirp . '/' . $pkgHandle . '/' . DIRNAME_BLOCKS . '/' . $this->getBlockTypeHandle();
        } else {
            if (is_dir(DIR_FILES_BLOCK_TYPES . '/' . $this->getBlockTypeHandle())) {
                $dir = DIR_FILES_BLOCK_TYPES . '/' . $this->getBlockTypeHandle();
            } else {
                $dir = DIR_FILES_BLOCK_TYPES_CORE . '/' . $this->getBlockTypeHandle();
            }
        }

        return $dir;
    }
630688
public static function getDirPath()
    {
        $dir = Composer::getComposerVendorDir().'/config';
        self::$dirPath = self::$dirPath === null ? $dir : self::$dirPath;
        self::$dirPath = str_replace('\\', '/', self::$dirPath);
        return self::$dirPath;
    }
832355
protected function getPath()
    {
        if (null === $this->parent) {
            return null;
        }
        if (null !== ( $pPath = $this->parent->getPath() )) {
            return $pPath . '.' . $this->handle;
        }else {
            return $this->handle;
        }
    }
70359
public function getPackageRoot()
    {
        $type = $this->getPackageType();
        if ($type === self::TYPE_PSEUDO) {
            return false;
        }

        if (is_string($this->packageRoot)) {
            return $this->packageRoot;
        }

        //determine where it is located
        //luckily we know where we are in vendor folder :)
        //is there a better recommended way?
        $root = __DIR__ . '/../../..';

        //HAX using the composer package to get the root of the vendor folder
        //is there a better recommended way?
        if (class_exists(SpdxLicenses::class)
            && method_exists(SpdxLicenses::class, 'getResourcesDir')
            && realpath(SpdxLicenses::getResourcesDir() . '/../../..')
        ) {
            $root = realpath(SpdxLicenses::getResourcesDir() . '/../../..');
        }

        //if it's a root package
        if ($type === self::TYPE_ROOT) {
            $root .= '/..';
        }

        $this->packageRoot = realpath($root);

        return $this->packageRoot;
    }
863772
public function getServerPath()
    {
        if (is_null($this->_serverPath)) {
            $this->_resourceTypeConfig = $this->getResourceTypeConfig();
            $this->_serverPath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_resourceTypeConfig->getDirectory(), ltrim($this->_clientPath, "/"));
        }

        return $this->_serverPath;
    }
741578
public function guess()
    {
        // Try fully qualified namespace
        if (class_exists($class = $this->namespaceBase.'\\'.$this->namespaceSuffix.'\\'.$this->contextClass)) {
            return $class;
        } 
        // Fall back to namespace with SilverStripe prefix
        // TODO Remove once core has namespace capabilities for modules
        if (class_exists($class = 'SilverStripe\\'.$this->namespaceBase.'\\'.$this->namespaceSuffix.'\\'.$this->contextClass)) {
            return $class;
        }
    }
1316304
protected function getBuildRoot() {

    $extra = $this->package->getExtra();
    $paths = isset($extra['installer-paths']) ? $extra['installer-paths'] : [];
    foreach ($paths as $path => $types) {
      if (in_array("type:drupal-core", $types)) {
        return str_replace('/core', '', $path);
      }
    }

    throw new InstallerPathsNotFoundException();
  }
1336044
protected function getSymlinkSourcePath(PackageInterface $package)
    {
        if (null != $this->config->getSymlinkBasePath()) {
            $targetDir = $package->getTargetDir();
            $sourcePath =
                $this->config->getSymlinkBasePath()
                . '/' . $package->getPrettyName()
                . '/' . $package->getPrettyVersion()
                . ($targetDir ? '/' . $targetDir : '')
            ;
        } else {
            $sourcePath = $this->getInstallPath($package);
        }

        return $sourcePath;
    }
1221117
private function get_packages()
    {
        if ($this->input->getOption('all') === true) {
            $packages = [];
            
            // Add all package files to $packages array.
            foreach (Config::get('services.providers') as $package) {
                $packages[ $package ] = $package::get_files_to_publish();
            }

            return $packages;
        }

        $package = $this->input->getOption('package');

        // If no package specified.
        if ($package === null) {
            $package = $this->package_prompt();
        }

        // If the package chosen does not exist.
        if (! \class_exists($package)) {
            $this->output->writeln("<error>The package [$package] could not be found.</error>");
            exit;
        }

        // When running publish via the theme installer, the current theme isn't active yet.
        // We need to trick WP into thinking it is.
        if (isset($this->root)) {
            $parts = \explode('/', $this->root);

            if ($parts[0] == $this->root) {
                $parts = \explode('\\', $this->root);
            }

            $theme_name = \end($parts);

            \add_filter(
                'stylesheet',
                function () use ($theme_name) {
                    return $theme_name;
                }
            );
            \add_filter(
                'template',
                function () use ($theme_name) {
                    return $theme_name;
                }
            );

            // Resolve the package manually.
            $provider = Container::resolve($package);
            $provider->register();
        }

        return [
            $package => $package::get_files_to_publish(),
        ];
    }