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


PHP Container::camelize方法代码示例

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


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

示例1: getProxyFactoryCode

    /**
     * {@inheritdoc}
     */
    public function getProxyFactoryCode(Definition $definition, $id)
    {
        $instantiation = 'return';
        if ($definition->isShared()) {
            $instantiation .= " \$this->services['{$id}'] =";
        }
        if (func_num_args() >= 3) {
            $methodName = func_get_arg(2);
        } else {
            @trigger_error(sprintf('You must use the third argument of %s to define the method to call to construct your service since version 3.1, not using it won\'t be supported in 4.0.', __METHOD__), E_USER_DEPRECATED);
            $methodName = 'get' . Container::camelize($id) . 'Service';
        }
        $proxyClass = $this->getProxyClassName($definition);
        $generatedClass = $this->generateProxyClass($definition);
        $constructorCall = $generatedClass->hasMethod('staticProxyConstructor') ? $proxyClass . '::staticProxyConstructor' : 'new ' . $proxyClass;
        return <<<EOF
        if (\$lazyLoad) {

            {$instantiation} {$constructorCall}(
                function (&\$wrappedInstance, \\ProxyManager\\Proxy\\LazyLoadingInterface \$proxy) {
                    \$wrappedInstance = \$this->{$methodName}(false);

                    \$proxy->setProxyInitializer(null);

                    return true;
                }
            );
        }


EOF;
    }
开发者ID:Ener-Getick,项目名称:symfony,代码行数:35,代码来源:ProxyDumper.php

示例2: getProxyFactoryCode

    /**
     * {@inheritdoc}
     */
    public function getProxyFactoryCode(Definition $definition, $id)
    {
        $instantiation = 'return';
        if ($definition->isShared()) {
            $instantiation .= " \$this->services['{$id}'] =";
        }
        $methodName = 'get' . Container::camelize($id) . 'Service';
        $proxyClass = $this->getProxyClassName($definition);
        return <<<EOF
        if (\$lazyLoad) {

            {$instantiation} new {$proxyClass}(
                function (&\$wrappedInstance, \\ProxyManager\\Proxy\\LazyLoadingInterface \$proxy) {
                    \$wrappedInstance = \$this->{$methodName}(false);

                    \$proxy->setProxyInitializer(null);

                    return true;
                }
            );
        }


EOF;
    }
开发者ID:vstepanyuk,项目名称:proxy-manager-bridge,代码行数:28,代码来源:ProxyDumper.php

示例3: getProxyFactoryCode

    /**
     * {@inheritdoc}
     */
    public function getProxyFactoryCode(Definition $definition, $id)
    {
        $instantiation = 'return';
        if ($definition->isShared()) {
            $instantiation .= " \$this->services['{$id}'] =";
            if (defined('Symfony\\Component\\DependencyInjection\\ContainerInterface::SCOPE_CONTAINER') && ContainerInterface::SCOPE_CONTAINER !== ($scope = $definition->getScope(false))) {
                $instantiation .= " \$this->scopedServices['{$scope}']['{$id}'] =";
            }
        }
        $methodName = 'get' . Container::camelize($id) . 'Service';
        $proxyClass = $this->getProxyClassName($definition);
        $generatedClass = $this->generateProxyClass($definition);
        $constructorCall = $generatedClass->hasMethod('staticProxyConstructor') ? $proxyClass . '::staticProxyConstructor' : 'new ' . $proxyClass;
        return <<<EOF
        if (\$lazyLoad) {
            \$container = \$this;

            {$instantiation} {$constructorCall}(
                function (&\$wrappedInstance, \\ProxyManager\\Proxy\\LazyLoadingInterface \$proxy) use (\$container) {
                    \$wrappedInstance = \$container->{$methodName}(false);

                    \$proxy->setProxyInitializer(null);

                    return true;
                }
            );
        }


EOF;
    }
开发者ID:robhaverkort,项目名称:belasting,代码行数:34,代码来源:ProxyDumper.php

示例4: getProxyFactoryCode

    /**
     * {@inheritdoc}
     */
    public function getProxyFactoryCode(Definition $definition, $id)
    {
        $instantiation = 'return';
        if (ContainerInterface::SCOPE_CONTAINER === $definition->getScope()) {
            $instantiation .= " \$this->services['{$id}'] =";
        } elseif (ContainerInterface::SCOPE_PROTOTYPE !== ($scope = $definition->getScope())) {
            $instantiation .= " \$this->services['{$id}'] = \$this->scopedServices['{$scope}']['{$id}'] =";
        }
        $methodName = 'get' . Container::camelize($id) . 'Service';
        $proxyClass = $this->getProxyClassName($definition);
        return <<<EOF
        if (\$lazyLoad) {
            \$container = \$this;

            {$instantiation} new {$proxyClass}(
                function (&\$wrappedInstance, \\ProxyManager\\Proxy\\LazyLoadingInterface \$proxy) use (\$container) {
                    \$wrappedInstance = \$container->{$methodName}(false);

                    \$proxy->setProxyInitializer(null);

                    return true;
                }
            );
        }


EOF;
    }
