Returns a callback that can read private variables from object.

@return \Closure
337648
protected function getGenericPropertyReader(): Closure
    {
        $reader = function &($object, $property) {
            $value = &Closure::bind(function &() use ($property) {
                return $this->{$property};
            }, $object, $object)->__invoke();

            return $value;
        };

        return $reader;
    }
455461
def private_props(obj):
    
    # Get private properties but NOT magic methods
    props = [item for item in dir(obj)]
    priv_props = [_PRIVATE_PROP_REGEXP.match(item) for item in props]
    call_props = [callable(getattr(obj, item)) for item in props]
    iobj = zip(props, priv_props, call_props)
    for obj_name in [prop for prop, priv, call in iobj if priv and (not call)]:
        yield obj_name
1253531
public function callback(Closure $callback)
    {
        foreach ($this->getInnerIterator() as $key => $value) {
            yield $callback($value, $key);
        }
    }
173886
public function methods($object)
    {
        $methods = (new ReflectionClass($object))->getMethods(ReflectionMethod::IS_PUBLIC);

        $iterator = function(ReflectionMethod $method)
        {
            return $method->getName();
        };

        return array_map($iterator, $methods);
    }
883073
public function getFilter(): Closure
    {
        $rootDirectory = $this->rootDirectory;
        $includePaths = $this->includePaths;
        $excludePaths = $this->excludePaths;

        return function (SplFileInfo $file) use ($rootDirectory, $includePaths, $excludePaths) {

            if ($file->getExtension() !== 'php') {
                return false;
            }

            $fullPath = $this->getFileFullPath($file);
            // Do not touch files that not under rootDirectory
            if (strpos($fullPath, $rootDirectory) !== 0) {
                return false;
            }

            if (!empty($includePaths)) {
                $found = false;
                foreach ($includePaths as $includePattern) {
                    if (fnmatch("{$includePattern}*", $fullPath, FNM_NOESCAPE)) {
                        $found = true;
                        break;
                    }
                }
                if (!$found) {
                    return false;
                }
            }

            foreach ($excludePaths as $excludePattern) {
                if (fnmatch("{$excludePattern}*", $fullPath, FNM_NOESCAPE)) {
                    return false;
                }
            }

            return true;
        };
    }
806153
public function getOnce($key, Closure $callback)
    {
        if ($this->has($key)) {
            return $this->cookies[$key];
        } else {
            $value = $callback();
            $this->set($key, $value);

            return $value;
        }
    }
273838
public function getClosures() {
    if (!isset($this->closures)) {
      $cc = new ClosureCompiler();
    
      list($closureCode, $methods) = $cc->compile(new GClass(\Psc\Code\Code::getClass($this)));
      unset($methods[array_search('getClosures', $methods)]);
    
      $that = $this;
      eval($closureCode);
      
      $this->closures = compact($methods);
    }
    
    return $this->closures;
  }
392112
protected static function getAttrs()
    {
        $class = get_called_class();
        $parent = get_parent_class($class);
        if ($parent) {
            $attrs_parent = $parent::getAttrs();
            $attrs = array_merge($attrs_parent, $class::$attrs);
        } else {
            $attrs = $class::$attrs;
        }
        if(empty($attrs)) $attrs = array();

        return array_diff_key($attrs, array('__private__'));

    }
262303
public function getIterator()
    {
        if (is_null($i = $this->model ?: $this->dq ?: $this->iter)) {
            throw $this->exception('Please specify data source with setSource or setModel');
        }
        if ($i instanceof Closure) {
            $i = call_user_func($i);
        }

        return $i;
    }
268368
protected function getMethodVisibilityString()
    {
        if ($this->reflectionService->isMethodProtected($this->fullOriginalClassName, $this->methodName)) {
            return 'protected';
        } elseif ($this->reflectionService->isMethodPrivate($this->fullOriginalClassName, $this->methodName)) {
            return 'private';
        }
        return 'public';
    }
905023
private function withReadPreference($object, \Closure $closure)
    {
        if ( ! isset($this->query['readPreference'])) {
            return $closure();
        }

        $prevReadPref = $object->getReadPreference();
        $object->setReadPreference($this->query['readPreference'], $this->query['readPreferenceTags']);

        try {
            return $closure();
        } finally {
            $prevTags = ! empty($prevReadPref['tagsets']) ? $prevReadPref['tagsets'] : [];
            $object->setReadPreference($prevReadPref['type'], $prevTags);
        }
    }
950
protected function dispatchToRouter() : Closure
    {
        return function ($request) {
            return $this->router->setContainer($this->container)->dispatch($request);
        };
    }
570833
private function menuSorter(): Closure
    {
        return static function (ModuleMenuInterface $x, ModuleMenuInterface $y): int {
            return $x->getMenuOrder() <=> $y->getMenuOrder();
        };
    }
1284711
public function read(&$data, $delimiters = '#', \closure $func, &$out = null){
		$ti = new \frdl\common\TokenIterator($data, $delimiters);
		foreach ($ti as $count => $token) {
            $func($token);
        }
        return $this;
	}
652550
protected function carry(): Closure
    {
        return function ($stack, $pipe) {
            return function ($passable) use ($stack, $pipe) {
                if ($this->always !== null) {
                    $passable = ($this->always)($passable, $pipe);
                }
                $slice = parent::carry();

                $callable = $slice($stack, $pipe);

                return $callable($passable);
            };
        };
    }
578845
protected function deserializer()
    {
        if (null === $this->deserializer) {
            $self = $this;
            $this->deserializer = Closure::bind($this->bindDeserializer(), null, $this->class);
        }
        return $this->deserializer;
    }
614060
public function share(Closure $closure)
		{
			return function($Eventable) use ($closure) {
				// We'll simply declare a static variable within the Closures and if it has
				// not been set we will execute the given Closures to resolve this value
				// and return it back to these consumers of the method as an instance.
				static $object;
				if (is_null($object)) {
					$object = $closure($Eventable);
				}
				return $object;
			};
		}