in /data/web/maiche.360che.com/360che_mall/vendor/tedivm/stash/src/Stash/Driver/Redis.php at line 121
if (count($servers) == 1) { $server = $servers[0]; $redis = new \Redis(); if (isset($server['socket']) && $server['socket']) { $redis->connect($server['socket']); } else { $port = isset($server['port']) ? $server['port'] : 6379; $ttl = isset($server['ttl']) ? $server['ttl'] : 0.1; $redis->connect($server['server'], $port, $ttl); } // auth - just password if (isset($options['password'])) { $redis->auth($options['password']); } $this->redis = $redis; } else {
public function __construct(array $options = array()) { if (!static::isAvailable()) { throw new RuntimeException(get_class($this) . ' is not available.'); } $this->setOptions($options); } /** * @return array */ public function getDefaultOptions()
$constructorInjection, $classReflection->getConstructor(), $parameters ); if (count($args) > 0) { $object = $classReflection->newInstanceArgs($args); } else { $object = new $classname; } $this->injectMethodsAndProperties($object, $definition); } catch (NotFoundException $e) {
{ // Lazy? if ($definition->isLazy()) { return $this->createProxy($definition, $parameters); } return $this->createInstance($definition, $parameters); } /** * The definition is not resolvable if the class is not instantiable (interface or abstract) * or if the class doesn't exist. *
* @return mixed Value obtained from the definition. */ public function resolve(Definition $definition, array $parameters = []) { $definitionResolver = $this->getDefinitionResolver($definition); return $definitionResolver->resolve($definition, $parameters); } /** * Check if a definition can be resolved. * * @param Definition $definition Object that defines how the value should be obtained.
throw new DependencyException("Circular dependency detected while trying to resolve entry '$entryName'"); } $this->entriesBeingResolved[$entryName] = true; // Resolve the definition try { $value = $this->definitionResolver->resolve($definition, $parameters); } catch (Exception $exception) { unset($this->entriesBeingResolved[$entryName]); throw $exception; } unset($this->entriesBeingResolved[$entryName]);
$definition = $this->definitionSource->getDefinition($name); if (! $definition) { throw new NotFoundException("No entry or class found for '$name'"); } $value = $this->resolveDefinition($definition); // If the entry is singleton, we store it to always return it without recomputing it if ($definition->getScope() === Scope::SINGLETON) { $this->singletonEntries[$name] = $value; }
if ($parameterClass->name === 'Interop\Container\ContainerInterface') { $resolvedParameters[$index] = $this->container; } elseif ($parameterClass->name === 'DI\Factory\RequestedEntry') { // By convention the second parameter is the definition $resolvedParameters[$index] = $providedParameters[1]; } elseif ($this->container->has($parameterClass->name)) { $resolvedParameters[$index] = $this->container->get($parameterClass->name); } } return $resolvedParameters; } }
foreach ($this->resolvers as $resolver) { $resolvedParameters = $resolver->getParameters( $reflection, $providedParameters, $resolvedParameters ); $diff = array_diff_key($reflectionParameters, $resolvedParameters); if (empty($diff)) { // Stop traversing: all parameters are resolved return $resolvedParameters; }
is_object($callable) ? 'Instance of ' . get_class($callable) : var_export($callable, true) )); } $callableReflection = CallableReflection::create($callable); $args = $this->parameterResolver->getParameters($callableReflection, $parameters, array()); // Sort by array key because call_user_func_array ignores numeric keys ksort($args); // Check all parameters are resolved $diff = array_diff_key($callableReflection->getParameters(), $args);
try { $providedParams = [$this->container, $definition]; $extraParams = $this->resolveExtraParams($definition->getParameters()); $providedParams = array_merge($providedParams, $extraParams); return $this->invoker->call($callable, $providedParams); } catch (NotCallableException $e) { // Custom error message to help debugging if (is_string($callable) && class_exists($callable) && method_exists($callable, '__invoke')) { throw new DefinitionException(sprintf( 'Entry "%s" cannot be resolved: factory %s. Invokable classes cannot be automatically resolved if autowiring is disabled on the container, you need to enable autowiring or define the entry manually.', $definition->getName(),
* @return mixed Value obtained from the definition. */ public function resolve(Definition $definition, array $parameters = []) { $definitionResolver = $this->getDefinitionResolver($definition); return $definitionResolver->resolve($definition, $parameters); } /** * Check if a definition can be resolved. * * @param Definition $definition Object that defines how the value should be obtained.
throw new DependencyException("Circular dependency detected while trying to resolve entry '$entryName'"); } $this->entriesBeingResolved[$entryName] = true; // Resolve the definition try { $value = $this->definitionResolver->resolve($definition, $parameters); } catch (Exception $exception) { unset($this->entriesBeingResolved[$entryName]); throw $exception; } unset($this->entriesBeingResolved[$entryName]);
$definition = $this->definitionSource->getDefinition($name); if (! $definition) { throw new NotFoundException("No entry or class found for '$name'"); } $value = $this->resolveDefinition($definition); // If the entry is singleton, we store it to always return it without recomputing it if ($definition->getScope() === Scope::SINGLETON) { $this->singletonEntries[$name] = $value; }
return str_replace('\\', '/', get_called_class() . "/{$key}"); } /** @return Pool */ protected static function getCachePool() { return \YiiBasics::$ioc->get(CacheItemPoolInterface::class); } public static function loadByCache($key) { $cacheKey = static::formatCacheKey($key); $item = static::getCacheItem($cacheKey);
return null; } protected static function getCacheItem($key, CacheItemPoolInterface $pool = null) { $pool = $pool ?: static::getCachePool(); return $pool->getItem($key); } public static function hasCache($key) { $cacheKey = static::formatCacheKey($key);
return \YiiBasics::$ioc->get(CacheItemPoolInterface::class); } public static function loadByCache($key) { $cacheKey = static::formatCacheKey($key); $item = static::getCacheItem($cacheKey); if ($item->isHit()) { return $item->get(); } return null; }
public $deduct; public $serial_id; public static function findById($id) { if (!$activity = self::loadByCache($id)) { $request = new GetActivityApiRequest(); $request->activityId = $id; if (\Yii::$app->request instanceof Request) { $request->userIp = \Yii::$app->request->userIP; }
* @return Activity */ protected function getActivity($activityId = null) { $activityId = $activityId ?: $this->getActivityIdByRequest(); return Activity::findById($activityId); } /** * @param $modelsId * * @return Activity
if (!$activityId) { throw new NotFoundHttpException; } if ($activityId == 249) { return $this->redirect(['content', 'activity_id' => 252]); } $activity = $this->getActivity($activityId); if (!$activity || $activity->isNotYetStarted()) { throw new NotFoundHttpException; } return $this->render('content2', ['activity' => $activity]); }
$args = $this->controller->bindActionParams($this, $params); Yii::trace('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); Yii::$app->controller = $oldController; return $result; } else { $id = $this->getUniqueId(); throw new InvalidRouteException('Unable to resolve the request "' . ($id === '' ? $route : $id . '/' . $route) . '".');
$params = $this->catchAll; unset($params[0]); } try { Yii::trace("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } else { $response = $this->getResponse(); if ($result !== null) { $response->data = $result;
try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
self::loadYii(); self::setYiiAppConfig(); } public static function run() { return self::$ioc->get(Application::class)->run(); } protected static function loadYii() { if (!class_exists('Yii', false)) { if (self::$environment == 'development' && self::$runMode != self::RUN_MODE_CONSOLE) {
<?php require(dirname(dirname(dirname(__DIR__))) . '/basics/YiiBasics.php'); YiiBasics::init(dirname(__DIR__)); YiiBasics::run();
$_GET = [ 'activity_id' => '361', ];