repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
yiisoft/yii-core | src/base/Event.php | Event.setResult | public function setResult($result): self
{
$this->_result = $result;
$this->_hasResult = true;
return $this;
} | php | public function setResult($result): self
{
$this->_result = $result;
$this->_hasResult = true;
return $this;
} | [
"public",
"function",
"setResult",
"(",
"$",
"result",
")",
":",
"self",
"{",
"$",
"this",
"->",
"_result",
"=",
"$",
"result",
";",
"$",
"this",
"->",
"_hasResult",
"=",
"true",
";",
"return",
"$",
"this",
";",
"}"
] | Set result associated with this event.
@param mixed $result result associated with this event.
@return self | [
"Set",
"result",
"associated",
"with",
"this",
"event",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/base/Event.php#L97-L103 | train |
yiisoft/yii-core | src/base/Event.php | Event.getName | public function getName()
{
if ($this->_name === null) {
$this->_name = $this->defaultName();
}
return $this->_name;
} | php | public function getName()
{
if ($this->_name === null) {
$this->_name = $this->defaultName();
}
return $this->_name;
} | [
"public",
"function",
"getName",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_name",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"_name",
"=",
"$",
"this",
"->",
"defaultName",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"_name",
";",
"}"
... | Returns event name.
@return string event name.
@since 3.0.0 | [
"Returns",
"event",
"name",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/base/Event.php#L119-L125 | train |
yiisoft/yii-core | src/http/HeaderCollection.php | HeaderCollection.fromArray | public function fromArray(array $array)
{
$this->removeAll();
foreach ($array as $name => $values) {
if (\is_array($values)) {
foreach ($values as $value) {
$this->add($name, $value);
}
} else {
$this->add($n... | php | public function fromArray(array $array)
{
$this->removeAll();
foreach ($array as $name => $values) {
if (\is_array($values)) {
foreach ($values as $value) {
$this->add($name, $value);
}
} else {
$this->add($n... | [
"public",
"function",
"fromArray",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"this",
"->",
"removeAll",
"(",
")",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"name",
"=>",
"$",
"values",
")",
"{",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"values",... | Populates the header collection from an array.
@param array $array the headers to populate from
@since 2.0.3 | [
"Populates",
"the",
"header",
"collection",
"from",
"an",
"array",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/http/HeaderCollection.php#L180-L192 | train |
yiisoft/yii-core | src/helpers/BaseYii.php | BaseYii.createObject | public static function createObject($config, array $params = [], ContainerInterface $container = null)
{
return static::get('factory', $container)->create($config, $params);
} | php | public static function createObject($config, array $params = [], ContainerInterface $container = null)
{
return static::get('factory', $container)->create($config, $params);
} | [
"public",
"static",
"function",
"createObject",
"(",
"$",
"config",
",",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"ContainerInterface",
"$",
"container",
"=",
"null",
")",
"{",
"return",
"static",
"::",
"get",
"(",
"'factory'",
",",
"$",
"container",
... | Creates a new object using the given configuration and constructor parameters.
@param string|array|callable $config the object configuration.
@param array $params the constructor parameters.
@param ContainerInterface $container the container, default one will be used if not given.
@return object the created object.
@s... | [
"Creates",
"a",
"new",
"object",
"using",
"the",
"given",
"configuration",
"and",
"constructor",
"parameters",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/helpers/BaseYii.php#L67-L70 | train |
yiisoft/yii-core | src/helpers/BaseYii.php | BaseYii.log | public static function log($level, $message, $category = 'application')
{
if (LogLevel::DEBUG === $level && !YII_DEBUG) {
return;
}
$logger = static::get('logger', null, false);
if ($logger) {
return $logger->log($level, $message, ['category' => $category]);
... | php | public static function log($level, $message, $category = 'application')
{
if (LogLevel::DEBUG === $level && !YII_DEBUG) {
return;
}
$logger = static::get('logger', null, false);
if ($logger) {
return $logger->log($level, $message, ['category' => $category]);
... | [
"public",
"static",
"function",
"log",
"(",
"$",
"level",
",",
"$",
"message",
",",
"$",
"category",
"=",
"'application'",
")",
"{",
"if",
"(",
"LogLevel",
"::",
"DEBUG",
"===",
"$",
"level",
"&&",
"!",
"YII_DEBUG",
")",
"{",
"return",
";",
"}",
"$",... | Logs given message with level and category.
Uses `logger` service if container is available.
Else logs message with PHP built-in `error_log()`.
@param string $level log level.
@param mixed $message the message to be logged. This can be a simple string or a more
complex data structure, such as array.
@param string $ca... | [
"Logs",
"given",
"message",
"with",
"level",
"and",
"category",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/helpers/BaseYii.php#L117-L129 | train |
yiisoft/yii-core | src/helpers/BaseYii.php | BaseYii.getLocaleString | public static function getLocaleString(string $default = 'en-US'): string
{
$i18n = static::get('i18n', null, false);
return $i18n ? (string)$i18n->getLocale() : $default;
} | php | public static function getLocaleString(string $default = 'en-US'): string
{
$i18n = static::get('i18n', null, false);
return $i18n ? (string)$i18n->getLocale() : $default;
} | [
"public",
"static",
"function",
"getLocaleString",
"(",
"string",
"$",
"default",
"=",
"'en-US'",
")",
":",
"string",
"{",
"$",
"i18n",
"=",
"static",
"::",
"get",
"(",
"'i18n'",
",",
"null",
",",
"false",
")",
";",
"return",
"$",
"i18n",
"?",
"(",
"... | Returns current locale if set or default.
@return string | [
"Returns",
"current",
"locale",
"if",
"set",
"or",
"default",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/helpers/BaseYii.php#L281-L286 | train |
yiisoft/yii-core | src/helpers/BaseYii.php | BaseYii.getSourceLocaleString | public static function getSourceLocaleString(string $default = 'en-US'): string
{
$view = static::get('view', null, false);
return $view ? (string)$view->getSourceLocale() : $default;
} | php | public static function getSourceLocaleString(string $default = 'en-US'): string
{
$view = static::get('view', null, false);
return $view ? (string)$view->getSourceLocale() : $default;
} | [
"public",
"static",
"function",
"getSourceLocaleString",
"(",
"string",
"$",
"default",
"=",
"'en-US'",
")",
":",
"string",
"{",
"$",
"view",
"=",
"static",
"::",
"get",
"(",
"'view'",
",",
"null",
",",
"false",
")",
";",
"return",
"$",
"view",
"?",
"(... | Returns current source locale if set or default.
@return string | [
"Returns",
"current",
"source",
"locale",
"if",
"set",
"or",
"default",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/helpers/BaseYii.php#L292-L297 | train |
yiisoft/yii-core | src/helpers/BaseYii.php | BaseYii.getTimeZone | public static function getTimeZone(string $default = 'UTC'): string
{
$i18n = static::get('i18n', null, false);
return $i18n ? (string)$i18n->getTimeZone() : $default;
} | php | public static function getTimeZone(string $default = 'UTC'): string
{
$i18n = static::get('i18n', null, false);
return $i18n ? (string)$i18n->getTimeZone() : $default;
} | [
"public",
"static",
"function",
"getTimeZone",
"(",
"string",
"$",
"default",
"=",
"'UTC'",
")",
":",
"string",
"{",
"$",
"i18n",
"=",
"static",
"::",
"get",
"(",
"'i18n'",
",",
"null",
",",
"false",
")",
";",
"return",
"$",
"i18n",
"?",
"(",
"string... | Returns current timezone if set or default.
@return string | [
"Returns",
"current",
"timezone",
"if",
"set",
"or",
"default",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/helpers/BaseYii.php#L303-L308 | train |
yiisoft/yii-core | src/helpers/BaseYii.php | BaseYii.getEncoding | public static function getEncoding(ContainerInterface $container = null): string
{
$i18n = static::get('i18n', $container, false);
return $i18n ? $i18n->getEncoding() : mb_internal_encoding();
} | php | public static function getEncoding(ContainerInterface $container = null): string
{
$i18n = static::get('i18n', $container, false);
return $i18n ? $i18n->getEncoding() : mb_internal_encoding();
} | [
"public",
"static",
"function",
"getEncoding",
"(",
"ContainerInterface",
"$",
"container",
"=",
"null",
")",
":",
"string",
"{",
"$",
"i18n",
"=",
"static",
"::",
"get",
"(",
"'i18n'",
",",
"$",
"container",
",",
"false",
")",
";",
"return",
"$",
"i18n"... | Returns current application encoding.
@param ContainerInterface|null $container
@return string | [
"Returns",
"current",
"application",
"encoding",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/helpers/BaseYii.php#L315-L320 | train |
yiisoft/yii-core | src/helpers/BaseYii.php | BaseYii.get | public static function get(string $name, ContainerInterface $container = null, bool $throwException = true)
{
if ($container === null) {
$container = static::$container;
}
if ($container !== null && $container->has($name)) {
return static::$container->get($name);
... | php | public static function get(string $name, ContainerInterface $container = null, bool $throwException = true)
{
if ($container === null) {
$container = static::$container;
}
if ($container !== null && $container->has($name)) {
return static::$container->get($name);
... | [
"public",
"static",
"function",
"get",
"(",
"string",
"$",
"name",
",",
"ContainerInterface",
"$",
"container",
"=",
"null",
",",
"bool",
"$",
"throwException",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"container",
"===",
"null",
")",
"{",
"$",
"container"... | Returns service from container.
@param string $name service or class/interface name.
@param ContainerInterface $container DI container, default one will be used if not given.
@param bool $throwException whether to throw an exception or return null.
@return object service object. | [
"Returns",
"service",
"from",
"container",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/helpers/BaseYii.php#L329-L344 | train |
yiisoft/yii-core | src/base/Security.php | Security.decrypt | protected function decrypt($data, $passwordBased, $secret, $info)
{
if (!extension_loaded('openssl')) {
throw new InvalidConfigException('Encryption requires the OpenSSL PHP extension');
}
if (!isset($this->allowedCiphers[$this->cipher][0], $this->allowedCiphers[$this->cipher][1]... | php | protected function decrypt($data, $passwordBased, $secret, $info)
{
if (!extension_loaded('openssl')) {
throw new InvalidConfigException('Encryption requires the OpenSSL PHP extension');
}
if (!isset($this->allowedCiphers[$this->cipher][0], $this->allowedCiphers[$this->cipher][1]... | [
"protected",
"function",
"decrypt",
"(",
"$",
"data",
",",
"$",
"passwordBased",
",",
"$",
"secret",
",",
"$",
"info",
")",
"{",
"if",
"(",
"!",
"extension_loaded",
"(",
"'openssl'",
")",
")",
"{",
"throw",
"new",
"InvalidConfigException",
"(",
"'Encryptio... | Decrypts data.
@param string $data encrypted data to be decrypted.
@param bool $passwordBased set true to use password-based key derivation
@param string $secret the decryption password or key
@param string|null $info context/application specific information, @see encrypt()
@return bool|string the decrypted data or f... | [
"Decrypts",
"data",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/base/Security.php#L216-L249 | train |
yiisoft/yii-core | src/base/Module.php | Module.createController | public function createController($route)
{
if ($route === '') {
$route = $this->defaultRoute;
}
// double slashes or leading/ending slashes may cause substr problem
$route = trim($route, '/');
if (strpos($route, '//') !== false) {
return false;
... | php | public function createController($route)
{
if ($route === '') {
$route = $this->defaultRoute;
}
// double slashes or leading/ending slashes may cause substr problem
$route = trim($route, '/');
if (strpos($route, '//') !== false) {
return false;
... | [
"public",
"function",
"createController",
"(",
"$",
"route",
")",
"{",
"if",
"(",
"$",
"route",
"===",
"''",
")",
"{",
"$",
"route",
"=",
"$",
"this",
"->",
"defaultRoute",
";",
"}",
"// double slashes or leading/ending slashes may cause substr problem",
"$",
"r... | Creates a controller instance based on the given route.
The route should be relative to this module. The method implements the following algorithm
to resolve the given route:
1. If the route is empty, use [[defaultRoute]];
2. If the first segment of the route is a valid module ID as declared in [[modules]],
call the ... | [
"Creates",
"a",
"controller",
"instance",
"based",
"on",
"the",
"given",
"route",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/base/Module.php#L576-L617 | train |
yiisoft/yii-core | src/base/Module.php | Module.get | public function get($id, bool $throwException = true)
{
if (!$this->_container->has($id)) {
if ($throwException) {
throw new InvalidConfigException("Unknown component ID: $id");
}
return null;
}
return $this->_container->get($id);
} | php | public function get($id, bool $throwException = true)
{
if (!$this->_container->has($id)) {
if ($throwException) {
throw new InvalidConfigException("Unknown component ID: $id");
}
return null;
}
return $this->_container->get($id);
} | [
"public",
"function",
"get",
"(",
"$",
"id",
",",
"bool",
"$",
"throwException",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_container",
"->",
"has",
"(",
"$",
"id",
")",
")",
"{",
"if",
"(",
"$",
"throwException",
")",
"{",
"thro... | Returns instance from DI by ID.
@param string $id
@param bool $throwException | [
"Returns",
"instance",
"from",
"DI",
"by",
"ID",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/base/Module.php#L796-L806 | train |
yiisoft/yii-core | src/http/MessageTrait.php | MessageTrait.getHeaderCollection | public function getHeaderCollection()
{
if ($this->_headerCollection === null) {
$headerCollection = new HeaderCollection();
$headerCollection->fromArray($this->defaultHeaders());
$this->_headerCollection = $headerCollection;
}
return $this->_headerCollect... | php | public function getHeaderCollection()
{
if ($this->_headerCollection === null) {
$headerCollection = new HeaderCollection();
$headerCollection->fromArray($this->defaultHeaders());
$this->_headerCollection = $headerCollection;
}
return $this->_headerCollect... | [
"public",
"function",
"getHeaderCollection",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_headerCollection",
"===",
"null",
")",
"{",
"$",
"headerCollection",
"=",
"new",
"HeaderCollection",
"(",
")",
";",
"$",
"headerCollection",
"->",
"fromArray",
"(",
"... | Returns the header collection.
The header collection contains the currently registered HTTP headers.
@return HeaderCollection the header collection | [
"Returns",
"the",
"header",
"collection",
".",
"The",
"header",
"collection",
"contains",
"the",
"currently",
"registered",
"HTTP",
"headers",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/http/MessageTrait.php#L100-L108 | train |
yiisoft/yii-core | src/http/MessageTrait.php | MessageTrait.setHeaders | public function setHeaders($headers)
{
$headerCollection = $this->getHeaderCollection();
$headerCollection->removeAll();
$headerCollection->fromArray($headers);
} | php | public function setHeaders($headers)
{
$headerCollection = $this->getHeaderCollection();
$headerCollection->removeAll();
$headerCollection->fromArray($headers);
} | [
"public",
"function",
"setHeaders",
"(",
"$",
"headers",
")",
"{",
"$",
"headerCollection",
"=",
"$",
"this",
"->",
"getHeaderCollection",
"(",
")",
";",
"$",
"headerCollection",
"->",
"removeAll",
"(",
")",
";",
"$",
"headerCollection",
"->",
"fromArray",
"... | Sets up message's headers at batch, removing any previously existing ones.
@param string[][] $headers an associative array of the message's headers. | [
"Sets",
"up",
"message",
"s",
"headers",
"at",
"batch",
"removing",
"any",
"previously",
"existing",
"ones",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/http/MessageTrait.php#L123-L128 | train |
yiisoft/yii-core | src/http/MessageTrait.php | MessageTrait.withBody | public function withBody(StreamInterface $body)
{
if ($this->getBody() === $body) {
return $this;
}
$newInstance = clone $this;
$newInstance->setBody($body);
return $newInstance;
} | php | public function withBody(StreamInterface $body)
{
if ($this->getBody() === $body) {
return $this;
}
$newInstance = clone $this;
$newInstance->setBody($body);
return $newInstance;
} | [
"public",
"function",
"withBody",
"(",
"StreamInterface",
"$",
"body",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getBody",
"(",
")",
"===",
"$",
"body",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$",
"newInstance",
"=",
"clone",
"$",
"this",
";",
"... | Return an instance with the specified message body.
This method retains the immutability of the message and returns an instance that has the
new body stream.
@param StreamInterface $body Body.
@return static
@throws \InvalidArgumentException When the body is not valid. | [
"Return",
"an",
"instance",
"with",
"the",
"specified",
"message",
"body",
".",
"This",
"method",
"retains",
"the",
"immutability",
"of",
"the",
"message",
"and",
"returns",
"an",
"instance",
"that",
"has",
"the",
"new",
"body",
"stream",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/http/MessageTrait.php#L329-L338 | train |
yiisoft/yii-core | src/helpers/BaseUrl.php | BaseUrl.canonical | public static function canonical()
{
$params = Yii::getApp()->controller->actionParams;
$params[0] = Yii::getApp()->controller->getRoute();
return static::getUrlManager()->createAbsoluteUrl($params);
} | php | public static function canonical()
{
$params = Yii::getApp()->controller->actionParams;
$params[0] = Yii::getApp()->controller->getRoute();
return static::getUrlManager()->createAbsoluteUrl($params);
} | [
"public",
"static",
"function",
"canonical",
"(",
")",
"{",
"$",
"params",
"=",
"Yii",
"::",
"getApp",
"(",
")",
"->",
"controller",
"->",
"actionParams",
";",
"$",
"params",
"[",
"0",
"]",
"=",
"Yii",
"::",
"getApp",
"(",
")",
"->",
"controller",
"-... | Returns the canonical URL of the currently requested page.
The canonical URL is constructed using the current controller's [[\yii\web\Controller::route]] and
[[\yii\web\Controller::actionParams]]. You may use the following code in the layout view to add a link tag
about canonical URL:
```php
$this->registerLinkTag(['... | [
"Returns",
"the",
"canonical",
"URL",
"of",
"the",
"currently",
"requested",
"page",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/helpers/BaseUrl.php#L341-L347 | train |
yiisoft/yii-core | src/helpers/BaseHtml.php | BaseHtml.beginTag | public static function beginTag($name, $options = [])
{
if ($name === null || $name === false) {
return '';
}
return '<' . $name . static::renderTagAttributes($options) . '>';
} | php | public static function beginTag($name, $options = [])
{
if ($name === null || $name === false) {
return '';
}
return '<' . $name . static::renderTagAttributes($options) . '>';
} | [
"public",
"static",
"function",
"beginTag",
"(",
"$",
"name",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"name",
"===",
"null",
"||",
"$",
"name",
"===",
"false",
")",
"{",
"return",
"''",
";",
"}",
"return",
"'<'",
".",
"$",
... | Generates a start tag.
@param string|bool|null $name the tag name. If $name is `null` or `false`, the corresponding content will be rendered without any tag.
@param array $options the tag options in terms of name-value pairs. These will be rendered as
the attributes of the resulting tag. The values will be HTML-encoded... | [
"Generates",
"a",
"start",
"tag",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/helpers/BaseHtml.php#L165-L172 | train |
yiisoft/yii-core | src/helpers/BaseHtml.php | BaseHtml.getInputId | public static function getInputId($model, $attribute)
{
$name = strtolower(static::getInputName($model, $attribute));
return str_replace(['[]', '][', '[', ']', ' ', '.'], ['', '-', '-', '', '-', '-'], $name);
} | php | public static function getInputId($model, $attribute)
{
$name = strtolower(static::getInputName($model, $attribute));
return str_replace(['[]', '][', '[', ']', ' ', '.'], ['', '-', '-', '', '-', '-'], $name);
} | [
"public",
"static",
"function",
"getInputId",
"(",
"$",
"model",
",",
"$",
"attribute",
")",
"{",
"$",
"name",
"=",
"strtolower",
"(",
"static",
"::",
"getInputName",
"(",
"$",
"model",
",",
"$",
"attribute",
")",
")",
";",
"return",
"str_replace",
"(",
... | Generates an appropriate input ID for the specified attribute name or expression.
This method converts the result [[getInputName()]] into a valid input ID.
For example, if [[getInputName()]] returns `Post[content]`, this method will return `post-content`.
@param Model $model the model object
@param string $attribute t... | [
"Generates",
"an",
"appropriate",
"input",
"ID",
"for",
"the",
"specified",
"attribute",
"name",
"or",
"expression",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/helpers/BaseHtml.php#L2292-L2296 | train |
yiisoft/yii-core | src/base/Aliases.php | Aliases.set | public function set(string $alias, ?string $path): void
{
if (strncmp($alias, '@', 1)) {
$alias = '@' . $alias;
}
$pos = strpos($alias, '/');
$root = $pos === false ? $alias : substr($alias, 0, $pos);
if ($path !== null) {
$path = strncmp($path, '@', 1... | php | public function set(string $alias, ?string $path): void
{
if (strncmp($alias, '@', 1)) {
$alias = '@' . $alias;
}
$pos = strpos($alias, '/');
$root = $pos === false ? $alias : substr($alias, 0, $pos);
if ($path !== null) {
$path = strncmp($path, '@', 1... | [
"public",
"function",
"set",
"(",
"string",
"$",
"alias",
",",
"?",
"string",
"$",
"path",
")",
":",
"void",
"{",
"if",
"(",
"strncmp",
"(",
"$",
"alias",
",",
"'@'",
",",
"1",
")",
")",
"{",
"$",
"alias",
"=",
"'@'",
".",
"$",
"alias",
";",
... | Registers a path alias.
A path alias is a short name representing a long path (a file path, a URL, etc.)
For example, we use '@yii' as the alias of the path to the Yii framework directory.
A path alias must start with the character '@' so that it can be easily differentiated
from non-alias paths.
Note that this meth... | [
"Registers",
"a",
"path",
"alias",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/base/Aliases.php#L61-L96 | train |
yiisoft/yii-core | src/validators/FileValidator.php | FileValidator.getSizeLimit | public function getSizeLimit()
{
// Get the lowest between post_max_size and upload_max_filesize, log a warning if the first is < than the latter
$limit = $this->sizeToBytes(ini_get('upload_max_filesize'));
$postLimit = $this->sizeToBytes(ini_get('post_max_size'));
if ($postLimit > 0... | php | public function getSizeLimit()
{
// Get the lowest between post_max_size and upload_max_filesize, log a warning if the first is < than the latter
$limit = $this->sizeToBytes(ini_get('upload_max_filesize'));
$postLimit = $this->sizeToBytes(ini_get('post_max_size'));
if ($postLimit > 0... | [
"public",
"function",
"getSizeLimit",
"(",
")",
"{",
"// Get the lowest between post_max_size and upload_max_filesize, log a warning if the first is < than the latter",
"$",
"limit",
"=",
"$",
"this",
"->",
"sizeToBytes",
"(",
"ini_get",
"(",
"'upload_max_filesize'",
")",
")",
... | Returns the maximum size allowed for uploaded files.
This is determined based on four factors:
- 'upload_max_filesize' in php.ini
- 'post_max_size' in php.ini
- 'MAX_FILE_SIZE' hidden field
- [[maxSize]]
@return int the size limit for uploaded files. | [
"Returns",
"the",
"maximum",
"size",
"allowed",
"for",
"uploaded",
"files",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/validators/FileValidator.php#L338-L359 | train |
yiisoft/yii-core | src/helpers/BaseFileHelper.php | BaseFileHelper.unlink | public static function unlink($path): bool
{
$isWindows = DIRECTORY_SEPARATOR === '\\';
if (!$isWindows) {
return unlink($path);
}
if (is_link($path) && is_dir($path)) {
return rmdir($path);
}
return unlink($path);
} | php | public static function unlink($path): bool
{
$isWindows = DIRECTORY_SEPARATOR === '\\';
if (!$isWindows) {
return unlink($path);
}
if (is_link($path) && is_dir($path)) {
return rmdir($path);
}
return unlink($path);
} | [
"public",
"static",
"function",
"unlink",
"(",
"$",
"path",
")",
":",
"bool",
"{",
"$",
"isWindows",
"=",
"DIRECTORY_SEPARATOR",
"===",
"'\\\\'",
";",
"if",
"(",
"!",
"$",
"isWindows",
")",
"{",
"return",
"unlink",
"(",
"$",
"path",
")",
";",
"}",
"i... | Removes a file or symlink in a cross-platform way
@param string $path
@return bool
@since 2.0.14 | [
"Removes",
"a",
"file",
"or",
"symlink",
"in",
"a",
"cross",
"-",
"platform",
"way"
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/helpers/BaseFileHelper.php#L377-L390 | train |
yiisoft/yii-core | src/helpers/BaseFileHelper.php | BaseFileHelper.firstWildcardInPattern | private static function firstWildcardInPattern($pattern)
{
$wildcards = ['*', '?', '[', '\\'];
$wildcardSearch = function ($carry, $item) use ($pattern) {
$position = strpos($pattern, $item);
if ($position === false) {
return $carry === false ? $position : $c... | php | private static function firstWildcardInPattern($pattern)
{
$wildcards = ['*', '?', '[', '\\'];
$wildcardSearch = function ($carry, $item) use ($pattern) {
$position = strpos($pattern, $item);
if ($position === false) {
return $carry === false ? $position : $c... | [
"private",
"static",
"function",
"firstWildcardInPattern",
"(",
"$",
"pattern",
")",
"{",
"$",
"wildcards",
"=",
"[",
"'*'",
",",
"'?'",
",",
"'['",
",",
"'\\\\'",
"]",
";",
"$",
"wildcardSearch",
"=",
"function",
"(",
"$",
"carry",
",",
"$",
"item",
"... | Searches for the first wildcard character in the pattern.
@param string $pattern the pattern to search in
@return int|bool position of first wildcard character or false if not found | [
"Searches",
"for",
"the",
"first",
"wildcard",
"character",
"in",
"the",
"pattern",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/helpers/BaseFileHelper.php#L787-L801 | train |
yiisoft/yii-core | src/base/Application.php | Application.debug | public function debug($message, string $category = 'application'): void
{
$this->log(LogLevel::DEBUG, $message, $category);
} | php | public function debug($message, string $category = 'application'): void
{
$this->log(LogLevel::DEBUG, $message, $category);
} | [
"public",
"function",
"debug",
"(",
"$",
"message",
",",
"string",
"$",
"category",
"=",
"'application'",
")",
":",
"void",
"{",
"$",
"this",
"->",
"log",
"(",
"LogLevel",
"::",
"DEBUG",
",",
"$",
"message",
",",
"$",
"category",
")",
";",
"}"
] | Logs a debug message.
Trace messages are logged mainly for development purpose to see
the execution work flow of some code.
@param mixed $message the message to be logged.
@param string $category the category of the message. | [
"Logs",
"a",
"debug",
"message",
".",
"Trace",
"messages",
"are",
"logged",
"mainly",
"for",
"development",
"purpose",
"to",
"see",
"the",
"execution",
"work",
"flow",
"of",
"some",
"code",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/base/Application.php#L330-L333 | train |
yiisoft/yii-core | src/base/Application.php | Application.log | public function log(string $level, $message, $category = 'application'): void
{
$this->getLogger()->log($level, $message, ['category' => $category]);
} | php | public function log(string $level, $message, $category = 'application'): void
{
$this->getLogger()->log($level, $message, ['category' => $category]);
} | [
"public",
"function",
"log",
"(",
"string",
"$",
"level",
",",
"$",
"message",
",",
"$",
"category",
"=",
"'application'",
")",
":",
"void",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"log",
"(",
"$",
"level",
",",
"$",
"message",
",",
"[... | Logs given message through `logger` service.
@param string $level log level.
@param mixed $message the message to be logged. This can be a simple string or a more
complex data structure, such as array.
@param string $category the category of the message.
@since 3.0.0 | [
"Logs",
"given",
"message",
"through",
"logger",
"service",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/base/Application.php#L380-L383 | train |
yiisoft/yii-core | src/base/Application.php | Application.setBasePath | public function setBasePath($path)
{
parent::setBasePath($path);
$this->setAlias('@app', $this->getBasePath());
if (empty($this->getAlias('@root', false))) {
$this->setAlias('@root', dirname(__DIR__, 5));
}
} | php | public function setBasePath($path)
{
parent::setBasePath($path);
$this->setAlias('@app', $this->getBasePath());
if (empty($this->getAlias('@root', false))) {
$this->setAlias('@root', dirname(__DIR__, 5));
}
} | [
"public",
"function",
"setBasePath",
"(",
"$",
"path",
")",
"{",
"parent",
"::",
"setBasePath",
"(",
"$",
"path",
")",
";",
"$",
"this",
"->",
"setAlias",
"(",
"'@app'",
",",
"$",
"this",
"->",
"getBasePath",
"(",
")",
")",
";",
"if",
"(",
"empty",
... | Sets the root directory of the application and the @app alias.
This method can only be invoked at the beginning of the constructor.
@param string $path the root directory of the application.
@property string the root directory of the application.
@throws InvalidArgumentException if the directory does not exist. | [
"Sets",
"the",
"root",
"directory",
"of",
"the",
"application",
"and",
"the"
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/base/Application.php#L519-L526 | train |
yiisoft/yii-core | src/base/Application.php | Application.run | public function run()
{
if (YII_ENABLE_ERROR_HANDLER) {
$this->get('errorHandler')->register();
}
try {
$this->state = self::STATE_BEFORE_REQUEST;
$this->trigger(RequestEvent::BEFORE);
$this->state = self::STATE_HANDLING_REQUEST;
... | php | public function run()
{
if (YII_ENABLE_ERROR_HANDLER) {
$this->get('errorHandler')->register();
}
try {
$this->state = self::STATE_BEFORE_REQUEST;
$this->trigger(RequestEvent::BEFORE);
$this->state = self::STATE_HANDLING_REQUEST;
... | [
"public",
"function",
"run",
"(",
")",
"{",
"if",
"(",
"YII_ENABLE_ERROR_HANDLER",
")",
"{",
"$",
"this",
"->",
"get",
"(",
"'errorHandler'",
")",
"->",
"register",
"(",
")",
";",
"}",
"try",
"{",
"$",
"this",
"->",
"state",
"=",
"self",
"::",
"STATE... | Runs the application.
This is the main entrance of an application.
@return int the exit status (0 means normal, non-zero values mean abnormal) | [
"Runs",
"the",
"application",
".",
"This",
"is",
"the",
"main",
"entrance",
"of",
"an",
"application",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/base/Application.php#L533-L559 | train |
yiisoft/yii-core | src/i18n/Formatter.php | Formatter.asNtext | public function asNtext($value)
{
if ($value === null) {
return $this->getNullDisplay();
}
return nl2br(Html::encode($value));
} | php | public function asNtext($value)
{
if ($value === null) {
return $this->getNullDisplay();
}
return nl2br(Html::encode($value));
} | [
"public",
"function",
"asNtext",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"getNullDisplay",
"(",
")",
";",
"}",
"return",
"nl2br",
"(",
"Html",
"::",
"encode",
"(",
"$",
"value",
")... | Formats the value as an HTML-encoded plain text with newlines converted into breaks.
@param string $value the value to be formatted.
@return string the formatted result. | [
"Formats",
"the",
"value",
"as",
"an",
"HTML",
"-",
"encoded",
"plain",
"text",
"with",
"newlines",
"converted",
"into",
"breaks",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/i18n/Formatter.php#L556-L563 | train |
yiisoft/yii-core | src/i18n/Formatter.php | Formatter.asImage | public function asImage($value, $options = [])
{
if ($value === null) {
return $this->getNullDisplay();
}
return Html::img($value, $options);
} | php | public function asImage($value, $options = [])
{
if ($value === null) {
return $this->getNullDisplay();
}
return Html::img($value, $options);
} | [
"public",
"function",
"asImage",
"(",
"$",
"value",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"getNullDisplay",
"(",
")",
";",
"}",
"return",
"Html",
"::",
"img",
... | Formats the value as an image tag.
@param mixed $value the value to be formatted.
@param array $options the tag options in terms of name-value pairs. See [[Html::img()]].
@return string the formatted result. | [
"Formats",
"the",
"value",
"as",
"an",
"image",
"tag",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/i18n/Formatter.php#L619-L626 | train |
yiisoft/yii-core | src/i18n/Formatter.php | Formatter.asBoolean | public function asBoolean($value)
{
if ($value === null) {
return $this->getNullDisplay();
}
return $value ? $this->getBooleanFormat()[1] : $this->getBooleanFormat()[0];
} | php | public function asBoolean($value)
{
if ($value === null) {
return $this->getNullDisplay();
}
return $value ? $this->getBooleanFormat()[1] : $this->getBooleanFormat()[0];
} | [
"public",
"function",
"asBoolean",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"getNullDisplay",
"(",
")",
";",
"}",
"return",
"$",
"value",
"?",
"$",
"this",
"->",
"getBooleanFormat",
"... | Formats the value as a boolean.
@param mixed $value the value to be formatted.
@return string the formatted result.
@see booleanFormat | [
"Formats",
"the",
"value",
"as",
"a",
"boolean",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/i18n/Formatter.php#L653-L660 | train |
yiisoft/yii-core | src/i18n/Formatter.php | Formatter.asScientific | public function asScientific($value, $decimals = null, $options = [], $textOptions = [])
{
if ($value === null) {
return $this->getNullDisplay();
}
$value = $this->normalizeNumericValue($value);
if ($this->_intlLoaded) {
$f = $this->createNumberFormatter(Numb... | php | public function asScientific($value, $decimals = null, $options = [], $textOptions = [])
{
if ($value === null) {
return $this->getNullDisplay();
}
$value = $this->normalizeNumericValue($value);
if ($this->_intlLoaded) {
$f = $this->createNumberFormatter(Numb... | [
"public",
"function",
"asScientific",
"(",
"$",
"value",
",",
"$",
"decimals",
"=",
"null",
",",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"textOptions",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"$",
"th... | Formats the value as a scientific number.
@param mixed $value the value to be formatted.
@param int $decimals the number of digits after the decimal point.
If not given, the number of digits depends in the input value and is determined based on
`NumberFormatter::MIN_FRACTION_DIGITS` and `NumberFormatter::MAX_FRACTION_... | [
"Formats",
"the",
"value",
"as",
"a",
"scientific",
"number",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/i18n/Formatter.php#L1276-L1297 | train |
yiisoft/yii-core | src/i18n/Formatter.php | Formatter.asCurrency | public function asCurrency($value, $currency = null, $options = [], $textOptions = [])
{
if ($value === null) {
return $this->getNullDisplay();
}
$normalizedValue = $this->normalizeNumericValue($value);
if ($this->isNormalizedValueMispresented($value, $n... | php | public function asCurrency($value, $currency = null, $options = [], $textOptions = [])
{
if ($value === null) {
return $this->getNullDisplay();
}
$normalizedValue = $this->normalizeNumericValue($value);
if ($this->isNormalizedValueMispresented($value, $n... | [
"public",
"function",
"asCurrency",
"(",
"$",
"value",
",",
"$",
"currency",
"=",
"null",
",",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"textOptions",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"$",
"this... | Formats the value as a currency number.
This function does not require the [PHP intl extension](http://php.net/manual/en/book.intl.php) to be installed
to work, but it is highly recommended to install it to get good formatting results.
Since 2.0.16 numbers that are mispresented after normalization are formatted as st... | [
"Formats",
"the",
"value",
"as",
"a",
"currency",
"number",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/i18n/Formatter.php#L1318-L1358 | train |
yiisoft/yii-core | src/i18n/Formatter.php | Formatter.asSpellout | public function asSpellout($value)
{
if ($value === null) {
return $this->getNullDisplay();
}
$value = $this->normalizeNumericValue($value);
if ($this->_intlLoaded) {
$f = $this->createNumberFormatter(NumberFormatter::SPELLOUT);
if (($result = $f->... | php | public function asSpellout($value)
{
if ($value === null) {
return $this->getNullDisplay();
}
$value = $this->normalizeNumericValue($value);
if ($this->_intlLoaded) {
$f = $this->createNumberFormatter(NumberFormatter::SPELLOUT);
if (($result = $f->... | [
"public",
"function",
"asSpellout",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"getNullDisplay",
"(",
")",
";",
"}",
"$",
"value",
"=",
"$",
"this",
"->",
"normalizeNumericValue",
"(",
... | Formats the value as a number spellout.
This function requires the [PHP intl extension](http://php.net/manual/en/book.intl.php) to be installed.
This formatter does not work well with very big numbers.
@param mixed $value the value to be formatted
@return string the formatted result.
@throws InvalidArgumentException ... | [
"Formats",
"the",
"value",
"as",
"a",
"number",
"spellout",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/i18n/Formatter.php#L1371-L1387 | train |
yiisoft/yii-core | src/i18n/Formatter.php | Formatter.createNumberFormatter | protected function createNumberFormatter($style, $decimals = null, $options = [], $textOptions = [])
{
$formatter = new NumberFormatter($this->getLocale(), $style);
// set text attributes
foreach ($this->numberFormatterTextOptions as $name => $attribute) {
$formatter->setTextAtt... | php | protected function createNumberFormatter($style, $decimals = null, $options = [], $textOptions = [])
{
$formatter = new NumberFormatter($this->getLocale(), $style);
// set text attributes
foreach ($this->numberFormatterTextOptions as $name => $attribute) {
$formatter->setTextAtt... | [
"protected",
"function",
"createNumberFormatter",
"(",
"$",
"style",
",",
"$",
"decimals",
"=",
"null",
",",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"textOptions",
"=",
"[",
"]",
")",
"{",
"$",
"formatter",
"=",
"new",
"NumberFormatter",
"(",
"$",
"th... | Creates a number formatter based on the given type and format.
You may override this method to create a number formatter based on patterns.
@param int $style the type of the number formatter.
Values: NumberFormatter::DECIMAL, ::CURRENCY, ::PERCENT, ::SCIENTIFIC, ::SPELLOUT, ::ORDINAL
::DURATION, ::PATTERN_RULEBASED, ... | [
"Creates",
"a",
"number",
"formatter",
"based",
"on",
"the",
"given",
"type",
"and",
"format",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/i18n/Formatter.php#L1813-L1850 | train |
yiisoft/yii-core | src/i18n/Formatter.php | Formatter.normalizeNumericStringValue | protected function normalizeNumericStringValue($value)
{
$separatorPosition = strrpos($value, '.');
if ($separatorPosition !== false) {
$integerPart = substr($value, 0, $separatorPosition);
$fractionalPart = substr($value, $separatorPosition + 1);
} else {
... | php | protected function normalizeNumericStringValue($value)
{
$separatorPosition = strrpos($value, '.');
if ($separatorPosition !== false) {
$integerPart = substr($value, 0, $separatorPosition);
$fractionalPart = substr($value, $separatorPosition + 1);
} else {
... | [
"protected",
"function",
"normalizeNumericStringValue",
"(",
"$",
"value",
")",
"{",
"$",
"separatorPosition",
"=",
"strrpos",
"(",
"$",
"value",
",",
"'.'",
")",
";",
"if",
"(",
"$",
"separatorPosition",
"!==",
"false",
")",
"{",
"$",
"integerPart",
"=",
... | Normalizes a numeric string value.
@param string $value
@return string the normalized number value as a string
@since 2.0.16 | [
"Normalizes",
"a",
"numeric",
"string",
"value",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/i18n/Formatter.php#L1858-L1888 | train |
yiisoft/yii-core | src/base/Component.php | Component.on | public function on($name, $handler, array $params = [], $append = true)
{
$this->ensureBehaviors();
if (strpos($name, '*') !== false) {
if ($append || empty($this->_eventWildcards[$name])) {
$this->_eventWildcards[$name][] = [$handler, $params];
} else {
... | php | public function on($name, $handler, array $params = [], $append = true)
{
$this->ensureBehaviors();
if (strpos($name, '*') !== false) {
if ($append || empty($this->_eventWildcards[$name])) {
$this->_eventWildcards[$name][] = [$handler, $params];
} else {
... | [
"public",
"function",
"on",
"(",
"$",
"name",
",",
"$",
"handler",
",",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"append",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"ensureBehaviors",
"(",
")",
";",
"if",
"(",
"strpos",
"(",
"$",
"name",
... | Attaches an event handler to an event.
The event handler must be a valid PHP callback. The following are
some examples:
```
function ($event) { ... } // anonymous function
[$object, 'handleClick'] // $object->handleClick()
['Page', 'handleClick'] // Page::handleClick()
'handleClick' ... | [
"Attaches",
"an",
"event",
"handler",
"to",
"an",
"event",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/base/Component.php#L524-L542 | train |
yiisoft/yii-core | src/base/ErrorHandler.php | ErrorHandler.register | public function register()
{
ini_set('display_errors', false);
set_exception_handler([$this, 'handleException']);
set_error_handler([$this, 'handleError']);
if ($this->memoryReserveSize > 0) {
$this->_memoryReserve = str_repeat('x', $this->memoryReserveSize);
}
... | php | public function register()
{
ini_set('display_errors', false);
set_exception_handler([$this, 'handleException']);
set_error_handler([$this, 'handleError']);
if ($this->memoryReserveSize > 0) {
$this->_memoryReserve = str_repeat('x', $this->memoryReserveSize);
}
... | [
"public",
"function",
"register",
"(",
")",
"{",
"ini_set",
"(",
"'display_errors'",
",",
"false",
")",
";",
"set_exception_handler",
"(",
"[",
"$",
"this",
",",
"'handleException'",
"]",
")",
";",
"set_error_handler",
"(",
"[",
"$",
"this",
",",
"'handleErr... | Register this error handler. | [
"Register",
"this",
"error",
"handler",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/base/ErrorHandler.php#L74-L84 | train |
yiisoft/yii-core | src/base/ErrorHandler.php | ErrorHandler.flushLogger | protected function flushLogger()
{
if ($this->logger instanceof \Yiisoft\Log\Logger) {
$this->logger->flush(true);
// attempt to invoke logger destructor:
unset($this->logger);
}
// TODO how?
// Yii::setLogger(null);
} | php | protected function flushLogger()
{
if ($this->logger instanceof \Yiisoft\Log\Logger) {
$this->logger->flush(true);
// attempt to invoke logger destructor:
unset($this->logger);
}
// TODO how?
// Yii::setLogger(null);
} | [
"protected",
"function",
"flushLogger",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"logger",
"instanceof",
"\\",
"Yiisoft",
"\\",
"Log",
"\\",
"Logger",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"flush",
"(",
"true",
")",
";",
"// attempt to invoke ... | Attempts to flush logger messages.
@since 3.0.0 | [
"Attempts",
"to",
"flush",
"logger",
"messages",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/base/ErrorHandler.php#L328-L337 | train |
yiisoft/yii-core | src/base/Model.php | Model.validateMultiple | public static function validateMultiple($models, $attributeNames = null, $clearErrors = true)
{
$valid = true;
/* @var $model Model */
foreach ($models as $model) {
$valid = $model->validate($attributeNames, $clearErrors) && $valid;
}
return $valid;
} | php | public static function validateMultiple($models, $attributeNames = null, $clearErrors = true)
{
$valid = true;
/* @var $model Model */
foreach ($models as $model) {
$valid = $model->validate($attributeNames, $clearErrors) && $valid;
}
return $valid;
} | [
"public",
"static",
"function",
"validateMultiple",
"(",
"$",
"models",
",",
"$",
"attributeNames",
"=",
"null",
",",
"$",
"clearErrors",
"=",
"true",
")",
"{",
"$",
"valid",
"=",
"true",
";",
"/* @var $model Model */",
"foreach",
"(",
"$",
"models",
"as",
... | Validates multiple models.
This method will validate every model. The models being validated may
be of the same or different types.
@param array $models the models to be validated
@param array $attributeNames list of attribute names that should be validated.
If this parameter is empty, it means any attribute listed in ... | [
"Validates",
"multiple",
"models",
".",
"This",
"method",
"will",
"validate",
"every",
"model",
".",
"The",
"models",
"being",
"validated",
"may",
"be",
"of",
"the",
"same",
"or",
"different",
"types",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/base/Model.php#L914-L923 | train |
yiisoft/yii-core | src/i18n/Translator.php | Translator.init | public function init()
{
parent::init();
if (!isset($this->translations['yii']) && !isset($this->translations['yii*'])) {
$this->translations['yii'] = [
'__class' => PhpMessageSource::class,
'sourceLanguage' => 'en-US',
'basePath' => '@yii/... | php | public function init()
{
parent::init();
if (!isset($this->translations['yii']) && !isset($this->translations['yii*'])) {
$this->translations['yii'] = [
'__class' => PhpMessageSource::class,
'sourceLanguage' => 'en-US',
'basePath' => '@yii/... | [
"public",
"function",
"init",
"(",
")",
"{",
"parent",
"::",
"init",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"translations",
"[",
"'yii'",
"]",
")",
"&&",
"!",
"isset",
"(",
"$",
"this",
"->",
"translations",
"[",
"'yii*'",
... | Initializes the component by configuring the default message categories. | [
"Initializes",
"the",
"component",
"by",
"configuring",
"the",
"default",
"message",
"categories",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/i18n/Translator.php#L61-L79 | train |
yiisoft/yii-core | src/helpers/BaseHtmlPurifier.php | BaseHtmlPurifier.process | public static function process(string $content, $config = null): string
{
$configInstance = static::createConfig($config);
$configInstance->autoFinalize = false;
return \HTMLPurifier::instance($configInstance)->purify($content);
} | php | public static function process(string $content, $config = null): string
{
$configInstance = static::createConfig($config);
$configInstance->autoFinalize = false;
return \HTMLPurifier::instance($configInstance)->purify($content);
} | [
"public",
"static",
"function",
"process",
"(",
"string",
"$",
"content",
",",
"$",
"config",
"=",
"null",
")",
":",
"string",
"{",
"$",
"configInstance",
"=",
"static",
"::",
"createConfig",
"(",
"$",
"config",
")",
";",
"$",
"configInstance",
"->",
"au... | Passes markup through HTMLPurifier making it safe to output to end user.
@param string $content The HTML content to purify
@param array|\Closure|null $config The config to use for HtmlPurifier.
If not specified or `null` the default config will be used.
You can use an array or an anonymous function to provide configur... | [
"Passes",
"markup",
"through",
"HTMLPurifier",
"making",
"it",
"safe",
"to",
"output",
"to",
"end",
"user",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/helpers/BaseHtmlPurifier.php#L56-L62 | train |
yiisoft/yii-core | src/helpers/BaseHtmlPurifier.php | BaseHtmlPurifier.truncateCharacters | public static function truncateCharacters(string $content, int $count, string $suffix = '...', string $encoding = 'utf-8', $config = null): string
{
$config = static::createConfig($config);
$tokens = \HTMLPurifier_Lexer::create($config)->tokenizeHTML($content, $config, new \HTMLPurifier_Context());... | php | public static function truncateCharacters(string $content, int $count, string $suffix = '...', string $encoding = 'utf-8', $config = null): string
{
$config = static::createConfig($config);
$tokens = \HTMLPurifier_Lexer::create($config)->tokenizeHTML($content, $config, new \HTMLPurifier_Context());... | [
"public",
"static",
"function",
"truncateCharacters",
"(",
"string",
"$",
"content",
",",
"int",
"$",
"count",
",",
"string",
"$",
"suffix",
"=",
"'...'",
",",
"string",
"$",
"encoding",
"=",
"'utf-8'",
",",
"$",
"config",
"=",
"null",
")",
":",
"string"... | Truncate a HTML string to count of characters specified.
@param string $content The string to be truncated.
@param int $count
@param string $suffix String to append to the end of the truncated string. Default is empty string.
@param string $encoding
@param array|\Closure|null $config The config to use for HtmlPurifier... | [
"Truncate",
"a",
"HTML",
"string",
"to",
"count",
"of",
"characters",
"specified",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/helpers/BaseHtmlPurifier.php#L76-L118 | train |
yiisoft/yii-core | src/http/Uri.php | Uri.setComponent | protected function setComponent($name, $value)
{
if ($this->_string !== null) {
$this->_components = $this->parseUri($this->_string);
}
$this->_components[$name] = $value;
$this->_string = null;
} | php | protected function setComponent($name, $value)
{
if ($this->_string !== null) {
$this->_components = $this->parseUri($this->_string);
}
$this->_components[$name] = $value;
$this->_string = null;
} | [
"protected",
"function",
"setComponent",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_string",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"_components",
"=",
"$",
"this",
"->",
"parseUri",
"(",
"$",
"this",
"->",
... | Sets up particular URI component.
@param string $name URI component name.
@param mixed $value URI component value. | [
"Sets",
"up",
"particular",
"URI",
"component",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/http/Uri.php#L305-L312 | train |
yiisoft/yii-core | src/http/Uri.php | Uri.getComponents | protected function getComponents()
{
if ($this->_components === null) {
if ($this->_string === null) {
return [];
}
$this->_components = $this->parseUri($this->_string);
}
return $this->_components;
} | php | protected function getComponents()
{
if ($this->_components === null) {
if ($this->_string === null) {
return [];
}
$this->_components = $this->parseUri($this->_string);
}
return $this->_components;
} | [
"protected",
"function",
"getComponents",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_components",
"===",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_string",
"===",
"null",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"this",
"->",
"_comp... | Returns URI components for this instance as an associative array.
@return array URI components in format: `[name => value]` | [
"Returns",
"URI",
"components",
"for",
"this",
"instance",
"as",
"an",
"associative",
"array",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/http/Uri.php#L332-L341 | train |
yiisoft/yii-core | src/http/Uri.php | Uri.composeUri | protected function composeUri(array $components)
{
$uri = '';
$scheme = empty($components['scheme']) ? 'http' : $components['scheme'];
if ($scheme !== '') {
$uri .= $scheme . ':';
}
$authority = $this->composeAuthority($components);
if ($authority !== '... | php | protected function composeUri(array $components)
{
$uri = '';
$scheme = empty($components['scheme']) ? 'http' : $components['scheme'];
if ($scheme !== '') {
$uri .= $scheme . ':';
}
$authority = $this->composeAuthority($components);
if ($authority !== '... | [
"protected",
"function",
"composeUri",
"(",
"array",
"$",
"components",
")",
"{",
"$",
"uri",
"=",
"''",
";",
"$",
"scheme",
"=",
"empty",
"(",
"$",
"components",
"[",
"'scheme'",
"]",
")",
"?",
"'http'",
":",
"$",
"components",
"[",
"'scheme'",
"]",
... | Composes URI string from given components.
@param array $components URI components.
@return string URI full string. | [
"Composes",
"URI",
"string",
"from",
"given",
"components",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/http/Uri.php#L363-L394 | train |
yiisoft/yii-core | src/http/Uri.php | Uri.isDefaultPort | protected function isDefaultPort($scheme, $port)
{
if (!isset(self::$defaultPorts[$scheme])) {
return false;
}
return self::$defaultPorts[$scheme] == $port;
} | php | protected function isDefaultPort($scheme, $port)
{
if (!isset(self::$defaultPorts[$scheme])) {
return false;
}
return self::$defaultPorts[$scheme] == $port;
} | [
"protected",
"function",
"isDefaultPort",
"(",
"$",
"scheme",
",",
"$",
"port",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"defaultPorts",
"[",
"$",
"scheme",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"self",
"::",
... | Checks whether specified port is default one for the specified scheme.
@param string $scheme scheme.
@param int $port port number.
@return bool whether specified port is default for specified scheme | [
"Checks",
"whether",
"specified",
"port",
"is",
"default",
"one",
"for",
"the",
"specified",
"scheme",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/http/Uri.php#L447-L453 | train |
yiisoft/yii-core | src/mail/BaseMessage.php | BaseMessage.send | public function send(MailerInterface $mailer = null)
{
if ($mailer === null && $this->mailer === null) {
$mailer = Yii::getApp()->getMailer();
} elseif ($mailer === null) {
$mailer = $this->mailer;
}
return $mailer->send($this);
} | php | public function send(MailerInterface $mailer = null)
{
if ($mailer === null && $this->mailer === null) {
$mailer = Yii::getApp()->getMailer();
} elseif ($mailer === null) {
$mailer = $this->mailer;
}
return $mailer->send($this);
} | [
"public",
"function",
"send",
"(",
"MailerInterface",
"$",
"mailer",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"mailer",
"===",
"null",
"&&",
"$",
"this",
"->",
"mailer",
"===",
"null",
")",
"{",
"$",
"mailer",
"=",
"Yii",
"::",
"getApp",
"(",
")",
"-... | Sends this email message.
@param MailerInterface $mailer the mailer that should be used to send this message.
If no mailer is given it will first check if [[mailer]] is set and if not,
the "mail" application component will be used instead.
@return bool whether this message is sent successfully. | [
"Sends",
"this",
"email",
"message",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/mail/BaseMessage.php#L41-L50 | train |
yiisoft/yii-core | src/i18n/Locale.php | Locale.getFallbackLocale | public function getFallbackLocale(): self
{
if ($this->variant !== null) {
return $this->withVariant(null);
}
if ($this->region !== null) {
return $this->withRegion(null);
}
if ($this->script !== null) {
return $this->withScript(null);
... | php | public function getFallbackLocale(): self
{
if ($this->variant !== null) {
return $this->withVariant(null);
}
if ($this->region !== null) {
return $this->withRegion(null);
}
if ($this->script !== null) {
return $this->withScript(null);
... | [
"public",
"function",
"getFallbackLocale",
"(",
")",
":",
"self",
"{",
"if",
"(",
"$",
"this",
"->",
"variant",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"withVariant",
"(",
"null",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"region",
... | Returns fallback locale
@return self fallback locale | [
"Returns",
"fallback",
"locale"
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/i18n/Locale.php#L461-L476 | train |
yiisoft/yii-core | src/data/Pagination.php | Pagination.createUrl | public function createUrl($page, $pageSize = null, $absolute = false)
{
$page = (int) $page;
$pageSize = (int) $pageSize;
if (($params = $this->params) === null) {
$request = Yii::getApp()->getRequest();
$params = $request instanceof Request ? $request->getQueryParams... | php | public function createUrl($page, $pageSize = null, $absolute = false)
{
$page = (int) $page;
$pageSize = (int) $pageSize;
if (($params = $this->params) === null) {
$request = Yii::getApp()->getRequest();
$params = $request instanceof Request ? $request->getQueryParams... | [
"public",
"function",
"createUrl",
"(",
"$",
"page",
",",
"$",
"pageSize",
"=",
"null",
",",
"$",
"absolute",
"=",
"false",
")",
"{",
"$",
"page",
"=",
"(",
"int",
")",
"$",
"page",
";",
"$",
"pageSize",
"=",
"(",
"int",
")",
"$",
"pageSize",
";"... | Creates the URL suitable for pagination with the specified page number.
This method is mainly called by pagers when creating URLs used to perform pagination.
@param int $page the zero-based page number that the URL should point to.
@param int $pageSize the number of items on each page. If not set, the value of [[pageSi... | [
"Creates",
"the",
"URL",
"suitable",
"for",
"pagination",
"with",
"the",
"specified",
"page",
"number",
".",
"This",
"method",
"is",
"mainly",
"called",
"by",
"pagers",
"when",
"creating",
"URLs",
"used",
"to",
"perform",
"pagination",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/data/Pagination.php#L259-L287 | train |
yiisoft/yii-core | src/base/BaseObject.php | BaseObject.__isset | public function __isset($name)
{
$getter = 'get' . $name;
if (method_exists($this, $getter)) {
return $this->$getter() !== null;
}
return false;
} | php | public function __isset($name)
{
$getter = 'get' . $name;
if (method_exists($this, $getter)) {
return $this->$getter() !== null;
}
return false;
} | [
"public",
"function",
"__isset",
"(",
"$",
"name",
")",
"{",
"$",
"getter",
"=",
"'get'",
".",
"$",
"name",
";",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"$",
"getter",
")",
")",
"{",
"return",
"$",
"this",
"->",
"$",
"getter",
"(",
")"... | Checks if a property is set, i.e. defined and not null.
Do not call this method directly as it is a PHP magic method that
will be implicitly called when executing `isset($object->property)`.
Note that if the property is not defined, false will be returned.
@param string $name the property name or the event name
@retu... | [
"Checks",
"if",
"a",
"property",
"is",
"set",
"i",
".",
"e",
".",
"defined",
"and",
"not",
"null",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/base/BaseObject.php#L140-L148 | train |
yiisoft/yii-core | src/base/BaseObject.php | BaseObject.canGetProperty | public function canGetProperty($name, $checkVars = true)
{
return method_exists($this, 'get' . $name) || $checkVars && property_exists($this, $name);
} | php | public function canGetProperty($name, $checkVars = true)
{
return method_exists($this, 'get' . $name) || $checkVars && property_exists($this, $name);
} | [
"public",
"function",
"canGetProperty",
"(",
"$",
"name",
",",
"$",
"checkVars",
"=",
"true",
")",
"{",
"return",
"method_exists",
"(",
"$",
"this",
",",
"'get'",
".",
"$",
"name",
")",
"||",
"$",
"checkVars",
"&&",
"property_exists",
"(",
"$",
"this",
... | Returns a value indicating whether a property can be read.
A property is readable if:
- the class has a getter method associated with the specified name
(in this case, property name is case-insensitive);
- the class has a member variable with the specified name (when `$checkVars` is true);
@param string $name the pr... | [
"Returns",
"a",
"value",
"indicating",
"whether",
"a",
"property",
"can",
"be",
"read",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/base/BaseObject.php#L221-L224 | train |
yiisoft/yii-core | src/i18n/I18N.php | I18N.translate | public function translate(string $category, string $message, array $params = [], string $language = null)
{
return $this->translator->translate($category, $message, $params, $language ?: (string)$this->locale);
} | php | public function translate(string $category, string $message, array $params = [], string $language = null)
{
return $this->translator->translate($category, $message, $params, $language ?: (string)$this->locale);
} | [
"public",
"function",
"translate",
"(",
"string",
"$",
"category",
",",
"string",
"$",
"message",
",",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"string",
"$",
"language",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"translator",
"->",
"trans... | Translates a message to the specified language.
Drops in the current locale when language is not given.
@see Translator::translate() | [
"Translates",
"a",
"message",
"to",
"the",
"specified",
"language",
".",
"Drops",
"in",
"the",
"current",
"locale",
"when",
"language",
"is",
"not",
"given",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/i18n/I18N.php#L119-L122 | train |
yiisoft/yii-core | src/i18n/I18N.php | I18N.getCurrencySymbol | public function getCurrencySymbol($currencyCode = null): string
{
if (!extension_loaded('intl')) {
throw new InvalidConfigException('Locale component requires PHP intl extension to be installed.');
}
$locale = $this->locale;
if ($currencyCode !== null) {
$lo... | php | public function getCurrencySymbol($currencyCode = null): string
{
if (!extension_loaded('intl')) {
throw new InvalidConfigException('Locale component requires PHP intl extension to be installed.');
}
$locale = $this->locale;
if ($currencyCode !== null) {
$lo... | [
"public",
"function",
"getCurrencySymbol",
"(",
"$",
"currencyCode",
"=",
"null",
")",
":",
"string",
"{",
"if",
"(",
"!",
"extension_loaded",
"(",
"'intl'",
")",
")",
"{",
"throw",
"new",
"InvalidConfigException",
"(",
"'Locale component requires PHP intl extension... | Returns a currency symbol
@param string $currencyCode the 3-letter ISO 4217 currency code to get symbol for. If null,
method will attempt using currency code from current locale.
@return string
@throws InvalidConfigException | [
"Returns",
"a",
"currency",
"symbol"
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/i18n/I18N.php#L145-L159 | train |
yiisoft/yii-core | src/i18n/PhpMessageSource.php | PhpMessageSource.loadMessagesFromFile | protected function loadMessagesFromFile($messageFile)
{
if (is_file($messageFile)) {
$messages = include $messageFile;
if (!\is_array($messages)) {
$messages = [];
}
return $messages;
}
return null;
} | php | protected function loadMessagesFromFile($messageFile)
{
if (is_file($messageFile)) {
$messages = include $messageFile;
if (!\is_array($messages)) {
$messages = [];
}
return $messages;
}
return null;
} | [
"protected",
"function",
"loadMessagesFromFile",
"(",
"$",
"messageFile",
")",
"{",
"if",
"(",
"is_file",
"(",
"$",
"messageFile",
")",
")",
"{",
"$",
"messages",
"=",
"include",
"$",
"messageFile",
";",
"if",
"(",
"!",
"\\",
"is_array",
"(",
"$",
"messa... | Loads the message translation for the specified language and category or returns null if file doesn't exist.
@param string $messageFile path to message file
@return array|null array of messages or null if file not found | [
"Loads",
"the",
"message",
"translation",
"for",
"the",
"specified",
"language",
"and",
"category",
"or",
"returns",
"null",
"if",
"file",
"doesn",
"t",
"exist",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/i18n/PhpMessageSource.php#L163-L175 | train |
yiisoft/yii-core | build/controllers/ClassmapController.php | ClassmapController.actionCreate | public function actionCreate($root = null, $mapFile = null)
{
if ($root === null) {
$root = YII_PATH;
}
$root = FileHelper::normalizePath($root);
if ($mapFile === null) {
$mapFile = YII_PATH . '/classes.php';
}
$options = [
'filter'... | php | public function actionCreate($root = null, $mapFile = null)
{
if ($root === null) {
$root = YII_PATH;
}
$root = FileHelper::normalizePath($root);
if ($mapFile === null) {
$mapFile = YII_PATH . '/classes.php';
}
$options = [
'filter'... | [
"public",
"function",
"actionCreate",
"(",
"$",
"root",
"=",
"null",
",",
"$",
"mapFile",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"root",
"===",
"null",
")",
"{",
"$",
"root",
"=",
"YII_PATH",
";",
"}",
"$",
"root",
"=",
"FileHelper",
"::",
"normali... | Creates a class map for the core Yii classes.
@param string $root the root path of Yii framework. Defaults to YII_PATH.
@param string $mapFile the file to contain the class map. Defaults to YII_PATH . '/classes.php'. | [
"Creates",
"a",
"class",
"map",
"for",
"the",
"core",
"Yii",
"classes",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/build/controllers/ClassmapController.php#L29-L92 | train |
yiisoft/yii-core | src/data/Sort.php | Sort.createSortParam | public function createSortParam($attribute)
{
if (!isset($this->attributes[$attribute])) {
throw new InvalidConfigException("Unknown attribute: $attribute");
}
$definition = $this->attributes[$attribute];
$directions = $this->getAttributeOrders();
if (isset($direc... | php | public function createSortParam($attribute)
{
if (!isset($this->attributes[$attribute])) {
throw new InvalidConfigException("Unknown attribute: $attribute");
}
$definition = $this->attributes[$attribute];
$directions = $this->getAttributeOrders();
if (isset($direc... | [
"public",
"function",
"createSortParam",
"(",
"$",
"attribute",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"attributes",
"[",
"$",
"attribute",
"]",
")",
")",
"{",
"throw",
"new",
"InvalidConfigException",
"(",
"\"Unknown attribute: $attribute\... | Creates the sort variable for the specified attribute.
The newly created sort variable can be used to create a URL that will lead to
sorting by the specified attribute.
@param string $attribute the attribute name
@return string the value of the sort variable
@throws InvalidConfigException if the specified attribute is ... | [
"Creates",
"the",
"sort",
"variable",
"for",
"the",
"specified",
"attribute",
".",
"The",
"newly",
"created",
"sort",
"variable",
"can",
"be",
"used",
"to",
"create",
"a",
"URL",
"that",
"will",
"lead",
"to",
"sorting",
"by",
"the",
"specified",
"attribute",... | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/data/Sort.php#L437-L463 | train |
yiisoft/yii-core | src/i18n/TranslationEvent.php | TranslationEvent.missing | public static function missing(string $category, $message, string $language)
{
return new static(static::MISSING, $category, $message, $language);
} | php | public static function missing(string $category, $message, string $language)
{
return new static(static::MISSING, $category, $message, $language);
} | [
"public",
"static",
"function",
"missing",
"(",
"string",
"$",
"category",
",",
"$",
"message",
",",
"string",
"$",
"language",
")",
"{",
"return",
"new",
"static",
"(",
"static",
"::",
"MISSING",
",",
"$",
"category",
",",
"$",
"message",
",",
"$",
"l... | Create MISSING translation event.
@param string $category message category
@param string $message the translated message
@param string $language the language ID e.g. en-US | [
"Create",
"MISSING",
"translation",
"event",
"."
] | 50c9eb923394c822d86bfc954cf026a7396bc95a | https://github.com/yiisoft/yii-core/blob/50c9eb923394c822d86bfc954cf026a7396bc95a/src/i18n/TranslationEvent.php#L64-L67 | train |
cweagans/composer-patches | src/PatchCollection.php | PatchCollection.fromJson | public static function fromJson($json)
{
if (!is_object($json)) {
$json = json_decode($json);
}
$collection = new static();
foreach ($json->patches as $package => $patches) {
foreach ($patches as $patch_json) {
$patch = Patch::fromJson($patch_... | php | public static function fromJson($json)
{
if (!is_object($json)) {
$json = json_decode($json);
}
$collection = new static();
foreach ($json->patches as $package => $patches) {
foreach ($patches as $patch_json) {
$patch = Patch::fromJson($patch_... | [
"public",
"static",
"function",
"fromJson",
"(",
"$",
"json",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"json",
")",
")",
"{",
"$",
"json",
"=",
"json_decode",
"(",
"$",
"json",
")",
";",
"}",
"$",
"collection",
"=",
"new",
"static",
"(",
... | Create a PatchCollection from a serialized representation.
@param $json
A json_encode'd representation of a PatchCollection.
@return PatchCollection
A PatchCollection with all of the serialized patches included. | [
"Create",
"a",
"PatchCollection",
"from",
"a",
"serialized",
"representation",
"."
] | 7eda09d4049c62ad5750e4aadb8663db3dced384 | https://github.com/cweagans/composer-patches/blob/7eda09d4049c62ad5750e4aadb8663db3dced384/src/PatchCollection.php#L54-L69 | train |
cweagans/composer-patches | src/Plugin/Patches.php | Patches.getPatchResolvers | public function getPatchResolvers()
{
$resolvers = [];
$plugin_manager = $this->composer->getPluginManager();
foreach ($plugin_manager->getPluginCapabilities(
'cweagans\Composer\Capability\ResolverProvider',
['composer' => $this->composer, 'io' => $this->io]
)... | php | public function getPatchResolvers()
{
$resolvers = [];
$plugin_manager = $this->composer->getPluginManager();
foreach ($plugin_manager->getPluginCapabilities(
'cweagans\Composer\Capability\ResolverProvider',
['composer' => $this->composer, 'io' => $this->io]
)... | [
"public",
"function",
"getPatchResolvers",
"(",
")",
"{",
"$",
"resolvers",
"=",
"[",
"]",
";",
"$",
"plugin_manager",
"=",
"$",
"this",
"->",
"composer",
"->",
"getPluginManager",
"(",
")",
";",
"foreach",
"(",
"$",
"plugin_manager",
"->",
"getPluginCapabil... | Gather a list of all patch resolvers from all enabled Composer plugins.
@return ResolverBase[]
A list of PatchResolvers to be run. | [
"Gather",
"a",
"list",
"of",
"all",
"patch",
"resolvers",
"from",
"all",
"enabled",
"Composer",
"plugins",
"."
] | 7eda09d4049c62ad5750e4aadb8663db3dced384 | https://github.com/cweagans/composer-patches/blob/7eda09d4049c62ad5750e4aadb8663db3dced384/src/Plugin/Patches.php#L161-L187 | train |
cweagans/composer-patches | src/Plugin/Patches.php | Patches.resolvePatches | public function resolvePatches(PackageEvent $event)
{
// No need to resolve patches more than once.
if ($this->patchesResolved) {
return;
}
// Let each resolver discover patches and add them to the PatchCollection.
/** @var ResolverInterface $resolver */
... | php | public function resolvePatches(PackageEvent $event)
{
// No need to resolve patches more than once.
if ($this->patchesResolved) {
return;
}
// Let each resolver discover patches and add them to the PatchCollection.
/** @var ResolverInterface $resolver */
... | [
"public",
"function",
"resolvePatches",
"(",
"PackageEvent",
"$",
"event",
")",
"{",
"// No need to resolve patches more than once.",
"if",
"(",
"$",
"this",
"->",
"patchesResolved",
")",
"{",
"return",
";",
"}",
"// Let each resolver discover patches and add them to the Pa... | Gather patches that need to be applied to the current set of packages.
Note that this work is done unconditionally if this plugin is enabled,
even if patching is disabled in any way. The point where patches are applied
is where the work will be skipped. It's done this way to ensure that
patching can be disabled tempor... | [
"Gather",
"patches",
"that",
"need",
"to",
"be",
"applied",
"to",
"the",
"current",
"set",
"of",
"packages",
"."
] | 7eda09d4049c62ad5750e4aadb8663db3dced384 | https://github.com/cweagans/composer-patches/blob/7eda09d4049c62ad5750e4aadb8663db3dced384/src/Plugin/Patches.php#L201-L222 | train |
cweagans/composer-patches | src/Plugin/Patches.php | Patches.checkPatches | public function checkPatches(Event $event)
{
if (!$this->isPatchingEnabled()) {
return;
}
try {
$repositoryManager = $this->composer->getRepositoryManager();
$localRepository = $repositoryManager->getLocalRepository();
$installationManager = $... | php | public function checkPatches(Event $event)
{
if (!$this->isPatchingEnabled()) {
return;
}
try {
$repositoryManager = $this->composer->getRepositoryManager();
$localRepository = $repositoryManager->getLocalRepository();
$installationManager = $... | [
"public",
"function",
"checkPatches",
"(",
"Event",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isPatchingEnabled",
"(",
")",
")",
"{",
"return",
";",
"}",
"try",
"{",
"$",
"repositoryManager",
"=",
"$",
"this",
"->",
"composer",
"->",
... | Before running composer install,
@param Event $event | [
"Before",
"running",
"composer",
"install"
] | 7eda09d4049c62ad5750e4aadb8663db3dced384 | https://github.com/cweagans/composer-patches/blob/7eda09d4049c62ad5750e4aadb8663db3dced384/src/Plugin/Patches.php#L228-L282 | train |
cweagans/composer-patches | src/Plugin/Patches.php | Patches.getPackageFromOperation | protected function getPackageFromOperation(OperationInterface $operation)
{
if ($operation instanceof InstallOperation) {
$package = $operation->getPackage();
} elseif ($operation instanceof UpdateOperation) {
$package = $operation->getTargetPackage();
} else {
... | php | protected function getPackageFromOperation(OperationInterface $operation)
{
if ($operation instanceof InstallOperation) {
$package = $operation->getPackage();
} elseif ($operation instanceof UpdateOperation) {
$package = $operation->getTargetPackage();
} else {
... | [
"protected",
"function",
"getPackageFromOperation",
"(",
"OperationInterface",
"$",
"operation",
")",
"{",
"if",
"(",
"$",
"operation",
"instanceof",
"InstallOperation",
")",
"{",
"$",
"package",
"=",
"$",
"operation",
"->",
"getPackage",
"(",
")",
";",
"}",
"... | Get a Package object from an OperationInterface object.
@param OperationInterface $operation
@return PackageInterface
@throws \Exception | [
"Get",
"a",
"Package",
"object",
"from",
"an",
"OperationInterface",
"object",
"."
] | 7eda09d4049c62ad5750e4aadb8663db3dced384 | https://github.com/cweagans/composer-patches/blob/7eda09d4049c62ad5750e4aadb8663db3dced384/src/Plugin/Patches.php#L352-L363 | train |
cweagans/composer-patches | src/Plugin/Patches.php | Patches.getAndApplyPatch | protected function getAndApplyPatch(RemoteFilesystem $downloader, $install_path, $patch_url)
{
// Local patch file.
if (file_exists($patch_url)) {
$filename = realpath($patch_url);
} else {
// Generate random (but not cryptographically so) filename.
$file... | php | protected function getAndApplyPatch(RemoteFilesystem $downloader, $install_path, $patch_url)
{
// Local patch file.
if (file_exists($patch_url)) {
$filename = realpath($patch_url);
} else {
// Generate random (but not cryptographically so) filename.
$file... | [
"protected",
"function",
"getAndApplyPatch",
"(",
"RemoteFilesystem",
"$",
"downloader",
",",
"$",
"install_path",
",",
"$",
"patch_url",
")",
"{",
"// Local patch file.",
"if",
"(",
"file_exists",
"(",
"$",
"patch_url",
")",
")",
"{",
"$",
"filename",
"=",
"r... | Apply a patch on code in the specified directory.
@param RemoteFilesystem $downloader
@param $install_path
@param $patch_url
@throws \Exception | [
"Apply",
"a",
"patch",
"on",
"code",
"in",
"the",
"specified",
"directory",
"."
] | 7eda09d4049c62ad5750e4aadb8663db3dced384 | https://github.com/cweagans/composer-patches/blob/7eda09d4049c62ad5750e4aadb8663db3dced384/src/Plugin/Patches.php#L373-L452 | train |
cweagans/composer-patches | src/Plugin/Patches.php | Patches.isPatchingEnabled | protected function isPatchingEnabled()
{
$enabled = true;
$has_no_patches = empty($extra['patches']);
$has_no_patches_file = ($this->getConfig('patches-file') === '');
$patching_disabled = $this->getConfig('disable-patching');
if ($patching_disabled || !($has_no_patches && ... | php | protected function isPatchingEnabled()
{
$enabled = true;
$has_no_patches = empty($extra['patches']);
$has_no_patches_file = ($this->getConfig('patches-file') === '');
$patching_disabled = $this->getConfig('disable-patching');
if ($patching_disabled || !($has_no_patches && ... | [
"protected",
"function",
"isPatchingEnabled",
"(",
")",
"{",
"$",
"enabled",
"=",
"true",
";",
"$",
"has_no_patches",
"=",
"empty",
"(",
"$",
"extra",
"[",
"'patches'",
"]",
")",
";",
"$",
"has_no_patches_file",
"=",
"(",
"$",
"this",
"->",
"getConfig",
... | Checks if the root package enables patching.
@return bool
Whether patching is enabled. Defaults to true. | [
"Checks",
"if",
"the",
"root",
"package",
"enables",
"patching",
"."
] | 7eda09d4049c62ad5750e4aadb8663db3dced384 | https://github.com/cweagans/composer-patches/blob/7eda09d4049c62ad5750e4aadb8663db3dced384/src/Plugin/Patches.php#L460-L473 | train |
cweagans/composer-patches | src/Patch.php | Patch.fromJson | public static function fromJson($json)
{
if (!is_object($json)) {
$json = json_decode($json);
}
$properties = ['package', 'description', 'url', 'sha1', 'depth'];
$patch = new static();
foreach ($properties as $property) {
if (isset($json->{$property})... | php | public static function fromJson($json)
{
if (!is_object($json)) {
$json = json_decode($json);
}
$properties = ['package', 'description', 'url', 'sha1', 'depth'];
$patch = new static();
foreach ($properties as $property) {
if (isset($json->{$property})... | [
"public",
"static",
"function",
"fromJson",
"(",
"$",
"json",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"json",
")",
")",
"{",
"$",
"json",
"=",
"json_decode",
"(",
"$",
"json",
")",
";",
"}",
"$",
"properties",
"=",
"[",
"'package'",
",",
... | Create a Patch from a serialized representation.
@param $json
A json_encode'd representation of a Patch.
@return Patch
A Patch with all of the serialized properties set. | [
"Create",
"a",
"Patch",
"from",
"a",
"serialized",
"representation",
"."
] | 7eda09d4049c62ad5750e4aadb8663db3dced384 | https://github.com/cweagans/composer-patches/blob/7eda09d4049c62ad5750e4aadb8663db3dced384/src/Patch.php#L51-L66 | train |
cweagans/composer-patches | src/Resolvers/ResolverBase.php | ResolverBase.findPatchesInJson | public function findPatchesInJson($patches)
{
// Given an array of patch data (pulled directly from the root composer.json
// or a patches file), figure out what patch format each package is using and
// marshall everything into Patch objects.
foreach ($patches as $package => $patch_... | php | public function findPatchesInJson($patches)
{
// Given an array of patch data (pulled directly from the root composer.json
// or a patches file), figure out what patch format each package is using and
// marshall everything into Patch objects.
foreach ($patches as $package => $patch_... | [
"public",
"function",
"findPatchesInJson",
"(",
"$",
"patches",
")",
"{",
"// Given an array of patch data (pulled directly from the root composer.json",
"// or a patches file), figure out what patch format each package is using and",
"// marshall everything into Patch objects.",
"foreach",
... | Handles the different patch definition formats and returns a list of Patches.
@param array $patches
An array of patch defs from composer.json or a patches file.
@return array $patches
An array of Patch objects grouped by package name. | [
"Handles",
"the",
"different",
"patch",
"definition",
"formats",
"and",
"returns",
"a",
"list",
"of",
"Patches",
"."
] | 7eda09d4049c62ad5750e4aadb8663db3dced384 | https://github.com/cweagans/composer-patches/blob/7eda09d4049c62ad5750e4aadb8663db3dced384/src/Resolvers/ResolverBase.php#L56-L92 | train |
cweagans/composer-patches | src/Resolvers/PatchesFile.php | PatchesFile.readPatchesFile | protected function readPatchesFile($patches_file)
{
$patches = file_get_contents($patches_file);
$patches = json_decode($patches, true);
// First, check for JSON syntax issues.
$json_error = json_last_error_msg();
if ($json_error !== "No error") {
throw new \Inva... | php | protected function readPatchesFile($patches_file)
{
$patches = file_get_contents($patches_file);
$patches = json_decode($patches, true);
// First, check for JSON syntax issues.
$json_error = json_last_error_msg();
if ($json_error !== "No error") {
throw new \Inva... | [
"protected",
"function",
"readPatchesFile",
"(",
"$",
"patches_file",
")",
"{",
"$",
"patches",
"=",
"file_get_contents",
"(",
"$",
"patches_file",
")",
";",
"$",
"patches",
"=",
"json_decode",
"(",
"$",
"patches",
",",
"true",
")",
";",
"// First, check for J... | Read a patches file.
@param $patches_file
A URI to a file. Can be anything accepted by file_get_contents().
@return array
A list of patches.
@throws \InvalidArgumentException | [
"Read",
"a",
"patches",
"file",
"."
] | 7eda09d4049c62ad5750e4aadb8663db3dced384 | https://github.com/cweagans/composer-patches/blob/7eda09d4049c62ad5750e4aadb8663db3dced384/src/Resolvers/PatchesFile.php#L53-L71 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.interval | public static function interval(int $interval, AsyncSchedulerInterface $scheduler = null): IntervalObservable
{
return new IntervalObservable($interval, $scheduler ?: Scheduler::getAsync());
} | php | public static function interval(int $interval, AsyncSchedulerInterface $scheduler = null): IntervalObservable
{
return new IntervalObservable($interval, $scheduler ?: Scheduler::getAsync());
} | [
"public",
"static",
"function",
"interval",
"(",
"int",
"$",
"interval",
",",
"AsyncSchedulerInterface",
"$",
"scheduler",
"=",
"null",
")",
":",
"IntervalObservable",
"{",
"return",
"new",
"IntervalObservable",
"(",
"$",
"interval",
",",
"$",
"scheduler",
"?",
... | Returns an Observable that emits an infinite sequence of ascending integers starting at 0, with a constant interval of time of your choosing between emissions.
@param $interval int Period for producing the values in the resulting sequence (specified as an integer denoting milliseconds).
@param null|AsyncSchedulerInter... | [
"Returns",
"an",
"Observable",
"that",
"emits",
"an",
"infinite",
"sequence",
"of",
"ascending",
"integers",
"starting",
"at",
"0",
"with",
"a",
"constant",
"interval",
"of",
"time",
"of",
"your",
"choosing",
"between",
"emissions",
"."
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L170-L173 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.of | public static function of($value, SchedulerInterface $scheduler = null): ReturnObservable
{
return new ReturnObservable($value, $scheduler ?: Scheduler::getDefault());
} | php | public static function of($value, SchedulerInterface $scheduler = null): ReturnObservable
{
return new ReturnObservable($value, $scheduler ?: Scheduler::getDefault());
} | [
"public",
"static",
"function",
"of",
"(",
"$",
"value",
",",
"SchedulerInterface",
"$",
"scheduler",
"=",
"null",
")",
":",
"ReturnObservable",
"{",
"return",
"new",
"ReturnObservable",
"(",
"$",
"value",
",",
"$",
"scheduler",
"?",
":",
"Scheduler",
"::",
... | Returns an observable sequence that contains a single element.
@param mixed $value Single element in the resulting observable sequence.
@param SchedulerInterface $scheduler
@return ReturnObservable An observable sequence with the single element.
@demo of/of.php
@operator
@reactivex just | [
"Returns",
"an",
"observable",
"sequence",
"that",
"contains",
"a",
"single",
"element",
"."
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L186-L189 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.error | public static function error(\Throwable $error, SchedulerInterface $scheduler = null): ErrorObservable
{
return new ErrorObservable($error, $scheduler ?: Scheduler::getImmediate());
} | php | public static function error(\Throwable $error, SchedulerInterface $scheduler = null): ErrorObservable
{
return new ErrorObservable($error, $scheduler ?: Scheduler::getImmediate());
} | [
"public",
"static",
"function",
"error",
"(",
"\\",
"Throwable",
"$",
"error",
",",
"SchedulerInterface",
"$",
"scheduler",
"=",
"null",
")",
":",
"ErrorObservable",
"{",
"return",
"new",
"ErrorObservable",
"(",
"$",
"error",
",",
"$",
"scheduler",
"?",
":",... | Returns an observable sequence that terminates with an exception.
@param \Throwable $error
@param SchedulerInterface $scheduler
@return ErrorObservable The observable sequence that terminates exceptionally with the specified exception object.
@demo error-observable/error-observable.php
@operator
@reactivex empty-neve... | [
"Returns",
"an",
"observable",
"sequence",
"that",
"terminates",
"with",
"an",
"exception",
"."
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L256-L259 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.merge | public function merge(ObservableInterface $otherObservable): Observable
{
return (new AnonymousObservable(function (ObserverInterface $observer) use ($otherObservable) {
$observer->onNext($this);
$observer->onNext($otherObservable);
$observer->onCompleted();
}))->... | php | public function merge(ObservableInterface $otherObservable): Observable
{
return (new AnonymousObservable(function (ObserverInterface $observer) use ($otherObservable) {
$observer->onNext($this);
$observer->onNext($otherObservable);
$observer->onCompleted();
}))->... | [
"public",
"function",
"merge",
"(",
"ObservableInterface",
"$",
"otherObservable",
")",
":",
"Observable",
"{",
"return",
"(",
"new",
"AnonymousObservable",
"(",
"function",
"(",
"ObserverInterface",
"$",
"observer",
")",
"use",
"(",
"$",
"otherObservable",
")",
... | Combine an Observable together with another Observable by merging their emissions into a single Observable.
@param ObservableInterface $otherObservable
@return Observable
@demo merge/merge.php
@operator
@reactivex merge | [
"Combine",
"an",
"Observable",
"together",
"with",
"another",
"Observable",
"by",
"merging",
"their",
"emissions",
"into",
"a",
"single",
"Observable",
"."
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L271-L278 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.fromIterator | public static function fromIterator(\Iterator $iterator, SchedulerInterface $scheduler = null): IteratorObservable
{
return new IteratorObservable($iterator, $scheduler ?: Scheduler::getDefault());
} | php | public static function fromIterator(\Iterator $iterator, SchedulerInterface $scheduler = null): IteratorObservable
{
return new IteratorObservable($iterator, $scheduler ?: Scheduler::getDefault());
} | [
"public",
"static",
"function",
"fromIterator",
"(",
"\\",
"Iterator",
"$",
"iterator",
",",
"SchedulerInterface",
"$",
"scheduler",
"=",
"null",
")",
":",
"IteratorObservable",
"{",
"return",
"new",
"IteratorObservable",
"(",
"$",
"iterator",
",",
"$",
"schedul... | Converts an Iterator into an observable sequence
@param \Iterator $iterator
@param SchedulerInterface $scheduler
@return IteratorObservable
@demo iterator/iterator.php
@operator
@reactivex from | [
"Converts",
"an",
"Iterator",
"into",
"an",
"observable",
"sequence"
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L323-L326 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.range | public static function range(int $start, int $count, SchedulerInterface $scheduler = null): RangeObservable
{
return new RangeObservable($start, $count, $scheduler ?: Scheduler::getDefault());
} | php | public static function range(int $start, int $count, SchedulerInterface $scheduler = null): RangeObservable
{
return new RangeObservable($start, $count, $scheduler ?: Scheduler::getDefault());
} | [
"public",
"static",
"function",
"range",
"(",
"int",
"$",
"start",
",",
"int",
"$",
"count",
",",
"SchedulerInterface",
"$",
"scheduler",
"=",
"null",
")",
":",
"RangeObservable",
"{",
"return",
"new",
"RangeObservable",
"(",
"$",
"start",
",",
"$",
"count... | Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to
send out observer messages.
@param $start
@param $count
@param SchedulerInterface $scheduler
@return RangeObservable
@throws \InvalidArgumentException
@demo range/range.php
@operator
@reactivex range | [
"Generates",
"an",
"observable",
"sequence",
"of",
"integral",
"numbers",
"within",
"a",
"specified",
"range",
"using",
"the",
"specified",
"scheduler",
"to",
"send",
"out",
"observer",
"messages",
"."
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L361-L364 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.mapWithIndex | public function mapWithIndex(callable $selector): Observable
{
$index = 0;
return $this->map(function ($value) use ($selector, &$index) {
return $selector($index++, $value);
});
} | php | public function mapWithIndex(callable $selector): Observable
{
$index = 0;
return $this->map(function ($value) use ($selector, &$index) {
return $selector($index++, $value);
});
} | [
"public",
"function",
"mapWithIndex",
"(",
"callable",
"$",
"selector",
")",
":",
"Observable",
"{",
"$",
"index",
"=",
"0",
";",
"return",
"$",
"this",
"->",
"map",
"(",
"function",
"(",
"$",
"value",
")",
"use",
"(",
"$",
"selector",
",",
"&",
"$",... | Maps operator variant that calls the map selector with the index and value
@param callable $selector
@return Observable
@demo map/mapWithIndex.php
@operator
@reactivex map | [
"Maps",
"operator",
"variant",
"that",
"calls",
"the",
"map",
"selector",
"with",
"the",
"index",
"and",
"value"
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L425-L431 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.skipWhileWithIndex | public function skipWhileWithIndex(callable $predicate): Observable
{
$index = 0;
return $this->skipWhile(function ($value) use ($predicate, &$index) {
return $predicate($index++, $value);
});
} | php | public function skipWhileWithIndex(callable $predicate): Observable
{
$index = 0;
return $this->skipWhile(function ($value) use ($predicate, &$index) {
return $predicate($index++, $value);
});
} | [
"public",
"function",
"skipWhileWithIndex",
"(",
"callable",
"$",
"predicate",
")",
":",
"Observable",
"{",
"$",
"index",
"=",
"0",
";",
"return",
"$",
"this",
"->",
"skipWhile",
"(",
"function",
"(",
"$",
"value",
")",
"use",
"(",
"$",
"predicate",
",",... | Bypasses elements in an observable sequence as long as a specified condition is true and then returns the
remaining elements. The element's index is used in the logic of the predicate function.
@param callable $predicate A function to test each element for a condition; the first parameter of the
function represents th... | [
"Bypasses",
"elements",
"in",
"an",
"observable",
"sequence",
"as",
"long",
"as",
"a",
"specified",
"condition",
"is",
"true",
"and",
"then",
"returns",
"the",
"remaining",
"elements",
".",
"The",
"element",
"s",
"index",
"is",
"used",
"in",
"the",
"logic",
... | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L618-L624 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.take | public function take(int $count): Observable
{
if ($count === 0) {
return self::empty();
}
return $this->lift(function () use ($count) {
return new TakeOperator($count);
});
} | php | public function take(int $count): Observable
{
if ($count === 0) {
return self::empty();
}
return $this->lift(function () use ($count) {
return new TakeOperator($count);
});
} | [
"public",
"function",
"take",
"(",
"int",
"$",
"count",
")",
":",
"Observable",
"{",
"if",
"(",
"$",
"count",
"===",
"0",
")",
"{",
"return",
"self",
"::",
"empty",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"lift",
"(",
"function",
"(",
")... | Returns a specified number of contiguous elements from the start of an observable sequence
@param integer $count
@return Observable|EmptyObservable
@demo take/take.php
@operator
@reactivex take | [
"Returns",
"a",
"specified",
"number",
"of",
"contiguous",
"elements",
"from",
"the",
"start",
"of",
"an",
"observable",
"sequence"
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L636-L645 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.takeWhileWithIndex | public function takeWhileWithIndex(callable $predicate): Observable
{
$index = 0;
return $this->takeWhile(function ($value) use ($predicate, &$index) {
return $predicate($index++, $value);
});
} | php | public function takeWhileWithIndex(callable $predicate): Observable
{
$index = 0;
return $this->takeWhile(function ($value) use ($predicate, &$index) {
return $predicate($index++, $value);
});
} | [
"public",
"function",
"takeWhileWithIndex",
"(",
"callable",
"$",
"predicate",
")",
":",
"Observable",
"{",
"$",
"index",
"=",
"0",
";",
"return",
"$",
"this",
"->",
"takeWhile",
"(",
"function",
"(",
"$",
"value",
")",
"use",
"(",
"$",
"predicate",
",",... | Returns elements from an observable sequence as long as a specified condition is true. It takes as a parameter a
a callback to test each source element for a condition. The callback predicate is called with the index and the
value of the element.
@param callable $predicate
@return Observable
@demo take/takeWhileWit... | [
"Returns",
"elements",
"from",
"an",
"observable",
"sequence",
"as",
"long",
"as",
"a",
"specified",
"condition",
"is",
"true",
".",
"It",
"takes",
"as",
"a",
"parameter",
"a",
"a",
"callback",
"to",
"test",
"each",
"source",
"element",
"for",
"a",
"condit... | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L697-L703 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.groupBy | public function groupBy(callable $keySelector, callable $elementSelector = null, callable $keySerializer = null): Observable
{
return $this->groupByUntil($keySelector, $elementSelector, function () {
return static::never();
}, $keySerializer);
} | php | public function groupBy(callable $keySelector, callable $elementSelector = null, callable $keySerializer = null): Observable
{
return $this->groupByUntil($keySelector, $elementSelector, function () {
return static::never();
}, $keySerializer);
} | [
"public",
"function",
"groupBy",
"(",
"callable",
"$",
"keySelector",
",",
"callable",
"$",
"elementSelector",
"=",
"null",
",",
"callable",
"$",
"keySerializer",
"=",
"null",
")",
":",
"Observable",
"{",
"return",
"$",
"this",
"->",
"groupByUntil",
"(",
"$"... | Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
@param callable $keySelector
@param callable|null $elementSelector
@param callable|null $keySerializer
@return Observable
@demo groupBy/groupBy.ph... | [
"Groups",
"the",
"elements",
"of",
"an",
"observable",
"sequence",
"according",
"to",
"a",
"specified",
"key",
"selector",
"function",
"and",
"comparer",
"and",
"selects",
"the",
"resulting",
"elements",
"by",
"using",
"a",
"specified",
"function",
"."
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L734-L739 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.reduce | public function reduce(callable $accumulator, $seed = null): Observable
{
return $this->lift(function () use ($accumulator, $seed) {
return new ReduceOperator($accumulator, $seed);
});
} | php | public function reduce(callable $accumulator, $seed = null): Observable
{
return $this->lift(function () use ($accumulator, $seed) {
return new ReduceOperator($accumulator, $seed);
});
} | [
"public",
"function",
"reduce",
"(",
"callable",
"$",
"accumulator",
",",
"$",
"seed",
"=",
"null",
")",
":",
"Observable",
"{",
"return",
"$",
"this",
"->",
"lift",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"accumulator",
",",
"$",
"seed",
")",
"{... | Applies an accumulator function over an observable sequence,
returning the result of the aggregation as a single element in the result sequence.
The specified seed value is used as the initial accumulator value.
@param callable $accumulator - An accumulator function to be invoked on each element.
@param mixed $seed [o... | [
"Applies",
"an",
"accumulator",
"function",
"over",
"an",
"observable",
"sequence",
"returning",
"the",
"result",
"of",
"the",
"aggregation",
"as",
"a",
"single",
"element",
"in",
"the",
"result",
"sequence",
".",
"The",
"specified",
"seed",
"value",
"is",
"us... | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L819-L824 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.distinct | public function distinct(callable $comparer = null): Observable
{
return $this->lift(function () use ($comparer) {
return new DistinctOperator(null, $comparer);
});
} | php | public function distinct(callable $comparer = null): Observable
{
return $this->lift(function () use ($comparer) {
return new DistinctOperator(null, $comparer);
});
} | [
"public",
"function",
"distinct",
"(",
"callable",
"$",
"comparer",
"=",
"null",
")",
":",
"Observable",
"{",
"return",
"$",
"this",
"->",
"lift",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"comparer",
")",
"{",
"return",
"new",
"DistinctOperator",
"(",... | Returns an observable sequence that contains only distinct elements according to the keySelector and the
comparer. Usage of this operator should be considered carefully due to the maintenance of an internal lookup
structure which can grow large.
@param callable|null $comparer
@return Observable
@demo distinct/distinc... | [
"Returns",
"an",
"observable",
"sequence",
"that",
"contains",
"only",
"distinct",
"elements",
"according",
"to",
"the",
"keySelector",
"and",
"the",
"comparer",
".",
"Usage",
"of",
"this",
"operator",
"should",
"be",
"considered",
"carefully",
"due",
"to",
"the... | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L838-L843 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.distinctKey | public function distinctKey(callable $keySelector, callable $comparer = null): Observable
{
return $this->lift(function () use ($keySelector, $comparer) {
return new DistinctOperator($keySelector, $comparer);
});
} | php | public function distinctKey(callable $keySelector, callable $comparer = null): Observable
{
return $this->lift(function () use ($keySelector, $comparer) {
return new DistinctOperator($keySelector, $comparer);
});
} | [
"public",
"function",
"distinctKey",
"(",
"callable",
"$",
"keySelector",
",",
"callable",
"$",
"comparer",
"=",
"null",
")",
":",
"Observable",
"{",
"return",
"$",
"this",
"->",
"lift",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"keySelector",
",",
"$"... | Variant of distinct that takes a key selector
@param callable|null $keySelector
@param callable|null $comparer
@return Observable
@demo distinct/distinctKey.php
@operator
@reactivex distinct | [
"Variant",
"of",
"distinct",
"that",
"takes",
"a",
"key",
"selector"
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L856-L861 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.distinctUntilChanged | public function distinctUntilChanged(callable $comparer = null): Observable
{
return $this->lift(function () use ($comparer) {
return new DistinctUntilChangedOperator(null, $comparer);
});
} | php | public function distinctUntilChanged(callable $comparer = null): Observable
{
return $this->lift(function () use ($comparer) {
return new DistinctUntilChangedOperator(null, $comparer);
});
} | [
"public",
"function",
"distinctUntilChanged",
"(",
"callable",
"$",
"comparer",
"=",
"null",
")",
":",
"Observable",
"{",
"return",
"$",
"this",
"->",
"lift",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"comparer",
")",
"{",
"return",
"new",
"DistinctUntil... | A variant of distinct that only compares emitted items from the source Observable against their immediate predecessors in order to determine whether or not they are distinct.
@param callable $comparer
@return Observable
@demo distinct/distinctUntilChanged.php
@operator
@reactivex distinct | [
"A",
"variant",
"of",
"distinct",
"that",
"only",
"compares",
"emitted",
"items",
"from",
"the",
"source",
"Observable",
"against",
"their",
"immediate",
"predecessors",
"in",
"order",
"to",
"determine",
"whether",
"or",
"not",
"they",
"are",
"distinct",
"."
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L873-L878 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.distinctUntilKeyChanged | public function distinctUntilKeyChanged(callable $keySelector = null, callable $comparer = null): Observable
{
return $this->lift(function () use ($keySelector, $comparer) {
return new DistinctUntilChangedOperator($keySelector, $comparer);
});
} | php | public function distinctUntilKeyChanged(callable $keySelector = null, callable $comparer = null): Observable
{
return $this->lift(function () use ($keySelector, $comparer) {
return new DistinctUntilChangedOperator($keySelector, $comparer);
});
} | [
"public",
"function",
"distinctUntilKeyChanged",
"(",
"callable",
"$",
"keySelector",
"=",
"null",
",",
"callable",
"$",
"comparer",
"=",
"null",
")",
":",
"Observable",
"{",
"return",
"$",
"this",
"->",
"lift",
"(",
"function",
"(",
")",
"use",
"(",
"$",
... | Variant of distinctUntilChanged that takes a key selector
and the comparer.
@param callable $keySelector
@param callable $comparer
@return Observable
@demo distinct/distinctUntilKeyChanged.php
@operator
@reactivex distinct | [
"Variant",
"of",
"distinctUntilChanged",
"that",
"takes",
"a",
"key",
"selector",
"and",
"the",
"comparer",
"."
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L892-L897 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.do | public function do($onNextOrObserver = null, callable $onError = null, callable $onCompleted = null): Observable
{
if ($onNextOrObserver instanceof ObserverInterface) {
$observer = $onNextOrObserver;
} elseif (is_callable($onNextOrObserver)) {
$observer = new DoObserver($onNe... | php | public function do($onNextOrObserver = null, callable $onError = null, callable $onCompleted = null): Observable
{
if ($onNextOrObserver instanceof ObserverInterface) {
$observer = $onNextOrObserver;
} elseif (is_callable($onNextOrObserver)) {
$observer = new DoObserver($onNe... | [
"public",
"function",
"do",
"(",
"$",
"onNextOrObserver",
"=",
"null",
",",
"callable",
"$",
"onError",
"=",
"null",
",",
"callable",
"$",
"onCompleted",
"=",
"null",
")",
":",
"Observable",
"{",
"if",
"(",
"$",
"onNextOrObserver",
"instanceof",
"ObserverInt... | Invokes an action for each element in the observable sequence and invokes an action upon graceful
or exceptional termination of the observable sequence.
This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to
run arbitrary actions for messages on the pipeline.
When ... | [
"Invokes",
"an",
"action",
"for",
"each",
"element",
"in",
"the",
"observable",
"sequence",
"and",
"invokes",
"an",
"action",
"upon",
"graceful",
"or",
"exceptional",
"termination",
"of",
"the",
"observable",
"sequence",
".",
"This",
"method",
"can",
"be",
"us... | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L923-L936 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.timer | public static function timer(int $dueTime, AsyncSchedulerInterface $scheduler = null): TimerObservable
{
return new TimerObservable($dueTime, $scheduler ?: Scheduler::getAsync());
} | php | public static function timer(int $dueTime, AsyncSchedulerInterface $scheduler = null): TimerObservable
{
return new TimerObservable($dueTime, $scheduler ?: Scheduler::getAsync());
} | [
"public",
"static",
"function",
"timer",
"(",
"int",
"$",
"dueTime",
",",
"AsyncSchedulerInterface",
"$",
"scheduler",
"=",
"null",
")",
":",
"TimerObservable",
"{",
"return",
"new",
"TimerObservable",
"(",
"$",
"dueTime",
",",
"$",
"scheduler",
"?",
":",
"S... | Returns an observable sequence that produces a value after dueTime has elapsed.
@param integer $dueTime - milliseconds
@param AsyncSchedulerInterface $scheduler
@return TimerObservable
@demo timer/timer.php
@operator
@reactivex timer | [
"Returns",
"an",
"observable",
"sequence",
"that",
"produces",
"a",
"value",
"after",
"dueTime",
"has",
"elapsed",
"."
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L1087-L1090 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.concatMap | public function concatMap(callable $selector, callable $resultSelector = null): Observable
{
return $this->lift(function () use ($selector, $resultSelector) {
return new ConcatMapOperator(new ObservableFactoryWrapper($selector), $resultSelector);
});
} | php | public function concatMap(callable $selector, callable $resultSelector = null): Observable
{
return $this->lift(function () use ($selector, $resultSelector) {
return new ConcatMapOperator(new ObservableFactoryWrapper($selector), $resultSelector);
});
} | [
"public",
"function",
"concatMap",
"(",
"callable",
"$",
"selector",
",",
"callable",
"$",
"resultSelector",
"=",
"null",
")",
":",
"Observable",
"{",
"return",
"$",
"this",
"->",
"lift",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"selector",
",",
"$",
... | Projects each element of an observable sequence to an observable sequence and concatenates the resulting
observable sequences into one observable sequence.
@param callable $selector A transform function to apply to each element from the source sequence onto.
The selector is called with the following information:
- the... | [
"Projects",
"each",
"element",
"of",
"an",
"observable",
"sequence",
"to",
"an",
"observable",
"sequence",
"and",
"concatenates",
"the",
"resulting",
"observable",
"sequences",
"into",
"one",
"observable",
"sequence",
"."
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L1150-L1155 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.concatMapTo | public function concatMapTo(ObservableInterface $observable, callable $resultSelector = null): Observable
{
return $this->concatMap(function () use ($observable) {
return $observable;
}, $resultSelector);
} | php | public function concatMapTo(ObservableInterface $observable, callable $resultSelector = null): Observable
{
return $this->concatMap(function () use ($observable) {
return $observable;
}, $resultSelector);
} | [
"public",
"function",
"concatMapTo",
"(",
"ObservableInterface",
"$",
"observable",
",",
"callable",
"$",
"resultSelector",
"=",
"null",
")",
":",
"Observable",
"{",
"return",
"$",
"this",
"->",
"concatMap",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"obser... | Projects each element of the source observable sequence to the other observable sequence and merges the
resulting observable sequences into one observable sequence.
@param ObservableInterface $observable - An an observable sequence to project each element from the source
sequence onto.
@param callable $resultSelector... | [
"Projects",
"each",
"element",
"of",
"the",
"source",
"observable",
"sequence",
"to",
"the",
"other",
"observable",
"sequence",
"and",
"merges",
"the",
"resulting",
"observable",
"sequences",
"into",
"one",
"observable",
"sequence",
"."
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L1179-L1184 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.publishValue | public function publishValue($initialValue, callable $selector = null): Observable
{
return $this->multicast(new BehaviorSubject($initialValue), $selector);
} | php | public function publishValue($initialValue, callable $selector = null): Observable
{
return $this->multicast(new BehaviorSubject($initialValue), $selector);
} | [
"public",
"function",
"publishValue",
"(",
"$",
"initialValue",
",",
"callable",
"$",
"selector",
"=",
"null",
")",
":",
"Observable",
"{",
"return",
"$",
"this",
"->",
"multicast",
"(",
"new",
"BehaviorSubject",
"(",
"$",
"initialValue",
")",
",",
"$",
"s... | Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence
that shares a single subscription to the underlying sequence and starts with initialValue.
This operator is a specialization of Multicast using a BehaviorSubject.
@param mixed $initialValue
@param callable $... | [
"Returns",
"an",
"observable",
"sequence",
"that",
"is",
"the",
"result",
"of",
"invoking",
"the",
"selector",
"on",
"a",
"connectable",
"observable",
"sequence",
"that",
"shares",
"a",
"single",
"subscription",
"to",
"the",
"underlying",
"sequence",
"and",
"sta... | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L1308-L1311 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.singleInstance | public function singleInstance(): Observable
{
$hasObservable = false;
$observable = null;
$source = $this;
$getObservable = function () use (&$hasObservable, &$observable, $source): Observable {
if (!$hasObservable) {
$hasObservable = true;
... | php | public function singleInstance(): Observable
{
$hasObservable = false;
$observable = null;
$source = $this;
$getObservable = function () use (&$hasObservable, &$observable, $source): Observable {
if (!$hasObservable) {
$hasObservable = true;
... | [
"public",
"function",
"singleInstance",
"(",
")",
":",
"Observable",
"{",
"$",
"hasObservable",
"=",
"false",
";",
"$",
"observable",
"=",
"null",
";",
"$",
"source",
"=",
"$",
"this",
";",
"$",
"getObservable",
"=",
"function",
"(",
")",
"use",
"(",
"... | Returns an observable sequence that shares a single subscription to the underlying sequence. This observable sequence
can be resubscribed to, even if all prior subscriptions have ended.
This operator behaves like share() in RxJS 5
@return \Rx\Observable An observable sequence that contains the elements of a sequence
... | [
"Returns",
"an",
"observable",
"sequence",
"that",
"shares",
"a",
"single",
"subscription",
"to",
"the",
"underlying",
"sequence",
".",
"This",
"observable",
"sequence",
"can",
"be",
"resubscribed",
"to",
"even",
"if",
"all",
"prior",
"subscriptions",
"have",
"e... | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L1345-L1367 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.shareReplay | public function shareReplay(int $bufferSize, int $windowSize = null, SchedulerInterface $scheduler = null): RefCountObservable
{
return $this->replay(null, $bufferSize, $windowSize, $scheduler)->refCount();
} | php | public function shareReplay(int $bufferSize, int $windowSize = null, SchedulerInterface $scheduler = null): RefCountObservable
{
return $this->replay(null, $bufferSize, $windowSize, $scheduler)->refCount();
} | [
"public",
"function",
"shareReplay",
"(",
"int",
"$",
"bufferSize",
",",
"int",
"$",
"windowSize",
"=",
"null",
",",
"SchedulerInterface",
"$",
"scheduler",
"=",
"null",
")",
":",
"RefCountObservable",
"{",
"return",
"$",
"this",
"->",
"replay",
"(",
"null",... | Returns an observable sequence that shares a single subscription to the underlying sequence replaying
notifications subject to a maximum time length for the replay buffer.
This operator is a specialization of replay which creates a subscription when the number of observers goes from
zero to one, then shares that sub... | [
"Returns",
"an",
"observable",
"sequence",
"that",
"shares",
"a",
"single",
"subscription",
"to",
"the",
"underlying",
"sequence",
"replaying",
"notifications",
"subject",
"to",
"a",
"maximum",
"time",
"length",
"for",
"the",
"replay",
"buffer",
"."
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L1428-L1431 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.repeat | public function repeat(int $count = -1): Observable
{
if ($count === 0) {
return self::empty();
}
return $this->lift(function () use ($count) {
return new RepeatOperator($count);
});
} | php | public function repeat(int $count = -1): Observable
{
if ($count === 0) {
return self::empty();
}
return $this->lift(function () use ($count) {
return new RepeatOperator($count);
});
} | [
"public",
"function",
"repeat",
"(",
"int",
"$",
"count",
"=",
"-",
"1",
")",
":",
"Observable",
"{",
"if",
"(",
"$",
"count",
"===",
"0",
")",
"{",
"return",
"self",
"::",
"empty",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"lift",
"(",
... | Generates an observable sequence that repeats the given element the specified number of times.
@param int $count
@return Observable|EmptyObservable
@demo repeat/repeat.php
@operator
@reactivex repeat | [
"Generates",
"an",
"observable",
"sequence",
"that",
"repeats",
"the",
"given",
"element",
"the",
"specified",
"number",
"of",
"times",
"."
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L1573-L1582 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.timeout | public function timeout(int $timeout, ObservableInterface $timeoutObservable = null, AsyncSchedulerInterface $scheduler = null): Observable
{
return $this->lift(function () use ($timeout, $timeoutObservable, $scheduler) {
return new TimeoutOperator($timeout, $timeoutObservable, $scheduler ?: Sch... | php | public function timeout(int $timeout, ObservableInterface $timeoutObservable = null, AsyncSchedulerInterface $scheduler = null): Observable
{
return $this->lift(function () use ($timeout, $timeoutObservable, $scheduler) {
return new TimeoutOperator($timeout, $timeoutObservable, $scheduler ?: Sch... | [
"public",
"function",
"timeout",
"(",
"int",
"$",
"timeout",
",",
"ObservableInterface",
"$",
"timeoutObservable",
"=",
"null",
",",
"AsyncSchedulerInterface",
"$",
"scheduler",
"=",
"null",
")",
":",
"Observable",
"{",
"return",
"$",
"this",
"->",
"lift",
"("... | Errors the observable sequence if no item is emitted in the specified time.
When a timeout occurs, this operator errors with an instance of Rx\Exception\TimeoutException
@param $timeout
@param ObservableInterface $timeoutObservable
@param AsyncSchedulerInterface $scheduler
@return Observable
@demo timeout/timeout.php... | [
"Errors",
"the",
"observable",
"sequence",
"if",
"no",
"item",
"is",
"emitted",
"in",
"the",
"specified",
"time",
".",
"When",
"a",
"timeout",
"occurs",
"this",
"operator",
"errors",
"with",
"an",
"instance",
"of",
"Rx",
"\\",
"Exception",
"\\",
"TimeoutExce... | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L1649-L1654 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.bufferWithCount | public function bufferWithCount(int $count, int $skip = null): Observable
{
return $this->lift(function () use ($count, $skip) {
return new BufferWithCountOperator($count, $skip);
});
} | php | public function bufferWithCount(int $count, int $skip = null): Observable
{
return $this->lift(function () use ($count, $skip) {
return new BufferWithCountOperator($count, $skip);
});
} | [
"public",
"function",
"bufferWithCount",
"(",
"int",
"$",
"count",
",",
"int",
"$",
"skip",
"=",
"null",
")",
":",
"Observable",
"{",
"return",
"$",
"this",
"->",
"lift",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"count",
",",
"$",
"skip",
")",
"... | Projects each element of an observable sequence into zero or more buffers which are produced based on
element count information.
@param $count
@param int $skip
@return Observable
@throws \InvalidArgumentException
@demo bufferWithCount/bufferWithCount.php
@demo bufferWithCount/bufferWithCountAndSkip.php
@operator
@rea... | [
"Projects",
"each",
"element",
"of",
"an",
"observable",
"sequence",
"into",
"zero",
"or",
"more",
"buffers",
"which",
"are",
"produced",
"based",
"on",
"element",
"count",
"information",
"."
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L1670-L1675 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.startWith | public function startWith($startValue, SchedulerInterface $scheduler = null): Observable
{
return $this->startWithArray([$startValue], $scheduler);
} | php | public function startWith($startValue, SchedulerInterface $scheduler = null): Observable
{
return $this->startWithArray([$startValue], $scheduler);
} | [
"public",
"function",
"startWith",
"(",
"$",
"startValue",
",",
"SchedulerInterface",
"$",
"scheduler",
"=",
"null",
")",
":",
"Observable",
"{",
"return",
"$",
"this",
"->",
"startWithArray",
"(",
"[",
"$",
"startValue",
"]",
",",
"$",
"scheduler",
")",
"... | Prepends a value to an observable sequence with an argument of a signal value to prepend.
@param mixed $startValue
@param SchedulerInterface $scheduler
@return Observable
@demo startWith/startWith.php
@operator
@reactivex startwith | [
"Prepends",
"a",
"value",
"to",
"an",
"observable",
"sequence",
"with",
"an",
"argument",
"of",
"a",
"signal",
"value",
"to",
"prepend",
"."
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L1717-L1720 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.startWithArray | public function startWithArray(array $startArray, SchedulerInterface $scheduler = null): Observable
{
return $this->lift(function () use ($startArray, $scheduler) {
return new StartWithArrayOperator($startArray, $scheduler ?: Scheduler::getDefault());
});
} | php | public function startWithArray(array $startArray, SchedulerInterface $scheduler = null): Observable
{
return $this->lift(function () use ($startArray, $scheduler) {
return new StartWithArrayOperator($startArray, $scheduler ?: Scheduler::getDefault());
});
} | [
"public",
"function",
"startWithArray",
"(",
"array",
"$",
"startArray",
",",
"SchedulerInterface",
"$",
"scheduler",
"=",
"null",
")",
":",
"Observable",
"{",
"return",
"$",
"this",
"->",
"lift",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"startArray",
"... | Prepends a sequence of values to an observable sequence with an argument of an array of values to prepend.
@param array $startArray
@param SchedulerInterface $scheduler
@return Observable
@demo startWith/startWithArray.php
@operator
@reactivex startwith | [
"Prepends",
"a",
"sequence",
"of",
"values",
"to",
"an",
"observable",
"sequence",
"with",
"an",
"argument",
"of",
"an",
"array",
"of",
"values",
"to",
"prepend",
"."
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L1733-L1738 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.timestamp | public function timestamp(SchedulerInterface $scheduler = null): Observable
{
return $this->lift(function () use ($scheduler) {
return new TimestampOperator($scheduler ?: Scheduler::getDefault());
});
} | php | public function timestamp(SchedulerInterface $scheduler = null): Observable
{
return $this->lift(function () use ($scheduler) {
return new TimestampOperator($scheduler ?: Scheduler::getDefault());
});
} | [
"public",
"function",
"timestamp",
"(",
"SchedulerInterface",
"$",
"scheduler",
"=",
"null",
")",
":",
"Observable",
"{",
"return",
"$",
"this",
"->",
"lift",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"scheduler",
")",
"{",
"return",
"new",
"TimestampOpe... | Records the timestamp for each value in an observable sequence.
@param SchedulerInterface|null $scheduler
@return Observable
@demo timestamp/timestamp.php
@operator
@reactivex timestamp | [
"Records",
"the",
"timestamp",
"for",
"each",
"value",
"in",
"an",
"observable",
"sequence",
"."
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L1816-L1821 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.partition | public function partition(callable $predicate): array
{
return [
$this->filter($predicate),
$this->filter(function () use ($predicate) {
return !call_user_func_array($predicate, func_get_args());
})
];
} | php | public function partition(callable $predicate): array
{
return [
$this->filter($predicate),
$this->filter(function () use ($predicate) {
return !call_user_func_array($predicate, func_get_args());
})
];
} | [
"public",
"function",
"partition",
"(",
"callable",
"$",
"predicate",
")",
":",
"array",
"{",
"return",
"[",
"$",
"this",
"->",
"filter",
"(",
"$",
"predicate",
")",
",",
"$",
"this",
"->",
"filter",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"predi... | Returns two observables which partition the observations of the source by the given function.
The first will trigger observations for those values for which the predicate returns true.
The second will trigger observations for those values where the predicate returns false.
The predicate is executed once for each subscr... | [
"Returns",
"two",
"observables",
"which",
"partition",
"the",
"observations",
"of",
"the",
"source",
"by",
"the",
"given",
"function",
".",
"The",
"first",
"will",
"trigger",
"observations",
"for",
"those",
"values",
"for",
"which",
"the",
"predicate",
"returns"... | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L1889-L1897 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.race | public static function race(array $observables, SchedulerInterface $scheduler = null): Observable
{
if (count($observables) === 1) {
return $observables[0];
}
return static::fromArray($observables, $scheduler)->lift(function () {
return new RaceOperator();
})... | php | public static function race(array $observables, SchedulerInterface $scheduler = null): Observable
{
if (count($observables) === 1) {
return $observables[0];
}
return static::fromArray($observables, $scheduler)->lift(function () {
return new RaceOperator();
})... | [
"public",
"static",
"function",
"race",
"(",
"array",
"$",
"observables",
",",
"SchedulerInterface",
"$",
"scheduler",
"=",
"null",
")",
":",
"Observable",
"{",
"if",
"(",
"count",
"(",
"$",
"observables",
")",
"===",
"1",
")",
"{",
"return",
"$",
"obser... | Propagates the observable sequence that reacts first. Also known as 'amb'.
@param Observable[] $observables
@param SchedulerInterface $scheduler
@return Observable
@demo race/race.php
@operator
@reactivex amb | [
"Propagates",
"the",
"observable",
"sequence",
"that",
"reacts",
"first",
".",
"Also",
"known",
"as",
"amb",
"."
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L1910-L1919 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.average | public function average(): Observable
{
return $this
->defaultIfEmpty(Observable::error(new \UnderflowException()))
->reduce(function ($a, $x) {
static $count = 0;
static $total = 0;
$count++;
$total += $x;
... | php | public function average(): Observable
{
return $this
->defaultIfEmpty(Observable::error(new \UnderflowException()))
->reduce(function ($a, $x) {
static $count = 0;
static $total = 0;
$count++;
$total += $x;
... | [
"public",
"function",
"average",
"(",
")",
":",
"Observable",
"{",
"return",
"$",
"this",
"->",
"defaultIfEmpty",
"(",
"Observable",
"::",
"error",
"(",
"new",
"\\",
"UnderflowException",
"(",
")",
")",
")",
"->",
"reduce",
"(",
"function",
"(",
"$",
"a"... | Computes the average of an observable sequence of values.
@return Observable
@demo average/average.php
@operator
@reactivex average | [
"Computes",
"the",
"average",
"of",
"an",
"observable",
"sequence",
"of",
"values",
"."
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L1947-L1960 | train |
ReactiveX/RxPHP | src/Observable.php | Observable.throttle | public function throttle(int $throttleDuration, SchedulerInterface $scheduler = null): Observable
{
return $this->lift(function () use ($throttleDuration, $scheduler) {
return new ThrottleOperator($throttleDuration, $scheduler ?: Scheduler::getDefault());
});
} | php | public function throttle(int $throttleDuration, SchedulerInterface $scheduler = null): Observable
{
return $this->lift(function () use ($throttleDuration, $scheduler) {
return new ThrottleOperator($throttleDuration, $scheduler ?: Scheduler::getDefault());
});
} | [
"public",
"function",
"throttle",
"(",
"int",
"$",
"throttleDuration",
",",
"SchedulerInterface",
"$",
"scheduler",
"=",
"null",
")",
":",
"Observable",
"{",
"return",
"$",
"this",
"->",
"lift",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"throttleDuration",... | Returns an Observable that emits only the first item emitted by the source Observable during
sequential time windows of a specified duration.
If items are emitted on the source observable prior to the expiration of the time period,
the last item emitted on the source observable will be emitted.
@param $throttleDurati... | [
"Returns",
"an",
"Observable",
"that",
"emits",
"only",
"the",
"first",
"item",
"emitted",
"by",
"the",
"source",
"Observable",
"during",
"sequential",
"time",
"windows",
"of",
"a",
"specified",
"duration",
"."
] | fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4 | https://github.com/ReactiveX/RxPHP/blob/fd74a0cd2b5edd4a48e4ff12aaa44cc6cdc4a9b4/src/Observable.php#L2007-L2012 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.