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


PHP Closure::bind方法代码示例

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


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

示例1: getInitializer

 public static function getInitializer(ClassLoader $loader)
 {
     return \Closure::bind(function () use($loader) {
         $loader->prefixLengthsPsr4 = ComposerStaticInitf1352f2cf6649e5122b3200d19030cce::$prefixLengthsPsr4;
         $loader->prefixDirsPsr4 = ComposerStaticInitf1352f2cf6649e5122b3200d19030cce::$prefixDirsPsr4;
     }, null, ClassLoader::class);
 }
开发者ID:sonarsoftware,项目名称:freeradius_genie,代码行数:7,代码来源:autoload_static.php

示例2: getInitializer

 public static function getInitializer(ClassLoader $loader)
 {
     return \Closure::bind(function () use($loader) {
         $loader->prefixLengthsPsr4 = ComposerStaticInit2103f6e438c101833cc1f952a48877c1::$prefixLengthsPsr4;
         $loader->prefixDirsPsr4 = ComposerStaticInit2103f6e438c101833cc1f952a48877c1::$prefixDirsPsr4;
     }, null, ClassLoader::class);
 }
开发者ID:VladStawizki,项目名称:ipl-logistik.de,代码行数:7,代码来源:autoload_static.php

示例3: getInitializer

 public static function getInitializer(ClassLoader $loader)
 {
     return \Closure::bind(function () use($loader) {
         $loader->prefixesPsr0 = ComposerStaticInit387a61af024f277d76be6a9ad67ce9d2::$prefixesPsr0;
         $loader->classMap = ComposerStaticInit387a61af024f277d76be6a9ad67ce9d2::$classMap;
     }, null, ClassLoader::class);
 }
开发者ID:slub,项目名称:slub-find-extend,代码行数:7,代码来源:autoload_static.php

示例4: getInitializer

 public static function getInitializer(ClassLoader $loader)
 {
     return \Closure::bind(function () use($loader) {
         $loader->prefixLengthsPsr4 = ComposerStaticInit85a1cefa95be2f464cf7f947cbc4c785::$prefixLengthsPsr4;
         $loader->prefixDirsPsr4 = ComposerStaticInit85a1cefa95be2f464cf7f947cbc4c785::$prefixDirsPsr4;
     }, null, ClassLoader::class);
 }
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:7,代码来源:autoload_static.php

示例5: fillClassInstance

 private function fillClassInstance($instance, $data)
 {
     $instantiator = $this;
     $valueProcessor = function ($value) use(&$valueProcessor, $instantiator) {
         if ($value instanceof ArrayedObject) {
             $value = $instantiator->instantiate($value);
         }
         if (is_array($value)) {
             foreach ($value as &$innerValue) {
                 $innerValue = $valueProcessor($innerValue);
             }
         }
         return $value;
     };
     $setObjectVarsClosure = function ($data, $class, &$valueProcessor) {
         foreach ($data as $property => $value) {
             if (property_exists($class, $property)) {
                 $value = $valueProcessor($value);
                 $this->{$property} = $value;
             }
         }
     };
     $class = get_class($instance);
     do {
         $bindedSetObjectVarsClosure = \Closure::bind($setObjectVarsClosure, $instance, $class);
         $bindedSetObjectVarsClosure($data, $class, $valueProcessor);
     } while ($class = get_parent_class($class));
 }
开发者ID:jimmyoak,项目名称:arrayed-object,代码行数:28,代码来源:ArrayedObjectInstantiator.php

示例6: __construct

 protected function __construct($namespace = '', $defaultLifetime = 0)
 {
     $this->namespace = '' === $namespace ? '' : $this->getId($namespace) . ':';
     if (null !== $this->maxIdLength && strlen($namespace) > $this->maxIdLength - 24) {
         throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s")', $this->maxIdLength - 24, strlen($namespace), $namespace));
     }
     $this->createCacheItem = \Closure::bind(function ($key, $value, $isHit) use($defaultLifetime) {
         $item = new CacheItem();
         $item->key = $key;
         $item->value = $value;
         $item->isHit = $isHit;
         $item->defaultLifetime = $defaultLifetime;
         return $item;
     }, null, CacheItem::class);
     $this->mergeByLifetime = \Closure::bind(function ($deferred, $namespace, &$expiredIds) {
         $byLifetime = array();
         $now = time();
         $expiredIds = array();
         foreach ($deferred as $key => $item) {
             if (null === $item->expiry) {
                 $byLifetime[0 < $item->defaultLifetime ? $item->defaultLifetime : 0][$namespace . $key] = $item->value;
             } elseif ($item->expiry > $now) {
                 $byLifetime[$item->expiry - $now][$namespace . $key] = $item->value;
             } else {
                 $expiredIds[] = $namespace . $key;
             }
         }
         return $byLifetime;
     }, null, CacheItem::class);
 }
开发者ID:ayoah,项目名称:symfony,代码行数:30,代码来源:AbstractAdapter.php

示例7: getInitializer

 public static function getInitializer(ClassLoader $loader)
 {
     return \Closure::bind(function () use($loader) {
         $loader->prefixLengthsPsr4 = ComposerStaticInitc9b168e8400f8789b0e099f4aa1d40aa::$prefixLengthsPsr4;
         $loader->prefixDirsPsr4 = ComposerStaticInitc9b168e8400f8789b0e099f4aa1d40aa::$prefixDirsPsr4;
     }, null, ClassLoader::class);
 }
开发者ID:pmaxs,项目名称:crawler,代码行数:7,代码来源:autoload_static.php

