id int32 0 241k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
35,700 | ouqiang/etcd-php | src/Client.php | Client.changeUserPassword | public function changeUserPassword($user, $password)
{
$params = [
'name' => $user,
'password' => $password,
];
$body = $this->request(self::URI_AUTH_USER_CHANGE_PASSWORD, $params);
return $body;
} | php | public function changeUserPassword($user, $password)
{
$params = [
'name' => $user,
'password' => $password,
];
$body = $this->request(self::URI_AUTH_USER_CHANGE_PASSWORD, $params);
return $body;
} | [
"public",
"function",
"changeUserPassword",
"(",
"$",
"user",
",",
"$",
"password",
")",
"{",
"$",
"params",
"=",
"[",
"'name'",
"=>",
"$",
"user",
",",
"'password'",
"=>",
"$",
"password",
",",
"]",
";",
"$",
"body",
"=",
"$",
"this",
"->",
"request... | change the password of a specified user.
@param string $user
@param string $password
@return array
@throws \GuzzleHttp\Exception\BadResponseException | [
"change",
"the",
"password",
"of",
"a",
"specified",
"user",
"."
] | 8d16ee71fadb50e055b83509da78e21ff959fe2c | https://github.com/ouqiang/etcd-php/blob/8d16ee71fadb50e055b83509da78e21ff959fe2c/src/Client.php#L595-L605 |
35,701 | ouqiang/etcd-php | src/Client.php | Client.grantRolePermission | public function grantRolePermission($role, $permType, $key, $rangeEnd = null)
{
$params = [
'name' => $role,
'perm' => [
'permType' => $permType,
'key' => base64_encode($key),
],
];
if ($rangeEnd !== null) {
$par... | php | public function grantRolePermission($role, $permType, $key, $rangeEnd = null)
{
$params = [
'name' => $role,
'perm' => [
'permType' => $permType,
'key' => base64_encode($key),
],
];
if ($rangeEnd !== null) {
$par... | [
"public",
"function",
"grantRolePermission",
"(",
"$",
"role",
",",
"$",
"permType",
",",
"$",
"key",
",",
"$",
"rangeEnd",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"[",
"'name'",
"=>",
"$",
"role",
",",
"'perm'",
"=>",
"[",
"'permType'",
"=>",
"$"... | grant a permission of a specified key or range to a specified role.
@param string $role
@param int $permType
@param string $key
@param string|null $rangeEnd
@return array
@throws \GuzzleHttp\Exception\BadResponseException | [
"grant",
"a",
"permission",
"of",
"a",
"specified",
"key",
"or",
"range",
"to",
"a",
"specified",
"role",
"."
] | 8d16ee71fadb50e055b83509da78e21ff959fe2c | https://github.com/ouqiang/etcd-php/blob/8d16ee71fadb50e055b83509da78e21ff959fe2c/src/Client.php#L617-L633 |
35,702 | ouqiang/etcd-php | src/Client.php | Client.revokeRolePermission | public function revokeRolePermission($role, $key, $rangeEnd = null)
{
$params = [
'role' => $role,
'key' => $key,
];
if ($rangeEnd !== null) {
$params['range_end'] = $rangeEnd;
}
$body = $this->request(self::URI_AUTH_ROLE_REVOKE, $params);... | php | public function revokeRolePermission($role, $key, $rangeEnd = null)
{
$params = [
'role' => $role,
'key' => $key,
];
if ($rangeEnd !== null) {
$params['range_end'] = $rangeEnd;
}
$body = $this->request(self::URI_AUTH_ROLE_REVOKE, $params);... | [
"public",
"function",
"revokeRolePermission",
"(",
"$",
"role",
",",
"$",
"key",
",",
"$",
"rangeEnd",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"[",
"'role'",
"=>",
"$",
"role",
",",
"'key'",
"=>",
"$",
"key",
",",
"]",
";",
"if",
"(",
"$",
"ra... | revoke a key or range permission of a specified role.
@param string $role
@param string $key
@param string|null $rangeEnd
@return array
@throws BadResponseException | [
"revoke",
"a",
"key",
"or",
"range",
"permission",
"of",
"a",
"specified",
"role",
"."
] | 8d16ee71fadb50e055b83509da78e21ff959fe2c | https://github.com/ouqiang/etcd-php/blob/8d16ee71fadb50e055b83509da78e21ff959fe2c/src/Client.php#L644-L657 |
35,703 | ouqiang/etcd-php | src/Client.php | Client.grantUserRole | public function grantUserRole($user, $role)
{
$params = [
'user' => $user,
'role' => $role,
];
$body = $this->request(self::URI_AUTH_USER_GRANT, $params);
return $body;
} | php | public function grantUserRole($user, $role)
{
$params = [
'user' => $user,
'role' => $role,
];
$body = $this->request(self::URI_AUTH_USER_GRANT, $params);
return $body;
} | [
"public",
"function",
"grantUserRole",
"(",
"$",
"user",
",",
"$",
"role",
")",
"{",
"$",
"params",
"=",
"[",
"'user'",
"=>",
"$",
"user",
",",
"'role'",
"=>",
"$",
"role",
",",
"]",
";",
"$",
"body",
"=",
"$",
"this",
"->",
"request",
"(",
"self... | grant a role to a specified user.
@param string $user
@param string $role
@return array
@throws BadResponseException | [
"grant",
"a",
"role",
"to",
"a",
"specified",
"user",
"."
] | 8d16ee71fadb50e055b83509da78e21ff959fe2c | https://github.com/ouqiang/etcd-php/blob/8d16ee71fadb50e055b83509da78e21ff959fe2c/src/Client.php#L667-L677 |
35,704 | ouqiang/etcd-php | src/Client.php | Client.revokeUserRole | public function revokeUserRole($user, $role)
{
$params = [
'name' => $user,
'role' => $role,
];
$body = $this->request(self::URI_AUTH_USER_REVOKE, $params);
return $body;
} | php | public function revokeUserRole($user, $role)
{
$params = [
'name' => $user,
'role' => $role,
];
$body = $this->request(self::URI_AUTH_USER_REVOKE, $params);
return $body;
} | [
"public",
"function",
"revokeUserRole",
"(",
"$",
"user",
",",
"$",
"role",
")",
"{",
"$",
"params",
"=",
"[",
"'name'",
"=>",
"$",
"user",
",",
"'role'",
"=>",
"$",
"role",
",",
"]",
";",
"$",
"body",
"=",
"$",
"this",
"->",
"request",
"(",
"sel... | revoke a role of specified user.
@param string $user
@param string $role
@return array
@throws \GuzzleHttp\Exception\BadResponseException | [
"revoke",
"a",
"role",
"of",
"specified",
"user",
"."
] | 8d16ee71fadb50e055b83509da78e21ff959fe2c | https://github.com/ouqiang/etcd-php/blob/8d16ee71fadb50e055b83509da78e21ff959fe2c/src/Client.php#L687-L697 |
35,705 | XavRsl/Cas | src/Xavrsl/Cas/CasManager.php | CasManager.connection | public function connection()
{
if ( empty($this->connection))
{
$this->connection = $this->createConnection();
}
return $this->connection;
} | php | public function connection()
{
if ( empty($this->connection))
{
$this->connection = $this->createConnection();
}
return $this->connection;
} | [
"public",
"function",
"connection",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"connection",
")",
")",
"{",
"$",
"this",
"->",
"connection",
"=",
"$",
"this",
"->",
"createConnection",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
... | Get a Cas connection instance.
@return Xavrsl\Cas\Directory | [
"Get",
"a",
"Cas",
"connection",
"instance",
"."
] | 2f9dc56844e5e6b463bcb751d651a62c9e76111b | https://github.com/XavRsl/Cas/blob/2f9dc56844e5e6b463bcb751d651a62c9e76111b/src/Xavrsl/Cas/CasManager.php#L31-L39 |
35,706 | XavRsl/Cas | src/Xavrsl/Cas/Sso.php | Sso.initializeCas | private function initializeCas()
{
$this->configureDebug();
// initialize CAS client
$this->configureCasClient();
$this->configureSslValidation();
phpCAS::handleLogoutRequests();
$this->configureProxyChain();
} | php | private function initializeCas()
{
$this->configureDebug();
// initialize CAS client
$this->configureCasClient();
$this->configureSslValidation();
phpCAS::handleLogoutRequests();
$this->configureProxyChain();
} | [
"private",
"function",
"initializeCas",
"(",
")",
"{",
"$",
"this",
"->",
"configureDebug",
"(",
")",
";",
"// initialize CAS client",
"$",
"this",
"->",
"configureCasClient",
"(",
")",
";",
"$",
"this",
"->",
"configureSslValidation",
"(",
")",
";",
"phpCAS",... | Make PHPCAS Initialization
Initialize phpCAS before authentication
@return none | [
"Make",
"PHPCAS",
"Initialization"
] | 2f9dc56844e5e6b463bcb751d651a62c9e76111b | https://github.com/XavRsl/Cas/blob/2f9dc56844e5e6b463bcb751d651a62c9e76111b/src/Xavrsl/Cas/Sso.php#L38-L48 |
35,707 | XavRsl/Cas | src/Xavrsl/Cas/Sso.php | Sso.configureDebug | private function configureDebug()
{
if($debug = $this->config['cas_debug'])
{
$path = (gettype($debug) == 'string') ? $debug : '';
phpCAS::setDebug($path);
// https://github.com/Jasig/phpCAS/commit/bb382f5038f6241c7c577fb55430ad505f1f6e23
phpCAS::setVe... | php | private function configureDebug()
{
if($debug = $this->config['cas_debug'])
{
$path = (gettype($debug) == 'string') ? $debug : '';
phpCAS::setDebug($path);
// https://github.com/Jasig/phpCAS/commit/bb382f5038f6241c7c577fb55430ad505f1f6e23
phpCAS::setVe... | [
"private",
"function",
"configureDebug",
"(",
")",
"{",
"if",
"(",
"$",
"debug",
"=",
"$",
"this",
"->",
"config",
"[",
"'cas_debug'",
"]",
")",
"{",
"$",
"path",
"=",
"(",
"gettype",
"(",
"$",
"debug",
")",
"==",
"'string'",
")",
"?",
"$",
"debug"... | Configure CAS debug | [
"Configure",
"CAS",
"debug"
] | 2f9dc56844e5e6b463bcb751d651a62c9e76111b | https://github.com/XavRsl/Cas/blob/2f9dc56844e5e6b463bcb751d651a62c9e76111b/src/Xavrsl/Cas/Sso.php#L53-L62 |
35,708 | XavRsl/Cas | src/Xavrsl/Cas/Sso.php | Sso.configureCasClient | private function configureCasClient()
{
$method = !$this->config['cas_proxy'] ? 'client' : 'proxy';
// Last argument of method (proxy or client) is $changeSessionID. It is true by default. It means it will
// override the framework's session_id. This allows for Single Sign Out. And it means ... | php | private function configureCasClient()
{
$method = !$this->config['cas_proxy'] ? 'client' : 'proxy';
// Last argument of method (proxy or client) is $changeSessionID. It is true by default. It means it will
// override the framework's session_id. This allows for Single Sign Out. And it means ... | [
"private",
"function",
"configureCasClient",
"(",
")",
"{",
"$",
"method",
"=",
"!",
"$",
"this",
"->",
"config",
"[",
"'cas_proxy'",
"]",
"?",
"'client'",
":",
"'proxy'",
";",
"// Last argument of method (proxy or client) is $changeSessionID. It is true by default. It me... | Configure CAS Client | [
"Configure",
"CAS",
"Client"
] | 2f9dc56844e5e6b463bcb751d651a62c9e76111b | https://github.com/XavRsl/Cas/blob/2f9dc56844e5e6b463bcb751d651a62c9e76111b/src/Xavrsl/Cas/Sso.php#L68-L81 |
35,709 | XavRsl/Cas | src/Xavrsl/Cas/Sso.php | Sso.configureSslValidation | private function configureSslValidation()
{
// set SSL validation for the CAS server
if ($this->config['cas_validation'] == 'ca' || $this->config['cas_validation'] == 'self')
{
phpCAS::setCasServerCACert($this->config['cas_cert']);
}
else
{
php... | php | private function configureSslValidation()
{
// set SSL validation for the CAS server
if ($this->config['cas_validation'] == 'ca' || $this->config['cas_validation'] == 'self')
{
phpCAS::setCasServerCACert($this->config['cas_cert']);
}
else
{
php... | [
"private",
"function",
"configureSslValidation",
"(",
")",
"{",
"// set SSL validation for the CAS server",
"if",
"(",
"$",
"this",
"->",
"config",
"[",
"'cas_validation'",
"]",
"==",
"'ca'",
"||",
"$",
"this",
"->",
"config",
"[",
"'cas_validation'",
"]",
"==",
... | Configure SSL Validation
Having some kind of server cert validation in production
is highly recommended. | [
"Configure",
"SSL",
"Validation"
] | 2f9dc56844e5e6b463bcb751d651a62c9e76111b | https://github.com/XavRsl/Cas/blob/2f9dc56844e5e6b463bcb751d651a62c9e76111b/src/Xavrsl/Cas/Sso.php#L89-L100 |
35,710 | XavRsl/Cas | src/Xavrsl/Cas/Sso.php | Sso.configureProxyChain | private function configureProxyChain()
{
if (is_array($this->config['cas_proxied_services'])
&& !empty($this->config['cas_proxied_services']))
{
phpCAS::allowProxyChain(new \CAS_ProxyChain($this->config['cas_proxied_services']));
}
} | php | private function configureProxyChain()
{
if (is_array($this->config['cas_proxied_services'])
&& !empty($this->config['cas_proxied_services']))
{
phpCAS::allowProxyChain(new \CAS_ProxyChain($this->config['cas_proxied_services']));
}
} | [
"private",
"function",
"configureProxyChain",
"(",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"config",
"[",
"'cas_proxied_services'",
"]",
")",
"&&",
"!",
"empty",
"(",
"$",
"this",
"->",
"config",
"[",
"'cas_proxied_services'",
"]",
")",
")... | Configure Cas Proxy Chain
Cas can proxy services. Here you can specify which ones are allowed. | [
"Configure",
"Cas",
"Proxy",
"Chain"
] | 2f9dc56844e5e6b463bcb751d651a62c9e76111b | https://github.com/XavRsl/Cas/blob/2f9dc56844e5e6b463bcb751d651a62c9e76111b/src/Xavrsl/Cas/Sso.php#L107-L114 |
35,711 | bpolaszek/bentools-etl | src/Exception/UnexpectedTypeException.php | UnexpectedTypeException.throwIfNot | public static function throwIfNot($actualObject, string $expectedType, bool $allowNull = false): void
{
if (!is_a($expectedType, $expectedType, true)) {
if (\gettype($actualObject) !== $expectedType) {
if (null === $actualObject && $allowNull) {
return;
... | php | public static function throwIfNot($actualObject, string $expectedType, bool $allowNull = false): void
{
if (!is_a($expectedType, $expectedType, true)) {
if (\gettype($actualObject) !== $expectedType) {
if (null === $actualObject && $allowNull) {
return;
... | [
"public",
"static",
"function",
"throwIfNot",
"(",
"$",
"actualObject",
",",
"string",
"$",
"expectedType",
",",
"bool",
"$",
"allowNull",
"=",
"false",
")",
":",
"void",
"{",
"if",
"(",
"!",
"is_a",
"(",
"$",
"expectedType",
",",
"$",
"expectedType",
",... | Throw an UnexpectedTypeException if actual object doesn't match expected type.
@param $actualObject
@param string $expectedType
@param bool $allowNull
@throws UnexpectedTypeException | [
"Throw",
"an",
"UnexpectedTypeException",
"if",
"actual",
"object",
"doesn",
"t",
"match",
"expected",
"type",
"."
] | d76dea73c5949866a9773ace19a4006f111e4b71 | https://github.com/bpolaszek/bentools-etl/blob/d76dea73c5949866a9773ace19a4006f111e4b71/src/Exception/UnexpectedTypeException.php#L30-L48 |
35,712 | bpolaszek/bentools-etl | src/Etl.php | Etl.process | public function process($data, ...$initLoaderArgs): void
{
$flushCounter = $totalCounter = 0;
$this->start();
foreach ($this->extract($data) as $key => $item) {
if ($this->shouldSkip) {
$this->skip($item, $key);
continue;
}
... | php | public function process($data, ...$initLoaderArgs): void
{
$flushCounter = $totalCounter = 0;
$this->start();
foreach ($this->extract($data) as $key => $item) {
if ($this->shouldSkip) {
$this->skip($item, $key);
continue;
}
... | [
"public",
"function",
"process",
"(",
"$",
"data",
",",
"...",
"$",
"initLoaderArgs",
")",
":",
"void",
"{",
"$",
"flushCounter",
"=",
"$",
"totalCounter",
"=",
"0",
";",
"$",
"this",
"->",
"start",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
... | Run the ETL on the given input.
@param $data
@param ...$initLoaderArgs - Optional arguments for loader init
@throws EtlException | [
"Run",
"the",
"ETL",
"on",
"the",
"given",
"input",
"."
] | d76dea73c5949866a9773ace19a4006f111e4b71 | https://github.com/bpolaszek/bentools-etl/blob/d76dea73c5949866a9773ace19a4006f111e4b71/src/Etl.php#L104-L144 |
35,713 | bpolaszek/bentools-etl | src/Etl.php | Etl.skip | private function skip($item, $key): void
{
$this->shouldSkip = false;
$this->eventDispatcher->dispatch(new ItemEvent(EtlEvents::SKIP, $item, $key, $this));
} | php | private function skip($item, $key): void
{
$this->shouldSkip = false;
$this->eventDispatcher->dispatch(new ItemEvent(EtlEvents::SKIP, $item, $key, $this));
} | [
"private",
"function",
"skip",
"(",
"$",
"item",
",",
"$",
"key",
")",
":",
"void",
"{",
"$",
"this",
"->",
"shouldSkip",
"=",
"false",
";",
"$",
"this",
"->",
"eventDispatcher",
"->",
"dispatch",
"(",
"new",
"ItemEvent",
"(",
"EtlEvents",
"::",
"SKIP"... | Process item skip.
@param $item
@param $key | [
"Process",
"item",
"skip",
"."
] | d76dea73c5949866a9773ace19a4006f111e4b71 | https://github.com/bpolaszek/bentools-etl/blob/d76dea73c5949866a9773ace19a4006f111e4b71/src/Etl.php#L166-L170 |
35,714 | bpolaszek/bentools-etl | src/Etl.php | Etl.stopProcessing | public function stopProcessing(bool $rollback = false): void
{
$this->shouldStop = true;
$this->shouldRollback = $rollback;
} | php | public function stopProcessing(bool $rollback = false): void
{
$this->shouldStop = true;
$this->shouldRollback = $rollback;
} | [
"public",
"function",
"stopProcessing",
"(",
"bool",
"$",
"rollback",
"=",
"false",
")",
":",
"void",
"{",
"$",
"this",
"->",
"shouldStop",
"=",
"true",
";",
"$",
"this",
"->",
"shouldRollback",
"=",
"$",
"rollback",
";",
"}"
] | Ask the ETl to stop.
@param bool $rollback - if the loader should rollback instead of flushing. | [
"Ask",
"the",
"ETl",
"to",
"stop",
"."
] | d76dea73c5949866a9773ace19a4006f111e4b71 | https://github.com/bpolaszek/bentools-etl/blob/d76dea73c5949866a9773ace19a4006f111e4b71/src/Etl.php#L177-L181 |
35,715 | bpolaszek/bentools-etl | src/Etl.php | Etl.reset | private function reset(): void
{
$this->shouldSkip = false;
$this->shouldStop = false;
$this->shouldRollback = false;
} | php | private function reset(): void
{
$this->shouldSkip = false;
$this->shouldStop = false;
$this->shouldRollback = false;
} | [
"private",
"function",
"reset",
"(",
")",
":",
"void",
"{",
"$",
"this",
"->",
"shouldSkip",
"=",
"false",
";",
"$",
"this",
"->",
"shouldStop",
"=",
"false",
";",
"$",
"this",
"->",
"shouldRollback",
"=",
"false",
";",
"}"
] | Reset the ETL. | [
"Reset",
"the",
"ETL",
"."
] | d76dea73c5949866a9773ace19a4006f111e4b71 | https://github.com/bpolaszek/bentools-etl/blob/d76dea73c5949866a9773ace19a4006f111e4b71/src/Etl.php#L195-L200 |
35,716 | bpolaszek/bentools-etl | src/Etl.php | Etl.extract | private function extract($data): iterable
{
$items = null === $this->extract ? $data : ($this->extract)($data, $this);
if (null === $items) {
$items = new \EmptyIterator();
}
if (!\is_iterable($items)) {
throw new EtlException('Could not extract data.');
... | php | private function extract($data): iterable
{
$items = null === $this->extract ? $data : ($this->extract)($data, $this);
if (null === $items) {
$items = new \EmptyIterator();
}
if (!\is_iterable($items)) {
throw new EtlException('Could not extract data.');
... | [
"private",
"function",
"extract",
"(",
"$",
"data",
")",
":",
"iterable",
"{",
"$",
"items",
"=",
"null",
"===",
"$",
"this",
"->",
"extract",
"?",
"$",
"data",
":",
"(",
"$",
"this",
"->",
"extract",
")",
"(",
"$",
"data",
",",
"$",
"this",
")",... | Extract data.
@param $data
@return iterable
@throws EtlException | [
"Extract",
"data",
"."
] | d76dea73c5949866a9773ace19a4006f111e4b71 | https://github.com/bpolaszek/bentools-etl/blob/d76dea73c5949866a9773ace19a4006f111e4b71/src/Etl.php#L209-L238 |
35,717 | bpolaszek/bentools-etl | src/Etl.php | Etl.transform | private function transform($item, $key)
{
$transformed = ($this->transform)($item, $key, $this);
if (!$transformed instanceof \Generator) {
throw new EtlException('The transformer must return a generator.');
}
// Traverse generator to trigger events
try {
... | php | private function transform($item, $key)
{
$transformed = ($this->transform)($item, $key, $this);
if (!$transformed instanceof \Generator) {
throw new EtlException('The transformer must return a generator.');
}
// Traverse generator to trigger events
try {
... | [
"private",
"function",
"transform",
"(",
"$",
"item",
",",
"$",
"key",
")",
"{",
"$",
"transformed",
"=",
"(",
"$",
"this",
"->",
"transform",
")",
"(",
"$",
"item",
",",
"$",
"key",
",",
"$",
"this",
")",
";",
"if",
"(",
"!",
"$",
"transformed",... | Transform data.
@param $item
@param $key
@return callable
@throws EtlException | [
"Transform",
"data",
"."
] | d76dea73c5949866a9773ace19a4006f111e4b71 | https://github.com/bpolaszek/bentools-etl/blob/d76dea73c5949866a9773ace19a4006f111e4b71/src/Etl.php#L248-L271 |
35,718 | bpolaszek/bentools-etl | src/Etl.php | Etl.initLoader | private function initLoader($item, $key, ...$initLoaderArgs): void
{
$this->eventDispatcher->dispatch(new ItemEvent(EtlEvents::LOADER_INIT, $item, $key, $this));
if (null === $this->init) {
return;
}
($this->init)(...$initLoaderArgs);
} | php | private function initLoader($item, $key, ...$initLoaderArgs): void
{
$this->eventDispatcher->dispatch(new ItemEvent(EtlEvents::LOADER_INIT, $item, $key, $this));
if (null === $this->init) {
return;
}
($this->init)(...$initLoaderArgs);
} | [
"private",
"function",
"initLoader",
"(",
"$",
"item",
",",
"$",
"key",
",",
"...",
"$",
"initLoaderArgs",
")",
":",
"void",
"{",
"$",
"this",
"->",
"eventDispatcher",
"->",
"dispatch",
"(",
"new",
"ItemEvent",
"(",
"EtlEvents",
"::",
"LOADER_INIT",
",",
... | Init the loader on the 1st item. | [
"Init",
"the",
"loader",
"on",
"the",
"1st",
"item",
"."
] | d76dea73c5949866a9773ace19a4006f111e4b71 | https://github.com/bpolaszek/bentools-etl/blob/d76dea73c5949866a9773ace19a4006f111e4b71/src/Etl.php#L276-L285 |
35,719 | bpolaszek/bentools-etl | src/Etl.php | Etl.flush | private function flush(int &$flushCounter, bool $partial): void
{
if (null === $this->flush) {
return;
}
($this->flush)($partial);
$this->eventDispatcher->dispatch(new FlushEvent($this, $flushCounter, $partial));
$flushCounter = 0;
} | php | private function flush(int &$flushCounter, bool $partial): void
{
if (null === $this->flush) {
return;
}
($this->flush)($partial);
$this->eventDispatcher->dispatch(new FlushEvent($this, $flushCounter, $partial));
$flushCounter = 0;
} | [
"private",
"function",
"flush",
"(",
"int",
"&",
"$",
"flushCounter",
",",
"bool",
"$",
"partial",
")",
":",
"void",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"flush",
")",
"{",
"return",
";",
"}",
"(",
"$",
"this",
"->",
"flush",
")",
"(... | Flush elements. | [
"Flush",
"elements",
"."
] | d76dea73c5949866a9773ace19a4006f111e4b71 | https://github.com/bpolaszek/bentools-etl/blob/d76dea73c5949866a9773ace19a4006f111e4b71/src/Etl.php#L315-L324 |
35,720 | bpolaszek/bentools-etl | src/Etl.php | Etl.rollback | private function rollback(int &$flushCounter): void
{
if (null === $this->rollback) {
return;
}
($this->rollback)();
$this->eventDispatcher->dispatch(new RollbackEvent($this, $flushCounter));
$flushCounter = 0;
} | php | private function rollback(int &$flushCounter): void
{
if (null === $this->rollback) {
return;
}
($this->rollback)();
$this->eventDispatcher->dispatch(new RollbackEvent($this, $flushCounter));
$flushCounter = 0;
} | [
"private",
"function",
"rollback",
"(",
"int",
"&",
"$",
"flushCounter",
")",
":",
"void",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"rollback",
")",
"{",
"return",
";",
"}",
"(",
"$",
"this",
"->",
"rollback",
")",
"(",
")",
";",
"$",
"t... | Restore loader's initial state. | [
"Restore",
"loader",
"s",
"initial",
"state",
"."
] | d76dea73c5949866a9773ace19a4006f111e4b71 | https://github.com/bpolaszek/bentools-etl/blob/d76dea73c5949866a9773ace19a4006f111e4b71/src/Etl.php#L329-L338 |
35,721 | bpolaszek/bentools-etl | src/Etl.php | Etl.end | private function end(int $flushCounter, int $totalCounter): void
{
if ($this->shouldRollback) {
$this->rollback($flushCounter);
$totalCounter = max(0, $totalCounter - $flushCounter);
} else {
$this->flush($flushCounter, false);
}
$this->eventDispat... | php | private function end(int $flushCounter, int $totalCounter): void
{
if ($this->shouldRollback) {
$this->rollback($flushCounter);
$totalCounter = max(0, $totalCounter - $flushCounter);
} else {
$this->flush($flushCounter, false);
}
$this->eventDispat... | [
"private",
"function",
"end",
"(",
"int",
"$",
"flushCounter",
",",
"int",
"$",
"totalCounter",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"shouldRollback",
")",
"{",
"$",
"this",
"->",
"rollback",
"(",
"$",
"flushCounter",
")",
";",
"$",
"... | Process the end of the ETL.
@param int $flushCounter
@param int $totalCounter | [
"Process",
"the",
"end",
"of",
"the",
"ETL",
"."
] | d76dea73c5949866a9773ace19a4006f111e4b71 | https://github.com/bpolaszek/bentools-etl/blob/d76dea73c5949866a9773ace19a4006f111e4b71/src/Etl.php#L346-L356 |
35,722 | bpolaszek/bentools-etl | src/Iterator/TextLinesIterator.php | TextLinesIterator.traverseWithStrTok | private function traverseWithStrTok()
{
$tok = \strtok($this->content, "\r\n");
while (false !== $tok) {
$line = $tok;
$tok = \strtok("\n\r");
yield $line;
}
} | php | private function traverseWithStrTok()
{
$tok = \strtok($this->content, "\r\n");
while (false !== $tok) {
$line = $tok;
$tok = \strtok("\n\r");
yield $line;
}
} | [
"private",
"function",
"traverseWithStrTok",
"(",
")",
"{",
"$",
"tok",
"=",
"\\",
"strtok",
"(",
"$",
"this",
"->",
"content",
",",
"\"\\r\\n\"",
")",
";",
"while",
"(",
"false",
"!==",
"$",
"tok",
")",
"{",
"$",
"line",
"=",
"$",
"tok",
";",
"$",... | Uses strtok to split lines. Provides better performance, but skips empty lines.
@return \Generator|string[] | [
"Uses",
"strtok",
"to",
"split",
"lines",
".",
"Provides",
"better",
"performance",
"but",
"skips",
"empty",
"lines",
"."
] | d76dea73c5949866a9773ace19a4006f111e4b71 | https://github.com/bpolaszek/bentools-etl/blob/d76dea73c5949866a9773ace19a4006f111e4b71/src/Iterator/TextLinesIterator.php#L59-L67 |
35,723 | bpolaszek/bentools-etl | src/Iterator/KeysAwareCsvIterator.php | KeysAwareCsvIterator.combine | private static function combine(array $keys, array $values): array
{
$nbKeys = \count($keys);
$nbValues = \count($values);
if ($nbKeys < $nbValues) {
return \array_combine($keys, \array_slice(\array_values($values), 0, $nbKeys));
}
if ($nbKeys > $nbValues) {
... | php | private static function combine(array $keys, array $values): array
{
$nbKeys = \count($keys);
$nbValues = \count($values);
if ($nbKeys < $nbValues) {
return \array_combine($keys, \array_slice(\array_values($values), 0, $nbKeys));
}
if ($nbKeys > $nbValues) {
... | [
"private",
"static",
"function",
"combine",
"(",
"array",
"$",
"keys",
",",
"array",
"$",
"values",
")",
":",
"array",
"{",
"$",
"nbKeys",
"=",
"\\",
"count",
"(",
"$",
"keys",
")",
";",
"$",
"nbValues",
"=",
"\\",
"count",
"(",
"$",
"values",
")",... | Combine keys & values
@param array $keys
@param array $values
@return array | [
"Combine",
"keys",
"&",
"values"
] | d76dea73c5949866a9773ace19a4006f111e4b71 | https://github.com/bpolaszek/bentools-etl/blob/d76dea73c5949866a9773ace19a4006f111e4b71/src/Iterator/KeysAwareCsvIterator.php#L68-L82 |
35,724 | jumilla/laravel-extension | sources/Commands/TailCommand.php | TailCommand.tailLocalLogs | protected function tailLocalLogs($path)
{
$output = $this->output;
$lines = $this->option('lines');
(new Process('tail -f -n '.$lines.' '.escapeshellarg($path)))->setTimeout(null)->run(function ($type, $line) use ($output) {
$output->write($line);
});
} | php | protected function tailLocalLogs($path)
{
$output = $this->output;
$lines = $this->option('lines');
(new Process('tail -f -n '.$lines.' '.escapeshellarg($path)))->setTimeout(null)->run(function ($type, $line) use ($output) {
$output->write($line);
});
} | [
"protected",
"function",
"tailLocalLogs",
"(",
"$",
"path",
")",
"{",
"$",
"output",
"=",
"$",
"this",
"->",
"output",
";",
"$",
"lines",
"=",
"$",
"this",
"->",
"option",
"(",
"'lines'",
")",
";",
"(",
"new",
"Process",
"(",
"'tail -f -n '",
".",
"$... | Tail a local log file for the application.
@param string $path
@return string | [
"Tail",
"a",
"local",
"log",
"file",
"for",
"the",
"application",
"."
] | a0ed9065fb1416eca947164dbf355ba3dc669cb3 | https://github.com/jumilla/laravel-extension/blob/a0ed9065fb1416eca947164dbf355ba3dc669cb3/sources/Commands/TailCommand.php#L93-L102 |
35,725 | jumilla/laravel-extension | sources/Generators/GeneratorCommandTrait.php | GeneratorCommandTrait.getAddon | protected function getAddon()
{
if ($addon = $this->option('addon')) {
$env = app(AddonEnvironment::class);
if (!$env->exists($addon)) {
throw new UnexpectedValueException("Addon '$addon' is not found.");
}
return $env->addon($addon);
... | php | protected function getAddon()
{
if ($addon = $this->option('addon')) {
$env = app(AddonEnvironment::class);
if (!$env->exists($addon)) {
throw new UnexpectedValueException("Addon '$addon' is not found.");
}
return $env->addon($addon);
... | [
"protected",
"function",
"getAddon",
"(",
")",
"{",
"if",
"(",
"$",
"addon",
"=",
"$",
"this",
"->",
"option",
"(",
"'addon'",
")",
")",
"{",
"$",
"env",
"=",
"app",
"(",
"AddonEnvironment",
"::",
"class",
")",
";",
"if",
"(",
"!",
"$",
"env",
"-... | Get addon.
@return string | [
"Get",
"addon",
"."
] | a0ed9065fb1416eca947164dbf355ba3dc669cb3 | https://github.com/jumilla/laravel-extension/blob/a0ed9065fb1416eca947164dbf355ba3dc669cb3/sources/Generators/GeneratorCommandTrait.php#L59-L72 |
35,726 | jumilla/laravel-extension | sources/Generators/GeneratorCommandTrait.php | GeneratorCommandTrait.getRootDirectory | protected function getRootDirectory()
{
if ($this->addon) {
$directories = $this->addon->config('addon.directories');
if (! $directories) {
$directories = ['classes'];
}
return $this->addon->path($directories[0]);
}
else {
... | php | protected function getRootDirectory()
{
if ($this->addon) {
$directories = $this->addon->config('addon.directories');
if (! $directories) {
$directories = ['classes'];
}
return $this->addon->path($directories[0]);
}
else {
... | [
"protected",
"function",
"getRootDirectory",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"addon",
")",
"{",
"$",
"directories",
"=",
"$",
"this",
"->",
"addon",
"->",
"config",
"(",
"'addon.directories'",
")",
";",
"if",
"(",
"!",
"$",
"directories",
... | Get the directory path for root namespace.
@return string | [
"Get",
"the",
"directory",
"path",
"for",
"root",
"namespace",
"."
] | a0ed9065fb1416eca947164dbf355ba3dc669cb3 | https://github.com/jumilla/laravel-extension/blob/a0ed9065fb1416eca947164dbf355ba3dc669cb3/sources/Generators/GeneratorCommandTrait.php#L109-L123 |
35,727 | oat-sa/extension-tao-outcomekeyvalue | models/classes/class.KeyValueResultStorage.php | taoAltResultStorage_models_classes_KeyValueResultStorage.extractResultVariableProperty | public function extractResultVariableProperty($variableId)
{
$variableIds = explode('http://',$variableId);
$parts = explode(static::PROPERTY_SEPARATOR, $variableIds[2]);
$itemUri = $variableIds[0] . 'http://' . $parts[0];
$propertyName = empty($parts[1]) ? 'RESPONSE' : $parts[1];
... | php | public function extractResultVariableProperty($variableId)
{
$variableIds = explode('http://',$variableId);
$parts = explode(static::PROPERTY_SEPARATOR, $variableIds[2]);
$itemUri = $variableIds[0] . 'http://' . $parts[0];
$propertyName = empty($parts[1]) ? 'RESPONSE' : $parts[1];
... | [
"public",
"function",
"extractResultVariableProperty",
"(",
"$",
"variableId",
")",
"{",
"$",
"variableIds",
"=",
"explode",
"(",
"'http://'",
",",
"$",
"variableId",
")",
";",
"$",
"parts",
"=",
"explode",
"(",
"static",
"::",
"PROPERTY_SEPARATOR",
",",
"$",
... | Returns the variable property key from the absolute variable key.
@param string $variableId
@return array | [
"Returns",
"the",
"variable",
"property",
"key",
"from",
"the",
"absolute",
"variable",
"key",
"."
] | c5b4c1b20d5a9c7db643243c779fe7a3e51d5a0c | https://github.com/oat-sa/extension-tao-outcomekeyvalue/blob/c5b4c1b20d5a9c7db643243c779fe7a3e51d5a0c/models/classes/class.KeyValueResultStorage.php#L398-L410 |
35,728 | oat-sa/lib-generis-search | src/factory/QueryCriterionFactory.php | QueryCriterionFactory.get | public function get($className,array $options = array()) {
$Param = $this->getServiceLocator()->get($className);
if($this->isValidClass($Param)) {
$Param->setName($options[0])
->setOperator($options[1])
->setValue($options[2])
->se... | php | public function get($className,array $options = array()) {
$Param = $this->getServiceLocator()->get($className);
if($this->isValidClass($Param)) {
$Param->setName($options[0])
->setOperator($options[1])
->setValue($options[2])
->se... | [
"public",
"function",
"get",
"(",
"$",
"className",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"Param",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"get",
"(",
"$",
"className",
")",
";",
"if",
"(",
"$",
... | return a new Query param
@param string $className
@param array $options
@return \oat\search\factory\QueryCriterionInterface
@throws \InvalidArgumentException | [
"return",
"a",
"new",
"Query",
"param"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/factory/QueryCriterionFactory.php#L42-L54 |
35,729 | oat-sa/lib-generis-search | src/Query.php | Query.addOr | public function addOr($value , $operator = null) {
/*@var $criterion QueryCriterionInterface */
$criterion = end($this->storedQueryCriteria);
$criterion->addOr($value, $operator);
return $this;
} | php | public function addOr($value , $operator = null) {
/*@var $criterion QueryCriterionInterface */
$criterion = end($this->storedQueryCriteria);
$criterion->addOr($value, $operator);
return $this;
} | [
"public",
"function",
"addOr",
"(",
"$",
"value",
",",
"$",
"operator",
"=",
"null",
")",
"{",
"/*@var $criterion QueryCriterionInterface */",
"$",
"criterion",
"=",
"end",
"(",
"$",
"this",
"->",
"storedQueryCriteria",
")",
";",
"$",
"criterion",
"->",
"addOr... | add a new condition on same property with OR separator
@param mixed $value
@param string|null $operator
@return $this | [
"add",
"a",
"new",
"condition",
"on",
"same",
"property",
"with",
"OR",
"separator"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/Query.php#L205-L211 |
35,730 | oat-sa/lib-generis-search | src/DbSql/TaoRdf/Command/AbstractRdfOperator.php | AbstractRdfOperator.setPropertyName | protected function setPropertyName($name) {
if(!empty($name)) {
$name = $this->getDriverEscaper()->escape($name);
$name = $this->getDriverEscaper()->quote($name);
return $this->getDriverEscaper()->reserved('predicate') . ' = ' . $name . ' '
. $this->getDr... | php | protected function setPropertyName($name) {
if(!empty($name)) {
$name = $this->getDriverEscaper()->escape($name);
$name = $this->getDriverEscaper()->quote($name);
return $this->getDriverEscaper()->reserved('predicate') . ' = ' . $name . ' '
. $this->getDr... | [
"protected",
"function",
"setPropertyName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"name",
")",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"getDriverEscaper",
"(",
")",
"->",
"escape",
"(",
"$",
"name",
")",
";",
"$",
... | set up predicate name condition
@param string $name
@return string | [
"set",
"up",
"predicate",
"name",
"condition"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/DbSql/TaoRdf/Command/AbstractRdfOperator.php#L46-L54 |
35,731 | oat-sa/lib-generis-search | src/DbSql/AbstractSqlQuerySerialyser.php | AbstractSqlQuerySerialyser.prefixQuery | public function prefixQuery() {
$options = $this->getOptions();
if ($this->validateOptions($options)) {
$this->queryPrefix = $this->getDriverEscaper()->dbCommand('SELECT') . ' ';
$fields = $this->setFieldList($options);
$this->queryPrefix .= $fields ... | php | public function prefixQuery() {
$options = $this->getOptions();
if ($this->validateOptions($options)) {
$this->queryPrefix = $this->getDriverEscaper()->dbCommand('SELECT') . ' ';
$fields = $this->setFieldList($options);
$this->queryPrefix .= $fields ... | [
"public",
"function",
"prefixQuery",
"(",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"getOptions",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"validateOptions",
"(",
"$",
"options",
")",
")",
"{",
"$",
"this",
"->",
"queryPrefix",
"=",
"$",
... | create base query for SQL single table query
@return $this | [
"create",
"base",
"query",
"for",
"SQL",
"single",
"table",
"query"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/DbSql/AbstractSqlQuerySerialyser.php#L40-L51 |
35,732 | oat-sa/lib-generis-search | src/DbSql/AbstractSqlQuerySerialyser.php | AbstractSqlQuerySerialyser.setFieldList | protected function setFieldList(array $options) {
$fields = $this->getDriverEscaper()->getAllFields();
if (array_key_exists('fields', $options)) {
$fieldsList = [];
foreach ($options['fields'] as $field) {
$fieldsList[] = $this->getDriverEscaper()->reserved($field... | php | protected function setFieldList(array $options) {
$fields = $this->getDriverEscaper()->getAllFields();
if (array_key_exists('fields', $options)) {
$fieldsList = [];
foreach ($options['fields'] as $field) {
$fieldsList[] = $this->getDriverEscaper()->reserved($field... | [
"protected",
"function",
"setFieldList",
"(",
"array",
"$",
"options",
")",
"{",
"$",
"fields",
"=",
"$",
"this",
"->",
"getDriverEscaper",
"(",
")",
"->",
"getAllFields",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"'fields'",
",",
"$",
"options",
... | set up selected field list
@param array $options
@return string | [
"set",
"up",
"selected",
"field",
"list"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/DbSql/AbstractSqlQuerySerialyser.php#L57-L67 |
35,733 | oat-sa/lib-generis-search | src/DbSql/AbstractSqlQuerySerialyser.php | AbstractSqlQuerySerialyser.addLimit | protected function addLimit($limit, $offset = null) {
$limitQuery = '';
if (intval($limit) > 0) {
$limitQuery .= $this->getDriverEscaper()->dbCommand('LIMIT') . ' ' . $limit;
if (!is_null($offset)) {
$limitQuery .= ' ' . $this->getDriverEscaper()->dbCommand('OF... | php | protected function addLimit($limit, $offset = null) {
$limitQuery = '';
if (intval($limit) > 0) {
$limitQuery .= $this->getDriverEscaper()->dbCommand('LIMIT') . ' ' . $limit;
if (!is_null($offset)) {
$limitQuery .= ' ' . $this->getDriverEscaper()->dbCommand('OF... | [
"protected",
"function",
"addLimit",
"(",
"$",
"limit",
",",
"$",
"offset",
"=",
"null",
")",
"{",
"$",
"limitQuery",
"=",
"''",
";",
"if",
"(",
"intval",
"(",
"$",
"limit",
")",
">",
"0",
")",
"{",
"$",
"limitQuery",
".=",
"$",
"this",
"->",
"ge... | create limit part for query
@param integer $limit
@param integer $offset
@return string | [
"create",
"limit",
"part",
"for",
"query"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/DbSql/AbstractSqlQuerySerialyser.php#L123-L135 |
35,734 | oat-sa/lib-generis-search | src/AbstractQuerySerialyser.php | AbstractQuerySerialyser.pretty | public function pretty($pretty) {
if($pretty) {
$this->operationSeparator = $this->prettyChar ;
} else {
$this->operationSeparator = $this->unPrettyChar ;
}
return $this;
} | php | public function pretty($pretty) {
if($pretty) {
$this->operationSeparator = $this->prettyChar ;
} else {
$this->operationSeparator = $this->unPrettyChar ;
}
return $this;
} | [
"public",
"function",
"pretty",
"(",
"$",
"pretty",
")",
"{",
"if",
"(",
"$",
"pretty",
")",
"{",
"$",
"this",
"->",
"operationSeparator",
"=",
"$",
"this",
"->",
"prettyChar",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"operationSeparator",
"=",
"$",
... | change operation separator
to pretty print or unpretty print
@param boolean $pretty
@return $this | [
"change",
"operation",
"separator",
"to",
"pretty",
"print",
"or",
"unpretty",
"print"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/AbstractQuerySerialyser.php#L95-L102 |
35,735 | oat-sa/lib-generis-search | src/AbstractQuerySerialyser.php | AbstractQuerySerialyser.serialyse | public function serialyse() {
$this->query = $this->queryPrefix;
foreach ($this->criteriaList->getStoredQueries() as $query) {
$this->setNextSeparator(false);
$this->parseQuery($query);
}
$this->finishQuery();
return... | php | public function serialyse() {
$this->query = $this->queryPrefix;
foreach ($this->criteriaList->getStoredQueries() as $query) {
$this->setNextSeparator(false);
$this->parseQuery($query);
}
$this->finishQuery();
return... | [
"public",
"function",
"serialyse",
"(",
")",
"{",
"$",
"this",
"->",
"query",
"=",
"$",
"this",
"->",
"queryPrefix",
";",
"foreach",
"(",
"$",
"this",
"->",
"criteriaList",
"->",
"getStoredQueries",
"(",
")",
"as",
"$",
"query",
")",
"{",
"$",
"this",
... | generate query exploitable by driver
@return string | [
"generate",
"query",
"exploitable",
"by",
"driver"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/AbstractQuerySerialyser.php#L117-L129 |
35,736 | oat-sa/lib-generis-search | src/AbstractQuerySerialyser.php | AbstractQuerySerialyser.parseQuery | protected function parseQuery(QueryInterface $query) {
$operationList = $query->getStoredQueryCriteria();
$pos = 0;
foreach ($operationList as $operation) {
if($pos > 0) {
$this->addSeparator(true);
}
$this->parseOperation($operation);
... | php | protected function parseQuery(QueryInterface $query) {
$operationList = $query->getStoredQueryCriteria();
$pos = 0;
foreach ($operationList as $operation) {
if($pos > 0) {
$this->addSeparator(true);
}
$this->parseOperation($operation);
... | [
"protected",
"function",
"parseQuery",
"(",
"QueryInterface",
"$",
"query",
")",
"{",
"$",
"operationList",
"=",
"$",
"query",
"->",
"getStoredQueryCriteria",
"(",
")",
";",
"$",
"pos",
"=",
"0",
";",
"foreach",
"(",
"$",
"operationList",
"as",
"$",
"opera... | parse QueryInterface criteria
@param QueryInterface $query
@return $this | [
"parse",
"QueryInterface",
"criteria"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/AbstractQuerySerialyser.php#L136-L148 |
35,737 | oat-sa/lib-generis-search | src/AbstractQuerySerialyser.php | AbstractQuerySerialyser.parseOperation | protected function parseOperation(QueryCriterionInterface $operation) {
$operation->setValue($this->getOperationValue($operation->getValue()));
$command = $this->prepareOperator()->getOperator($operation->getOperator())->convert($operation);
$this->setConditions($command , $op... | php | protected function parseOperation(QueryCriterionInterface $operation) {
$operation->setValue($this->getOperationValue($operation->getValue()));
$command = $this->prepareOperator()->getOperator($operation->getOperator())->convert($operation);
$this->setConditions($command , $op... | [
"protected",
"function",
"parseOperation",
"(",
"QueryCriterionInterface",
"$",
"operation",
")",
"{",
"$",
"operation",
"->",
"setValue",
"(",
"$",
"this",
"->",
"getOperationValue",
"(",
"$",
"operation",
"->",
"getValue",
"(",
")",
")",
")",
";",
"$",
"co... | parse QueryCriterionInterface criteria
@param QueryCriterionInterface $operation
@return $this | [
"parse",
"QueryCriterionInterface",
"criteria"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/AbstractQuerySerialyser.php#L155-L167 |
35,738 | oat-sa/lib-generis-search | src/AbstractQuerySerialyser.php | AbstractQuerySerialyser.getOperationValue | protected function getOperationValue($value) {
if(is_a($value, '\\oat\\search\\base\\QueryBuilderInterface')) {
$serialyser = new self();
$serialyser->setDriverEscaper($this->getDriverEscaper())->setServiceLocator($this->getServiceLocator())->setOptions($this->getOptions());
... | php | protected function getOperationValue($value) {
if(is_a($value, '\\oat\\search\\base\\QueryBuilderInterface')) {
$serialyser = new self();
$serialyser->setDriverEscaper($this->getDriverEscaper())->setServiceLocator($this->getServiceLocator())->setOptions($this->getOptions());
... | [
"protected",
"function",
"getOperationValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_a",
"(",
"$",
"value",
",",
"'\\\\oat\\\\search\\\\base\\\\QueryBuilderInterface'",
")",
")",
"{",
"$",
"serialyser",
"=",
"new",
"self",
"(",
")",
";",
"$",
"serialyser"... | convert value to string if it's an object
@param mixed $value
@return string | [
"convert",
"value",
"to",
"string",
"if",
"it",
"s",
"an",
"object"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/AbstractQuerySerialyser.php#L174-L182 |
35,739 | oat-sa/lib-generis-search | src/AbstractQuerySerialyser.php | AbstractQuerySerialyser.setConditions | protected function setConditions(&$command , array $conditionList , $separator = 'and') {
foreach($conditionList as $condition) {
$addCondition = $this->getOperator($condition->getOperator())->convert($condition);
$this->mergeCondition($command , $addCondition , $separator);... | php | protected function setConditions(&$command , array $conditionList , $separator = 'and') {
foreach($conditionList as $condition) {
$addCondition = $this->getOperator($condition->getOperator())->convert($condition);
$this->mergeCondition($command , $addCondition , $separator);... | [
"protected",
"function",
"setConditions",
"(",
"&",
"$",
"command",
",",
"array",
"$",
"conditionList",
",",
"$",
"separator",
"=",
"'and'",
")",
"{",
"foreach",
"(",
"$",
"conditionList",
"as",
"$",
"condition",
")",
"{",
"$",
"addCondition",
"=",
"$",
... | generate and add to query a condition
exploitable by database driver
@param type $command
@param array $conditionList
@param type $separator
@return string | [
"generate",
"and",
"add",
"to",
"query",
"a",
"condition",
"exploitable",
"by",
"database",
"driver"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/AbstractQuerySerialyser.php#L193-L201 |
35,740 | oat-sa/lib-generis-search | src/AbstractQuerySerialyser.php | AbstractQuerySerialyser.getOperator | protected function getOperator($operator) {
/**
* @todo change that for a factory
*/
if(array_key_exists($operator, $this->supportedOperators)) {
$operatorClass = $this->operatorNameSpace . '\\' . ($this->supportedOperators[$operator]);
$operator... | php | protected function getOperator($operator) {
/**
* @todo change that for a factory
*/
if(array_key_exists($operator, $this->supportedOperators)) {
$operatorClass = $this->operatorNameSpace . '\\' . ($this->supportedOperators[$operator]);
$operator... | [
"protected",
"function",
"getOperator",
"(",
"$",
"operator",
")",
"{",
"/**\n * @todo change that for a factory\n */",
"if",
"(",
"array_key_exists",
"(",
"$",
"operator",
",",
"$",
"this",
"->",
"supportedOperators",
")",
")",
"{",
"$",
"operatorCl... | operator command factory
@param type $operator
@return \oat\search\base\command\OperatorConverterInterface
@throws QueryParsingException | [
"operator",
"command",
"factory"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/AbstractQuerySerialyser.php#L211-L223 |
35,741 | oat-sa/lib-generis-search | src/AbstractQuerySerialyser.php | AbstractQuerySerialyser.setNextSeparator | protected function setNextSeparator($and) {
if(!is_null($this->nextSeparator)) {
$this->addSeparator($this->nextSeparator);
}
$this->nextSeparator = $and;
return $this;
} | php | protected function setNextSeparator($and) {
if(!is_null($this->nextSeparator)) {
$this->addSeparator($this->nextSeparator);
}
$this->nextSeparator = $and;
return $this;
} | [
"protected",
"function",
"setNextSeparator",
"(",
"$",
"and",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"nextSeparator",
")",
")",
"{",
"$",
"this",
"->",
"addSeparator",
"(",
"$",
"this",
"->",
"nextSeparator",
")",
";",
"}",
"$",
... | change next separator to "and" or "or"
@param boolean $and
@return $this | [
"change",
"next",
"separator",
"to",
"and",
"or",
"or"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/AbstractQuerySerialyser.php#L230-L237 |
35,742 | oat-sa/lib-generis-search | src/DbSql/TaoRdf/UnionQuerySerialyser.php | UnionQuerySerialyser.mergeCondition | protected function mergeCondition(&$command, $condition, $separator = null) {
$command .= (is_null($separator)) ? '' : ' ' . $this->getDriverEscaper()->dbCommand($separator);
$command .= ' ' . $condition . $this->operationSeparator;
return $this;
} | php | protected function mergeCondition(&$command, $condition, $separator = null) {
$command .= (is_null($separator)) ? '' : ' ' . $this->getDriverEscaper()->dbCommand($separator);
$command .= ' ' . $condition . $this->operationSeparator;
return $this;
} | [
"protected",
"function",
"mergeCondition",
"(",
"&",
"$",
"command",
",",
"$",
"condition",
",",
"$",
"separator",
"=",
"null",
")",
"{",
"$",
"command",
".=",
"(",
"is_null",
"(",
"$",
"separator",
")",
")",
"?",
"''",
":",
"' '",
".",
"$",
"this",
... | merge multiple condition QueryCriterion
@param string $command
@param string $condition
@param string $separator
@return $this | [
"merge",
"multiple",
"condition",
"QueryCriterion"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/DbSql/TaoRdf/UnionQuerySerialyser.php#L199-L205 |
35,743 | oat-sa/lib-generis-search | src/DbSql/TaoRdf/UnionQuerySerialyser.php | UnionQuerySerialyser.sortedQueryPrefix | protected function sortedQueryPrefix(array $aliases) {
$sortFields = [];
$result = $this->getDriverEscaper()->dbCommand('SELECT') . ' ' .
$this->getDriverEscaper()->reserved('subject') . ' ' .
$this->getDriverEscaper()->dbCommand('FROM') .
$this->operati... | php | protected function sortedQueryPrefix(array $aliases) {
$sortFields = [];
$result = $this->getDriverEscaper()->dbCommand('SELECT') . ' ' .
$this->getDriverEscaper()->reserved('subject') . ' ' .
$this->getDriverEscaper()->dbCommand('FROM') .
$this->operati... | [
"protected",
"function",
"sortedQueryPrefix",
"(",
"array",
"$",
"aliases",
")",
"{",
"$",
"sortFields",
"=",
"[",
"]",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"getDriverEscaper",
"(",
")",
"->",
"dbCommand",
"(",
"'SELECT'",
")",
".",
"' '",
".",
... | add prefix if query is sorted
@param array $aliases
@return string | [
"add",
"prefix",
"if",
"query",
"is",
"sorted"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/DbSql/TaoRdf/UnionQuerySerialyser.php#L251-L277 |
35,744 | oat-sa/lib-generis-search | src/DbSql/TaoRdf/UnionQuerySerialyser.php | UnionQuerySerialyser.orderByPart | protected function orderByPart(array $aliases) {
$sortFields = [];
foreach ($aliases as $alias) {
$sortFields[] = $this->getDriverEscaper()->reserved($alias['name']) . '.' .
$this->getDriverEscaper()->reserved('object') . ' ' .
$alias['dir'] . $this->... | php | protected function orderByPart(array $aliases) {
$sortFields = [];
foreach ($aliases as $alias) {
$sortFields[] = $this->getDriverEscaper()->reserved($alias['name']) . '.' .
$this->getDriverEscaper()->reserved('object') . ' ' .
$alias['dir'] . $this->... | [
"protected",
"function",
"orderByPart",
"(",
"array",
"$",
"aliases",
")",
"{",
"$",
"sortFields",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"aliases",
"as",
"$",
"alias",
")",
"{",
"$",
"sortFields",
"[",
"]",
"=",
"$",
"this",
"->",
"getDriverEscaper"... | return Order by string
@param array $aliases
@return string | [
"return",
"Order",
"by",
"string"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/DbSql/TaoRdf/UnionQuerySerialyser.php#L284-L298 |
35,745 | oat-sa/lib-generis-search | src/DbSql/TaoRdf/UnionQuerySerialyser.php | UnionQuerySerialyser.addRandomSort | protected function addRandomSort() {
$random = '';
$this->query .= $this->operationSeparator .
$this->getDriverEscaper()->dbCommand('ORDER BY') . ' ' .
$this->getDriverEscaper()->random() .
$this->operationSeparator;
return $rand... | php | protected function addRandomSort() {
$random = '';
$this->query .= $this->operationSeparator .
$this->getDriverEscaper()->dbCommand('ORDER BY') . ' ' .
$this->getDriverEscaper()->random() .
$this->operationSeparator;
return $rand... | [
"protected",
"function",
"addRandomSort",
"(",
")",
"{",
"$",
"random",
"=",
"''",
";",
"$",
"this",
"->",
"query",
".=",
"$",
"this",
"->",
"operationSeparator",
".",
"$",
"this",
"->",
"getDriverEscaper",
"(",
")",
"->",
"dbCommand",
"(",
"'ORDER BY'",
... | set sort as random
@return string | [
"set",
"sort",
"as",
"random"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/DbSql/TaoRdf/UnionQuerySerialyser.php#L365-L374 |
35,746 | oat-sa/lib-generis-search | src/QueryBuilder.php | QueryBuilder.newQuery | public function newQuery() {
$factory = $this->factory;
$factory->setServiceLocator($this->serviceLocator);
return $factory->get($this->queryClassName)->setParent($this);
} | php | public function newQuery() {
$factory = $this->factory;
$factory->setServiceLocator($this->serviceLocator);
return $factory->get($this->queryClassName)->setParent($this);
} | [
"public",
"function",
"newQuery",
"(",
")",
"{",
"$",
"factory",
"=",
"$",
"this",
"->",
"factory",
";",
"$",
"factory",
"->",
"setServiceLocator",
"(",
"$",
"this",
"->",
"serviceLocator",
")",
";",
"return",
"$",
"factory",
"->",
"get",
"(",
"$",
"th... | generate a new query
@return \oat\search\base\QueryInterface | [
"generate",
"a",
"new",
"query"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/QueryBuilder.php#L80-L84 |
35,747 | oat-sa/lib-generis-search | src/DbSql/TaoRdf/Command/In.php | In.setValuesList | protected function setValuesList(array $values) {
$parseValues = [];
foreach ($values as $value) {
$parseValues[] = $this->getDriverEscaper()->quote($this->getDriverEscaper()->escape($value));
}
return '(' . implode(' ' . $this->getDriverEscaper()->getFieldsSeparator() . ' '... | php | protected function setValuesList(array $values) {
$parseValues = [];
foreach ($values as $value) {
$parseValues[] = $this->getDriverEscaper()->quote($this->getDriverEscaper()->escape($value));
}
return '(' . implode(' ' . $this->getDriverEscaper()->getFieldsSeparator() . ' '... | [
"protected",
"function",
"setValuesList",
"(",
"array",
"$",
"values",
")",
"{",
"$",
"parseValues",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"values",
"as",
"$",
"value",
")",
"{",
"$",
"parseValues",
"[",
"]",
"=",
"$",
"this",
"->",
"getDriverEscape... | create condition for object
@param array $values
@return string | [
"create",
"condition",
"for",
"object"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/DbSql/TaoRdf/Command/In.php#L46-L52 |
35,748 | oat-sa/lib-generis-search | src/factory/FactoryAbstract.php | FactoryAbstract.isValidClass | protected function isValidClass($object) {
if(is_a($object, $this->validInterface)) {
return true;
}
throw new \InvalidArgumentException(get_class($object) . ' doesn\'t implements ' . $this->validInterface );
} | php | protected function isValidClass($object) {
if(is_a($object, $this->validInterface)) {
return true;
}
throw new \InvalidArgumentException(get_class($object) . ' doesn\'t implements ' . $this->validInterface );
} | [
"protected",
"function",
"isValidClass",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"is_a",
"(",
"$",
"object",
",",
"$",
"this",
"->",
"validInterface",
")",
")",
"{",
"return",
"true",
";",
"}",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"get... | verify if class implements valid interface
@param Object $object
@throws \InvalidArgumentException
@return boolean | [
"verify",
"if",
"class",
"implements",
"valid",
"interface"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/factory/FactoryAbstract.php#L47-L53 |
35,749 | oat-sa/lib-generis-search | src/Command/OperatorAbstractfactory.php | OperatorAbstractfactory.canCreateServiceWithName | public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) {
$interface = 'oat\search\base\command\OperatorConverterInterface';
return (class_exists($requestedName) && in_array($interface , class_implements($requestedName)));
} | php | public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) {
$interface = 'oat\search\base\command\OperatorConverterInterface';
return (class_exists($requestedName) && in_array($interface , class_implements($requestedName)));
} | [
"public",
"function",
"canCreateServiceWithName",
"(",
"ServiceLocatorInterface",
"$",
"serviceLocator",
",",
"$",
"name",
",",
"$",
"requestedName",
")",
"{",
"$",
"interface",
"=",
"'oat\\search\\base\\command\\OperatorConverterInterface'",
";",
"return",
"(",
"class_ex... | verify if class name is an existing operator
@param ServiceLocatorInterface $serviceLocator
@param type $name
@param type $requestedName
@return boolean | [
"verify",
"if",
"class",
"name",
"is",
"an",
"existing",
"operator"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/Command/OperatorAbstractfactory.php#L51-L54 |
35,750 | oat-sa/lib-generis-search | src/DbSql/TaoRdf/QuerySerialyser.php | QuerySerialyser.setLanguageCondition | public function setLanguageCondition($language , $emptyAvailable = false) {
$languageField = $this->getDriverEscaper()->reserved('l_language');
$languageValue = $this->getDriverEscaper()->escape($language);
$sql = '(';
$sql .= $languageField .' = ' . $this->getDriverEscaper()->quot... | php | public function setLanguageCondition($language , $emptyAvailable = false) {
$languageField = $this->getDriverEscaper()->reserved('l_language');
$languageValue = $this->getDriverEscaper()->escape($language);
$sql = '(';
$sql .= $languageField .' = ' . $this->getDriverEscaper()->quot... | [
"public",
"function",
"setLanguageCondition",
"(",
"$",
"language",
",",
"$",
"emptyAvailable",
"=",
"false",
")",
"{",
"$",
"languageField",
"=",
"$",
"this",
"->",
"getDriverEscaper",
"(",
")",
"->",
"reserved",
"(",
"'l_language'",
")",
";",
"$",
"languag... | return an SQL string with language filter condition
@param string $language
@param boolean $emptyAvailable
@return string | [
"return",
"an",
"SQL",
"string",
"with",
"language",
"filter",
"condition"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/DbSql/TaoRdf/QuerySerialyser.php#L134-L144 |
35,751 | oat-sa/lib-generis-search | src/factory/QueryFactory.php | QueryFactory.get | public function get($className , array $options = array()) {
$Query = $this->getServiceLocator()->get($className);
if($this->isValidClass($Query)) {
return $Query->setServiceLocator($this->getServiceLocator())->setOptions($options);
}
} | php | public function get($className , array $options = array()) {
$Query = $this->getServiceLocator()->get($className);
if($this->isValidClass($Query)) {
return $Query->setServiceLocator($this->getServiceLocator())->setOptions($options);
}
} | [
"public",
"function",
"get",
"(",
"$",
"className",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"Query",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"get",
"(",
"$",
"className",
")",
";",
"if",
"(",
"$",
... | return a new Query
@param string $className
@param array $options
@return \oat\search\factory\QueryInterface
@throws \InvalidArgumentException | [
"return",
"a",
"new",
"Query"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/factory/QueryFactory.php#L45-L51 |
35,752 | oat-sa/lib-generis-search | src/AbstractSearchGateWay.php | AbstractSearchGateWay.init | public function init() {
$options = $this->getServiceLocator()->get('search.options');
$this->setOptions($options);
$this->driverName = $options['driver'];
$this->setDriverEscaper($this->getServiceLocator()->get($this->driverList[$this->driverName]));
return $this;
} | php | public function init() {
$options = $this->getServiceLocator()->get('search.options');
$this->setOptions($options);
$this->driverName = $options['driver'];
$this->setDriverEscaper($this->getServiceLocator()->get($this->driverList[$this->driverName]));
return $this;
} | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"get",
"(",
"'search.options'",
")",
";",
"$",
"this",
"->",
"setOptions",
"(",
"$",
"options",
")",
";",
"$",
"this",
"->",
"dr... | init the gateway
@return $this | [
"init",
"the",
"gateway"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/AbstractSearchGateWay.php#L87-L94 |
35,753 | oat-sa/lib-generis-search | src/AbstractSearchGateWay.php | AbstractSearchGateWay.serialyse | public function serialyse(QueryBuilderInterface $Builder) {
$this->parsedQuery = $this->getSerialyser()->setCriteriaList($Builder)->serialyse();
return $this;
} | php | public function serialyse(QueryBuilderInterface $Builder) {
$this->parsedQuery = $this->getSerialyser()->setCriteriaList($Builder)->serialyse();
return $this;
} | [
"public",
"function",
"serialyse",
"(",
"QueryBuilderInterface",
"$",
"Builder",
")",
"{",
"$",
"this",
"->",
"parsedQuery",
"=",
"$",
"this",
"->",
"getSerialyser",
"(",
")",
"->",
"setCriteriaList",
"(",
"$",
"Builder",
")",
"->",
"serialyse",
"(",
")",
... | parse QueryBuilder and store parsed query
@param QueryBuilderInterface $Builder
@return $this | [
"parse",
"QueryBuilder",
"and",
"store",
"parsed",
"query"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/AbstractSearchGateWay.php#L101-L104 |
35,754 | oat-sa/lib-generis-search | src/AbstractSearchGateWay.php | AbstractSearchGateWay.getSerialyser | public function getSerialyser() {
$serialyser = $this->getServiceLocator()->get($this->serialyserList[$this->driverName]);
$serialyser->setServiceLocator($this->serviceLocator)->setDriverEscaper($this->driverEscaper)->setOptions($this->options)->prefixQuery();
return $serialyser;
} | php | public function getSerialyser() {
$serialyser = $this->getServiceLocator()->get($this->serialyserList[$this->driverName]);
$serialyser->setServiceLocator($this->serviceLocator)->setDriverEscaper($this->driverEscaper)->setOptions($this->options)->prefixQuery();
return $serialyser;
} | [
"public",
"function",
"getSerialyser",
"(",
")",
"{",
"$",
"serialyser",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"get",
"(",
"$",
"this",
"->",
"serialyserList",
"[",
"$",
"this",
"->",
"driverName",
"]",
")",
";",
"$",
"serialyser",... | query serialyser factory
@return QuerySerialyserInterface | [
"query",
"serialyser",
"factory"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/AbstractSearchGateWay.php#L135-L139 |
35,755 | oat-sa/lib-generis-search | src/AbstractSearchGateWay.php | AbstractSearchGateWay.query | public function query() {
$builder = $this->getServiceLocator()->get($this->builderClassName);
$builder->setOptions($this->options)->setServiceLocator($this->serviceLocator);
return $builder;
} | php | public function query() {
$builder = $this->getServiceLocator()->get($this->builderClassName);
$builder->setOptions($this->options)->setServiceLocator($this->serviceLocator);
return $builder;
} | [
"public",
"function",
"query",
"(",
")",
"{",
"$",
"builder",
"=",
"$",
"this",
"->",
"getServiceLocator",
"(",
")",
"->",
"get",
"(",
"$",
"this",
"->",
"builderClassName",
")",
";",
"$",
"builder",
"->",
"setOptions",
"(",
"$",
"this",
"->",
"options... | query builder factory
@return QueryBuilder | [
"query",
"builder",
"factory"
] | bf19991d7fb807341f7889f7e786f09668013a13 | https://github.com/oat-sa/lib-generis-search/blob/bf19991d7fb807341f7889f7e786f09668013a13/src/AbstractSearchGateWay.php#L163-L167 |
35,756 | apfelbox/PHP-File-Download | src/FileDownload.php | FileDownload.sendDownload | public function sendDownload ($filename, $forceDownload = true)
{
if (headers_sent())
{
throw new \RuntimeException("Cannot send file to the browser, since the headers were already sent.");
}
header("Pragma: public");
header("Expires: 0");
header("Cache-C... | php | public function sendDownload ($filename, $forceDownload = true)
{
if (headers_sent())
{
throw new \RuntimeException("Cannot send file to the browser, since the headers were already sent.");
}
header("Pragma: public");
header("Expires: 0");
header("Cache-C... | [
"public",
"function",
"sendDownload",
"(",
"$",
"filename",
",",
"$",
"forceDownload",
"=",
"true",
")",
"{",
"if",
"(",
"headers_sent",
"(",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"\"Cannot send file to the browser, since the headers were alr... | Sends the download to the browser
@param string $filename
@param bool $forceDownload
@throws \RuntimeException is thrown, if the headers are already sent | [
"Sends",
"the",
"download",
"to",
"the",
"browser"
] | ac97f04d89fe8a9ad9de811162953db3f07685b1 | https://github.com/apfelbox/PHP-File-Download/blob/ac97f04d89fe8a9ad9de811162953db3f07685b1/src/FileDownload.php#L55-L84 |
35,757 | apfelbox/PHP-File-Download | src/FileDownload.php | FileDownload.getMimeType | private function getMimeType ($fileName)
{
$fileExtension = pathinfo($fileName, PATHINFO_EXTENSION);
$mimeTypeHelper = Mimetypes::getInstance();
$mimeType = $mimeTypeHelper->fromExtension($fileExtension);
return !is_null($mimeType) ? $mimeType : "application/force-download";
... | php | private function getMimeType ($fileName)
{
$fileExtension = pathinfo($fileName, PATHINFO_EXTENSION);
$mimeTypeHelper = Mimetypes::getInstance();
$mimeType = $mimeTypeHelper->fromExtension($fileExtension);
return !is_null($mimeType) ? $mimeType : "application/force-download";
... | [
"private",
"function",
"getMimeType",
"(",
"$",
"fileName",
")",
"{",
"$",
"fileExtension",
"=",
"pathinfo",
"(",
"$",
"fileName",
",",
"PATHINFO_EXTENSION",
")",
";",
"$",
"mimeTypeHelper",
"=",
"Mimetypes",
"::",
"getInstance",
"(",
")",
";",
"$",
"mimeTyp... | Returns the mime type of a file name
@param string $fileName
@return string | [
"Returns",
"the",
"mime",
"type",
"of",
"a",
"file",
"name"
] | ac97f04d89fe8a9ad9de811162953db3f07685b1 | https://github.com/apfelbox/PHP-File-Download/blob/ac97f04d89fe8a9ad9de811162953db3f07685b1/src/FileDownload.php#L95-L102 |
35,758 | apfelbox/PHP-File-Download | src/FileDownload.php | FileDownload.createFromFilePath | public static function createFromFilePath ($filePath)
{
if (!is_file($filePath))
{
throw new \InvalidArgumentException("File does not exist");
}
else if (!is_readable($filePath))
{
throw new \InvalidArgumentException("File to download is not readable."... | php | public static function createFromFilePath ($filePath)
{
if (!is_file($filePath))
{
throw new \InvalidArgumentException("File does not exist");
}
else if (!is_readable($filePath))
{
throw new \InvalidArgumentException("File to download is not readable."... | [
"public",
"static",
"function",
"createFromFilePath",
"(",
"$",
"filePath",
")",
"{",
"if",
"(",
"!",
"is_file",
"(",
"$",
"filePath",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"File does not exist\"",
")",
";",
"}",
"else",
"if... | Creates a new file download from a file path
@static
@param string $filePath
@throws \InvalidArgumentException is thrown, if the given file does not exist or is not readable
@return FileDownload | [
"Creates",
"a",
"new",
"file",
"download",
"from",
"a",
"file",
"path"
] | ac97f04d89fe8a9ad9de811162953db3f07685b1 | https://github.com/apfelbox/PHP-File-Download/blob/ac97f04d89fe8a9ad9de811162953db3f07685b1/src/FileDownload.php#L130-L142 |
35,759 | goto-bus-stop/recanalyst | src/Analyzers/PlayerMetaAnalyzer.php | PlayerMetaAnalyzer.readPlayerMeta | protected function readPlayerMeta($i)
{
$player = new Player($this->rec);
$player->number = $i;
$player->index = $this->readHeader('l', 4);
$human = $this->readHeader('l', 4);
$length = $this->readHeader('L', 4);
if ($length) {
$player->name = $this->readH... | php | protected function readPlayerMeta($i)
{
$player = new Player($this->rec);
$player->number = $i;
$player->index = $this->readHeader('l', 4);
$human = $this->readHeader('l', 4);
$length = $this->readHeader('L', 4);
if ($length) {
$player->name = $this->readH... | [
"protected",
"function",
"readPlayerMeta",
"(",
"$",
"i",
")",
"{",
"$",
"player",
"=",
"new",
"Player",
"(",
"$",
"this",
"->",
"rec",
")",
";",
"$",
"player",
"->",
"number",
"=",
"$",
"i",
";",
"$",
"player",
"->",
"index",
"=",
"$",
"this",
"... | Reads a player meta info block for a single player. This just includes
their nickname, index and "human" status. More information about players
is stored later on in the recorded game file and is read by the
PlayerInfoBlockAnalyzer.
Player meta structure:
int32 index;
int32 human; // indicates whether player is AI/hum... | [
"Reads",
"a",
"player",
"meta",
"info",
"block",
"for",
"a",
"single",
"player",
".",
"This",
"just",
"includes",
"their",
"nickname",
"index",
"and",
"human",
"status",
".",
"More",
"information",
"about",
"players",
"is",
"stored",
"later",
"on",
"in",
"... | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/Analyzers/PlayerMetaAnalyzer.php#L61-L77 |
35,760 | goto-bus-stop/recanalyst | src/Analyzers/PlayerMetaAnalyzer.php | PlayerMetaAnalyzer.seek | private function seek()
{
$version = $this->get(VersionAnalyzer::class);
$constant2 = pack('c*', 0x9A, 0x99, 0x99, 0x99, 0x99, 0x99, 0xF9, 0x3F);
$separator = pack('c*', 0x9D, 0xFF, 0xFF, 0xFF);
$playersByIndex = [];
$size = strlen($this->header);
$this->position =... | php | private function seek()
{
$version = $this->get(VersionAnalyzer::class);
$constant2 = pack('c*', 0x9A, 0x99, 0x99, 0x99, 0x99, 0x99, 0xF9, 0x3F);
$separator = pack('c*', 0x9D, 0xFF, 0xFF, 0xFF);
$playersByIndex = [];
$size = strlen($this->header);
$this->position =... | [
"private",
"function",
"seek",
"(",
")",
"{",
"$",
"version",
"=",
"$",
"this",
"->",
"get",
"(",
"VersionAnalyzer",
"::",
"class",
")",
";",
"$",
"constant2",
"=",
"pack",
"(",
"'c*'",
",",
"0x9A",
",",
"0x99",
",",
"0x99",
",",
"0x99",
",",
"0x99... | Find the position of the small player metadata block. | [
"Find",
"the",
"position",
"of",
"the",
"small",
"player",
"metadata",
"block",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/Analyzers/PlayerMetaAnalyzer.php#L82-L110 |
35,761 | goto-bus-stop/recanalyst | src/Model/Team.php | Team.addPlayer | public function addPlayer(Player $player)
{
$this->players[] = $player;
if ($this->index == -1) {
$this->index = $player->team;
}
} | php | public function addPlayer(Player $player)
{
$this->players[] = $player;
if ($this->index == -1) {
$this->index = $player->team;
}
} | [
"public",
"function",
"addPlayer",
"(",
"Player",
"$",
"player",
")",
"{",
"$",
"this",
"->",
"players",
"[",
"]",
"=",
"$",
"player",
";",
"if",
"(",
"$",
"this",
"->",
"index",
"==",
"-",
"1",
")",
"{",
"$",
"this",
"->",
"index",
"=",
"$",
"... | Adds a player to the team.
@param \RecAnalyst\Model\Player $player The player we wish to add
@return void | [
"Adds",
"a",
"player",
"to",
"the",
"team",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/Model/Team.php#L30-L36 |
35,762 | goto-bus-stop/recanalyst | src/ResourcePacks/AgeOfEmpires/Civilization.php | Civilization.isAoKCiv | public static function isAoKCiv($id)
{
return in_array($id, [
self::BRITONS,
self::FRANKS,
self::GOTHS,
self::TEUTONS,
self::JAPANESE,
self::CHINESE,
self::BYZANTINES,
self::PERSIANS,
self::SARACENS,
... | php | public static function isAoKCiv($id)
{
return in_array($id, [
self::BRITONS,
self::FRANKS,
self::GOTHS,
self::TEUTONS,
self::JAPANESE,
self::CHINESE,
self::BYZANTINES,
self::PERSIANS,
self::SARACENS,
... | [
"public",
"static",
"function",
"isAoKCiv",
"(",
"$",
"id",
")",
"{",
"return",
"in_array",
"(",
"$",
"id",
",",
"[",
"self",
"::",
"BRITONS",
",",
"self",
"::",
"FRANKS",
",",
"self",
"::",
"GOTHS",
",",
"self",
"::",
"TEUTONS",
",",
"self",
"::",
... | Checks if a civilization is included in the Age of Kings base game.
@param int $id Civilization ID.
@return bool True if the given civilization exists in AoK, false
otherwise. | [
"Checks",
"if",
"a",
"civilization",
"is",
"included",
"in",
"the",
"Age",
"of",
"Kings",
"base",
"game",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/ResourcePacks/AgeOfEmpires/Civilization.php#L84-L101 |
35,763 | goto-bus-stop/recanalyst | src/ResourcePacks/AgeOfEmpires/Civilization.php | Civilization.isAoCCiv | public static function isAoCCiv($id)
{
return in_array($id, [
self::SPANISH,
self::AZTECS,
self::MAYANS,
self::HUNS,
self::KOREANS,
]);
} | php | public static function isAoCCiv($id)
{
return in_array($id, [
self::SPANISH,
self::AZTECS,
self::MAYANS,
self::HUNS,
self::KOREANS,
]);
} | [
"public",
"static",
"function",
"isAoCCiv",
"(",
"$",
"id",
")",
"{",
"return",
"in_array",
"(",
"$",
"id",
",",
"[",
"self",
"::",
"SPANISH",
",",
"self",
"::",
"AZTECS",
",",
"self",
"::",
"MAYANS",
",",
"self",
"::",
"HUNS",
",",
"self",
"::",
"... | Checks if a civilization was added in the Age of Conquerors expansion.
@param int $id Civilization ID.
@return bool True if the given civilization is part of AoC, false
otherwise. | [
"Checks",
"if",
"a",
"civilization",
"was",
"added",
"in",
"the",
"Age",
"of",
"Conquerors",
"expansion",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/ResourcePacks/AgeOfEmpires/Civilization.php#L110-L119 |
35,764 | goto-bus-stop/recanalyst | src/ResourcePacks/AgeOfEmpires/Civilization.php | Civilization.isForgottenCiv | public static function isForgottenCiv($id)
{
return in_array($id, [
self::ITALIANS,
self::INDIANS,
self::INCAS,
self::MAGYARS,
self::SLAVS,
]);
} | php | public static function isForgottenCiv($id)
{
return in_array($id, [
self::ITALIANS,
self::INDIANS,
self::INCAS,
self::MAGYARS,
self::SLAVS,
]);
} | [
"public",
"static",
"function",
"isForgottenCiv",
"(",
"$",
"id",
")",
"{",
"return",
"in_array",
"(",
"$",
"id",
",",
"[",
"self",
"::",
"ITALIANS",
",",
"self",
"::",
"INDIANS",
",",
"self",
"::",
"INCAS",
",",
"self",
"::",
"MAGYARS",
",",
"self",
... | Checks if a civilization was added in the Forgotten Empires expansion.
@param int $id Civilization ID.
@return bool True if the given civilization is part of The Forgotten,
false otherwise. | [
"Checks",
"if",
"a",
"civilization",
"was",
"added",
"in",
"the",
"Forgotten",
"Empires",
"expansion",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/ResourcePacks/AgeOfEmpires/Civilization.php#L128-L137 |
35,765 | goto-bus-stop/recanalyst | src/Processors/MapName.php | MapName.run | public function run()
{
$header = $this->rec->header();
$messages = $header->messages;
$instructions = $messages->instructions;
$lines = explode("\n", $instructions);
foreach ($lines as $line) {
// We don't know what language the game was played in, so we try
... | php | public function run()
{
$header = $this->rec->header();
$messages = $header->messages;
$instructions = $messages->instructions;
$lines = explode("\n", $instructions);
foreach ($lines as $line) {
// We don't know what language the game was played in, so we try
... | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"header",
"=",
"$",
"this",
"->",
"rec",
"->",
"header",
"(",
")",
";",
"$",
"messages",
"=",
"$",
"header",
"->",
"messages",
";",
"$",
"instructions",
"=",
"$",
"messages",
"->",
"instructions",
";",... | Run the processor.
@return string|null The map name, if found. | [
"Run",
"the",
"processor",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/Processors/MapName.php#L68-L84 |
35,766 | goto-bus-stop/recanalyst | src/Analyzers/BodyAnalyzer.php | BodyAnalyzer.processGameStart | private function processGameStart()
{
$this->syncChecksumInterval = $this->readBody('l', 4);
if ($this->version->isMgl) {
// not sure what difference is vs mgx and up
$this->position += 28;
$ver = ord($this->body[$this->position]);
$this->position += 4... | php | private function processGameStart()
{
$this->syncChecksumInterval = $this->readBody('l', 4);
if ($this->version->isMgl) {
// not sure what difference is vs mgx and up
$this->position += 28;
$ver = ord($this->body[$this->position]);
$this->position += 4... | [
"private",
"function",
"processGameStart",
"(",
")",
"{",
"$",
"this",
"->",
"syncChecksumInterval",
"=",
"$",
"this",
"->",
"readBody",
"(",
"'l'",
",",
"4",
")",
";",
"if",
"(",
"$",
"this",
"->",
"version",
"->",
"isMgl",
")",
"{",
"// not sure what d... | Process the game start data. | [
"Process",
"the",
"game",
"start",
"data",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/Analyzers/BodyAnalyzer.php#L393-L409 |
35,767 | goto-bus-stop/recanalyst | src/Analyzers/BodyAnalyzer.php | BodyAnalyzer.processChatMessage | private function processChatMessage()
{
$length = $this->readBody('l', 4);
if ($length <= 0) {
return;
}
$chat = $this->readBodyRaw($length);
// Chat messages are stored as "@#%dPlayerName: Message", where %d is a
// digit from 1 to 8 indicating player's ... | php | private function processChatMessage()
{
$length = $this->readBody('l', 4);
if ($length <= 0) {
return;
}
$chat = $this->readBodyRaw($length);
// Chat messages are stored as "@#%dPlayerName: Message", where %d is a
// digit from 1 to 8 indicating player's ... | [
"private",
"function",
"processChatMessage",
"(",
")",
"{",
"$",
"length",
"=",
"$",
"this",
"->",
"readBody",
"(",
"'l'",
",",
"4",
")",
";",
"if",
"(",
"$",
"length",
"<=",
"0",
")",
"{",
"return",
";",
"}",
"$",
"chat",
"=",
"$",
"this",
"->",... | Read a chat message. | [
"Read",
"a",
"chat",
"message",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/Analyzers/BodyAnalyzer.php#L414-L443 |
35,768 | goto-bus-stop/recanalyst | src/Analyzers/HeaderAnalyzer.php | HeaderAnalyzer.readChat | protected function readChat(array $players)
{
$playersByNumber = [];
foreach ($players as $player) {
$playersByNumber[$player->number] = $player;
}
$messages = [];
$messageCount = $this->readHeader('l', 4);
for ($i = 0; $i < $messageCount; $i += 1) {
... | php | protected function readChat(array $players)
{
$playersByNumber = [];
foreach ($players as $player) {
$playersByNumber[$player->number] = $player;
}
$messages = [];
$messageCount = $this->readHeader('l', 4);
for ($i = 0; $i < $messageCount; $i += 1) {
... | [
"protected",
"function",
"readChat",
"(",
"array",
"$",
"players",
")",
"{",
"$",
"playersByNumber",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"players",
"as",
"$",
"player",
")",
"{",
"$",
"playersByNumber",
"[",
"$",
"player",
"->",
"number",
"]",
"="... | Read a block containing chat messages.
Chat block structure:
int32 count;
ChatMessage messages[count];
Chat message structure:
int32 length;
char contents[length];
Not much data is encoded in the chat message structure, so we derive
a lot of it from the `contents` string instead.
@param array $players Array of `$p... | [
"Read",
"a",
"block",
"containing",
"chat",
"messages",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/Analyzers/HeaderAnalyzer.php#L269-L300 |
35,769 | goto-bus-stop/recanalyst | src/Analyzers/HeaderAnalyzer.php | HeaderAnalyzer.skipTriggerInfo | protected function skipTriggerInfo()
{
// Effects and triggers are of variable size, but conditions are
// constant.
$conditionSize = (
(11 * 4) + // 11 ints
(4 * 4) + // area (4 ints)
(3 * 4) // 3 ints
);
if ($this->version->isHDPatch4) {... | php | protected function skipTriggerInfo()
{
// Effects and triggers are of variable size, but conditions are
// constant.
$conditionSize = (
(11 * 4) + // 11 ints
(4 * 4) + // area (4 ints)
(3 * 4) // 3 ints
);
if ($this->version->isHDPatch4) {... | [
"protected",
"function",
"skipTriggerInfo",
"(",
")",
"{",
"// Effects and triggers are of variable size, but conditions are",
"// constant.",
"$",
"conditionSize",
"=",
"(",
"(",
"11",
"*",
"4",
")",
"+",
"// 11 ints",
"(",
"4",
"*",
"4",
")",
"+",
"// area (4 ints... | Skip a scenario triggers info block. See ScenarioTriggersAnalyzer for
contents of a trigger block. | [
"Skip",
"a",
"scenario",
"triggers",
"info",
"block",
".",
"See",
"ScenarioTriggersAnalyzer",
"for",
"contents",
"of",
"a",
"trigger",
"block",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/Analyzers/HeaderAnalyzer.php#L374-L437 |
35,770 | goto-bus-stop/recanalyst | src/Analyzers/HeaderAnalyzer.php | HeaderAnalyzer.readScenarioHeader | protected function readScenarioHeader()
{
$nextUnitId = $this->readHeader('l', 4);
$this->position += 4;
// Player names
for ($i = 0; $i < 16; $i++) {
$this->position += 256; // rtrim(readHeaderRaw(), \0)
}
// Player names (string table)
for ($i = ... | php | protected function readScenarioHeader()
{
$nextUnitId = $this->readHeader('l', 4);
$this->position += 4;
// Player names
for ($i = 0; $i < 16; $i++) {
$this->position += 256; // rtrim(readHeaderRaw(), \0)
}
// Player names (string table)
for ($i = ... | [
"protected",
"function",
"readScenarioHeader",
"(",
")",
"{",
"$",
"nextUnitId",
"=",
"$",
"this",
"->",
"readHeader",
"(",
"'l'",
",",
"4",
")",
";",
"$",
"this",
"->",
"position",
"+=",
"4",
";",
"// Player names",
"for",
"(",
"$",
"i",
"=",
"0",
"... | Read the scenario info header. Contains information about configured
players and the scenario file.
@return void | [
"Read",
"the",
"scenario",
"info",
"header",
".",
"Contains",
"information",
"about",
"configured",
"players",
"and",
"the",
"scenario",
"file",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/Analyzers/HeaderAnalyzer.php#L445-L477 |
35,771 | goto-bus-stop/recanalyst | src/Analyzers/HeaderAnalyzer.php | HeaderAnalyzer.readMessages | protected function readMessages()
{
$len = $this->readHeader('v', 2);
$instructions = rtrim($this->readHeaderRaw($len), "\0");
$len = $this->readHeader('v', 2);
$hints = rtrim($this->readHeaderRaw($len), "\0");
$len = $this->readHeader('v', 2);
$victory = rtrim($this-... | php | protected function readMessages()
{
$len = $this->readHeader('v', 2);
$instructions = rtrim($this->readHeaderRaw($len), "\0");
$len = $this->readHeader('v', 2);
$hints = rtrim($this->readHeaderRaw($len), "\0");
$len = $this->readHeader('v', 2);
$victory = rtrim($this-... | [
"protected",
"function",
"readMessages",
"(",
")",
"{",
"$",
"len",
"=",
"$",
"this",
"->",
"readHeader",
"(",
"'v'",
",",
"2",
")",
";",
"$",
"instructions",
"=",
"rtrim",
"(",
"$",
"this",
"->",
"readHeaderRaw",
"(",
"$",
"len",
")",
",",
"\"\\0\""... | Read messages.
@return \StdClass | [
"Read",
"messages",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/Analyzers/HeaderAnalyzer.php#L484-L506 |
35,772 | goto-bus-stop/recanalyst | src/Analyzers/HeaderAnalyzer.php | HeaderAnalyzer.buildTeams | protected function buildTeams($players)
{
$teams = [];
$teamsByIndex = [];
foreach ($players as $player) {
/**
* Team = 0 can mean two things: either this player has no team,
* i.e. is in a team on their own, or this player is cooping with
*... | php | protected function buildTeams($players)
{
$teams = [];
$teamsByIndex = [];
foreach ($players as $player) {
/**
* Team = 0 can mean two things: either this player has no team,
* i.e. is in a team on their own, or this player is cooping with
*... | [
"protected",
"function",
"buildTeams",
"(",
"$",
"players",
")",
"{",
"$",
"teams",
"=",
"[",
"]",
";",
"$",
"teamsByIndex",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"players",
"as",
"$",
"player",
")",
"{",
"/**\n * Team = 0 can mean two things:... | Group players into teams.
@param \RecAnalyst\Model\Player[] $players Array of players.
@return \RecAnalyst\Model\Team[] | [
"Group",
"players",
"into",
"teams",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/Analyzers/HeaderAnalyzer.php#L515-L559 |
35,773 | goto-bus-stop/recanalyst | src/Analyzers/VersionAnalyzer.php | VersionAnalyzer.run | protected function run()
{
$versionString = rtrim($this->readHeaderRaw(8));
$subVersion = round($this->readHeader('f', 4), 2);
$version = $this->getVersion($versionString, $subVersion);
$analysis = new Version($this->rec, $versionString, $subVersion);
$analysis->version = $... | php | protected function run()
{
$versionString = rtrim($this->readHeaderRaw(8));
$subVersion = round($this->readHeader('f', 4), 2);
$version = $this->getVersion($versionString, $subVersion);
$analysis = new Version($this->rec, $versionString, $subVersion);
$analysis->version = $... | [
"protected",
"function",
"run",
"(",
")",
"{",
"$",
"versionString",
"=",
"rtrim",
"(",
"$",
"this",
"->",
"readHeaderRaw",
"(",
"8",
")",
")",
";",
"$",
"subVersion",
"=",
"round",
"(",
"$",
"this",
"->",
"readHeader",
"(",
"'f'",
",",
"4",
")",
"... | Read recorded game version metadata.
Recorded game version information is encoded as:
char version[8]; // something like "VER 9.C\0"
float subVersion;
@return object | [
"Read",
"recorded",
"game",
"version",
"metadata",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/Analyzers/VersionAnalyzer.php#L86-L119 |
35,774 | goto-bus-stop/recanalyst | src/Analyzers/VersionAnalyzer.php | VersionAnalyzer.getVersion | private function getVersion($version, $subVersion)
{
switch ($version) {
case 'TRL 9.3':
return $this->isMgx ? Version::VERSION_AOCTRIAL : Version::VERSION_AOKTRIAL;
case 'VER 9.3':
return Version::VERSION_AOK;
case 'VER 9.4':
... | php | private function getVersion($version, $subVersion)
{
switch ($version) {
case 'TRL 9.3':
return $this->isMgx ? Version::VERSION_AOCTRIAL : Version::VERSION_AOKTRIAL;
case 'VER 9.3':
return Version::VERSION_AOK;
case 'VER 9.4':
... | [
"private",
"function",
"getVersion",
"(",
"$",
"version",
",",
"$",
"subVersion",
")",
"{",
"switch",
"(",
"$",
"version",
")",
"{",
"case",
"'TRL 9.3'",
":",
"return",
"$",
"this",
"->",
"isMgx",
"?",
"Version",
"::",
"VERSION_AOCTRIAL",
":",
"Version",
... | Get the version ID from a version string and sub-version number.
@param string $version Version string, found at the start of the file
header.
@param float $subVersion Sub-version number.
@return int Game version ID. | [
"Get",
"the",
"version",
"ID",
"from",
"a",
"version",
"string",
"and",
"sub",
"-",
"version",
"number",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/Analyzers/VersionAnalyzer.php#L129-L174 |
35,775 | goto-bus-stop/recanalyst | src/ResourcePacks/AgeOfEmpires/Map.php | Map.isRealWorldMap | public static function isRealWorldMap($id)
{
return in_array($id, [
self::IBERIA, self::BRITAIN, self::MIDEAST, self::TEXAS,
self::ITALY, self::CENTRALAMERICA, self::FRANCE, self::NORSELANDS,
self::SEAOFJAPAN, self::BYZANTINUM,
]);
} | php | public static function isRealWorldMap($id)
{
return in_array($id, [
self::IBERIA, self::BRITAIN, self::MIDEAST, self::TEXAS,
self::ITALY, self::CENTRALAMERICA, self::FRANCE, self::NORSELANDS,
self::SEAOFJAPAN, self::BYZANTINUM,
]);
} | [
"public",
"static",
"function",
"isRealWorldMap",
"(",
"$",
"id",
")",
"{",
"return",
"in_array",
"(",
"$",
"id",
",",
"[",
"self",
"::",
"IBERIA",
",",
"self",
"::",
"BRITAIN",
",",
"self",
"::",
"MIDEAST",
",",
"self",
"::",
"TEXAS",
",",
"self",
"... | Check whether a builtin map is a "Real World" map, such as Byzantinum or
Texas.
@param int $id Map ID of a builtin map.
@return bool True if the map is a "Real World" map, false otherwise. | [
"Check",
"whether",
"a",
"builtin",
"map",
"is",
"a",
"Real",
"World",
"map",
"such",
"as",
"Byzantinum",
"or",
"Texas",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/ResourcePacks/AgeOfEmpires/Map.php#L73-L80 |
35,776 | goto-bus-stop/recanalyst | src/ResourcePacks/AgeOfEmpires/Map.php | Map.isStandardMap | public static function isStandardMap($id)
{
return in_array($id, [
self::ARABIA, self::ARCHIPELAGO, self::BALTIC, self::BLACKFOREST,
self::COASTAL, self::CONTINENTAL, self::CRATERLAKE,
self::FORTRESS, self::GOLDRUSH, self::HIGHLAND, self::ISLANDS,
self... | php | public static function isStandardMap($id)
{
return in_array($id, [
self::ARABIA, self::ARCHIPELAGO, self::BALTIC, self::BLACKFOREST,
self::COASTAL, self::CONTINENTAL, self::CRATERLAKE,
self::FORTRESS, self::GOLDRUSH, self::HIGHLAND, self::ISLANDS,
self... | [
"public",
"static",
"function",
"isStandardMap",
"(",
"$",
"id",
")",
"{",
"return",
"in_array",
"(",
"$",
"id",
",",
"[",
"self",
"::",
"ARABIA",
",",
"self",
"::",
"ARCHIPELAGO",
",",
"self",
"::",
"BALTIC",
",",
"self",
"::",
"BLACKFOREST",
",",
"se... | Check whether a map ID denotes a builtin map.
@see \RecAnalyst\ResourcePacks\AgeOfEmpires::isCustomMap
For the inverse.
@param int $id Map ID.
@return bool True if the map is builtin, false otherwise. | [
"Check",
"whether",
"a",
"map",
"ID",
"denotes",
"a",
"builtin",
"map",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/ResourcePacks/AgeOfEmpires/Map.php#L103-L115 |
35,777 | goto-bus-stop/recanalyst | src/StreamExtractor.php | StreamExtractor.manuallyDetermineHeaderLength | private function manuallyDetermineHeaderLength()
{
// This separator is part of the Start Game command, which is the very
// first command in the recorded game body. It's … reasonably accurate.
$separator = pack('c*', 0xF4, 0x01, 0x00, 0x00);
// We need to reset the file pointer when... | php | private function manuallyDetermineHeaderLength()
{
// This separator is part of the Start Game command, which is the very
// first command in the recorded game body. It's … reasonably accurate.
$separator = pack('c*', 0xF4, 0x01, 0x00, 0x00);
// We need to reset the file pointer when... | [
"private",
"function",
"manuallyDetermineHeaderLength",
"(",
")",
"{",
"// This separator is part of the Start Game command, which is the very",
"// first command in the recorded game body. It's … reasonably accurate.",
"$",
"separator",
"=",
"pack",
"(",
"'c*'",
",",
"0xF4",
",",
... | Determine the header length if the Header Length field was not set in the
file. | [
"Determine",
"the",
"header",
"length",
"if",
"the",
"Header",
"Length",
"field",
"was",
"not",
"set",
"in",
"the",
"file",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/StreamExtractor.php#L73-L92 |
35,778 | goto-bus-stop/recanalyst | src/StreamExtractor.php | StreamExtractor.determineHeaderLength | private function determineHeaderLength()
{
$rawRead = fread($this->fp, 4);
if ($rawRead === false || strlen($rawRead) < 4) {
throw new RecAnalystException(
'Unable to read the header length',
RecAnalystException::HEADERLEN_READERROR
);
... | php | private function determineHeaderLength()
{
$rawRead = fread($this->fp, 4);
if ($rawRead === false || strlen($rawRead) < 4) {
throw new RecAnalystException(
'Unable to read the header length',
RecAnalystException::HEADERLEN_READERROR
);
... | [
"private",
"function",
"determineHeaderLength",
"(",
")",
"{",
"$",
"rawRead",
"=",
"fread",
"(",
"$",
"this",
"->",
"fp",
",",
"4",
")",
";",
"if",
"(",
"$",
"rawRead",
"===",
"false",
"||",
"strlen",
"(",
"$",
"rawRead",
")",
"<",
"4",
")",
"{",
... | Find the header length. | [
"Find",
"the",
"header",
"length",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/StreamExtractor.php#L109-L141 |
35,779 | goto-bus-stop/recanalyst | src/StreamExtractor.php | StreamExtractor.getHeader | public function getHeader()
{
if ($this->headerContents) {
return $this->headerContents;
}
if (!$this->headerLen) {
$this->determineHeaderLength();
}
fseek($this->fp, $this->headerStart, SEEK_SET);
$read = 0;
$bindata = '';
w... | php | public function getHeader()
{
if ($this->headerContents) {
return $this->headerContents;
}
if (!$this->headerLen) {
$this->determineHeaderLength();
}
fseek($this->fp, $this->headerStart, SEEK_SET);
$read = 0;
$bindata = '';
w... | [
"public",
"function",
"getHeader",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"headerContents",
")",
"{",
"return",
"$",
"this",
"->",
"headerContents",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"headerLen",
")",
"{",
"$",
"this",
"->",
"determi... | Read or return the Recorded Game file's header block.
@return string | [
"Read",
"or",
"return",
"the",
"Recorded",
"Game",
"file",
"s",
"header",
"block",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/StreamExtractor.php#L148-L179 |
35,780 | goto-bus-stop/recanalyst | src/StreamExtractor.php | StreamExtractor.getBody | public function getBody()
{
if ($this->bodyContents) {
return $this->bodyContents;
}
if (!$this->headerLen) {
$this->determineHeaderLength();
}
fseek($this->fp, $this->headerStart + $this->headerLen, SEEK_SET);
$this->bodyContents = '';
... | php | public function getBody()
{
if ($this->bodyContents) {
return $this->bodyContents;
}
if (!$this->headerLen) {
$this->determineHeaderLength();
}
fseek($this->fp, $this->headerStart + $this->headerLen, SEEK_SET);
$this->bodyContents = '';
... | [
"public",
"function",
"getBody",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"bodyContents",
")",
"{",
"return",
"$",
"this",
"->",
"bodyContents",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"headerLen",
")",
"{",
"$",
"this",
"->",
"determineHead... | Read or return the Recorded Game file's body.
@return string | [
"Read",
"or",
"return",
"the",
"Recorded",
"Game",
"file",
"s",
"body",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/StreamExtractor.php#L186-L205 |
35,781 | goto-bus-stop/recanalyst | src/Model/VictorySettings.php | VictorySettings.getVictoryString | public function getVictoryString()
{
if (!isset(RecAnalystConst::$VICTORY_CONDITIONS[$this->_victoryCondition])) {
return '';
}
$result = RecAnalystConst::$VICTORY_CONDITIONS[$this->_victoryCondition];
switch ($this->_victoryCondition) {
case self::TIMELIMIT:
... | php | public function getVictoryString()
{
if (!isset(RecAnalystConst::$VICTORY_CONDITIONS[$this->_victoryCondition])) {
return '';
}
$result = RecAnalystConst::$VICTORY_CONDITIONS[$this->_victoryCondition];
switch ($this->_victoryCondition) {
case self::TIMELIMIT:
... | [
"public",
"function",
"getVictoryString",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"RecAnalystConst",
"::",
"$",
"VICTORY_CONDITIONS",
"[",
"$",
"this",
"->",
"_victoryCondition",
"]",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"result",
"=",
"Rec... | Returns victory string.
@return string | [
"Returns",
"victory",
"string",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/Model/VictorySettings.php#L64-L83 |
35,782 | goto-bus-stop/recanalyst | src/Model/GameSettings.php | GameSettings.mapStyleName | public function mapStyleName()
{
$mapStyle = $this->rec->getResourcePack()
->getMapStyle($this->mapId);
return $this->rec->trans('map_styles', $mapStyle);
} | php | public function mapStyleName()
{
$mapStyle = $this->rec->getResourcePack()
->getMapStyle($this->mapId);
return $this->rec->trans('map_styles', $mapStyle);
} | [
"public",
"function",
"mapStyleName",
"(",
")",
"{",
"$",
"mapStyle",
"=",
"$",
"this",
"->",
"rec",
"->",
"getResourcePack",
"(",
")",
"->",
"getMapStyle",
"(",
"$",
"this",
"->",
"mapId",
")",
";",
"return",
"$",
"this",
"->",
"rec",
"->",
"trans",
... | Returns map style string.
@return string | [
"Returns",
"map",
"style",
"string",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/Model/GameSettings.php#L145-L150 |
35,783 | goto-bus-stop/recanalyst | src/Model/GameSettings.php | GameSettings.mapName | public function mapName($options = [])
{
$extractRmsName = isset($options['extractRMSName']) ? $options['extractRMSName'] : true;
if ($extractRmsName && $this->isCustomMap()) {
$nameExtractor = new MapNameExtractor($this->rec);
$likelyName = $nameExtractor->run();
... | php | public function mapName($options = [])
{
$extractRmsName = isset($options['extractRMSName']) ? $options['extractRMSName'] : true;
if ($extractRmsName && $this->isCustomMap()) {
$nameExtractor = new MapNameExtractor($this->rec);
$likelyName = $nameExtractor->run();
... | [
"public",
"function",
"mapName",
"(",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"extractRmsName",
"=",
"isset",
"(",
"$",
"options",
"[",
"'extractRMSName'",
"]",
")",
"?",
"$",
"options",
"[",
"'extractRMSName'",
"]",
":",
"true",
";",
"if",
"(",
... | Get the map name.
@param array $options Options.
- `$options['extractRMSName']` - Whether to attempt to find the RMS
file names of custom random maps. Defaults to `true`.
@return string Map name. | [
"Get",
"the",
"map",
"name",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/Model/GameSettings.php#L231-L242 |
35,784 | goto-bus-stop/recanalyst | src/BasicTranslator.php | BasicTranslator.get | private function get($arr, $path)
{
foreach (explode('.', $path) as $prop) {
$arr = $arr[$prop];
}
return $arr;
} | php | private function get($arr, $path)
{
foreach (explode('.', $path) as $prop) {
$arr = $arr[$prop];
}
return $arr;
} | [
"private",
"function",
"get",
"(",
"$",
"arr",
",",
"$",
"path",
")",
"{",
"foreach",
"(",
"explode",
"(",
"'.'",
",",
"$",
"path",
")",
"as",
"$",
"prop",
")",
"{",
"$",
"arr",
"=",
"$",
"arr",
"[",
"$",
"prop",
"]",
";",
"}",
"return",
"$",... | Get a value from a dotted property path.
@param array $arr Array.
@param string $path Path, properties separated by '.'s.
@return mixed (But probably a string because it's for translations.) | [
"Get",
"a",
"value",
"from",
"a",
"dotted",
"property",
"path",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/BasicTranslator.php#L66-L72 |
35,785 | goto-bus-stop/recanalyst | src/Model/ChatMessage.php | ChatMessage.create | public static function create($time, $player, $chat)
{
$group = '';
// This is directed someplace (@All, @Team, @Enemy, etc.)
// Voobly adds @Rating messages too, which we might wish to parse into
// the player objects later as a `->rating` property.
if ($chat[0] === '<') {
... | php | public static function create($time, $player, $chat)
{
$group = '';
// This is directed someplace (@All, @Team, @Enemy, etc.)
// Voobly adds @Rating messages too, which we might wish to parse into
// the player objects later as a `->rating` property.
if ($chat[0] === '<') {
... | [
"public",
"static",
"function",
"create",
"(",
"$",
"time",
",",
"$",
"player",
",",
"$",
"chat",
")",
"{",
"$",
"group",
"=",
"''",
";",
"// This is directed someplace (@All, @Team, @Enemy, etc.)",
"// Voobly adds @Rating messages too, which we might wish to parse into",
... | Helper method to create a chat message from a chat string more easily.
Messages actually have the player name and sometimes a group specifier
(<Team>, <Enemy>, etc) included in their message body which is lame.
Sometimes players that don't end up in the player info blocks of the
recorded games sent messages anyway (pa... | [
"Helper",
"method",
"to",
"create",
"a",
"chat",
"message",
"from",
"a",
"chat",
"string",
"more",
"easily",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/Model/ChatMessage.php#L78-L110 |
35,786 | goto-bus-stop/recanalyst | src/RecordedGame.php | RecordedGame.getAnalysis | public function getAnalysis($analyzerName, $arg = null, $startAt = 0)
{
$key = $analyzerName . ':' . $startAt;
if (!array_key_exists($key, $this->analyses)) {
$analyzer = new $analyzerName($arg);
$analyzer->position = $startAt;
$result = new \StdClass;
... | php | public function getAnalysis($analyzerName, $arg = null, $startAt = 0)
{
$key = $analyzerName . ':' . $startAt;
if (!array_key_exists($key, $this->analyses)) {
$analyzer = new $analyzerName($arg);
$analyzer->position = $startAt;
$result = new \StdClass;
... | [
"public",
"function",
"getAnalysis",
"(",
"$",
"analyzerName",
",",
"$",
"arg",
"=",
"null",
",",
"$",
"startAt",
"=",
"0",
")",
"{",
"$",
"key",
"=",
"$",
"analyzerName",
".",
"':'",
".",
"$",
"startAt",
";",
"if",
"(",
"!",
"array_key_exists",
"(",... | Get an analysis result for a specific analyzer, running it if necessary.
@param string $analyzerName Fully qualified name of the analyzer class.
@param mixed $arg Optional argument to the analyzer.
@param int $startAt Position to start at.
@return mixed | [
"Get",
"an",
"analysis",
"result",
"for",
"a",
"specific",
"analyzer",
"running",
"it",
"if",
"necessary",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/RecordedGame.php#L136-L148 |
35,787 | goto-bus-stop/recanalyst | src/RecordedGame.php | RecordedGame.getPlayer | public function getPlayer($id)
{
foreach ($this->header()->players as $player) {
if ($player->index === $id) {
return $player;
}
}
} | php | public function getPlayer($id)
{
foreach ($this->header()->players as $player) {
if ($player->index === $id) {
return $player;
}
}
} | [
"public",
"function",
"getPlayer",
"(",
"$",
"id",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"header",
"(",
")",
"->",
"players",
"as",
"$",
"player",
")",
"{",
"if",
"(",
"$",
"player",
"->",
"index",
"===",
"$",
"id",
")",
"{",
"return",
"$"... | Get a player by their index.
@param int $id Player index.
@return \RecAnalyst\Model\Player|null | [
"Get",
"a",
"player",
"by",
"their",
"index",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/RecordedGame.php#L291-L298 |
35,788 | goto-bus-stop/recanalyst | src/RecordedGame.php | RecordedGame.getTranslateKey | private function getTranslateKey($args)
{
// Game version names are in their own file, not in with resource packs.
if ($args[0] === 'game_versions') {
$key = implode('.', $args);
} else {
$pack = get_class($this->resourcePack);
$key = $pack::NAME . '.' . i... | php | private function getTranslateKey($args)
{
// Game version names are in their own file, not in with resource packs.
if ($args[0] === 'game_versions') {
$key = implode('.', $args);
} else {
$pack = get_class($this->resourcePack);
$key = $pack::NAME . '.' . i... | [
"private",
"function",
"getTranslateKey",
"(",
"$",
"args",
")",
"{",
"// Game version names are in their own file, not in with resource packs.",
"if",
"(",
"$",
"args",
"[",
"0",
"]",
"===",
"'game_versions'",
")",
"{",
"$",
"key",
"=",
"implode",
"(",
"'.'",
","... | Get a translate key for use with Symfony or Laravel Translations.
@return string A translation key. | [
"Get",
"a",
"translate",
"key",
"for",
"use",
"with",
"Symfony",
"or",
"Laravel",
"Translations",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/RecordedGame.php#L316-L329 |
35,789 | goto-bus-stop/recanalyst | src/ResourcePacks/AgeOfEmpires.php | AgeOfEmpires.isGateUnit | public function isGateUnit($id)
{
return $id === Unit::GATE
|| $id === Unit::GATE2
|| $id === Unit::GATE3
|| $id === Unit::GATE4;
} | php | public function isGateUnit($id)
{
return $id === Unit::GATE
|| $id === Unit::GATE2
|| $id === Unit::GATE3
|| $id === Unit::GATE4;
} | [
"public",
"function",
"isGateUnit",
"(",
"$",
"id",
")",
"{",
"return",
"$",
"id",
"===",
"Unit",
"::",
"GATE",
"||",
"$",
"id",
"===",
"Unit",
"::",
"GATE2",
"||",
"$",
"id",
"===",
"Unit",
"::",
"GATE3",
"||",
"$",
"id",
"===",
"Unit",
"::",
"G... | Checks whether a unit type ID is a Gate unit.
@param int $id Unit type ID.
@return bool True if the unit type is a gate, false otherwise. | [
"Checks",
"whether",
"a",
"unit",
"type",
"ID",
"is",
"a",
"Gate",
"unit",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/ResourcePacks/AgeOfEmpires.php#L111-L117 |
35,790 | goto-bus-stop/recanalyst | src/ResourcePacks/AgeOfEmpires.php | AgeOfEmpires.isPalisadeGateUnit | public function isPalisadeGateUnit($id)
{
return $id === Unit::PALISADE_GATE
|| $id === Unit::PALISADE_GATE2
|| $id === Unit::PALISADE_GATE3
|| $id === Unit::PALISADE_GATE4;
} | php | public function isPalisadeGateUnit($id)
{
return $id === Unit::PALISADE_GATE
|| $id === Unit::PALISADE_GATE2
|| $id === Unit::PALISADE_GATE3
|| $id === Unit::PALISADE_GATE4;
} | [
"public",
"function",
"isPalisadeGateUnit",
"(",
"$",
"id",
")",
"{",
"return",
"$",
"id",
"===",
"Unit",
"::",
"PALISADE_GATE",
"||",
"$",
"id",
"===",
"Unit",
"::",
"PALISADE_GATE2",
"||",
"$",
"id",
"===",
"Unit",
"::",
"PALISADE_GATE3",
"||",
"$",
"i... | Checks whether a unit type ID is a Palisade Gate unit.
@param int $id Unit type ID.
@return bool True if the unit type is a palisade gate, false otherwise. | [
"Checks",
"whether",
"a",
"unit",
"type",
"ID",
"is",
"a",
"Palisade",
"Gate",
"unit",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/ResourcePacks/AgeOfEmpires.php#L125-L131 |
35,791 | goto-bus-stop/recanalyst | src/ResourcePacks/AgeOfEmpires.php | AgeOfEmpires.isGaiaObject | public function isGaiaObject($id)
{
return $id >= Unit::CLIFF1 && $id <= Unit::CLIFF10
|| $id === Unit::GOLDMINE
|| $id === Unit::STONEMINE
|| $id === Unit::FORAGEBUSH;
} | php | public function isGaiaObject($id)
{
return $id >= Unit::CLIFF1 && $id <= Unit::CLIFF10
|| $id === Unit::GOLDMINE
|| $id === Unit::STONEMINE
|| $id === Unit::FORAGEBUSH;
} | [
"public",
"function",
"isGaiaObject",
"(",
"$",
"id",
")",
"{",
"return",
"$",
"id",
">=",
"Unit",
"::",
"CLIFF1",
"&&",
"$",
"id",
"<=",
"Unit",
"::",
"CLIFF10",
"||",
"$",
"id",
"===",
"Unit",
"::",
"GOLDMINE",
"||",
"$",
"id",
"===",
"Unit",
"::... | Checks whether a unit type ID is a GAIA object type. Used to determine
which objects to draw on a map.
@param int $id Unit type ID.
@return bool True if the unit type is a GAIA object, false otherwise. | [
"Checks",
"whether",
"a",
"unit",
"type",
"ID",
"is",
"a",
"GAIA",
"object",
"type",
".",
"Used",
"to",
"determine",
"which",
"objects",
"to",
"draw",
"on",
"a",
"map",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/ResourcePacks/AgeOfEmpires.php#L151-L157 |
35,792 | goto-bus-stop/recanalyst | src/ResourcePacks/AgeOfEmpires.php | AgeOfEmpires.isGaiaUnit | public function isGaiaUnit($id)
{
return $id === Unit::RELIC
|| $id === Unit::DEER
|| $id === Unit::BOAR
|| $id === Unit::JAVELINA
|| $id === Unit::TURKEY
|| $id === Unit::SHEEP;
} | php | public function isGaiaUnit($id)
{
return $id === Unit::RELIC
|| $id === Unit::DEER
|| $id === Unit::BOAR
|| $id === Unit::JAVELINA
|| $id === Unit::TURKEY
|| $id === Unit::SHEEP;
} | [
"public",
"function",
"isGaiaUnit",
"(",
"$",
"id",
")",
"{",
"return",
"$",
"id",
"===",
"Unit",
"::",
"RELIC",
"||",
"$",
"id",
"===",
"Unit",
"::",
"DEER",
"||",
"$",
"id",
"===",
"Unit",
"::",
"BOAR",
"||",
"$",
"id",
"===",
"Unit",
"::",
"JA... | Checks whether a unit type ID is a GAIA unit. Used to determine which
units to draw on a map as not belonging to any player.
@param int $id Unit type ID.
@return bool True if the unit type is a GAIA unit, false otherwise. | [
"Checks",
"whether",
"a",
"unit",
"type",
"ID",
"is",
"a",
"GAIA",
"unit",
".",
"Used",
"to",
"determine",
"which",
"units",
"to",
"draw",
"on",
"a",
"map",
"as",
"not",
"belonging",
"to",
"any",
"player",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/ResourcePacks/AgeOfEmpires.php#L166-L174 |
35,793 | goto-bus-stop/recanalyst | src/Model/GameInfo.php | GameInfo.getPOV | public function getPOV()
{
foreach ($this->owner->players as $player) {
if ($player->owner) {
return $player->name;
}
}
return '';
} | php | public function getPOV()
{
foreach ($this->owner->players as $player) {
if ($player->owner) {
return $player->name;
}
}
return '';
} | [
"public",
"function",
"getPOV",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"owner",
"->",
"players",
"as",
"$",
"player",
")",
"{",
"if",
"(",
"$",
"player",
"->",
"owner",
")",
"{",
"return",
"$",
"player",
"->",
"name",
";",
"}",
"}",
"r... | Returns the point of view.
@return string | [
"Returns",
"the",
"point",
"of",
"view",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/Model/GameInfo.php#L79-L87 |
35,794 | goto-bus-stop/recanalyst | src/Model/GameInfo.php | GameInfo.ingameCoop | public function ingameCoop()
{
foreach ($this->owner->players as $player) {
if ($player->isCooping) {
return true;
}
}
return false;
} | php | public function ingameCoop()
{
foreach ($this->owner->players as $player) {
if ($player->isCooping) {
return true;
}
}
return false;
} | [
"public",
"function",
"ingameCoop",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"owner",
"->",
"players",
"as",
"$",
"player",
")",
"{",
"if",
"(",
"$",
"player",
"->",
"isCooping",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
... | Determines if there is a cooping player in the game.
@return bool True, if there is a cooping player in the game, false otherwise. | [
"Determines",
"if",
"there",
"is",
"a",
"cooping",
"player",
"in",
"the",
"game",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/Model/GameInfo.php#L127-L135 |
35,795 | goto-bus-stop/recanalyst | examples/laravel.php | RecAnalystController.showMapImage | public function showMapImage(Request $request)
{
// The RecordedGame constructor accepts SplFileInfo instances,
// so uploaded files can be passed straight to it:
$rec = new RecordedGame($request->file('game'));
// `mapImage()` returns an instance of \Intervention\Image, which has a... | php | public function showMapImage(Request $request)
{
// The RecordedGame constructor accepts SplFileInfo instances,
// so uploaded files can be passed straight to it:
$rec = new RecordedGame($request->file('game'));
// `mapImage()` returns an instance of \Intervention\Image, which has a... | [
"public",
"function",
"showMapImage",
"(",
"Request",
"$",
"request",
")",
"{",
"// The RecordedGame constructor accepts SplFileInfo instances,",
"// so uploaded files can be passed straight to it:",
"$",
"rec",
"=",
"new",
"RecordedGame",
"(",
"$",
"request",
"->",
"file",
... | Render a PNG map image and send it to the browser. | [
"Render",
"a",
"PNG",
"map",
"image",
"and",
"send",
"it",
"to",
"the",
"browser",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/examples/laravel.php#L16-L25 |
35,796 | goto-bus-stop/recanalyst | src/Model/Player.php | Player.team | public function team()
{
$teams = $this->rec->teams();
foreach ($teams as $team) {
if ($team->index() === $this->teamIndex) {
return $team;
}
}
} | php | public function team()
{
$teams = $this->rec->teams();
foreach ($teams as $team) {
if ($team->index() === $this->teamIndex) {
return $team;
}
}
} | [
"public",
"function",
"team",
"(",
")",
"{",
"$",
"teams",
"=",
"$",
"this",
"->",
"rec",
"->",
"teams",
"(",
")",
";",
"foreach",
"(",
"$",
"teams",
"as",
"$",
"team",
")",
"{",
"if",
"(",
"$",
"team",
"->",
"index",
"(",
")",
"===",
"$",
"t... | Get the player's team.
@return \RecAnalyst\Model\Team|null | [
"Get",
"the",
"player",
"s",
"team",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/Model/Player.php#L177-L185 |
35,797 | goto-bus-stop/recanalyst | src/Model/Player.php | Player.color | public function color()
{
if (is_null($this->rec)) {
return null;
}
$resourcePack = $this->rec->getResourcePack();
return $resourcePack->getPlayerColor($this->colorId);
} | php | public function color()
{
if (is_null($this->rec)) {
return null;
}
$resourcePack = $this->rec->getResourcePack();
return $resourcePack->getPlayerColor($this->colorId);
} | [
"public",
"function",
"color",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"rec",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"resourcePack",
"=",
"$",
"this",
"->",
"rec",
"->",
"getResourcePack",
"(",
")",
";",
"return",
"$",... | Get the hex color of this player.
@return string Hexadecimal representation of this player's color. | [
"Get",
"the",
"hex",
"color",
"of",
"this",
"player",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/Model/Player.php#L263-L270 |
35,798 | goto-bus-stop/recanalyst | src/Model/Player.php | Player.addResearch | public function addResearch($id, $time)
{
$this->researchesById[$id] = new Research($this->rec, $id, $time);
} | php | public function addResearch($id, $time)
{
$this->researchesById[$id] = new Research($this->rec, $id, $time);
} | [
"public",
"function",
"addResearch",
"(",
"$",
"id",
",",
"$",
"time",
")",
"{",
"$",
"this",
"->",
"researchesById",
"[",
"$",
"id",
"]",
"=",
"new",
"Research",
"(",
"$",
"this",
"->",
"rec",
",",
"$",
"id",
",",
"$",
"time",
")",
";",
"}"
] | Add a research action.
@param int $id Research ID.
@param int $time Research completion time. | [
"Add",
"a",
"research",
"action",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/Model/Player.php#L293-L296 |
35,799 | goto-bus-stop/recanalyst | src/Model/Player.php | Player.civName | public function civName()
{
if (!is_null($this->rec)) {
return $this->rec->trans('civilizations', $this->civId);
}
return 'Civ #' . $this->civId;
} | php | public function civName()
{
if (!is_null($this->rec)) {
return $this->rec->trans('civilizations', $this->civId);
}
return 'Civ #' . $this->civId;
} | [
"public",
"function",
"civName",
"(",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"rec",
")",
")",
"{",
"return",
"$",
"this",
"->",
"rec",
"->",
"trans",
"(",
"'civilizations'",
",",
"$",
"this",
"->",
"civId",
")",
";",
"}",
"r... | Get the name of this player's civilization.
@return string | [
"Get",
"the",
"name",
"of",
"this",
"player",
"s",
"civilization",
"."
] | daec4916d04a73cf89f9325ad77bfaf0644fda06 | https://github.com/goto-bus-stop/recanalyst/blob/daec4916d04a73cf89f9325ad77bfaf0644fda06/src/Model/Player.php#L311-L317 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.