當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。