开发者ID:Dren-x,项目名称:mobit,代码行数:31,代码来源:ProxyDumper.php

示例5: __construct

 /**
  * Constructs a ViewsPluginManager object.
  *
  * @param string $type
  *   The plugin type, for example filter.
  * @param \Traversable $namespaces
  *   An object that implements \Traversable which contains the root paths
  *   keyed by the corresponding namespace to look for plugin implementations,
  * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
  *   Cache backend instance to use.
  * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
  *   The module handler to invoke the alter hook with.
  */
 public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler)
 {
     $plugin_definition_annotation_name = 'Drupal\\views\\Annotation\\Views' . Container::camelize($type);
     parent::__construct("Plugin/views/{$type}", $namespaces, $module_handler, 'Drupal\\views\\Plugin\\views\\ViewsPluginInterface', $plugin_definition_annotation_name);
     $this->defaults += array('parent' => 'parent', 'plugin_type' => $type, 'register_theme' => TRUE);
     $this->alterInfo('views_plugins_' . $type);
     $this->setCacheBackend($cache_backend, "views:{$type}");
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:21,代码来源:ViewsPluginManager.php

示例6: __construct

 /**
  * @inheritdoc
  */
 public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler)
 {
     $plugin_definition_annotation_name = 'Drupal\\geocoder\\Annotation\\GeocoderPlugin';
     parent::__construct('Plugin/Geocoder/' . Container::camelize($type), $namespaces, $module_handler, 'Drupal\\geocoder\\Plugin\\GeocoderPluginInterface', $plugin_definition_annotation_name);
     $this->defaults += array('plugin_type' => strtolower($type));
     $this->alterInfo('geocoder_plugins_' . $type);
     $this->setCacheBackend($cache_backend, 'geocoder:' . $type);
 }
开发者ID:seongbae,项目名称:drumo-distribution,代码行数:11,代码来源:GeocoderPluginManager.php

示例7: __construct

 public function __construct(array $defaults = array(), $router = null, $templateRoute = null)
 {
     $this->setRouter($router, $templateRoute);
     foreach ($defaults as $key => $val) {
         $method = 'set' . \Symfony\Component\DependencyInjection\Container::camelize($key);
         $this->{$method}($val);
     }
 }
开发者ID:sasedev,项目名称:samenjoy,代码行数:8,代码来源:ConfigurationContainer.php

示例8: validate

 /**
  * {@inheritdoc}
  */
 public function validate($value, Constraint $constraint)
 {
     foreach ($this->context->getMetadata()->properties as $propertyMetadata) {
         /* @var PropertyMetadata $propertyMetadata */
         foreach ($propertyMetadata->getConstraints() as $constraint) {
             if ($constraint instanceof ContentFile) {
                 $method = 'get' . Container::camelize($constraint->mapping) . 'MappingType';
                 if (!method_exists($value, $method)) {
                     throw new \RuntimeException(sprintf('Method "%s" should be defined in class %s', $method, get_class($value)));
                 }
                 $accessor = PropertyAccess::createPropertyAccessor();
                 $propertyName = $propertyMetadata->getPropertyName();
                 $content = $accessor->getValue($value, $propertyName);
                 // check also translations
                 if ($translations = $accessor->getValue($value, 'translations')) {
                     foreach ($translations as $translation) {
                         if ($translation->getField() == $propertyName) {
                             $content .= $translation->getContent();
                         }
                     }
                 }
                 $content = trim($content);
                 if (mb_strlen($content) == 0) {
                     return;
                 }
                 $mappingType = $value->{$method}();
                 $files = $this->contentFileManager->findFilesByMappingType($mappingType);
                 // extract all images from content property
                 preg_match_all('/src=[\'\\"]*(.+?)[\'\\"]/', $content, $matches);
                 array_shift($matches);
                 if (count($matches[0]) > 0) {
                     $matches = $matches[0];
                     foreach ($matches as $imgFile) {
                         $imgFile = preg_replace('/\\?.*$/', '', $imgFile);
                         $imgFile = pathinfo($imgFile, PATHINFO_BASENAME);
                         foreach ($files as $key => $file) {
                             /* @var \SciGroup\TinymcePluploadFileManagerBundle\Model\ContentFile $file */
                             if ($file->getFileName() == $imgFile) {
                                 $file->setIsSubmitted(true);
                                 unset($files[$key]);
                                 continue 2;
                             }
                         }
                         // remove file
                         $pathResolver = $this->mappingResolver->resolve($mappingType);
                         $imgFile = $pathResolver->getDirectory(true) . '/' . $imgFile;
                         if (file_exists($imgFile)) {
                             unlink($imgFile);
                         }
                     }
                 }
                 foreach ($files as $file) {
                     $this->contentFileManager->remove($file);
                 }
             }
         }
     }
 }
