当前位置: 首页>>代码示例>>PHP>>正文


PHP Package::getClass方法代码示例

本文整理汇总了PHP中Package::getClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Package::getClass方法的具体用法?PHP Package::getClass怎么用?PHP Package::getClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Package的用法示例。


在下文中一共展示了Package::getClass方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute(Batch $batch)
 {
     $packages = $batch->getObjectCollection('package');
     if (!$packages) {
         return;
     }
     foreach ($packages->getPackages() as $package) {
         if (!$package->getPublisherValidator()->skipItem()) {
             $pkg = \Package::getClass($package->getHandle());
             if (!$pkg->isPackageInstalled()) {
                 $pkg->install();
             }
         }
     }
 }
开发者ID:motoki1199,项目名称:addon_migration_tool,代码行数:15,代码来源:CreatePackagesRoutine.php

示例2: registerPackage

 public function registerPackage($pkg)
 {
     if (is_string($pkg)) {
         $pkg = \Package::getClass($pkg);
     }
     $pkgHandle = $pkg->getPackageHandle();
     $loader = new ModifiedPSR4ClassLoader();
     $loader->addPrefix(NAMESPACE_SEGMENT_VENDOR . '\\Package\\' . camelcase($pkgHandle) . '\\Attribute', DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_ATTRIBUTES);
     $loader->addPrefix(NAMESPACE_SEGMENT_VENDOR . '\\Package\\' . camelcase($pkgHandle) . '\\MenuItem', DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_MENU_ITEMS);
     $loader->addPrefix(NAMESPACE_SEGMENT_VENDOR . '\\Package\\' . camelcase($pkgHandle) . '\\Authentication', DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_AUTHENTICATION);
     $loader->addPrefix(NAMESPACE_SEGMENT_VENDOR . '\\Package\\' . camelcase($pkgHandle) . '\\Block', DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_BLOCKS);
     $loader->addPrefix(NAMESPACE_SEGMENT_VENDOR . '\\Package\\' . camelcase($pkgHandle) . '\\Theme', DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_THEMES);
     $loader->addPrefix(NAMESPACE_SEGMENT_VENDOR . '\\Package\\' . camelcase($pkgHandle) . '\\Controller\\PageType', DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_CONTROLLERS . '/' . DIRNAME_PAGE_TYPES);
     $loader->addPrefix(NAMESPACE_SEGMENT_VENDOR . '\\Package\\' . camelcase($pkgHandle) . '\\Controller', DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_CONTROLLERS);
     $loader->addPrefix(NAMESPACE_SEGMENT_VENDOR . '\\Package\\' . camelcase($pkgHandle) . '\\Job', DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_JOBS);
     $this->loaders[] = $loader;
     $loader->register();
     $loader = new Psr4ClassLoader();
     $loaders = $pkg->getPackageAutoloaderRegistries();
     if (count($loaders) > 0) {
         foreach ($loaders as $path => $prefix) {
             $loader->addPrefix($prefix, DIR_PACKAGES . '/' . $pkgHandle . '/' . $path);
         }
     }
     /** @type Package $pkg */
     if (!$pkg->shouldEnableLegacyNamespace()) {
         // We map all src files in the package to the src/Concrete directory
         $loader->addPrefix(NAMESPACE_SEGMENT_VENDOR . '\\Package\\' . camelcase($pkgHandle), DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_CLASSES . '/Concrete');
         $loader->addPrefix(NAMESPACE_SEGMENT_VENDOR . '\\Package\\' . camelcase($pkgHandle) . '\\Entity', DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_CLASSES . '/Entity');
     } else {
         // legacy Src support
         $loader->addPrefix(NAMESPACE_SEGMENT_VENDOR . '\\Package\\' . camelcase($pkgHandle) . '\\Src', DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_CLASSES);
     }
     $this->loaders[] = $loader;
     $loader->register();
     $this->registerPackageController($pkgHandle);
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:37,代码来源:ClassLoader.php

示例3: registerPackage

 /**
  * Registers the prefixes for a package
  *
  * The following prefixes are registered:
  * <ul>
  * <li>`Concrete\Package\PkgHandle\Attribute` -> `packages/pkg_handle/attributes`</li>
  * <li>`Concrete\Package\PkgHandle\MenuItem` -> `packages/pkg_handle/menu_items`</li>
  * <li>`Concrete\Package\PkgHandle\Authentication` -> `packages/pkg_handle/authentication`</li>
  * <li>`Concrete\Package\PkgHandle\Block` -> `packages/pkg_handle/blocks`</li>
  * <li>`Concrete\Package\PkgHandle\Theme` -> `packages/pkg_handle/themes`</li>
  * <li>`Concrete\Package\PkgHandle\Controller\PageType` -> `packages/pkg_handle/controllers/page_type`</li>
  * <li>`Concrete\Package\PkgHandle\Controller` -> `packages/pkg_handle/controllers`</li>
  * <li>`Concrete\Package\PkgHandle\Job` -> `packages/pkg_handle/jobs`</li>
  * </ul>
  *
  * If Package::$pkgAutoloaderMapCoreExtensions is true, all remaining class paths will be checked for
  * under packages/pkg_handle/src/Concrete
  *
  * Otherwise, `Concrete\Package\PkgHandle\Src` -> `packages/pkg_handle/src` will be registered
  *
  * The function Package::getPackageAutoloaderRegistries() can be used to add custom prefixes
  *
  * @param string|\Package $pkg Package handle or an instance of the package controller
  * @see Package::$pkgAutoloaderMapCoreExtensions, Package::getPackageAutoloaderRegistries()
  */
 public function registerPackage($pkg)
 {
     if (!$pkg instanceof Package) {
         $pkg = \Package::getClass($pkg);
     }
     $pkgHandle = $pkg->getPackageHandle();
     $symfonyLoader = new ModifiedPSR4ClassLoader();
     $symfonyLoader->addPrefix(NAMESPACE_SEGMENT_VENDOR . '\\Package\\' . camelcase($pkgHandle) . '\\Attribute', DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_ATTRIBUTES);
     $symfonyLoader->addPrefix(NAMESPACE_SEGMENT_VENDOR . '\\Package\\' . camelcase($pkgHandle) . '\\MenuItem', DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_MENU_ITEMS);
     $symfonyLoader->addPrefix(NAMESPACE_SEGMENT_VENDOR . '\\Package\\' . camelcase($pkgHandle) . '\\Authentication', DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_AUTHENTICATION);
     $symfonyLoader->addPrefix(NAMESPACE_SEGMENT_VENDOR . '\\Package\\' . camelcase($pkgHandle) . '\\Block', DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_BLOCKS);
     $symfonyLoader->addPrefix(NAMESPACE_SEGMENT_VENDOR . '\\Package\\' . camelcase($pkgHandle) . '\\Theme', DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_THEMES);
     $symfonyLoader->addPrefix(NAMESPACE_SEGMENT_VENDOR . '\\Package\\' . camelcase($pkgHandle) . '\\Controller\\PageType', DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_CONTROLLERS . '/' . DIRNAME_PAGE_TYPES);
     $symfonyLoader->addPrefix(NAMESPACE_SEGMENT_VENDOR . '\\Package\\' . camelcase($pkgHandle) . '\\Controller', DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_CONTROLLERS);
     $symfonyLoader->addPrefix(NAMESPACE_SEGMENT_VENDOR . '\\Package\\' . camelcase($pkgHandle) . '\\Job', DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_JOBS);
     $strictLoader = new SymfonyClassLoader();
     $loaders = $pkg->getPackageAutoloaderRegistries();
     if (count($loaders) > 0) {
         foreach ($loaders as $path => $prefix) {
             $strictLoader->addPrefix($prefix, DIR_PACKAGES . '/' . $pkgHandle . '/' . $path);
         }
     }
     if ($pkg->providesCoreExtensionAutoloaderMapping()) {
         // We map all src files in the package to the src/Concrete directory
         $strictLoader->addPrefix(NAMESPACE_SEGMENT_VENDOR . '\\Package\\' . camelcase($pkgHandle), DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_CLASSES . '/Concrete');
     } else {
         // legacy Src support
         $strictLoader->addPrefix(NAMESPACE_SEGMENT_VENDOR . '\\Package\\' . camelcase($pkgHandle) . '\\Src', DIR_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_CLASSES);
     }
     $symfonyLoader->register();
     $strictLoader->register();
     $this->registerPackageController($pkgHandle);
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:58,代码来源:ClassLoader.php

示例4: core_class

/**
 *  Returns a concrete5 namespaced class. $prefix is either true (for application), or a package handle or null.
 *
 * @param string $class
 * @param bool   $prefix
 * @return string
 */
function core_class($class, $prefix = false)
{
    $class = trim($class, '\\');
    if ($prefix) {
        if (substr($class, 0, 5) == "Core\\") {
            if ($prefix !== true) {
                $x = \Package::getClass($prefix);
                if ($x->providesCoreExtensionAutoloaderMapping()) {
                    $class = substr($class, 5);
                } else {
                    $class = "Src\\" . substr($class, 5);
                }
            } else {
                if (Config::get('app.provide_core_extension_autoloader_mapping')) {
                    $class = substr($class, 5);
                } else {
                    $class = "Src\\" . substr($class, 5);
                }
            }
        }
        if ($prefix === true) {
            $prefix = Config::get('app.namespace');
        } else {
            $prefix = 'Concrete\\Package\\' . camelcase($prefix);
        }
    }
    if (!$prefix) {
        $prefix = 'Concrete';
    }
    $class = '\\' . $prefix . '\\' . $class;
    return $class;
}
开发者ID:ceko,项目名称:concrete5-1,代码行数:39,代码来源:helpers.php

示例5: registerPackageCustomAutoloaders

 public function registerPackageCustomAutoloaders($pkg)
 {
     if (is_string($pkg)) {
         $pkg = \Package::getClass($pkg);
     }
     $pkgHandle = $pkg->getPackageHandle();
     $loader = new Psr4ClassLoader();
     $loaders = $pkg->getPackageAutoloaderRegistries();
     if (count($loaders) > 0) {
         foreach ($loaders as $path => $prefix) {
             $loader->addPrefix($prefix, DIR_PACKAGES . '/' . $pkgHandle . '/' . $path);
         }
     }
     $this->loaders[] = $loader;
     $loader->register();
 }
开发者ID:seebaermichi,项目名称:concrete5,代码行数:16,代码来源:ClassLoader.php


注:本文中的Package::getClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。