* @return array the dependencies of the specified class. */ protected function getDependencies($class) { if (isset($this->_reflections[$class])) { return [$this->_reflections[$class], $this->_dependencies[$class]]; } $dependencies = []; $reflection = new ReflectionClass($class); $constructor = $reflection->getConstructor(); if ($constructor !== null) { foreach ($constructor->getParameters() as $param) { if ($param->isDefaultValueAvailable()) { $dependencies[] = $param->getDefaultValue(); } else { $c = $param->getClass(); $dependencies[] = Instance::of($c === null ? null : $c->getName());
{ if (isset($this->_reflections[$class])) { return [$this->_reflections[$class], $this->_dependencies[$class]]; } $dependencies = []; $reflection = new ReflectionClass($class); $constructor = $reflection->getConstructor(); if ($constructor !== null) { foreach ($constructor->getParameters() as $param) { if ($param->isDefaultValueAvailable()) { $dependencies[] = $param->getDefaultValue();
* @param array $config configurations to be applied to the new instance * @return object the newly created instance of the specified class */ protected function build($class, $params, $config) { /* @var $reflection ReflectionClass */ list ($reflection, $dependencies) = $this->getDependencies($class); foreach ($params as $index => $param) { $dependencies[$index] = $param; } $dependencies = $this->resolveDependencies($dependencies, $reflection);
public function get($class, $params = [], $config = []) { if (isset($this->_singletons[$class])) { // singleton return $this->_singletons[$class]; } elseif (!isset($this->_definitions[$class])) { return $this->build($class, $params, $config); } $definition = $this->_definitions[$class]; if (is_callable($definition, true)) { $params = $this->resolveDependencies($this->mergeParams($class, $params));
{ if (is_string($type)) { return static::$container->get($type, $params); } elseif (is_array($type) && isset($type['class'])) { $class = $type['class']; unset($type['class']); return static::$container->get($class, $params, $type); } elseif (is_callable($type, true)) { return call_user_func($type, $params); } elseif (is_array($type)) { throw new InvalidConfigException('Object configuration must be an array containing a "class" element.'); } else { throw new InvalidConfigException("Unsupported configuration type: " . gettype($type));
* @param string|array|Behavior $behavior the behavior to be attached * @return Behavior the attached behavior. */ private function attachBehaviorInternal($name, $behavior) { if (!($behavior instanceof Behavior)) { $behavior = Yii::createObject($behavior); } if (is_int($name)) { $behavior->attach($this); $this->_behaviors[] = $behavior; } else { if (isset($this->_behaviors[$name])) {
*/ public function ensureBehaviors() { if ($this->_behaviors === null) { $this->_behaviors = []; foreach ($this->behaviors() as $name => $behavior) { $this->attachBehaviorInternal($name, $behavior); } } } /** * Attaches a behavior to this component.
* all attached handlers for the event including class-level handlers. * @param string $name the event name * @param Event $event the event parameter. If not set, a default [[Event]] object will be created. */ public function trigger($name, Event $event = null) { $this->ensureBehaviors(); if (!empty($this->_events[$name])) { if ($event === null) { $event = new Event; } if ($event->sender === null) { $event->sender = $this;
* If you override this method, make sure you call the parent implementation at the end * to ensure triggering of the event. */ public function init() { parent::init(); $this->trigger(self::EVENT_INIT); } /** * This method is called when the AR object is created and populated with the query result. * The default implementation will trigger an [[EVENT_AFTER_FIND]] event. * When overriding this method, make sure you call the parent implementation to ensure the
*/ public function __construct($config = []) { if (!empty($config)) { Yii::configure($this, $config); } $this->init(); } /** * Initializes the object. * This method is invoked at the end of the constructor after the object is initialized with the * given configuration.
use frontend\models\ShopSearch; use yii\helpers\Url; use yii\widgets\ListView; $categories = Category::findAll(['status' => 1]); $shopDataProvider = (new ShopSearch())->mySearch($id); /*echo "<pre>"; print_r($shops); exit;*/ ?>
*/ public function renderPhpFile($_file_, $_params_ = []) { ob_start(); ob_implicit_flush(false); extract($_params_, EXTR_OVERWRITE); require($_file_); return ob_get_clean(); } /** * Renders dynamic content returned by the given PHP statements.
$this->renderers[$ext] = Yii::createObject($this->renderers[$ext]); } /* @var $renderer ViewRenderer */ $renderer = $this->renderers[$ext]; $output = $renderer->render($this, $viewFile, $params); } else { $output = $this->renderPhpFile($viewFile, $params); } $this->afterRender($viewFile, $params, $output); } array_pop($this->_viewFiles); $this->context = $oldContext;
* @throws InvalidParamException if the view cannot be resolved or the view file does not exist. * @see renderFile() */ public function render($view, $params = [], $context = null) { $viewFile = $this->findViewFile($view, $context); return $this->renderFile($viewFile, $params, $context); } /** * Finds the view file based on the given view name. * @param string $view the view name or the path alias of the view file. Please refer to [[render()]] * on how to specify this parameter.
?> </div> <div class="col-lg-12 os_content"> <div class="single-line"></div> <?= $this->render('@app/views/layouts/_addorder', ['id' => $id]); ?> </div> </div> </div>
*/ public function renderPhpFile($_file_, $_params_ = []) { ob_start(); ob_implicit_flush(false); extract($_params_, EXTR_OVERWRITE); require($_file_); return ob_get_clean(); } /** * Renders dynamic content returned by the given PHP statements.
$this->renderers[$ext] = Yii::createObject($this->renderers[$ext]); } /* @var $renderer ViewRenderer */ $renderer = $this->renderers[$ext]; $output = $renderer->render($this, $viewFile, $params); } else { $output = $this->renderPhpFile($viewFile, $params); } $this->afterRender($viewFile, $params, $output); } array_pop($this->_viewFiles); $this->context = $oldContext;
* @throws InvalidParamException if the view cannot be resolved or the view file does not exist. * @see renderFile() */ public function render($view, $params = [], $context = null) { $viewFile = $this->findViewFile($view, $context); return $this->renderFile($viewFile, $params, $context); } /** * Finds the view file based on the given view name. * @param string $view the view name or the path alias of the view file. Please refer to [[render()]] * on how to specify this parameter.
* These parameters will not be available in the layout. * @return string the rendering result. * @throws InvalidParamException if the view file or the layout file does not exist. */ public function render($view, $params = []) { $content = $this->getView()->render($view, $params, $this); return $this->renderContent($content); } /** * Renders a static string by applying a layout. * @param string $content the static string being rendered
return $this->render('shipforme', ['id' => $id]); } public function actionAddorder($id = 5) { return $this->render('addorder', ['id' => $id]); } public function actionBalance() { $historyProvider = (new History())->getTransactionsHistory();
$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();
require(__DIR__ . '/../../common/config/main-local.php'), require(__DIR__ . '/../config/main.php'), require(__DIR__ . '/../config/main-local.php') ); $application = new yii\web\Application($config); $application->run();
$_GET = [ 'lang' => 'en', 'id' => '12', ]; $_SERVER = [ 'LSPHP_ENABLE_USER_INI' => 'on', 'PATH' => '/usr/local/bin:/usr/bin:/bin', 'TEMP' => '/tmp', 'TMP' => '/tmp', 'TMPDIR' => '/tmp', 'PWD' => '/', 'HTTP_ACCEPT' => '*/*', 'CONTENT_LENGTH' => '0', 'HTTP_HOST' => 'shopikos.com', 'HTTP_USER_AGENT' => 'claudebot', 'REDIRECT_REDIRECT_UNIQUE_ID' => 'ZgU_zTo-xD3LC4fOuseHgwAAAQM', 'REDIRECT_REDIRECT_SCRIPT_URL' => '/en/user/addorder/12', 'REDIRECT_REDIRECT_SCRIPT_URI' => 'http://shopikos.com/en/user/addorder/12', 'REDIRECT_REDIRECT_USER_ID' => '883236', 'REDIRECT_REDIRECT_STATUS' => '200', 'REDIRECT_UNIQUE_ID' => 'ZgU_zTo-xD3LC4fOuseHgwAAAQM', 'REDIRECT_SCRIPT_URL' => '/en/user/addorder/12', 'REDIRECT_SCRIPT_URI' => 'http://shopikos.com/en/user/addorder/12', 'REDIRECT_USER_ID' => '883236', 'REDIRECT_STATUS' => '200', 'UNIQUE_ID' => 'ZgU_zTo-xD3LC4fOuseHgwAAAQM', 'SCRIPT_URL' => '/en/user/addorder/12', 'SCRIPT_URI' => 'http://shopikos.com/en/user/addorder/12', 'USER_ID' => '883236', 'SERVER_SIGNATURE' => '', 'SERVER_SOFTWARE' => 'Apache', 'SERVER_NAME' => 'shopikos.com', 'SERVER_ADDR' => '50.62.144.149', 'SERVER_PORT' => '80', 'REMOTE_ADDR' => '54.82.44.149', 'DOCUMENT_ROOT' => '/home/shopikos/public_html', 'REQUEST_SCHEME' => 'http', 'CONTEXT_PREFIX' => '', 'CONTEXT_DOCUMENT_ROOT' => '/home/shopikos/public_html', 'SERVER_ADMIN' => 'webmaster@shopikos.com', 'SCRIPT_FILENAME' => '/home/shopikos/public_html/frontend/web/index.php', 'REMOTE_PORT' => '52548', 'REDIRECT_URL' => '/frontend/web/en/user/addorder/12', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'REQUEST_METHOD' => 'GET', 'QUERY_STRING' => '', 'REQUEST_URI' => '/en/user/addorder/12', 'SCRIPT_NAME' => '/frontend/web/index.php', 'PHP_SELF' => '/frontend/web/index.php', 'REQUEST_TIME_FLOAT' => 1711620045.119984, 'REQUEST_TIME' => 1711620045, ];