Perform an action on each character in the string.

@param $closure
@return object|Manipulator
431511
public function eachCharacter(\Closure $closure) : Manipulator
    {
        $modifiedString = '';

        foreach (str_split($this->string) as $character) {
            $modifiedString .= $closure($character);
        }

        return new static($modifiedString);
    }
586611
public function daemonize(Closure $closure = null)
    {
        $processId = $this->fork();

        if ($processId) {
            if (false === is_null($closure)) {
                $process = new Process($processId, $this->master);
                call_user_func($closure, $process);
            }

            return $this->terminateProcess($this->master);
        }

        $this->posix->setsid(); // Child leads the session

        return new Process($this->posix->getpid());
    }
268377
public function ifTrue(\Closure $closure = null)
    {
        if (null === $closure) {
            $closure = function ($v) { return true === $v; };
        }

        $this->ifPart = $closure;

        return $this;
    }
300236
public static function register($action, $closure) {
		
		if(false === is_string($action)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($action)), E_USER_ERROR);
		}
		
		if(false === is_object($closure)) {
			return trigger_error(sprintf('Argument 2 passed to %s() must be callable object, "%s" given', __METHOD__, gettype($closure)), E_USER_ERROR);
		}

		static :: setTemplateFunctions($action, $closure);
	}
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;
			};
		}
147626
public function at(\Closure $closure): self
    {
        $arrayy = clone $this;

        foreach ($arrayy->getGenerator() as $key => $value) {
            $closure($value, $key);
        }

        return static::create(
            $arrayy->toArray(),
            $this->iteratorClass,
            false
        );
    }
1084637
public function each(\Closure $closure): self
    {
        // init
        $array = [];

        foreach ($this->getGenerator() as $key => $value) {
            $array[$key] = $closure($value, $key);
        }

        return static::create(
            $array,
            $this->iteratorClass,
            false
        );
    }
1343782
public function orFilter(Closure $closure)
    {
        $query = $this->newNestedInstance($closure);

        $filter = $this->grammar->compileOr($query->getQuery());

        return $this->rawFilter($filter);
    }
374000
public function runInTrans(\Closure $closure) {
        $this->startTrans();
        try {
            $result = $closure();
            $this->commit();
            return $result;
        } catch (\Exception $e) {
            $this->rollback();
            throw $e;
        } catch (\Throwable $e) {
            $this->rollback();
            throw $e;
        }
    }
589505
public function closureWrapper($closure)
    {
        $dependentService = $this->container->dependentService;
        return function (...$args) use ($closure, $dependentService) {
            return $dependentService->call($closure, $args);
        };
    }
1075241
public function iterateClosure($Closure, $Glue = false)
    {
        if (!is_callable($Closure) || empty($this->Input)) {
            return;
        }
        if (!$Glue) {
            foreach ($this->Working as &$Segment) {
                $Segment = $Closure($Segment);
            }
            return;
        }
        foreach ($this->Markers as &$Segment) {
            if (isset($Segment[0][0]) && !is_array($Segment[0][0])) {
                $Segment[0][0] = $Closure($Segment[0][0]);
            }
        }
    }
896008
public function after(\Closure $closure)
    {
        $key = 'after';
        $after = new Hook($key, $closure, $this->current);
        $this->current->setHook($key, $after);
    }
979911
public static function bind(string $method, Closure $closure)
  {
    $trace = debug_backtrace()[1];

    if (
      $trace['class'] == 'Modulus\Framework\Upstart\Prototype' &&
      $trace['function'] == 'bind' &&
      count($trace['args']) == 3
    ) {
      if (!array_key_exists($method, Self::$functions)) {
        return Self::$functions[$method] = [$method => $closure];
      }

      throw new CannotAddMethodException;
    }

    throw new CannotCallMethodException('Call to ' . self::class . '::bind() is not allowed');
  }
179384
public function toCamelCase() : Manipulator
    {
        $modifiedString = '';

        foreach (explode(' ', $this->string) as $word) {
            $modifiedString .= self::make($word)->toLower()->capitalize()->toString();
        }

        $final = self::make($modifiedString)
            ->replace(' ', '')
            ->lowercaseFirst()
            ->toString();

        return new static($final);
    }
304223
function sortCustomKey(callable $closure) {
        $data = $this->data;
        \uksort($data, $closure);
        
        return (new self($data));
    }
1008228
public function before(\Closure $closure)
    {
        $key = 'before';
        $before = new Hook($key, $closure, $this->current);
        $this->current->setHook($key, $before);
    }
821089
private function buildName(\Closure $closure)
    {
        $reflection = new \ReflectionFunction($closure);

        // Quite hackish, but it seems there's no better way to get if a closure is static
        $bind = @\Closure::bind($closure, new \stdClass);
        $static =
            $bind === null
            || (new \ReflectionFunction($bind))->getClosureThis() === null;

        $arguments = array_map('strval', array_map(
            [ClosureParamStringForm::class, 'fromReflectionParameter'],
            $reflection->getParameters()
        ));

        $name = $static ? 'static function (' : 'function (';

        return $name.implode($arguments, ', ').')';
    }