Handle the user defined dictionary service if present

@param bool $fallback
@return $this
@throws PlinthException
346931
private function handleDictionaryService($fallback = false)
	{
		$dictionaryServiceClass = $this->getSetting("dictionaryservice");
		$dictionaryServiceMerge = $this->getSetting("dictionarymerge");

		if ($dictionaryServiceClass !== false) {
			if (class_exists($dictionaryServiceClass)) {
				/** @var Dictionary\DictionaryService $dictionaryService */
				$dictionaryService = new $dictionaryServiceClass($this);

				$this->getDict()->loadFromArray($dictionaryService->loadTranslations($this->getLang()), $dictionaryServiceMerge);
				if (Language::validate($fallback) === $fallback) {
					$this->getDict()->loadFromArray($dictionaryService->loadTranslations($fallback), $dictionaryServiceMerge, true);
				}
			} else {
				throw new PlinthException("Your dictionary service implementation, $dictionaryServiceClass, cannot be found.");
			}
		}

		return $this;
	}
377653
public function reindexAll()
    {
        $this->tableStrategy
			->setUseIdxTable(false);
		
        $this->beginTransaction();
        try {
            $this->reindex();
            $this->commit();
        } catch (\Exception $e) {
            $this->rollBack();
            throw $e;
        }
        return $this;
    }
1127128
private function handleSessions()
	{
		if ($this->getRouter()->hasRoute()) {
			if (!$this->getRouter()->getRoute()->isPublic() || $this->getRouter()->getRoute()->allowSessions()) {
				if ($this->getSetting('userservice')) {
					try
					{
						if ($this->getSetting('userclass') === false) throw new PlinthException('Please define a user class and user repository');

						$this->getUserService()->setUserRepository($this->getEntityRepository()->getRepository($this->getSetting('userclass')));

						session_start();
					}
					catch (PlinthException $e)
					{
						throw $e;
					}
				} else {
					session_start();
				}
			}
		}
    }
569817
public function pushProcessor($callback)
    {
        if (!is_callable($callback)) {
            throw new \InvalidArgumentException('Processors must be valid callables (callback or object with an __invoke method), '.var_export($callback, true).' given');
        }
        array_unshift($this->processors, $callback);

        return $this;
    }
1159432
public function writeCallback($callback)
    {
        if (is_callable($callback)) {
            $debugs = debug_backtrace(version_compare(PHP_VERSION, '5.3.6', '>=') ? DEBUG_BACKTRACE_PROVIDE_OBJECT : true);
            // this is current function debug backtrace
            $current = array_shift($debugs);
            // this is the current function caller debug backtrace
            $caller = array_shift($debugs);
            call_user_func($callback, $this, isset($caller['object']) ? $caller['object'] : $this);
        }

        return $this;
    }
1037340
public function addFallback($name, $fallbackName)
    {
        if (!isset($this->fallbacks[$name])) {
            $this->fallbacks[$name] = array();
        }
        $this->fallbacks[$name][] = $fallbackName;
        return $this;
    }
1235819
public function each($callback)  
    {
        Eden_Array_Argument::i()->test(1, 'callable');

        foreach ($this->data as $key => $value) {
            call_user_func($callback, $key, $value);
        }

        return $this;
    }
165802
public function addBefore($key, callable $callback)
    {
        if ($this->addItem($key, $callback)) {
            return $this;
        }

        throw new \Exception(htmlspecialchars("The item $key was not found."));
    }
790492
public function set($callback, $args = [])
    {
        if (!$this->app) {
            throw new Exception(['Call-back must be part of a RenderTree']);
        }

        $this->view = $this->owner;

        if (isset($_GET[$this->name])) {
            $this->triggered = $_GET[$this->name];

            $this->app->run_called = true;
            $this->app->stickyGet($this->name);
            $ret = call_user_func_array($callback, $args);
            $this->sendSse();

            return $ret;
        }

        return $this;
    }
48133
public function setCallback($callback = null)
    {
        if (!is_null($callback) && !is_callable($callback)) {
            throw new Exception("callback must be of type callable or null");
        }

        $this->callback = $callback;

        return $this;
    }
106818
public function back( $fallback = '', $status = 302 ) {
		$url = $this->request->headers( 'Referer' );

		if ( empty( $url ) ) {
			$url = $fallback;
		}

		if ( empty( $url ) ) {
			$url = $this->request->getUrl();
		}

		return $this->to( $url, $status );
	}
51412
protected function stream($path, $resource, array $config, $fallback)
    {
        Util::rewindStream($resource);
        $contents = \stream_get_contents($resource);

        return $this->{$fallback}($path, $contents, $config);
    }
798004
public function setup($mixData){
		if(is_array($mixData)){
			return $this->setupWithArray($mixData);
		}

		//fallback assumes JSON
		$this->setupWithJSON($mixData);
	}
884969
public function setService($name, $callback, $protected = false)
    {
        if ($this->hasService($name) && $this->isProtected($name)) {
            throw new ErrorException(
                sprintf('Over-write service "%s" is forbidden!', $name)
            );
        }
        if ($this->_validateService($name, $callback)) {
            $this->_services->setEntry($name, $callback);
            if ($protected) {
                $this->setProtected($name);
            }
        }
        return $this;
    }
1120858
public function execute($callback)
    {
        if (!$this->isBatch) {
            throw new \RuntimeException('Please batch json rpc first.');
        }
        $methods = $this->methods;
        $proxy = function ($err, $res) use ($methods, $callback) {
            if ($err !== null) {
                return call_user_func($callback, $err, null);
            }
            foreach ($methods as $key => $method) {
                if (isset($res[$key])) {
                    if (!is_array($res[$key])) {
                        $transformed = $method->transform([$res[$key]], $method->outputFormatters);
                        $res[$key] = $transformed[0];
                    } else {
                        $transformed = $method->transform($res[$key], $method->outputFormatters);
                        $res[$key] = $transformed;
                    }
                }
            }
            return call_user_func($callback, null, $res);
        };
        $this->requestManager->sendPayload('[' . implode(',', $this->batch) . ']', $proxy);
        $this->methods[] = [];
        $this->batch = [];
    }
232957
public function process($input, array $fallbackData = [])
    {
        $this->registerFallbackData($fallbackData);
        $apiDef = new ApiDefinition();

        /**
         * @var \stdClass $swagger
         */
        $swagger = $this->decodeJson($input);
        if (is_object($swagger)) {
            $this->document->setDocument($swagger);
            $this->setBaseValues($apiDef);

            $operations = $this->document->getOperationsById();
            foreach ($operations as $service) {
                $path = $service->getPath();

                if (in_array(strtolower($service->getMethod()), ['delete', 'patch']) || $apiDef->hasEndpoint($path)) {
                    continue;
                }
                $apiDef->addEndpoint($path);
                $apiDef->addSchema(
                    $path,
                    $this->getServiceSchema($service)
                );
                $apiDef->setOrigin($this->document);
            }
        }

        return $apiDef;
    }
89898
public function transaction($callback)
    {
        $connection = $this->getConnection();
        $connection->beginTransaction();

        if ($callback instanceof Closure) {
            $callback = $callback->bindTo($this, get_class($this));
        }

        if (call_user_func($callback, $this) === false) {
            $connection->rollBack();
        } else {
            $connection->commit();
        }

        return $this;
    }