示例8: get_changed_values

function get_changed_values($object)
{
    $function = \Closure::bind(function ($object) {
        $changedValues = $object->changedValues;
        // hack I know
        if (property_exists($object, 'objects')) {
            foreach ($object->objects as $namespace => $namespaceValues) {
                foreach ($namespaceValues as $name => $values) {
                    if (is_array($values)) {
                        foreach ($values as $valueKey => $value) {
                            $changed = get_changed_values($value);
                            if (false == empty($changed)) {
                                $changedValues[$namespace][$name][$valueKey] = $changed;
                            }
                        }
                    } elseif (is_object($values)) {
                        $changed = get_changed_values($values);
                        if (false == empty($changed)) {
                            $changedValues[$namespace][$name] = $changed;
                        }
                    }
                }
            }
        }
        return $changedValues;
    }, null, $object);
    return $function($object);
}
开发者ID:postalservice14,项目名称:yadm,代码行数:28,代码来源:functions.php

示例9: partial

function partial(callable $callable, $partialArgs, $defaultArgs = [])
{
    $partialMerge = function ($partialArgs, $addedArgs, $defaultArgs = []) {
        end($partialArgs);
        $l = key($partialArgs);
        for ($i = 0; $i <= $l; $i++) {
            if (!array_key_exists($i, $partialArgs) && count($addedArgs)) {
                $partialArgs[$i] = array_shift($addedArgs);
            }
        }
        if (count($addedArgs)) {
            // there are $addedArgs left, so there should be no 'holes' in $partialArgs
            $partialArgs = array_merge($partialArgs, $addedArgs);
        }
        // fill any 'holes' in $partialArgs with entries from $defaultArgs
        $result = array_replace($defaultArgs, $partialArgs);
        ksort($result);
        return $result;
    };
    return function () use($callable, $partialArgs, $defaultArgs, $partialMerge) {
        if ($callable instanceof \Closure && isset($this)) {
            $callable = \Closure::bind($callable, $this);
        }
        return call_user_func_array($callable, $partialMerge($partialArgs, func_get_args(), $defaultArgs));
    };
}
开发者ID:poef,项目名称:ariadne,代码行数:26,代码来源:lambda.php

示例10: addMethod

 public function addMethod($methodName, $methodCallable)
 {
     if (!is_callable($methodCallable)) {
         throw new \InvalidArgumentException('Second param must be callable');
     }
     $this->methods[$methodName] = \Closure::bind($methodCallable, $this, get_class());
 }
开发者ID:mirandaguillaume,项目名称:shop-generator,代码行数:7,代码来源:MetaTrait.php

示例11: getInitializer

 public static function getInitializer(ClassLoader $loader)
 {
     return \Closure::bind(function () use($loader) {
         $loader->prefixLengthsPsr4 = ComposerStaticInitee24b804a2f00cc5ec6cefabe5f3d658::$prefixLengthsPsr4;
         $loader->prefixDirsPsr4 = ComposerStaticInitee24b804a2f00cc5ec6cefabe5f3d658::$prefixDirsPsr4;
     }, null, ClassLoader::class);
 }
开发者ID:kevinriemens,项目名称:cda-kerkrade,代码行数:7,代码来源:autoload_static.php

示例12: getInitializer

 public static function getInitializer(ClassLoader $loader)
 {
     return \Closure::bind(function () use($loader) {
         $loader->prefixLengthsPsr4 = ComposerStaticInit4136185281a97be0e373e4c1a575a123::$prefixLengthsPsr4;
         $loader->prefixDirsPsr4 = ComposerStaticInit4136185281a97be0e373e4c1a575a123::$prefixDirsPsr4;
     }, null, ClassLoader::class);
 }
开发者ID:roopet,项目名称:vividin,代码行数:7,代码来源:autoload_static.php

示例13: getInitializer

 public static function getInitializer(ClassLoader $loader)
 {
     return \Closure::bind(function () use($loader) {
         $loader->prefixLengthsPsr4 = ComposerStaticInit923639f9b6d3390d9802ecd1f72b6130::$prefixLengthsPsr4;
         $loader->prefixDirsPsr4 = ComposerStaticInit923639f9b6d3390d9802ecd1f72b6130::$prefixDirsPsr4;
     }, null, ClassLoader::class);
 }
开发者ID:hackingangle,项目名称:design-patterns,代码行数:7,代码来源:autoload_static.php

示例14: getInitializer

 public static function getInitializer(ClassLoader $loader)
 {
     return \Closure::bind(function () use($loader) {
         $loader->prefixesPsr0 = ComposerStaticInit8c00ac27a90dfc4ac1a7acb480023ed4::$prefixesPsr0;
         $loader->classMap = ComposerStaticInit8c00ac27a90dfc4ac1a7acb480023ed4::$classMap;
     }, null, ClassLoader::class);
 }
开发者ID:kimai,项目名称:kimai,代码行数:7,代码来源:autoload_static.php

示例15: getInitializer

 public static function getInitializer(ClassLoader $loader)
 {
     return \Closure::bind(function () use($loader) {
         $loader->prefixLengthsPsr4 = ComposerStaticInit5aaf7da0fd82b6a6ed0ed396a67edc3d::$prefixLengthsPsr4;
         $loader->prefixDirsPsr4 = ComposerStaticInit5aaf7da0fd82b6a6ed0ed396a67edc3d::$prefixDirsPsr4;
     }, null, ClassLoader::class);
 }
开发者ID:beggiatom,项目名称:international,代码行数:7,代码来源:autoload_static.php


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