开发者ID:scigroup,项目名称:tinyuplmngr,代码行数:61,代码来源:ContentFiledValidator.php

示例9: __construct

 /**
  * {@inheritdoc}
  *
  * @param string $type
  *   The plugin type, for example 'color_selector'.
  */
 public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, $type, ConfigFactoryInterface $config_factory)
 {
     $path = Container::camelize($type);
     $this->config = $config_factory->get('image_effects.settings');
     parent::__construct("Plugin/image_effects/{$path}", $namespaces, $module_handler);
     $this->alterInfo("image_effects_{$type}_plugin_info");
     $this->setCacheBackend($cache_backend, "image_effects_{$type}_plugins");
     $this->defaults += ['plugin_type' => $type];
 }
开发者ID:andrewl,项目名称:andrewlnet,代码行数:15,代码来源:ImageEffectsPluginManager.php

示例10: __construct

 /**
  * Constructs a ViewsHandlerManager object.
  *
  * @param string $handler_type
  *   The plugin type, for example filter.
  * @param \Traversable $namespaces
  *   An object that implements \Traversable which contains the root paths
  *   keyed by the corresponding namespace to look for plugin implementations,
  * @param \Drupal\views\ViewsData $views_data
  *   The views data cache.
  * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
  *   Cache backend instance to use.
  * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
  *   The module handler to invoke the alter hook with.
  */
 public function __construct($handler_type, \Traversable $namespaces, ViewsData $views_data, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler)
 {
     $plugin_definition_annotation_name = 'Drupal\\views\\Annotation\\Views' . Container::camelize($handler_type);
     parent::__construct("Plugin/views/{$handler_type}", $namespaces, $module_handler, $plugin_definition_annotation_name);
     $this->setCacheBackend($cache_backend, "views:{$handler_type}", array('extension' => array(TRUE, 'views')));
     $this->viewsData = $views_data;
     $this->handlerType = $handler_type;
     $this->defaults = array('plugin_type' => $handler_type);
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:24,代码来源:ViewsHandlerManager.php

示例11: getCodeBlocks

 /** {@inheritdoc} */
 public function getCodeBlocks()
 {
     // Convert keys to camelCase.
     $config = [];
     foreach ($this->config['resolve_loader'] as $key => $value) {
         $config[lcfirst(Container::camelize($key))] = $value;
     }
     return [(new CodeBlock())->set(CodeBlock::RESOLVE_LOADER, $config)];
 }
开发者ID:emilnordh,项目名称:webpack-bundle,代码行数:10,代码来源:ResolveLoaderConfig.php

示例12: getCodeBlocks

 /** {@inheritdoc} */
 public function getCodeBlocks()
 {
     // Convert keys to camelCase.
     $config = [];
     foreach ($this->config['output'] as $key => $value) {
         $config[lcfirst(Container::camelize($key))] = $value;
     }
     return [(new CodeBlock())->set(CodeBlock::OUTPUT, $config)];
 }
开发者ID:eljam,项目名称:webpack-bundle,代码行数:10,代码来源:OutputConfig.php

示例13: process

 /**
  * @param ContainerBuilder $container
  */
 public function process(ContainerBuilder $container)
 {
     foreach ($container->getDefinitions() as $id => $definition) {
         $className = strtr(Container::camelize($id), '_', '\\');
         /** @var \Symfony\Component\DependencyInjection\Definition $definition */
         if ($definition->getClass() === NULL && !$definition->isAbstract() && (class_exists($className) || interface_exists($className))) {
             $definition->setClass($className);
         }
     }
 }
开发者ID:janmarek,项目名称:autowiring-bundle,代码行数:13,代码来源:GuessClassPass.php

示例14: getWhereSnippet

 /**
  * {@inheritdoc}
  */
 public function getWhereSnippet(FilterDataInterface $filterData)
 {
     $values = $filterData->getValue();
     $clauses = [];
     $parameters = [];
     foreach ($values as $value) {
         $parameter = Container::camelize($this->getConfig()['field'] . '_' . $value);
         $clauses[] = sprintf("%s = :%s", $this->getConfig()['field'], $parameter);
         $parameters[$parameter] = $value;
     }
     return ['snippet' => '(' . implode(' OR ', $clauses) . ')', 'parameters' => $parameters];
 }
开发者ID:mvar,项目名称:filtered-list-bundle,代码行数:15,代码来源:ChoiceFilter.php

示例15: camelizeKeys

 private function camelizeKeys($array)
 {
     $result = [];
     foreach ($array as $key => $value) {
         $key = lcfirst(Container::camelize($key));
         if (is_array($value)) {
             $value = $this->camelizeKeys($value);
         }
         $result[$key] = $value;
     }
     return $result;
 }
开发者ID:northdakota,项目名称:diamantedesk-application,代码行数:12,代码来源:MethodParameters.php


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