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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
222,300 | nabbar/SwaggerValidator-PHP | src/Common/Context.php | Context.logModel | public function logModel($method = null, $line = null)
{
if (self::getConfig('log', 'model')) {
$this->logMessage('MODEL', 'Model Created "' . $this->getDataPath() . '"', $method, $line);
}
} | php | public function logModel($method = null, $line = null)
{
if (self::getConfig('log', 'model')) {
$this->logMessage('MODEL', 'Model Created "' . $this->getDataPath() . '"', $method, $line);
}
} | [
"public",
"function",
"logModel",
"(",
"$",
"method",
"=",
"null",
",",
"$",
"line",
"=",
"null",
")",
"{",
"if",
"(",
"self",
"::",
"getConfig",
"(",
"'log'",
",",
"'model'",
")",
")",
"{",
"$",
"this",
"->",
"logMessage",
"(",
"'MODEL'",
",",
"'M... | Log a creation model success
@param string $path
@param string $method
@param int $line | [
"Log",
"a",
"creation",
"model",
"success"
] | c3518c53beed71b653a98ea7d56bd12a580d5aa8 | https://github.com/nabbar/SwaggerValidator-PHP/blob/c3518c53beed71b653a98ea7d56bd12a580d5aa8/src/Common/Context.php#L845-L850 |
222,301 | nabbar/SwaggerValidator-PHP | src/Common/Context.php | Context.logReference | public function logReference($type, $ref, $oldRef = null, $method = null, $line = null)
{
if (self::getConfig('log', 'reference') || self::getConfig('log', $type . 'Ref')) {
switch ($type) {
case 'replace':
$this->logMessage('REPLACE REF', 'Replacing Reference... | php | public function logReference($type, $ref, $oldRef = null, $method = null, $line = null)
{
if (self::getConfig('log', 'reference') || self::getConfig('log', $type . 'Ref')) {
switch ($type) {
case 'replace':
$this->logMessage('REPLACE REF', 'Replacing Reference... | [
"public",
"function",
"logReference",
"(",
"$",
"type",
",",
"$",
"ref",
",",
"$",
"oldRef",
"=",
"null",
",",
"$",
"method",
"=",
"null",
",",
"$",
"line",
"=",
"null",
")",
"{",
"if",
"(",
"self",
"::",
"getConfig",
"(",
"'log'",
",",
"'reference... | Log an external reference action
@param string $type Type of action
@param string $ref
@param string $oldRef
@param string $method
@param int $line | [
"Log",
"an",
"external",
"reference",
"action"
] | c3518c53beed71b653a98ea7d56bd12a580d5aa8 | https://github.com/nabbar/SwaggerValidator-PHP/blob/c3518c53beed71b653a98ea7d56bd12a580d5aa8/src/Common/Context.php#L860-L878 |
222,302 | nabbar/SwaggerValidator-PHP | src/Common/Context.php | Context.logMessage | public function logMessage($type, $message, $method = null, $line = null)
{
if (is_array($message) || is_object($message)) {
$message = \SwaggerValidator\Common\Collection::jsonEncode($message);
}
print "[" . date('Y-m-d H:i:s') . "][{$type}][{{$method}#{$line}] - {$message} \n"... | php | public function logMessage($type, $message, $method = null, $line = null)
{
if (is_array($message) || is_object($message)) {
$message = \SwaggerValidator\Common\Collection::jsonEncode($message);
}
print "[" . date('Y-m-d H:i:s') . "][{$type}][{{$method}#{$line}] - {$message} \n"... | [
"public",
"function",
"logMessage",
"(",
"$",
"type",
",",
"$",
"message",
",",
"$",
"method",
"=",
"null",
",",
"$",
"line",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"message",
")",
"||",
"is_object",
"(",
"$",
"message",
")",
")",
... | Used to customizing log and more when a debug is send
@param string $message
@param mixed $context
@param string $method
@param TypeInteger $line | [
"Used",
"to",
"customizing",
"log",
"and",
"more",
"when",
"a",
"debug",
"is",
"send"
] | c3518c53beed71b653a98ea7d56bd12a580d5aa8 | https://github.com/nabbar/SwaggerValidator-PHP/blob/c3518c53beed71b653a98ea7d56bd12a580d5aa8/src/Common/Context.php#L888-L896 |
222,303 | nabbar/SwaggerValidator-PHP | src/Common/Context.php | Context.throwException | public function throwException($message, $method = null, $line = null)
{
$this->logException($message, $method, $line);
$e = new \SwaggerValidator\Exception($message);
$e->setFile($method);
$e->setLine($line);
$e->setContext($this);
throw $e;
} | php | public function throwException($message, $method = null, $line = null)
{
$this->logException($message, $method, $line);
$e = new \SwaggerValidator\Exception($message);
$e->setFile($method);
$e->setLine($line);
$e->setContext($this);
throw $e;
} | [
"public",
"function",
"throwException",
"(",
"$",
"message",
",",
"$",
"method",
"=",
"null",
",",
"$",
"line",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"logException",
"(",
"$",
"message",
",",
"$",
"method",
",",
"$",
"line",
")",
";",
"$",
"e",... | Throw a new \SwaggerValidator\Exception with automatic find method, line, ...
@param string $message
@param mixed $context
@throws \SwaggerValidator\Exception | [
"Throw",
"a",
"new",
"\\",
"SwaggerValidator",
"\\",
"Exception",
"with",
"automatic",
"find",
"method",
"line",
"..."
] | c3518c53beed71b653a98ea7d56bd12a580d5aa8 | https://github.com/nabbar/SwaggerValidator-PHP/blob/c3518c53beed71b653a98ea7d56bd12a580d5aa8/src/Common/Context.php#L931-L942 |
222,304 | adshares/ads-php-client | src/AdsClient.php | AdsClient.prepareTransaction | private function prepareTransaction(AbstractTransactionCommand $transaction, bool $force = false): void
{
if (!$force && (null !== $transaction->getLastMsid()) && (null !== $transaction->getLastHash())) {
return;
}
$sender = $transaction->getSender();
if (null !== $sende... | php | private function prepareTransaction(AbstractTransactionCommand $transaction, bool $force = false): void
{
if (!$force && (null !== $transaction->getLastMsid()) && (null !== $transaction->getLastHash())) {
return;
}
$sender = $transaction->getSender();
if (null !== $sende... | [
"private",
"function",
"prepareTransaction",
"(",
"AbstractTransactionCommand",
"$",
"transaction",
",",
"bool",
"$",
"force",
"=",
"false",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"force",
"&&",
"(",
"null",
"!==",
"$",
"transaction",
"->",
"getLastMsid... | Fills last account hash and message id in request. Function needs to be called before transaction.
Otherwise above parameters should be passed explicitly.
@param AbstractTransactionCommand $transaction
@param bool $force force set msid and hash
@throws CommandException | [
"Fills",
"last",
"account",
"hash",
"and",
"message",
"id",
"in",
"request",
".",
"Function",
"needs",
"to",
"be",
"called",
"before",
"transaction",
".",
"Otherwise",
"above",
"parameters",
"should",
"be",
"passed",
"explicitly",
"."
] | b9a897219dfa60a316a29191dbeb836c5e1aa760 | https://github.com/adshares/ads-php-client/blob/b9a897219dfa60a316a29191dbeb836c5e1aa760/src/AdsClient.php#L105-L119 |
222,305 | adshares/ads-php-client | src/AdsClient.php | AdsClient.changeAccountKey | public function changeAccountKey(ChangeAccountKeyCommand $command, bool $isDryRun = false): ChangeAccountKeyResponse
{
$this->prepareTransaction($command);
$response = $this->driver->executeTransaction($command, $isDryRun);
return new ChangeAccountKeyResponse($response->getRawData());
} | php | public function changeAccountKey(ChangeAccountKeyCommand $command, bool $isDryRun = false): ChangeAccountKeyResponse
{
$this->prepareTransaction($command);
$response = $this->driver->executeTransaction($command, $isDryRun);
return new ChangeAccountKeyResponse($response->getRawData());
} | [
"public",
"function",
"changeAccountKey",
"(",
"ChangeAccountKeyCommand",
"$",
"command",
",",
"bool",
"$",
"isDryRun",
"=",
"false",
")",
":",
"ChangeAccountKeyResponse",
"{",
"$",
"this",
"->",
"prepareTransaction",
"(",
"$",
"command",
")",
";",
"$",
"respons... | Executes `change_account_key` transaction.
@param ChangeAccountKeyCommand $command
@param bool $isDryRun if true, transaction won't be send to network
@return ChangeAccountKeyResponse | [
"Executes",
"change_account_key",
"transaction",
"."
] | b9a897219dfa60a316a29191dbeb836c5e1aa760 | https://github.com/adshares/ads-php-client/blob/b9a897219dfa60a316a29191dbeb836c5e1aa760/src/AdsClient.php#L128-L134 |
222,306 | adshares/ads-php-client | src/AdsClient.php | AdsClient.changeNodeKey | public function changeNodeKey(ChangeNodeKeyCommand $command, bool $isDryRun = false): ChangeNodeKeyResponse
{
$this->prepareTransaction($command);
$response = $this->driver->executeTransaction($command, $isDryRun);
return new ChangeNodeKeyResponse($response->getRawData());
} | php | public function changeNodeKey(ChangeNodeKeyCommand $command, bool $isDryRun = false): ChangeNodeKeyResponse
{
$this->prepareTransaction($command);
$response = $this->driver->executeTransaction($command, $isDryRun);
return new ChangeNodeKeyResponse($response->getRawData());
} | [
"public",
"function",
"changeNodeKey",
"(",
"ChangeNodeKeyCommand",
"$",
"command",
",",
"bool",
"$",
"isDryRun",
"=",
"false",
")",
":",
"ChangeNodeKeyResponse",
"{",
"$",
"this",
"->",
"prepareTransaction",
"(",
"$",
"command",
")",
";",
"$",
"response",
"="... | Executes `change_node_key` transaction.
@param ChangeNodeKeyCommand $command
@param bool $isDryRun if true, transaction won't be send to network
@return ChangeNodeKeyResponse | [
"Executes",
"change_node_key",
"transaction",
"."
] | b9a897219dfa60a316a29191dbeb836c5e1aa760 | https://github.com/adshares/ads-php-client/blob/b9a897219dfa60a316a29191dbeb836c5e1aa760/src/AdsClient.php#L143-L149 |
222,307 | adshares/ads-php-client | src/AdsClient.php | AdsClient.createAccount | public function createAccount(CreateAccountCommand $command, bool $isDryRun = false): CreateAccountResponse
{
$this->prepareTransaction($command);
$response = $this->driver->executeTransaction($command, $isDryRun);
return new CreateAccountResponse($response->getRawData());
} | php | public function createAccount(CreateAccountCommand $command, bool $isDryRun = false): CreateAccountResponse
{
$this->prepareTransaction($command);
$response = $this->driver->executeTransaction($command, $isDryRun);
return new CreateAccountResponse($response->getRawData());
} | [
"public",
"function",
"createAccount",
"(",
"CreateAccountCommand",
"$",
"command",
",",
"bool",
"$",
"isDryRun",
"=",
"false",
")",
":",
"CreateAccountResponse",
"{",
"$",
"this",
"->",
"prepareTransaction",
"(",
"$",
"command",
")",
";",
"$",
"response",
"="... | Executes `create_account` transaction.
@param CreateAccountCommand $command
@param bool $isDryRun if true, transaction won't be send to network
@return CreateAccountResponse | [
"Executes",
"create_account",
"transaction",
"."
] | b9a897219dfa60a316a29191dbeb836c5e1aa760 | https://github.com/adshares/ads-php-client/blob/b9a897219dfa60a316a29191dbeb836c5e1aa760/src/AdsClient.php#L158-L164 |
222,308 | adshares/ads-php-client | src/AdsClient.php | AdsClient.getAccount | public function getAccount(string $address): GetAccountResponse
{
$command = new GetAccountCommand($address);
$response = $this->driver->executeCommand($command);
return new GetAccountResponse($response->getRawData());
} | php | public function getAccount(string $address): GetAccountResponse
{
$command = new GetAccountCommand($address);
$response = $this->driver->executeCommand($command);
return new GetAccountResponse($response->getRawData());
} | [
"public",
"function",
"getAccount",
"(",
"string",
"$",
"address",
")",
":",
"GetAccountResponse",
"{",
"$",
"command",
"=",
"new",
"GetAccountCommand",
"(",
"$",
"address",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"driver",
"->",
"executeCommand",... | Returns account data.
@param string $address account address
@return GetAccountResponse
@throws CommandException | [
"Returns",
"account",
"data",
"."
] | b9a897219dfa60a316a29191dbeb836c5e1aa760 | https://github.com/adshares/ads-php-client/blob/b9a897219dfa60a316a29191dbeb836c5e1aa760/src/AdsClient.php#L175-L181 |
222,309 | adshares/ads-php-client | src/AdsClient.php | AdsClient.getAccounts | public function getAccounts(string $nodeId, ?string $blockId = null): GetAccountsResponse
{
$node = hexdec($nodeId);
$command = new GetAccountsCommand($node, $blockId);
$response = $this->driver->executeCommand($command);
return new GetAccountsResponse($response->getRawData());
... | php | public function getAccounts(string $nodeId, ?string $blockId = null): GetAccountsResponse
{
$node = hexdec($nodeId);
$command = new GetAccountsCommand($node, $blockId);
$response = $this->driver->executeCommand($command);
return new GetAccountsResponse($response->getRawData());
... | [
"public",
"function",
"getAccounts",
"(",
"string",
"$",
"nodeId",
",",
"?",
"string",
"$",
"blockId",
"=",
"null",
")",
":",
"GetAccountsResponse",
"{",
"$",
"node",
"=",
"hexdec",
"(",
"$",
"nodeId",
")",
";",
"$",
"command",
"=",
"new",
"GetAccountsCo... | Returns account list for node.
@param string $nodeId node id (hex)
@param null|string $blockId block id, time in Unix Epoch seconds as hexadecimal string.
If null, last block will be taken.
@return GetAccountsResponse
@throws CommandException | [
"Returns",
"account",
"list",
"for",
"node",
"."
] | b9a897219dfa60a316a29191dbeb836c5e1aa760 | https://github.com/adshares/ads-php-client/blob/b9a897219dfa60a316a29191dbeb836c5e1aa760/src/AdsClient.php#L194-L201 |
222,310 | adshares/ads-php-client | src/AdsClient.php | AdsClient.getBlock | public function getBlock(?string $blockId = null): GetBlockResponse
{
$command = new GetBlockCommand($blockId);
$response = $this->driver->executeCommand($command);
return new GetBlockResponse($response->getRawData());
} | php | public function getBlock(?string $blockId = null): GetBlockResponse
{
$command = new GetBlockCommand($blockId);
$response = $this->driver->executeCommand($command);
return new GetBlockResponse($response->getRawData());
} | [
"public",
"function",
"getBlock",
"(",
"?",
"string",
"$",
"blockId",
"=",
"null",
")",
":",
"GetBlockResponse",
"{",
"$",
"command",
"=",
"new",
"GetBlockCommand",
"(",
"$",
"blockId",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"driver",
"->",
... | Returns block data.
@param null|string $blockId block id, time in Unix Epoch seconds as hexadecimal string.
If null, last block will be taken.
@return GetBlockResponse
@throws CommandException | [
"Returns",
"block",
"data",
"."
] | b9a897219dfa60a316a29191dbeb836c5e1aa760 | https://github.com/adshares/ads-php-client/blob/b9a897219dfa60a316a29191dbeb836c5e1aa760/src/AdsClient.php#L213-L219 |
222,311 | adshares/ads-php-client | src/AdsClient.php | AdsClient.getBlockIds | public function getBlockIds(?string $blockIdFrom = null, ?string $blockIdTo = null): GetBlockIdsResponse
{
$command = new GetBlockIdsCommand($blockIdFrom, $blockIdTo);
$response = $this->driver->executeCommand($command);
return new GetBlockIdsResponse($response->getRawData());
} | php | public function getBlockIds(?string $blockIdFrom = null, ?string $blockIdTo = null): GetBlockIdsResponse
{
$command = new GetBlockIdsCommand($blockIdFrom, $blockIdTo);
$response = $this->driver->executeCommand($command);
return new GetBlockIdsResponse($response->getRawData());
} | [
"public",
"function",
"getBlockIds",
"(",
"?",
"string",
"$",
"blockIdFrom",
"=",
"null",
",",
"?",
"string",
"$",
"blockIdTo",
"=",
"null",
")",
":",
"GetBlockIdsResponse",
"{",
"$",
"command",
"=",
"new",
"GetBlockIdsCommand",
"(",
"$",
"blockIdFrom",
",",... | Updates block data for selected period and returns ids of updated blocks.
@param null|string $blockIdFrom starting block id, time in Unix Epoch seconds as hexadecimal string.
If null, first block (genesis) will be taken.
@param null|string $blockIdTo ending block id, time in Unix Epoch seconds as hexadecimal string.
I... | [
"Updates",
"block",
"data",
"for",
"selected",
"period",
"and",
"returns",
"ids",
"of",
"updated",
"blocks",
"."
] | b9a897219dfa60a316a29191dbeb836c5e1aa760 | https://github.com/adshares/ads-php-client/blob/b9a897219dfa60a316a29191dbeb836c5e1aa760/src/AdsClient.php#L233-L239 |
222,312 | adshares/ads-php-client | src/AdsClient.php | AdsClient.getBroadcast | public function getBroadcast(?string $blockId = null): GetBroadcastResponse
{
$command = new GetBroadcastCommand($blockId);
$response = $this->driver->executeCommand($command);
return new GetBroadcastResponse($response->getRawData());
} | php | public function getBroadcast(?string $blockId = null): GetBroadcastResponse
{
$command = new GetBroadcastCommand($blockId);
$response = $this->driver->executeCommand($command);
return new GetBroadcastResponse($response->getRawData());
} | [
"public",
"function",
"getBroadcast",
"(",
"?",
"string",
"$",
"blockId",
"=",
"null",
")",
":",
"GetBroadcastResponse",
"{",
"$",
"command",
"=",
"new",
"GetBroadcastCommand",
"(",
"$",
"blockId",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"driver... | Collects broadcast messages for particular block. Messages are in random order and can be duplicated.
@param null|string $blockId block id, time in Unix Epoch seconds as hexadecimal string.
If null, last block will be taken.
@return GetBroadcastResponse
@throws CommandException | [
"Collects",
"broadcast",
"messages",
"for",
"particular",
"block",
".",
"Messages",
"are",
"in",
"random",
"order",
"and",
"can",
"be",
"duplicated",
"."
] | b9a897219dfa60a316a29191dbeb836c5e1aa760 | https://github.com/adshares/ads-php-client/blob/b9a897219dfa60a316a29191dbeb836c5e1aa760/src/AdsClient.php#L251-L257 |
222,313 | adshares/ads-php-client | src/AdsClient.php | AdsClient.getLog | public function getLog(?\DateTime $from = null): GetLogResponse
{
$command = new GetLogCommand($from);
$response = $this->driver->executeCommand($command);
return new GetLogResponse($response->getRawData());
} | php | public function getLog(?\DateTime $from = null): GetLogResponse
{
$command = new GetLogCommand($from);
$response = $this->driver->executeCommand($command);
return new GetLogResponse($response->getRawData());
} | [
"public",
"function",
"getLog",
"(",
"?",
"\\",
"DateTime",
"$",
"from",
"=",
"null",
")",
":",
"GetLogResponse",
"{",
"$",
"command",
"=",
"new",
"GetLogCommand",
"(",
"$",
"from",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"driver",
"->",
"... | Returns available log event.
@param null|\DateTime $from start date of event log
@return GetLogResponse
@throws CommandException | [
"Returns",
"available",
"log",
"event",
"."
] | b9a897219dfa60a316a29191dbeb836c5e1aa760 | https://github.com/adshares/ads-php-client/blob/b9a897219dfa60a316a29191dbeb836c5e1aa760/src/AdsClient.php#L268-L274 |
222,314 | adshares/ads-php-client | src/AdsClient.php | AdsClient.getMe | public function getMe(): GetAccountResponse
{
$command = new GetMeCommand();
$response = $this->driver->executeCommand($command);
return new GetAccountResponse($response->getRawData());
} | php | public function getMe(): GetAccountResponse
{
$command = new GetMeCommand();
$response = $this->driver->executeCommand($command);
return new GetAccountResponse($response->getRawData());
} | [
"public",
"function",
"getMe",
"(",
")",
":",
"GetAccountResponse",
"{",
"$",
"command",
"=",
"new",
"GetMeCommand",
"(",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"driver",
"->",
"executeCommand",
"(",
"$",
"command",
")",
";",
"return",
"new",... | Returns current account data. Current account is the account, which was used to initialize AdsClient.
@return GetAccountResponse
@throws CommandException | [
"Returns",
"current",
"account",
"data",
".",
"Current",
"account",
"is",
"the",
"account",
"which",
"was",
"used",
"to",
"initialize",
"AdsClient",
"."
] | b9a897219dfa60a316a29191dbeb836c5e1aa760 | https://github.com/adshares/ads-php-client/blob/b9a897219dfa60a316a29191dbeb836c5e1aa760/src/AdsClient.php#L283-L289 |
222,315 | adshares/ads-php-client | src/AdsClient.php | AdsClient.getMessage | public function getMessage(string $messageId, ?string $blockId = null): GetMessageResponse
{
$command = new GetMessageCommand($messageId, $blockId);
$response = $this->driver->executeCommand($command);
return new GetMessageResponse($response->getRawData());
} | php | public function getMessage(string $messageId, ?string $blockId = null): GetMessageResponse
{
$command = new GetMessageCommand($messageId, $blockId);
$response = $this->driver->executeCommand($command);
return new GetMessageResponse($response->getRawData());
} | [
"public",
"function",
"getMessage",
"(",
"string",
"$",
"messageId",
",",
"?",
"string",
"$",
"blockId",
"=",
"null",
")",
":",
"GetMessageResponse",
"{",
"$",
"command",
"=",
"new",
"GetMessageCommand",
"(",
"$",
"messageId",
",",
"$",
"blockId",
")",
";"... | Returns message data. Each message contains one or more transactions.
@param string $messageId message id
@param null|string $blockId block id, time in Unix Epoch seconds as hexadecimal string.
If null, block will be calculated automatically.
@return GetMessageResponse
@throws CommandException | [
"Returns",
"message",
"data",
".",
"Each",
"message",
"contains",
"one",
"or",
"more",
"transactions",
"."
] | b9a897219dfa60a316a29191dbeb836c5e1aa760 | https://github.com/adshares/ads-php-client/blob/b9a897219dfa60a316a29191dbeb836c5e1aa760/src/AdsClient.php#L302-L308 |
222,316 | adshares/ads-php-client | src/AdsClient.php | AdsClient.getMessageIds | public function getMessageIds(?string $blockId = null): GetMessageIdsResponse
{
$command = new GetMessageIdsCommand($blockId);
$response = $this->driver->executeCommand($command);
return new GetMessageIdsResponse($response->getRawData());
} | php | public function getMessageIds(?string $blockId = null): GetMessageIdsResponse
{
$command = new GetMessageIdsCommand($blockId);
$response = $this->driver->executeCommand($command);
return new GetMessageIdsResponse($response->getRawData());
} | [
"public",
"function",
"getMessageIds",
"(",
"?",
"string",
"$",
"blockId",
"=",
"null",
")",
":",
"GetMessageIdsResponse",
"{",
"$",
"command",
"=",
"new",
"GetMessageIdsCommand",
"(",
"$",
"blockId",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"dri... | Returns message ids for selected block.
@param null|string $blockId block id, time in Unix Epoch seconds as hexadecimal string.
If null, last block will be taken.
@return GetMessageIdsResponse
@throws CommandException | [
"Returns",
"message",
"ids",
"for",
"selected",
"block",
"."
] | b9a897219dfa60a316a29191dbeb836c5e1aa760 | https://github.com/adshares/ads-php-client/blob/b9a897219dfa60a316a29191dbeb836c5e1aa760/src/AdsClient.php#L320-L326 |
222,317 | adshares/ads-php-client | src/AdsClient.php | AdsClient.getTransaction | public function getTransaction(string $txid): GetTransactionResponse
{
$command = new GetTransactionCommand($txid);
$response = $this->driver->executeCommand($command);
return new GetTransactionResponse($response->getRawData());
} | php | public function getTransaction(string $txid): GetTransactionResponse
{
$command = new GetTransactionCommand($txid);
$response = $this->driver->executeCommand($command);
return new GetTransactionResponse($response->getRawData());
} | [
"public",
"function",
"getTransaction",
"(",
"string",
"$",
"txid",
")",
":",
"GetTransactionResponse",
"{",
"$",
"command",
"=",
"new",
"GetTransactionCommand",
"(",
"$",
"txid",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"driver",
"->",
"executeCom... | Returns single transaction data.
@param string $txid transaction id
@return GetTransactionResponse
@throws CommandException | [
"Returns",
"single",
"transaction",
"data",
"."
] | b9a897219dfa60a316a29191dbeb836c5e1aa760 | https://github.com/adshares/ads-php-client/blob/b9a897219dfa60a316a29191dbeb836c5e1aa760/src/AdsClient.php#L337-L343 |
222,318 | nabbar/SwaggerValidator-PHP | src/SwaggerAutoload.php | SwaggerAutoload.autoload | final public static function autoload($className)
{
if (\Phar::running() && defined('PHAR_SWAGGER_VALIDATOR_ROOT_PATH')) {
$baseDir = PHAR_SWAGGER_VALIDATOR_ROOT_PATH;
}
elseif (\Phar::running()) {
$baseDir = null;
}
else {
$baseDir = __DIR... | php | final public static function autoload($className)
{
if (\Phar::running() && defined('PHAR_SWAGGER_VALIDATOR_ROOT_PATH')) {
$baseDir = PHAR_SWAGGER_VALIDATOR_ROOT_PATH;
}
elseif (\Phar::running()) {
$baseDir = null;
}
else {
$baseDir = __DIR... | [
"final",
"public",
"static",
"function",
"autoload",
"(",
"$",
"className",
")",
"{",
"if",
"(",
"\\",
"Phar",
"::",
"running",
"(",
")",
"&&",
"defined",
"(",
"'PHAR_SWAGGER_VALIDATOR_ROOT_PATH'",
")",
")",
"{",
"$",
"baseDir",
"=",
"PHAR_SWAGGER_VALIDATOR_RO... | Slim PSR-0 autoloader | [
"Slim",
"PSR",
"-",
"0",
"autoloader"
] | c3518c53beed71b653a98ea7d56bd12a580d5aa8 | https://github.com/nabbar/SwaggerValidator-PHP/blob/c3518c53beed71b653a98ea7d56bd12a580d5aa8/src/SwaggerAutoload.php#L38-L76 |
222,319 | adshares/ads-php-client | src/Util/AdsChecksumGenerator.php | AdsChecksumGenerator.crc16 | private static function crc16(string $hexChars): int
{
$chars = hex2bin($hexChars);
if ($chars) {
$crc = 0x1D0F;
for ($i = 0; $i < strlen($chars); $i++) {
$x = ($crc >> 8) ^ ord($chars[$i]);
$x ^= $x >> 4;
$crc = (($crc << 8) ^ ... | php | private static function crc16(string $hexChars): int
{
$chars = hex2bin($hexChars);
if ($chars) {
$crc = 0x1D0F;
for ($i = 0; $i < strlen($chars); $i++) {
$x = ($crc >> 8) ^ ord($chars[$i]);
$x ^= $x >> 4;
$crc = (($crc << 8) ^ ... | [
"private",
"static",
"function",
"crc16",
"(",
"string",
"$",
"hexChars",
")",
":",
"int",
"{",
"$",
"chars",
"=",
"hex2bin",
"(",
"$",
"hexChars",
")",
";",
"if",
"(",
"$",
"chars",
")",
"{",
"$",
"crc",
"=",
"0x1D0F",
";",
"for",
"(",
"$",
"i",... | Generates CRC16 checksum.
@param string $hexChars string
@return int checksum | [
"Generates",
"CRC16",
"checksum",
"."
] | b9a897219dfa60a316a29191dbeb836c5e1aa760 | https://github.com/adshares/ads-php-client/blob/b9a897219dfa60a316a29191dbeb836c5e1aa760/src/Util/AdsChecksumGenerator.php#L36-L50 |
222,320 | adshares/ads-php-client | src/Util/AdsChecksumGenerator.php | AdsChecksumGenerator.getAccountChecksum | public static function getAccountChecksum(int $node, int $user): string
{
return sprintf('%04X', self::crc16(sprintf('%04X%08X', $node, $user)));
} | php | public static function getAccountChecksum(int $node, int $user): string
{
return sprintf('%04X', self::crc16(sprintf('%04X%08X', $node, $user)));
} | [
"public",
"static",
"function",
"getAccountChecksum",
"(",
"int",
"$",
"node",
",",
"int",
"$",
"user",
")",
":",
"string",
"{",
"return",
"sprintf",
"(",
"'%04X'",
",",
"self",
"::",
"crc16",
"(",
"sprintf",
"(",
"'%04X%08X'",
",",
"$",
"node",
",",
"... | Generate checksum for account.
@param int $node node number
@param int $user account number in node
@return string | [
"Generate",
"checksum",
"for",
"account",
"."
] | b9a897219dfa60a316a29191dbeb836c5e1aa760 | https://github.com/adshares/ads-php-client/blob/b9a897219dfa60a316a29191dbeb836c5e1aa760/src/Util/AdsChecksumGenerator.php#L59-L62 |
222,321 | paulzi/yii2-materialized-path | MaterializedPathBehavior.php | MaterializedPathBehavior.getSiblings | public function getSiblings($andSelf = false)
{
$tableName = $this->owner->tableName();
$path = $this->getParentPath();
$like = strtr($path . $this->delimiter, ['%' => '\%', '_' => '\_', '\\' => '\\\\']);
$query = $this->owner->find()
->andWhere(['like', "{$tableName}.[[... | php | public function getSiblings($andSelf = false)
{
$tableName = $this->owner->tableName();
$path = $this->getParentPath();
$like = strtr($path . $this->delimiter, ['%' => '\%', '_' => '\_', '\\' => '\\\\']);
$query = $this->owner->find()
->andWhere(['like', "{$tableName}.[[... | [
"public",
"function",
"getSiblings",
"(",
"$",
"andSelf",
"=",
"false",
")",
"{",
"$",
"tableName",
"=",
"$",
"this",
"->",
"owner",
"->",
"tableName",
"(",
")",
";",
"$",
"path",
"=",
"$",
"this",
"->",
"getParentPath",
"(",
")",
";",
"$",
"like",
... | Returns all sibilings of node.
@param bool $andSelf = false Include self node into result.
@return \yii\db\ActiveQuery | [
"Returns",
"all",
"sibilings",
"of",
"node",
"."
] | ece0f8ec52a125522fd8b7d984119789e76e5cdc | https://github.com/paulzi/yii2-materialized-path/blob/ece0f8ec52a125522fd8b7d984119789e76e5cdc/MaterializedPathBehavior.php#L316-L342 |
222,322 | nabbar/SwaggerValidator-PHP | src/Common/Factory.php | Factory.getClass | private function getClass($type)
{
$collType = \SwaggerValidator\Common\CollectionType::getInstance();
$class = $collType->get($type);
if (empty($class)) {
$e = new \SwaggerValidator\Exception('Cannot retrieve the callable for this type : ' . $type);
$e->se... | php | private function getClass($type)
{
$collType = \SwaggerValidator\Common\CollectionType::getInstance();
$class = $collType->get($type);
if (empty($class)) {
$e = new \SwaggerValidator\Exception('Cannot retrieve the callable for this type : ' . $type);
$e->se... | [
"private",
"function",
"getClass",
"(",
"$",
"type",
")",
"{",
"$",
"collType",
"=",
"\\",
"SwaggerValidator",
"\\",
"Common",
"\\",
"CollectionType",
"::",
"getInstance",
"(",
")",
";",
"$",
"class",
"=",
"$",
"collType",
"->",
"get",
"(",
"$",
"type",
... | Check if the type is defined and return his callable string
@param callable $type
@throws Exception | [
"Check",
"if",
"the",
"type",
"is",
"defined",
"and",
"return",
"his",
"callable",
"string"
] | c3518c53beed71b653a98ea7d56bd12a580d5aa8 | https://github.com/nabbar/SwaggerValidator-PHP/blob/c3518c53beed71b653a98ea7d56bd12a580d5aa8/src/Common/Factory.php#L102-L115 |
222,323 | nabbar/SwaggerValidator-PHP | src/Common/Factory.php | Factory.invoke | public function invoke($type, $parameters = null)
{
$class = $this->getClass($type);
$name = $this->normalizeType($type);
$params = func_get_args();
array_shift($params);
$reflector = new \ReflectionClass($class);
$instance = $reflector->newInstanceArgs($... | php | public function invoke($type, $parameters = null)
{
$class = $this->getClass($type);
$name = $this->normalizeType($type);
$params = func_get_args();
array_shift($params);
$reflector = new \ReflectionClass($class);
$instance = $reflector->newInstanceArgs($... | [
"public",
"function",
"invoke",
"(",
"$",
"type",
",",
"$",
"parameters",
"=",
"null",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"getClass",
"(",
"$",
"type",
")",
";",
"$",
"name",
"=",
"$",
"this",
"->",
"normalizeType",
"(",
"$",
"type",
... | Start new instance of the object type
@param string $type the name of the object type for the new instance
@param type $parameters [optional] the parameters to the constructor
@return object
@throws Exception | [
"Start",
"new",
"instance",
"of",
"the",
"object",
"type"
] | c3518c53beed71b653a98ea7d56bd12a580d5aa8 | https://github.com/nabbar/SwaggerValidator-PHP/blob/c3518c53beed71b653a98ea7d56bd12a580d5aa8/src/Common/Factory.php#L144-L160 |
222,324 | nabbar/SwaggerValidator-PHP | src/Common/Factory.php | Factory.registerClosure | public function registerClosure($type, $object)
{
$class = $this->getClass($type);
$name = $this->normalizeType($type);
if (is_object($object) || ($object instanceof \Closure)) {
parent::__set($name, $object);
return true;
}
return false;
... | php | public function registerClosure($type, $object)
{
$class = $this->getClass($type);
$name = $this->normalizeType($type);
if (is_object($object) || ($object instanceof \Closure)) {
parent::__set($name, $object);
return true;
}
return false;
... | [
"public",
"function",
"registerClosure",
"(",
"$",
"type",
",",
"$",
"object",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"getClass",
"(",
"$",
"type",
")",
";",
"$",
"name",
"=",
"$",
"this",
"->",
"normalizeType",
"(",
"$",
"type",
")",
";",... | Register the base instance to be clone when a new instance is call
@param string $type
@param object|\Closure $object | [
"Register",
"the",
"base",
"instance",
"to",
"be",
"clone",
"when",
"a",
"new",
"instance",
"is",
"call"
] | c3518c53beed71b653a98ea7d56bd12a580d5aa8 | https://github.com/nabbar/SwaggerValidator-PHP/blob/c3518c53beed71b653a98ea7d56bd12a580d5aa8/src/Common/Factory.php#L202-L213 |
222,325 | nabbar/SwaggerValidator-PHP | src/Swagger.php | Swagger.setCachePath | public static function setCachePath($pathCacheFile)
{
self::$cacheEnable = false;
if (!empty($pathCacheFile) && file_exists($pathCacheFile)) {
self::$cacheEnable = true;
self::$cachePath = $pathCacheFile;
}
elseif (!empty($pathCacheFile) && !file_ex... | php | public static function setCachePath($pathCacheFile)
{
self::$cacheEnable = false;
if (!empty($pathCacheFile) && file_exists($pathCacheFile)) {
self::$cacheEnable = true;
self::$cachePath = $pathCacheFile;
}
elseif (!empty($pathCacheFile) && !file_ex... | [
"public",
"static",
"function",
"setCachePath",
"(",
"$",
"pathCacheFile",
")",
"{",
"self",
"::",
"$",
"cacheEnable",
"=",
"false",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"pathCacheFile",
")",
"&&",
"file_exists",
"(",
"$",
"pathCacheFile",
")",
")",
"... | Store the cache path and check if the file cache can enabled or not
@param string $pathCacheFile | [
"Store",
"the",
"cache",
"path",
"and",
"check",
"if",
"the",
"file",
"cache",
"can",
"enabled",
"or",
"not"
] | c3518c53beed71b653a98ea7d56bd12a580d5aa8 | https://github.com/nabbar/SwaggerValidator-PHP/blob/c3518c53beed71b653a98ea7d56bd12a580d5aa8/src/Swagger.php#L67-L84 |
222,326 | nabbar/SwaggerValidator-PHP | src/Swagger.php | Swagger.load | public static function load(\SwaggerValidator\Common\Context $context)
{
if (self::$cacheEnable !== true || !file_exists(self::$cachePath)) {
return self::regenSwagger($context);
}
if ((filemtime(self::$cachePath) + self::$cacheLifeTime) < time() && self::$cacheLifeTime > ... | php | public static function load(\SwaggerValidator\Common\Context $context)
{
if (self::$cacheEnable !== true || !file_exists(self::$cachePath)) {
return self::regenSwagger($context);
}
if ((filemtime(self::$cachePath) + self::$cacheLifeTime) < time() && self::$cacheLifeTime > ... | [
"public",
"static",
"function",
"load",
"(",
"\\",
"SwaggerValidator",
"\\",
"Common",
"\\",
"Context",
"$",
"context",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"cacheEnable",
"!==",
"true",
"||",
"!",
"file_exists",
"(",
"self",
"::",
"$",
"cachePath",
"... | Load the Swagger Object from the cache file or create a new
@param \SwaggerValidator\Common\Context $context
@return \SwaggerValidator\Object\Swagger | [
"Load",
"the",
"Swagger",
"Object",
"from",
"the",
"cache",
"file",
"or",
"create",
"a",
"new"
] | c3518c53beed71b653a98ea7d56bd12a580d5aa8 | https://github.com/nabbar/SwaggerValidator-PHP/blob/c3518c53beed71b653a98ea7d56bd12a580d5aa8/src/Swagger.php#L137-L148 |
222,327 | nabbar/SwaggerValidator-PHP | src/Swagger.php | Swagger.regenSwagger | protected static function regenSwagger(\SwaggerValidator\Common\Context $context)
{
$fileObj = \SwaggerValidator\Common\CollectionFile::getInstance()->get($context, self::$swaggerFile);
if (!is_object($fileObj) && ($fileObj instanceof \SwaggerValidator\Common\ReferenceFile)) {
$con... | php | protected static function regenSwagger(\SwaggerValidator\Common\Context $context)
{
$fileObj = \SwaggerValidator\Common\CollectionFile::getInstance()->get($context, self::$swaggerFile);
if (!is_object($fileObj) && ($fileObj instanceof \SwaggerValidator\Common\ReferenceFile)) {
$con... | [
"protected",
"static",
"function",
"regenSwagger",
"(",
"\\",
"SwaggerValidator",
"\\",
"Common",
"\\",
"Context",
"$",
"context",
")",
"{",
"$",
"fileObj",
"=",
"\\",
"SwaggerValidator",
"\\",
"Common",
"\\",
"CollectionFile",
"::",
"getInstance",
"(",
")",
"... | Return a Swagger Object new object
@param \SwaggerValidator\Common\Context $context
@return \SwaggerValidator\Object\Swagger | [
"Return",
"a",
"Swagger",
"Object",
"new",
"object"
] | c3518c53beed71b653a98ea7d56bd12a580d5aa8 | https://github.com/nabbar/SwaggerValidator-PHP/blob/c3518c53beed71b653a98ea7d56bd12a580d5aa8/src/Swagger.php#L155-L176 |
222,328 | nabbar/SwaggerValidator-PHP | src/Swagger.php | Swagger.loadCache | protected static function loadCache(\SwaggerValidator\Common\Context $context)
{
self::cleanInstances();
$swagger = include self::$cachePath;
if (!is_array($swagger)) {
$context->throwException('Cannot Load Cache file : ' . self::$cachePath, __METHOD__, __LINE__);
... | php | protected static function loadCache(\SwaggerValidator\Common\Context $context)
{
self::cleanInstances();
$swagger = include self::$cachePath;
if (!is_array($swagger)) {
$context->throwException('Cannot Load Cache file : ' . self::$cachePath, __METHOD__, __LINE__);
... | [
"protected",
"static",
"function",
"loadCache",
"(",
"\\",
"SwaggerValidator",
"\\",
"Common",
"\\",
"Context",
"$",
"context",
")",
"{",
"self",
"::",
"cleanInstances",
"(",
")",
";",
"$",
"swagger",
"=",
"include",
"self",
"::",
"$",
"cachePath",
";",
"i... | load cache file or call regen file cache
@param \SwaggerValidator\Common\Context $context
@return \SwaggerValidator\Object\Swagger | [
"load",
"cache",
"file",
"or",
"call",
"regen",
"file",
"cache"
] | c3518c53beed71b653a98ea7d56bd12a580d5aa8 | https://github.com/nabbar/SwaggerValidator-PHP/blob/c3518c53beed71b653a98ea7d56bd12a580d5aa8/src/Swagger.php#L183-L200 |
222,329 | nabbar/SwaggerValidator-PHP | src/Swagger.php | Swagger.storeCache | protected static function storeCache(\SwaggerValidator\Object\Swagger $swagger, \SwaggerValidator\Common\Context $context)
{
if (self::$cacheEnable !== true) {
return $swagger;
}
if (!file_exists(self::$cachePath) && !touch(self::$cachePath)) {
self::$cacheEna... | php | protected static function storeCache(\SwaggerValidator\Object\Swagger $swagger, \SwaggerValidator\Common\Context $context)
{
if (self::$cacheEnable !== true) {
return $swagger;
}
if (!file_exists(self::$cachePath) && !touch(self::$cachePath)) {
self::$cacheEna... | [
"protected",
"static",
"function",
"storeCache",
"(",
"\\",
"SwaggerValidator",
"\\",
"Object",
"\\",
"Swagger",
"$",
"swagger",
",",
"\\",
"SwaggerValidator",
"\\",
"Common",
"\\",
"Context",
"$",
"context",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"cacheEna... | store the new swagger object is available
@param \SwaggerValidator\Object\Swagger $swagger
@return \SwaggerValidator\Object\Swagger | [
"store",
"the",
"new",
"swagger",
"object",
"is",
"available"
] | c3518c53beed71b653a98ea7d56bd12a580d5aa8 | https://github.com/nabbar/SwaggerValidator-PHP/blob/c3518c53beed71b653a98ea7d56bd12a580d5aa8/src/Swagger.php#L207-L227 |
222,330 | mdmsoft/yii2-widgets | Column.php | Column.renderDataCell | public function renderDataCell($model, $key, $index)
{
if (is_callable($this->value)) {
$value = call_user_func($this->value, $model, $key, $index);
} else {
$value = $this->value;
}
if ($this->format !== null) {
$value = Yii::$app->getFormatter()-... | php | public function renderDataCell($model, $key, $index)
{
if (is_callable($this->value)) {
$value = call_user_func($this->value, $model, $key, $index);
} else {
$value = $this->value;
}
if ($this->format !== null) {
$value = Yii::$app->getFormatter()-... | [
"public",
"function",
"renderDataCell",
"(",
"$",
"model",
",",
"$",
"key",
",",
"$",
"index",
")",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"this",
"->",
"value",
")",
")",
"{",
"$",
"value",
"=",
"call_user_func",
"(",
"$",
"this",
"->",
"value",
... | Render data cell
@param Model $model model for cell
@param string $key
@param integer $index
@return string | [
"Render",
"data",
"cell"
] | 1ef3c4cd29ec54560c14def54f9961b6715069ea | https://github.com/mdmsoft/yii2-widgets/blob/1ef3c4cd29ec54560c14def54f9961b6715069ea/Column.php#L81-L92 |
222,331 | adshares/ads-php-client | src/Util/AdsConverter.php | AdsConverter.adsToClicks | public static function adsToClicks($amount): int
{
$amountAsString = (string)$amount;
if (strpos($amountAsString, '.') !== false) {
$ar = explode('.', $amountAsString);
$ar[1] = str_pad($ar[1], 11, '0');
$amountAsString = implode($ar);
} else {
... | php | public static function adsToClicks($amount): int
{
$amountAsString = (string)$amount;
if (strpos($amountAsString, '.') !== false) {
$ar = explode('.', $amountAsString);
$ar[1] = str_pad($ar[1], 11, '0');
$amountAsString = implode($ar);
} else {
... | [
"public",
"static",
"function",
"adsToClicks",
"(",
"$",
"amount",
")",
":",
"int",
"{",
"$",
"amountAsString",
"=",
"(",
"string",
")",
"$",
"amount",
";",
"if",
"(",
"strpos",
"(",
"$",
"amountAsString",
",",
"'.'",
")",
"!==",
"false",
")",
"{",
"... | Converts Ads to clicks.
@param mixed $amount
@return int | [
"Converts",
"Ads",
"to",
"clicks",
"."
] | b9a897219dfa60a316a29191dbeb836c5e1aa760 | https://github.com/adshares/ads-php-client/blob/b9a897219dfa60a316a29191dbeb836c5e1aa760/src/Util/AdsConverter.php#L36-L47 |
222,332 | adshares/ads-php-client | src/Util/AdsConverter.php | AdsConverter.clicksToAds | public static function clicksToAds($amount): string
{
$amountAsString = (string)$amount;
$isNegativeValue = false;
if ('-' === $amountAsString[0]) {
$isNegativeValue = true;
// cut minus sign from negative value
$amountAsString = substr($amountAsString, 1,... | php | public static function clicksToAds($amount): string
{
$amountAsString = (string)$amount;
$isNegativeValue = false;
if ('-' === $amountAsString[0]) {
$isNegativeValue = true;
// cut minus sign from negative value
$amountAsString = substr($amountAsString, 1,... | [
"public",
"static",
"function",
"clicksToAds",
"(",
"$",
"amount",
")",
":",
"string",
"{",
"$",
"amountAsString",
"=",
"(",
"string",
")",
"$",
"amount",
";",
"$",
"isNegativeValue",
"=",
"false",
";",
"if",
"(",
"'-'",
"===",
"$",
"amountAsString",
"["... | Converts clicks to Ads.
@param int $amount
@return string | [
"Converts",
"clicks",
"to",
"Ads",
"."
] | b9a897219dfa60a316a29191dbeb836c5e1aa760 | https://github.com/adshares/ads-php-client/blob/b9a897219dfa60a316a29191dbeb836c5e1aa760/src/Util/AdsConverter.php#L55-L73 |
222,333 | hprose/hprose-yii | src/Hprose/Yii/DiscoveryController.php | DiscoveryController.getActions | protected function getActions($controller)
{
$actions = array_keys($controller->actions());
$class = new \ReflectionClass($controller);
foreach ($class->getMethods() as $method) {
$name = $method->getName();
if ($name !== 'actions' && $method->isPublic() && !$method->... | php | protected function getActions($controller)
{
$actions = array_keys($controller->actions());
$class = new \ReflectionClass($controller);
foreach ($class->getMethods() as $method) {
$name = $method->getName();
if ($name !== 'actions' && $method->isPublic() && !$method->... | [
"protected",
"function",
"getActions",
"(",
"$",
"controller",
")",
"{",
"$",
"actions",
"=",
"array_keys",
"(",
"$",
"controller",
"->",
"actions",
"(",
")",
")",
";",
"$",
"class",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"controller",
")",
";",
... | Returns all available actions of the specified controller.
@param Controller $controller the controller instance
@return array all available action IDs. | [
"Returns",
"all",
"available",
"actions",
"of",
"the",
"specified",
"controller",
"."
] | 716059c5baafd98ccd9159321eb67acb197426bc | https://github.com/hprose/hprose-yii/blob/716059c5baafd98ccd9159321eb67acb197426bc/src/Hprose/Yii/DiscoveryController.php#L107-L120 |
222,334 | php-mock/php-mock-prophecy | classes/PHPProphet.php | PHPProphet.getProperty | private static function getProperty(Prophet $prophet, $property)
{
$reflection = new \ReflectionProperty($prophet, $property);
$reflection->setAccessible(true);
return $reflection->getValue($prophet);
} | php | private static function getProperty(Prophet $prophet, $property)
{
$reflection = new \ReflectionProperty($prophet, $property);
$reflection->setAccessible(true);
return $reflection->getValue($prophet);
} | [
"private",
"static",
"function",
"getProperty",
"(",
"Prophet",
"$",
"prophet",
",",
"$",
"property",
")",
"{",
"$",
"reflection",
"=",
"new",
"\\",
"ReflectionProperty",
"(",
"$",
"prophet",
",",
"$",
"property",
")",
";",
"$",
"reflection",
"->",
"setAcc... | Returns a private property of a prophet.
@param Prophet $prophet prophet
@param string $property property name
@return mixed property value of that prophet | [
"Returns",
"a",
"private",
"property",
"of",
"a",
"prophet",
"."
] | 8a0dce6deeb9190b8b62c57a236310dc910c078c | https://github.com/php-mock/php-mock-prophecy/blob/8a0dce6deeb9190b8b62c57a236310dc910c078c/classes/PHPProphet.php#L121-L126 |
222,335 | nabbar/SwaggerValidator-PHP | src/Common/CollectionType.php | CollectionType.registerCallable | public function registerCallable(\SwaggerValidator\Common\Context $context, $type, $callable)
{
if (!$this->__isset($type)) {
$context->throwException('Cannot find type : "' . $type . '" (Normalized : "' . $this->normalizeType($type) . '" ', __FILE__, __LINE__);
}
if (is_c... | php | public function registerCallable(\SwaggerValidator\Common\Context $context, $type, $callable)
{
if (!$this->__isset($type)) {
$context->throwException('Cannot find type : "' . $type . '" (Normalized : "' . $this->normalizeType($type) . '" ', __FILE__, __LINE__);
}
if (is_c... | [
"public",
"function",
"registerCallable",
"(",
"\\",
"SwaggerValidator",
"\\",
"Common",
"\\",
"Context",
"$",
"context",
",",
"$",
"type",
",",
"$",
"callable",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"__isset",
"(",
"$",
"type",
")",
")",
"{",
... | Replace the default callable string by the given for the type in parameters
@param string $type
@param callable $callable | [
"Replace",
"the",
"default",
"callable",
"string",
"by",
"the",
"given",
"for",
"the",
"type",
"in",
"parameters"
] | c3518c53beed71b653a98ea7d56bd12a580d5aa8 | https://github.com/nabbar/SwaggerValidator-PHP/blob/c3518c53beed71b653a98ea7d56bd12a580d5aa8/src/Common/CollectionType.php#L219-L242 |
222,336 | adshares/ads-php-client | src/Entity/AbstractEntity.php | AbstractEntity.toCamelCase | private static function toCamelCase(string $text): string
{
if (strpos($text, '_') !== false) {
$text = str_replace(' ', '', ucwords(str_replace('_', ' ', $text)));
}
$text[0] = strtolower($text[0]);
return $text;
} | php | private static function toCamelCase(string $text): string
{
if (strpos($text, '_') !== false) {
$text = str_replace(' ', '', ucwords(str_replace('_', ' ', $text)));
}
$text[0] = strtolower($text[0]);
return $text;
} | [
"private",
"static",
"function",
"toCamelCase",
"(",
"string",
"$",
"text",
")",
":",
"string",
"{",
"if",
"(",
"strpos",
"(",
"$",
"text",
",",
"'_'",
")",
"!==",
"false",
")",
"{",
"$",
"text",
"=",
"str_replace",
"(",
"' '",
",",
"''",
",",
"ucw... | Changes string with underscores to camelCase string. First letter is low.
@param string $text text to change case
@return string text in camelCase | [
"Changes",
"string",
"with",
"underscores",
"to",
"camelCase",
"string",
".",
"First",
"letter",
"is",
"low",
"."
] | b9a897219dfa60a316a29191dbeb836c5e1aa760 | https://github.com/adshares/ads-php-client/blob/b9a897219dfa60a316a29191dbeb836c5e1aa760/src/Entity/AbstractEntity.php#L36-L44 |
222,337 | LeaseWeb/LswGettextTranslationBundle | Routing/GettextLocaleListener.php | GettextLocaleListener.onKernelRequest | public function onKernelRequest(GetResponseEvent $event)
{
$currentLocale = $this->getCurrentLocale();
$requestedLocale = $this->getRequestedLocale();
if ($requestedLocale && $currentLocale != $requestedLocale) {
$request = $event->getRequest();
// ugly backwards compatibility f... | php | public function onKernelRequest(GetResponseEvent $event)
{
$currentLocale = $this->getCurrentLocale();
$requestedLocale = $this->getRequestedLocale();
if ($requestedLocale && $currentLocale != $requestedLocale) {
$request = $event->getRequest();
// ugly backwards compatibility f... | [
"public",
"function",
"onKernelRequest",
"(",
"GetResponseEvent",
"$",
"event",
")",
"{",
"$",
"currentLocale",
"=",
"$",
"this",
"->",
"getCurrentLocale",
"(",
")",
";",
"$",
"requestedLocale",
"=",
"$",
"this",
"->",
"getRequestedLocale",
"(",
")",
";",
"i... | Binds the default domain to the combined translations on Kernel Request
@param GetResponseEvent $event event
@throws InvalidParameterException | [
"Binds",
"the",
"default",
"domain",
"to",
"the",
"combined",
"translations",
"on",
"Kernel",
"Request"
] | 614003db44a0f498349f1ef779f44dc6323dcdb0 | https://github.com/LeaseWeb/LswGettextTranslationBundle/blob/614003db44a0f498349f1ef779f44dc6323dcdb0/Routing/GettextLocaleListener.php#L44-L64 |
222,338 | adshares/ads-php-client | src/Command/CreateAccountCommand.php | CreateAccountCommand.setAccountKey | public function setAccountKey(string $publicKey, string $confirm)
{
$this->publicKey = $publicKey;
$this->confirm = $confirm;
} | php | public function setAccountKey(string $publicKey, string $confirm)
{
$this->publicKey = $publicKey;
$this->confirm = $confirm;
} | [
"public",
"function",
"setAccountKey",
"(",
"string",
"$",
"publicKey",
",",
"string",
"$",
"confirm",
")",
"{",
"$",
"this",
"->",
"publicKey",
"=",
"$",
"publicKey",
";",
"$",
"this",
"->",
"confirm",
"=",
"$",
"confirm",
";",
"}"
] | Sets key of account.
@param string $publicKey Public key
@param string $confirm Signature of empty string generated using secret key | [
"Sets",
"key",
"of",
"account",
"."
] | b9a897219dfa60a316a29191dbeb836c5e1aa760 | https://github.com/adshares/ads-php-client/blob/b9a897219dfa60a316a29191dbeb836c5e1aa760/src/Command/CreateAccountCommand.php#L52-L56 |
222,339 | mdmsoft/yii2-widgets | TabularWidget.php | TabularWidget.getClientOptions | protected function getClientOptions()
{
$counter = count($this->allModels) ? max(array_keys($this->allModels)) + 1 : 0;
$clientOptions = $this->clientOptions;
$clientOptions['counter'] = $counter;
if (empty($clientOptions['itemSelector'])) {
throw new InvalidConfigExcept... | php | protected function getClientOptions()
{
$counter = count($this->allModels) ? max(array_keys($this->allModels)) + 1 : 0;
$clientOptions = $this->clientOptions;
$clientOptions['counter'] = $counter;
if (empty($clientOptions['itemSelector'])) {
throw new InvalidConfigExcept... | [
"protected",
"function",
"getClientOptions",
"(",
")",
"{",
"$",
"counter",
"=",
"count",
"(",
"$",
"this",
"->",
"allModels",
")",
"?",
"max",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"allModels",
")",
")",
"+",
"1",
":",
"0",
";",
"$",
"clientOpt... | Get client options
@return array | [
"Get",
"client",
"options"
] | 1ef3c4cd29ec54560c14def54f9961b6715069ea | https://github.com/mdmsoft/yii2-widgets/blob/1ef3c4cd29ec54560c14def54f9961b6715069ea/TabularWidget.php#L186-L227 |
222,340 | nabbar/SwaggerValidator-PHP | src/Common/CollectionSwagger.php | CollectionSwagger.checkMandatoryKey | public function checkMandatoryKey()
{
foreach ($this->mandatoryKeys as $key) {
if (!array_key_exists($key, $this)) {
return $key;
}
}
return true;
} | php | public function checkMandatoryKey()
{
foreach ($this->mandatoryKeys as $key) {
if (!array_key_exists($key, $this)) {
return $key;
}
}
return true;
} | [
"public",
"function",
"checkMandatoryKey",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"mandatoryKeys",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
")",
")",
"{",
"return",
"$",
"key",
";",... | Return true if all mandatory keys are defined or the missing key name
@return boolean|string | [
"Return",
"true",
"if",
"all",
"mandatory",
"keys",
"are",
"defined",
"or",
"the",
"missing",
"key",
"name"
] | c3518c53beed71b653a98ea7d56bd12a580d5aa8 | https://github.com/nabbar/SwaggerValidator-PHP/blob/c3518c53beed71b653a98ea7d56bd12a580d5aa8/src/Common/CollectionSwagger.php#L104-L113 |
222,341 | nabbar/SwaggerValidator-PHP | src/Common/CollectionSwagger.php | CollectionSwagger.checkJsonObject | protected function checkJsonObject(\SwaggerValidator\Common\Context $context, &$jsonData)
{
if (!is_object($jsonData)) {
$context->throwException('Mismatching type of JSON Data received', get_class($this) . '::' . __METHOD__, __LINE__);
}
if (!($jsonData instanceof \stdCla... | php | protected function checkJsonObject(\SwaggerValidator\Common\Context $context, &$jsonData)
{
if (!is_object($jsonData)) {
$context->throwException('Mismatching type of JSON Data received', get_class($this) . '::' . __METHOD__, __LINE__);
}
if (!($jsonData instanceof \stdCla... | [
"protected",
"function",
"checkJsonObject",
"(",
"\\",
"SwaggerValidator",
"\\",
"Common",
"\\",
"Context",
"$",
"context",
",",
"&",
"$",
"jsonData",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"jsonData",
")",
")",
"{",
"$",
"context",
"->",
"thro... | Check that entry JsonData is an object of stdClass
@param \stdClass $jsonData
@return boolean | [
"Check",
"that",
"entry",
"JsonData",
"is",
"an",
"object",
"of",
"stdClass"
] | c3518c53beed71b653a98ea7d56bd12a580d5aa8 | https://github.com/nabbar/SwaggerValidator-PHP/blob/c3518c53beed71b653a98ea7d56bd12a580d5aa8/src/Common/CollectionSwagger.php#L263-L274 |
222,342 | nabbar/SwaggerValidator-PHP | src/Common/CollectionSwagger.php | CollectionSwagger.checkJsonObjectOrArray | protected function checkJsonObjectOrArray(\SwaggerValidator\Common\Context $context, &$jsonData)
{
if (is_object($jsonData) && !($jsonData instanceof \stdClass)) {
$context->throwException('Mismatching type of JSON Data received', get_class($this) . '::' . __METHOD__, __LINE__);
}
... | php | protected function checkJsonObjectOrArray(\SwaggerValidator\Common\Context $context, &$jsonData)
{
if (is_object($jsonData) && !($jsonData instanceof \stdClass)) {
$context->throwException('Mismatching type of JSON Data received', get_class($this) . '::' . __METHOD__, __LINE__);
}
... | [
"protected",
"function",
"checkJsonObjectOrArray",
"(",
"\\",
"SwaggerValidator",
"\\",
"Common",
"\\",
"Context",
"$",
"context",
",",
"&",
"$",
"jsonData",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"jsonData",
")",
"&&",
"!",
"(",
"$",
"jsonData",
"ins... | Check that entry JsonData is an object of stdClass or an array
@param \stdClass $jsonData
@return boolean | [
"Check",
"that",
"entry",
"JsonData",
"is",
"an",
"object",
"of",
"stdClass",
"or",
"an",
"array"
] | c3518c53beed71b653a98ea7d56bd12a580d5aa8 | https://github.com/nabbar/SwaggerValidator-PHP/blob/c3518c53beed71b653a98ea7d56bd12a580d5aa8/src/Common/CollectionSwagger.php#L281-L295 |
222,343 | php-mock/php-mock-prophecy | classes/Revelation.php | Revelation.reveal | public function reveal()
{
$delegate = $this->prophecy->reveal();
$builder = new MockBuilder();
$builder->setNamespace($this->namespace)
->setName($this->functionName)
->setFunction([$delegate, MockDelegateFunctionBuilder::METHOD]);
$mock = $builder->... | php | public function reveal()
{
$delegate = $this->prophecy->reveal();
$builder = new MockBuilder();
$builder->setNamespace($this->namespace)
->setName($this->functionName)
->setFunction([$delegate, MockDelegateFunctionBuilder::METHOD]);
$mock = $builder->... | [
"public",
"function",
"reveal",
"(",
")",
"{",
"$",
"delegate",
"=",
"$",
"this",
"->",
"prophecy",
"->",
"reveal",
"(",
")",
";",
"$",
"builder",
"=",
"new",
"MockBuilder",
"(",
")",
";",
"$",
"builder",
"->",
"setNamespace",
"(",
"$",
"this",
"->",... | Reveals the function prophecy.
I.e. the prophesized function will become effective.
@return Mock enabled function mock | [
"Reveals",
"the",
"function",
"prophecy",
"."
] | 8a0dce6deeb9190b8b62c57a236310dc910c078c | https://github.com/php-mock/php-mock-prophecy/blob/8a0dce6deeb9190b8b62c57a236310dc910c078c/classes/Revelation.php#L56-L66 |
222,344 | mdmsoft/yii2-widgets | DataColumn.php | DataColumn.renderInputCell | public function renderInputCell($model, $key, $index)
{
$form = $this->grid->form;
$items = $this->items;
if ($this->widget !== null) {
if (is_array($this->widget)) {
list($widget, $options) = $this->widget;
if ($options instanceof \Closure) {
... | php | public function renderInputCell($model, $key, $index)
{
$form = $this->grid->form;
$items = $this->items;
if ($this->widget !== null) {
if (is_array($this->widget)) {
list($widget, $options) = $this->widget;
if ($options instanceof \Closure) {
... | [
"public",
"function",
"renderInputCell",
"(",
"$",
"model",
",",
"$",
"key",
",",
"$",
"index",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"grid",
"->",
"form",
";",
"$",
"items",
"=",
"$",
"this",
"->",
"items",
";",
"if",
"(",
"$",
"this",
... | Render input cell
@param Model $model model for cell
@param string $key
@param integer $index
@return string | [
"Render",
"input",
"cell"
] | 1ef3c4cd29ec54560c14def54f9961b6715069ea | https://github.com/mdmsoft/yii2-widgets/blob/1ef3c4cd29ec54560c14def54f9961b6715069ea/DataColumn.php#L88-L129 |
222,345 | LeaseWeb/LswGettextTranslationBundle | Command/AbstractCommand.php | AbstractCommand.findFilesInFolder | protected function findFilesInFolder($dir, $extension)
{
$templates = array();
if (is_dir($dir)) {
$finder = new Finder();
foreach ($finder->files()->followLinks()->in($dir)->exclude('cache')->name('*.' . $extension) as $file) {
$templates[] = $this->relative(... | php | protected function findFilesInFolder($dir, $extension)
{
$templates = array();
if (is_dir($dir)) {
$finder = new Finder();
foreach ($finder->files()->followLinks()->in($dir)->exclude('cache')->name('*.' . $extension) as $file) {
$templates[] = $this->relative(... | [
"protected",
"function",
"findFilesInFolder",
"(",
"$",
"dir",
",",
"$",
"extension",
")",
"{",
"$",
"templates",
"=",
"array",
"(",
")",
";",
"if",
"(",
"is_dir",
"(",
"$",
"dir",
")",
")",
"{",
"$",
"finder",
"=",
"new",
"Finder",
"(",
")",
";",
... | Search for files with specific extension
@param string $dir
@param string $extension
@return array | [
"Search",
"for",
"files",
"with",
"specific",
"extension"
] | 614003db44a0f498349f1ef779f44dc6323dcdb0 | https://github.com/LeaseWeb/LswGettextTranslationBundle/blob/614003db44a0f498349f1ef779f44dc6323dcdb0/Command/AbstractCommand.php#L34-L45 |
222,346 | LeaseWeb/LswGettextTranslationBundle | Command/AbstractCommand.php | AbstractCommand.relativePath | private function relativePath($from, $to, $ps = DIRECTORY_SEPARATOR)
{
$from = realpath($from);
$to = realpath($to);
$equalOffset = 0;
$minLength = min(strlen($from), strlen($to));
while ($equalOffset < $minLength && $from[$equalOffset] == $to[$equalOffset]) {
$... | php | private function relativePath($from, $to, $ps = DIRECTORY_SEPARATOR)
{
$from = realpath($from);
$to = realpath($to);
$equalOffset = 0;
$minLength = min(strlen($from), strlen($to));
while ($equalOffset < $minLength && $from[$equalOffset] == $to[$equalOffset]) {
$... | [
"private",
"function",
"relativePath",
"(",
"$",
"from",
",",
"$",
"to",
",",
"$",
"ps",
"=",
"DIRECTORY_SEPARATOR",
")",
"{",
"$",
"from",
"=",
"realpath",
"(",
"$",
"from",
")",
";",
"$",
"to",
"=",
"realpath",
"(",
"$",
"to",
")",
";",
"$",
"e... | Get relative path from file to directory
@param string $from
@param string $to
@param string $ps
@return string | [
"Get",
"relative",
"path",
"from",
"file",
"to",
"directory"
] | 614003db44a0f498349f1ef779f44dc6323dcdb0 | https://github.com/LeaseWeb/LswGettextTranslationBundle/blob/614003db44a0f498349f1ef779f44dc6323dcdb0/Command/AbstractCommand.php#L55-L71 |
222,347 | LeaseWeb/LswGettextTranslationBundle | Command/AbstractCommand.php | AbstractCommand.initializeFromTemplate | protected function initializeFromTemplate($template, $languages)
{
$results = array();
$target = dirname($template);
if (!file_exists($template)) {
throw new ResourceNotFoundException("Template not found in: $template\n\nRun 'app/console gettext:bundle:extract' first.");
... | php | protected function initializeFromTemplate($template, $languages)
{
$results = array();
$target = dirname($template);
if (!file_exists($template)) {
throw new ResourceNotFoundException("Template not found in: $template\n\nRun 'app/console gettext:bundle:extract' first.");
... | [
"protected",
"function",
"initializeFromTemplate",
"(",
"$",
"template",
",",
"$",
"languages",
")",
"{",
"$",
"results",
"=",
"array",
"(",
")",
";",
"$",
"target",
"=",
"dirname",
"(",
"$",
"template",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$... | Initialize .po file from template
@param string $template
@param string $languages
@return array
@throws ResourceNotFoundException | [
"Initialize",
".",
"po",
"file",
"from",
"template"
] | 614003db44a0f498349f1ef779f44dc6323dcdb0 | https://github.com/LeaseWeb/LswGettextTranslationBundle/blob/614003db44a0f498349f1ef779f44dc6323dcdb0/Command/AbstractCommand.php#L198-L227 |
222,348 | LeaseWeb/LswGettextTranslationBundle | Command/AbstractCommand.php | AbstractCommand.compile | protected function compile($file,$path)
{
$results = array();
// if .tmp file exists, clean it for further using it as cache
if (file_exists("$path.tmp")) {
unlink("$path.tmp");
}
$options = implode(' ',array(
'--check',
"-o $path.tmp",
... | php | protected function compile($file,$path)
{
$results = array();
// if .tmp file exists, clean it for further using it as cache
if (file_exists("$path.tmp")) {
unlink("$path.tmp");
}
$options = implode(' ',array(
'--check',
"-o $path.tmp",
... | [
"protected",
"function",
"compile",
"(",
"$",
"file",
",",
"$",
"path",
")",
"{",
"$",
"results",
"=",
"array",
"(",
")",
";",
"// if .tmp file exists, clean it for further using it as cache",
"if",
"(",
"file_exists",
"(",
"\"$path.tmp\"",
")",
")",
"{",
"unlin... | Compile message catalog to binary format
@param string $file
@param string $path
@return array
@throws \Exception | [
"Compile",
"message",
"catalog",
"to",
"binary",
"format"
] | 614003db44a0f498349f1ef779f44dc6323dcdb0 | https://github.com/LeaseWeb/LswGettextTranslationBundle/blob/614003db44a0f498349f1ef779f44dc6323dcdb0/Command/AbstractCommand.php#L285-L314 |
222,349 | middlewares/php-session | src/PhpSession.php | PhpSession.regenerateId | public function regenerateId(int $interval, string $key = 'session-id-expires'): self
{
$this->regenerateIdInterval = $interval;
$this->sessionIdExpiryKey = $key;
return $this;
} | php | public function regenerateId(int $interval, string $key = 'session-id-expires'): self
{
$this->regenerateIdInterval = $interval;
$this->sessionIdExpiryKey = $key;
return $this;
} | [
"public",
"function",
"regenerateId",
"(",
"int",
"$",
"interval",
",",
"string",
"$",
"key",
"=",
"'session-id-expires'",
")",
":",
"self",
"{",
"$",
"this",
"->",
"regenerateIdInterval",
"=",
"$",
"interval",
";",
"$",
"this",
"->",
"sessionIdExpiryKey",
"... | Set the session id regenerate interval and id expiry key name. | [
"Set",
"the",
"session",
"id",
"regenerate",
"interval",
"and",
"id",
"expiry",
"key",
"name",
"."
] | 1ab5c308f510c1ad99c17d517df7c50b178be760 | https://github.com/middlewares/php-session/blob/1ab5c308f510c1ad99c17d517df7c50b178be760/src/PhpSession.php#L72-L79 |
222,350 | middlewares/php-session | src/PhpSession.php | PhpSession.runIdRegeneration | private static function runIdRegeneration(int $interval = null, string $key = null)
{
if (empty($interval)) {
return;
}
$expiry = time() + $interval;
if (!isset($_SESSION[$key])) {
$_SESSION[$key] = $expiry;
}
if ($_SESSION[$key] < time() ||... | php | private static function runIdRegeneration(int $interval = null, string $key = null)
{
if (empty($interval)) {
return;
}
$expiry = time() + $interval;
if (!isset($_SESSION[$key])) {
$_SESSION[$key] = $expiry;
}
if ($_SESSION[$key] < time() ||... | [
"private",
"static",
"function",
"runIdRegeneration",
"(",
"int",
"$",
"interval",
"=",
"null",
",",
"string",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"interval",
")",
")",
"{",
"return",
";",
"}",
"$",
"expiry",
"=",
"time",... | Regenerate the session id if it's needed | [
"Regenerate",
"the",
"session",
"id",
"if",
"it",
"s",
"needed"
] | 1ab5c308f510c1ad99c17d517df7c50b178be760 | https://github.com/middlewares/php-session/blob/1ab5c308f510c1ad99c17d517df7c50b178be760/src/PhpSession.php#L144-L161 |
222,351 | wandersonwhcr/romans | src/Filter/IntToRoman.php | IntToRoman.filter | public function filter(int $value) : string
{
if ($value < 0) {
throw new Exception(sprintf('Invalid integer: %d', $value), Exception::INVALID_INTEGER);
}
$tokens = $this->getGrammar()->getTokens();
$values = array_reverse($this->getGrammar()->getValuesWithModifiers(), t... | php | public function filter(int $value) : string
{
if ($value < 0) {
throw new Exception(sprintf('Invalid integer: %d', $value), Exception::INVALID_INTEGER);
}
$tokens = $this->getGrammar()->getTokens();
$values = array_reverse($this->getGrammar()->getValuesWithModifiers(), t... | [
"public",
"function",
"filter",
"(",
"int",
"$",
"value",
")",
":",
"string",
"{",
"if",
"(",
"$",
"value",
"<",
"0",
")",
"{",
"throw",
"new",
"Exception",
"(",
"sprintf",
"(",
"'Invalid integer: %d'",
",",
"$",
"value",
")",
",",
"Exception",
"::",
... | Filter Integer to Roman Number
@param int Integer
@return string Roman Number Result | [
"Filter",
"Integer",
"to",
"Roman",
"Number"
] | cb076a6371abc6627a261157b856effc77784320 | https://github.com/wandersonwhcr/romans/blob/cb076a6371abc6627a261157b856effc77784320/src/Filter/IntToRoman.php#L35-L65 |
222,352 | doesntmattr/mongodb-migrations | src/AntiMattr/MongoDB/Migrations/AbstractMigration.php | AbstractMigration.warnIf | public function warnIf($condition, $message = '')
{
$message = (strlen($message)) ? $message : 'Unknown Reason';
if (true === $condition) {
$this->outputWriter->write(' <warning>Warning during ' . $this->version->getExecutionState() . ': ' . $message . '</warning>');
}
} | php | public function warnIf($condition, $message = '')
{
$message = (strlen($message)) ? $message : 'Unknown Reason';
if (true === $condition) {
$this->outputWriter->write(' <warning>Warning during ' . $this->version->getExecutionState() . ': ' . $message . '</warning>');
}
} | [
"public",
"function",
"warnIf",
"(",
"$",
"condition",
",",
"$",
"message",
"=",
"''",
")",
"{",
"$",
"message",
"=",
"(",
"strlen",
"(",
"$",
"message",
")",
")",
"?",
"$",
"message",
":",
"'Unknown Reason'",
";",
"if",
"(",
"true",
"===",
"$",
"c... | Print a warning message if the condition evalutes to TRUE.
@param bool $condition
@param string $message | [
"Print",
"a",
"warning",
"message",
"if",
"the",
"condition",
"evalutes",
"to",
"TRUE",
"."
] | 19ba9f04c1c346c6e17882840c209cfc4b000b93 | https://github.com/doesntmattr/mongodb-migrations/blob/19ba9f04c1c346c6e17882840c209cfc4b000b93/src/AntiMattr/MongoDB/Migrations/AbstractMigration.php#L102-L109 |
222,353 | doesntmattr/mongodb-migrations | src/AntiMattr/MongoDB/Migrations/AbstractMigration.php | AbstractMigration.abortIf | public function abortIf($condition, $message = '')
{
$message = (strlen($message)) ? $message : 'Unknown Reason';
if (true === $condition) {
throw new AbortException($message);
}
} | php | public function abortIf($condition, $message = '')
{
$message = (strlen($message)) ? $message : 'Unknown Reason';
if (true === $condition) {
throw new AbortException($message);
}
} | [
"public",
"function",
"abortIf",
"(",
"$",
"condition",
",",
"$",
"message",
"=",
"''",
")",
"{",
"$",
"message",
"=",
"(",
"strlen",
"(",
"$",
"message",
")",
")",
"?",
"$",
"message",
":",
"'Unknown Reason'",
";",
"if",
"(",
"true",
"===",
"$",
"... | Abort the migration if the condition evalutes to TRUE.
@param bool $condition
@param string $message
@throws AntiMattr\MongoDB\Migrations\Exception\AbortException | [
"Abort",
"the",
"migration",
"if",
"the",
"condition",
"evalutes",
"to",
"TRUE",
"."
] | 19ba9f04c1c346c6e17882840c209cfc4b000b93 | https://github.com/doesntmattr/mongodb-migrations/blob/19ba9f04c1c346c6e17882840c209cfc4b000b93/src/AntiMattr/MongoDB/Migrations/AbstractMigration.php#L119-L126 |
222,354 | idr0id/Papper | src/Papper/FluentSyntax/MappingFluentSyntax.php | MappingFluentSyntax.constructUsing | public function constructUsing($objectCreator)
{
if ($objectCreator instanceof \Closure) {
$objectCreator = new ClosureObjectCreator($objectCreator);
}
if (!$objectCreator instanceof ObjectCreatorInterface) {
throw new PapperConfigurationException('Argument objectCreator must be closure or instance of Papp... | php | public function constructUsing($objectCreator)
{
if ($objectCreator instanceof \Closure) {
$objectCreator = new ClosureObjectCreator($objectCreator);
}
if (!$objectCreator instanceof ObjectCreatorInterface) {
throw new PapperConfigurationException('Argument objectCreator must be closure or instance of Papp... | [
"public",
"function",
"constructUsing",
"(",
"$",
"objectCreator",
")",
"{",
"if",
"(",
"$",
"objectCreator",
"instanceof",
"\\",
"Closure",
")",
"{",
"$",
"objectCreator",
"=",
"new",
"ClosureObjectCreator",
"(",
"$",
"objectCreator",
")",
";",
"}",
"if",
"... | Supply a custom instantiation function for the destination type
@param ObjectCreatorInterface|\Closure $objectCreator Callback to create the destination type given the source object
@throws PapperConfigurationException
@return MappingFluentSyntax | [
"Supply",
"a",
"custom",
"instantiation",
"function",
"for",
"the",
"destination",
"type"
] | 53682bd058934027dbd4376abab93ac0cd06dffb | https://github.com/idr0id/Papper/blob/53682bd058934027dbd4376abab93ac0cd06dffb/src/Papper/FluentSyntax/MappingFluentSyntax.php#L38-L47 |
222,355 | idr0id/Papper | src/Papper/FluentSyntax/MappingFluentSyntax.php | MappingFluentSyntax.forMember | public function forMember($name, $memberOptions)
{
$propertyMap = $this->typeMap->getPropertyMap($name);
if ($propertyMap === null) {
throw new PapperConfigurationException(sprintf('Unable to find destination member %s on type %s', $name, $this->typeMap->getDestinationType()));
}
$memberOptions = is_array($... | php | public function forMember($name, $memberOptions)
{
$propertyMap = $this->typeMap->getPropertyMap($name);
if ($propertyMap === null) {
throw new PapperConfigurationException(sprintf('Unable to find destination member %s on type %s', $name, $this->typeMap->getDestinationType()));
}
$memberOptions = is_array($... | [
"public",
"function",
"forMember",
"(",
"$",
"name",
",",
"$",
"memberOptions",
")",
"{",
"$",
"propertyMap",
"=",
"$",
"this",
"->",
"typeMap",
"->",
"getPropertyMap",
"(",
"$",
"name",
")",
";",
"if",
"(",
"$",
"propertyMap",
"===",
"null",
")",
"{",... | Customize configuration for individual member
@param string $name Destination member name
@param MemberOptionInterface|MemberOptionInterface[] $memberOptions Member option
@throws PapperConfigurationException
@return MappingFluentSyntax | [
"Customize",
"configuration",
"for",
"individual",
"member"
] | 53682bd058934027dbd4376abab93ac0cd06dffb | https://github.com/idr0id/Papper/blob/53682bd058934027dbd4376abab93ac0cd06dffb/src/Papper/FluentSyntax/MappingFluentSyntax.php#L57-L71 |
222,356 | idr0id/Papper | src/Papper/FluentSyntax/MappingFluentSyntax.php | MappingFluentSyntax.forDynamicMember | public function forDynamicMember($name, $memberOptions = null)
{
$propertyMap = $this->typeMap->getPropertyMap($name);
if ($propertyMap !== null) {
throw new PapperConfigurationException(sprintf('Unable to create dynamic destination member %s on type %s because it already exists in type', $name, $this->typeMap-... | php | public function forDynamicMember($name, $memberOptions = null)
{
$propertyMap = $this->typeMap->getPropertyMap($name);
if ($propertyMap !== null) {
throw new PapperConfigurationException(sprintf('Unable to create dynamic destination member %s on type %s because it already exists in type', $name, $this->typeMap-... | [
"public",
"function",
"forDynamicMember",
"(",
"$",
"name",
",",
"$",
"memberOptions",
"=",
"null",
")",
"{",
"$",
"propertyMap",
"=",
"$",
"this",
"->",
"typeMap",
"->",
"getPropertyMap",
"(",
"$",
"name",
")",
";",
"if",
"(",
"$",
"propertyMap",
"!==",... | Create configuration for individual dynamic member
@param string $name Destination member name
@param MemberOptionInterface|MemberOptionInterface[] $memberOptions Member option
@throws PapperConfigurationException
@return MappingFluentSyntax | [
"Create",
"configuration",
"for",
"individual",
"dynamic",
"member"
] | 53682bd058934027dbd4376abab93ac0cd06dffb | https://github.com/idr0id/Papper/blob/53682bd058934027dbd4376abab93ac0cd06dffb/src/Papper/FluentSyntax/MappingFluentSyntax.php#L81-L102 |
222,357 | wandersonwhcr/romans | src/Parser/Automaton.php | Automaton.addTokenValue | protected function addTokenValue(string $token, string $modifier = null, int $quantity = 1) : self
{
$tokens = array_flip($this->getGrammar()->getTokens());
$values = $this->getGrammar()->getValuesWithModifiers();
$elements = [];
if (isset($modifier)) {
$elements[] =... | php | protected function addTokenValue(string $token, string $modifier = null, int $quantity = 1) : self
{
$tokens = array_flip($this->getGrammar()->getTokens());
$values = $this->getGrammar()->getValuesWithModifiers();
$elements = [];
if (isset($modifier)) {
$elements[] =... | [
"protected",
"function",
"addTokenValue",
"(",
"string",
"$",
"token",
",",
"string",
"$",
"modifier",
"=",
"null",
",",
"int",
"$",
"quantity",
"=",
"1",
")",
":",
"self",
"{",
"$",
"tokens",
"=",
"array_flip",
"(",
"$",
"this",
"->",
"getGrammar",
"(... | Add Token Value
@param string $token Token
@param string $modifier Modifier Token
@param int $quantity Quantity
@return self Fluent Interface | [
"Add",
"Token",
"Value"
] | cb076a6371abc6627a261157b856effc77784320 | https://github.com/wandersonwhcr/romans/blob/cb076a6371abc6627a261157b856effc77784320/src/Parser/Automaton.php#L165-L180 |
222,358 | wandersonwhcr/romans | src/Parser/Automaton.php | Automaton.doTransitionFromY | private function doTransitionFromY() : self
{
if ($this->getToken() !== '$') {
throw (new Exception('Invalid Roman', Exception::INVALID_ROMAN))
->setPosition($this->getPosition())
->setToken($this->getToken());
}
// done!
$this->setState(s... | php | private function doTransitionFromY() : self
{
if ($this->getToken() !== '$') {
throw (new Exception('Invalid Roman', Exception::INVALID_ROMAN))
->setPosition($this->getPosition())
->setToken($this->getToken());
}
// done!
$this->setState(s... | [
"private",
"function",
"doTransitionFromY",
"(",
")",
":",
"self",
"{",
"if",
"(",
"$",
"this",
"->",
"getToken",
"(",
")",
"!==",
"'$'",
")",
"{",
"throw",
"(",
"new",
"Exception",
"(",
"'Invalid Roman'",
",",
"Exception",
"::",
"INVALID_ROMAN",
")",
")... | Do Transition from Y
@return self Fluent Interface | [
"Do",
"Transition",
"from",
"Y"
] | cb076a6371abc6627a261157b856effc77784320 | https://github.com/wandersonwhcr/romans/blob/cb076a6371abc6627a261157b856effc77784320/src/Parser/Automaton.php#L246-L257 |
222,359 | wandersonwhcr/romans | src/Parser/Automaton.php | Automaton.doTransitionFromG | private function doTransitionFromG() : self
{
if ($this->getToken() === Grammar::T_N) {
$this
->setState(self::STATE_Y)
->addPosition(1);
return $this;
}
if ($this->getToken() === Grammar::T_M) {
$this
->set... | php | private function doTransitionFromG() : self
{
if ($this->getToken() === Grammar::T_N) {
$this
->setState(self::STATE_Y)
->addPosition(1);
return $this;
}
if ($this->getToken() === Grammar::T_M) {
$this
->set... | [
"private",
"function",
"doTransitionFromG",
"(",
")",
":",
"self",
"{",
"if",
"(",
"$",
"this",
"->",
"getToken",
"(",
")",
"===",
"Grammar",
"::",
"T_N",
")",
"{",
"$",
"this",
"->",
"setState",
"(",
"self",
"::",
"STATE_Y",
")",
"->",
"addPosition",
... | Do Transition from G
@return self Fluent Interface | [
"Do",
"Transition",
"from",
"G"
] | cb076a6371abc6627a261157b856effc77784320 | https://github.com/wandersonwhcr/romans/blob/cb076a6371abc6627a261157b856effc77784320/src/Parser/Automaton.php#L264-L283 |
222,360 | wandersonwhcr/romans | src/Parser/Automaton.php | Automaton.doTransitionFromF | private function doTransitionFromF() : self
{
if ($this->getToken() === Grammar::T_D) {
$this
->setState(self::STATE_E)
->addPosition(1)
->addTokenValue(Grammar::T_D);
return $this;
}
if ($this->getToken() === Grammar::... | php | private function doTransitionFromF() : self
{
if ($this->getToken() === Grammar::T_D) {
$this
->setState(self::STATE_E)
->addPosition(1)
->addTokenValue(Grammar::T_D);
return $this;
}
if ($this->getToken() === Grammar::... | [
"private",
"function",
"doTransitionFromF",
"(",
")",
":",
"self",
"{",
"if",
"(",
"$",
"this",
"->",
"getToken",
"(",
")",
"===",
"Grammar",
"::",
"T_D",
")",
"{",
"$",
"this",
"->",
"setState",
"(",
"self",
"::",
"STATE_E",
")",
"->",
"addPosition",
... | Do Transition from F
@return self Fluent Interface | [
"Do",
"Transition",
"from",
"F"
] | cb076a6371abc6627a261157b856effc77784320 | https://github.com/wandersonwhcr/romans/blob/cb076a6371abc6627a261157b856effc77784320/src/Parser/Automaton.php#L290-L318 |
222,361 | wandersonwhcr/romans | src/Parser/Automaton.php | Automaton.doTransitionFromE | private function doTransitionFromE() : self
{
if ($this->getToken() === Grammar::T_C) {
if ($this->hasToken(1) && $this->getToken(1) === Grammar::T_C) {
if ($this->hasToken(2) && $this->getToken(2) === Grammar::T_C) {
$this
->setState(s... | php | private function doTransitionFromE() : self
{
if ($this->getToken() === Grammar::T_C) {
if ($this->hasToken(1) && $this->getToken(1) === Grammar::T_C) {
if ($this->hasToken(2) && $this->getToken(2) === Grammar::T_C) {
$this
->setState(s... | [
"private",
"function",
"doTransitionFromE",
"(",
")",
":",
"self",
"{",
"if",
"(",
"$",
"this",
"->",
"getToken",
"(",
")",
"===",
"Grammar",
"::",
"T_C",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasToken",
"(",
"1",
")",
"&&",
"$",
"this",
"->",
... | Do Transition from E
@return self Fluent Interface | [
"Do",
"Transition",
"from",
"E"
] | cb076a6371abc6627a261157b856effc77784320 | https://github.com/wandersonwhcr/romans/blob/cb076a6371abc6627a261157b856effc77784320/src/Parser/Automaton.php#L325-L353 |
222,362 | wandersonwhcr/romans | src/Parser/Automaton.php | Automaton.doTransitionFromD | private function doTransitionFromD() : self
{
if ($this->getToken() === Grammar::T_L) {
$this
->setState(self::STATE_C)
->addPosition(1)
->addTokenValue(Grammar::T_L);
return $this;
}
if ($this->getToken() === Grammar::... | php | private function doTransitionFromD() : self
{
if ($this->getToken() === Grammar::T_L) {
$this
->setState(self::STATE_C)
->addPosition(1)
->addTokenValue(Grammar::T_L);
return $this;
}
if ($this->getToken() === Grammar::... | [
"private",
"function",
"doTransitionFromD",
"(",
")",
":",
"self",
"{",
"if",
"(",
"$",
"this",
"->",
"getToken",
"(",
")",
"===",
"Grammar",
"::",
"T_L",
")",
"{",
"$",
"this",
"->",
"setState",
"(",
"self",
"::",
"STATE_C",
")",
"->",
"addPosition",
... | Do Transition from D
@return self Fluent Interface | [
"Do",
"Transition",
"from",
"D"
] | cb076a6371abc6627a261157b856effc77784320 | https://github.com/wandersonwhcr/romans/blob/cb076a6371abc6627a261157b856effc77784320/src/Parser/Automaton.php#L360-L388 |
222,363 | wandersonwhcr/romans | src/Parser/Automaton.php | Automaton.doTransitionFromC | private function doTransitionFromC() : self
{
if ($this->getToken() === Grammar::T_X) {
if ($this->hasToken(1) && $this->getToken(1) === Grammar::T_X) {
if ($this->hasToken(2) && $this->getToken(2) === Grammar::T_X) {
$this
->setState(s... | php | private function doTransitionFromC() : self
{
if ($this->getToken() === Grammar::T_X) {
if ($this->hasToken(1) && $this->getToken(1) === Grammar::T_X) {
if ($this->hasToken(2) && $this->getToken(2) === Grammar::T_X) {
$this
->setState(s... | [
"private",
"function",
"doTransitionFromC",
"(",
")",
":",
"self",
"{",
"if",
"(",
"$",
"this",
"->",
"getToken",
"(",
")",
"===",
"Grammar",
"::",
"T_X",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasToken",
"(",
"1",
")",
"&&",
"$",
"this",
"->",
... | Do Transition from C
@return self Fluent Interface | [
"Do",
"Transition",
"from",
"C"
] | cb076a6371abc6627a261157b856effc77784320 | https://github.com/wandersonwhcr/romans/blob/cb076a6371abc6627a261157b856effc77784320/src/Parser/Automaton.php#L395-L423 |
222,364 | wandersonwhcr/romans | src/Parser/Automaton.php | Automaton.doTransitionFromB | private function doTransitionFromB() : self
{
if ($this->getToken() === Grammar::T_V) {
$this
->setState(self::STATE_A)
->addPosition(1)
->addTokenValue(Grammar::T_V);
return $this;
}
if ($this->getToken() === Grammar::... | php | private function doTransitionFromB() : self
{
if ($this->getToken() === Grammar::T_V) {
$this
->setState(self::STATE_A)
->addPosition(1)
->addTokenValue(Grammar::T_V);
return $this;
}
if ($this->getToken() === Grammar::... | [
"private",
"function",
"doTransitionFromB",
"(",
")",
":",
"self",
"{",
"if",
"(",
"$",
"this",
"->",
"getToken",
"(",
")",
"===",
"Grammar",
"::",
"T_V",
")",
"{",
"$",
"this",
"->",
"setState",
"(",
"self",
"::",
"STATE_A",
")",
"->",
"addPosition",
... | Do Transition from B
@return self Fluent Interface | [
"Do",
"Transition",
"from",
"B"
] | cb076a6371abc6627a261157b856effc77784320 | https://github.com/wandersonwhcr/romans/blob/cb076a6371abc6627a261157b856effc77784320/src/Parser/Automaton.php#L430-L458 |
222,365 | wandersonwhcr/romans | src/Parser/Automaton.php | Automaton.doTransitionFromA | private function doTransitionFromA() : self
{
if ($this->getToken() === Grammar::T_I) {
if ($this->hasToken(1) && $this->getToken(1) === Grammar::T_I) {
if ($this->hasToken(2) && $this->getToken(2) === Grammar::T_I) {
$this
->setState(s... | php | private function doTransitionFromA() : self
{
if ($this->getToken() === Grammar::T_I) {
if ($this->hasToken(1) && $this->getToken(1) === Grammar::T_I) {
if ($this->hasToken(2) && $this->getToken(2) === Grammar::T_I) {
$this
->setState(s... | [
"private",
"function",
"doTransitionFromA",
"(",
")",
":",
"self",
"{",
"if",
"(",
"$",
"this",
"->",
"getToken",
"(",
")",
"===",
"Grammar",
"::",
"T_I",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasToken",
"(",
"1",
")",
"&&",
"$",
"this",
"->",
... | Do Transition From A
@return self Fluent Interface | [
"Do",
"Transition",
"From",
"A"
] | cb076a6371abc6627a261157b856effc77784320 | https://github.com/wandersonwhcr/romans/blob/cb076a6371abc6627a261157b856effc77784320/src/Parser/Automaton.php#L465-L493 |
222,366 | doesntmattr/mongodb-migrations | src/AntiMattr/MongoDB/Migrations/Configuration/ConfigurationBuilder.php | ConfigurationBuilder.getDirectoryRelativeToFile | protected function getDirectoryRelativeToFile(string $configFile, ?string $directory = null): ?string
{
if (!$directory) {
return null;
}
$path = realpath(dirname($configFile) . '/' . $directory);
if (false !== $path) {
return $path;
}
retur... | php | protected function getDirectoryRelativeToFile(string $configFile, ?string $directory = null): ?string
{
if (!$directory) {
return null;
}
$path = realpath(dirname($configFile) . '/' . $directory);
if (false !== $path) {
return $path;
}
retur... | [
"protected",
"function",
"getDirectoryRelativeToFile",
"(",
"string",
"$",
"configFile",
",",
"?",
"string",
"$",
"directory",
"=",
"null",
")",
":",
"?",
"string",
"{",
"if",
"(",
"!",
"$",
"directory",
")",
"{",
"return",
"null",
";",
"}",
"$",
"path",... | Get the path to the directory relative to the config file.
@param string $configFile
@param string|null $directory
@return string|null | [
"Get",
"the",
"path",
"to",
"the",
"directory",
"relative",
"to",
"the",
"config",
"file",
"."
] | 19ba9f04c1c346c6e17882840c209cfc4b000b93 | https://github.com/doesntmattr/mongodb-migrations/blob/19ba9f04c1c346c6e17882840c209cfc4b000b93/src/AntiMattr/MongoDB/Migrations/Configuration/ConfigurationBuilder.php#L234-L247 |
222,367 | idr0id/Papper | src/Papper/Engine.php | Engine.execute | public function execute(MappingContext $context)
{
$typeMap = $this->config->findTypeMap($context->getSourceType(), $context->getDestinationType());
try {
$typeMap->validate();
$mapFunc = $typeMap->getMapFunc();
$destination = is_array($context->getSource())
? $this->mapCollection($context, $mapFunc... | php | public function execute(MappingContext $context)
{
$typeMap = $this->config->findTypeMap($context->getSourceType(), $context->getDestinationType());
try {
$typeMap->validate();
$mapFunc = $typeMap->getMapFunc();
$destination = is_array($context->getSource())
? $this->mapCollection($context, $mapFunc... | [
"public",
"function",
"execute",
"(",
"MappingContext",
"$",
"context",
")",
"{",
"$",
"typeMap",
"=",
"$",
"this",
"->",
"config",
"->",
"findTypeMap",
"(",
"$",
"context",
"->",
"getSourceType",
"(",
")",
",",
"$",
"context",
"->",
"getDestinationType",
... | Execute a mapping using MappingContext
@param MappingContext $context Mapping context
@return object|object[] Mapped destination object or collection
@throws MappingException
@throws ClassNotFoundException | [
"Execute",
"a",
"mapping",
"using",
"MappingContext"
] | 53682bd058934027dbd4376abab93ac0cd06dffb | https://github.com/idr0id/Papper/blob/53682bd058934027dbd4376abab93ac0cd06dffb/src/Papper/Engine.php#L81-L97 |
222,368 | idr0id/Papper | src/Papper/Engine.php | Engine.validate | public function validate()
{
$errors = array();
foreach ($this->config->getAllTypeMaps() as $typeMap) {
try {
$typeMap->validate();
} catch (\Exception $e) {
$errors[] = $e->getMessage();
}
}
if (!empty($errors)) {
throw new ValidationException(implode("\n\n", $errors));
}
} | php | public function validate()
{
$errors = array();
foreach ($this->config->getAllTypeMaps() as $typeMap) {
try {
$typeMap->validate();
} catch (\Exception $e) {
$errors[] = $e->getMessage();
}
}
if (!empty($errors)) {
throw new ValidationException(implode("\n\n", $errors));
}
} | [
"public",
"function",
"validate",
"(",
")",
"{",
"$",
"errors",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"config",
"->",
"getAllTypeMaps",
"(",
")",
"as",
"$",
"typeMap",
")",
"{",
"try",
"{",
"$",
"typeMap",
"->",
"validate",
... | Validates that every top level destination property is mapped to source property.
If not, a ConfigurationException is thrown detailing any missing mappings.
@throws ValidationException if any TypeMaps contain unmapped properties | [
"Validates",
"that",
"every",
"top",
"level",
"destination",
"property",
"is",
"mapped",
"to",
"source",
"property",
".",
"If",
"not",
"a",
"ConfigurationException",
"is",
"thrown",
"detailing",
"any",
"missing",
"mappings",
"."
] | 53682bd058934027dbd4376abab93ac0cd06dffb | https://github.com/idr0id/Papper/blob/53682bd058934027dbd4376abab93ac0cd06dffb/src/Papper/Engine.php#L105-L119 |
222,369 | wandersonwhcr/romans | src/Grammar/Grammar.php | Grammar.getValuesWithModifiers | public function getValuesWithModifiers()
{
$values = array_map(function ($value) {
return [$value];
}, array_flip($this->getValues()));
$valuesWithModifiers = $values + $this->getModifiers(); // merge and keep keys (append)
ksort($valuesWithModifiers);
return $... | php | public function getValuesWithModifiers()
{
$values = array_map(function ($value) {
return [$value];
}, array_flip($this->getValues()));
$valuesWithModifiers = $values + $this->getModifiers(); // merge and keep keys (append)
ksort($valuesWithModifiers);
return $... | [
"public",
"function",
"getValuesWithModifiers",
"(",
")",
"{",
"$",
"values",
"=",
"array_map",
"(",
"function",
"(",
"$",
"value",
")",
"{",
"return",
"[",
"$",
"value",
"]",
";",
"}",
",",
"array_flip",
"(",
"$",
"this",
"->",
"getValues",
"(",
")",
... | Get Values with Modifiers
@return array Values with Modifiers Available | [
"Get",
"Values",
"with",
"Modifiers"
] | cb076a6371abc6627a261157b856effc77784320 | https://github.com/wandersonwhcr/romans/blob/cb076a6371abc6627a261157b856effc77784320/src/Grammar/Grammar.php#L79-L90 |
222,370 | doesntmattr/mongodb-migrations | src/AntiMattr/MongoDB/Migrations/Version.php | Version.execute | public function execute($direction, $replay = false)
{
if ('down' === $direction && $replay) {
throw new AbortException(
'Cannot run \'down\' and replay it. Use replay with \'up\''
);
}
try {
$start = microtime(true);
$this->s... | php | public function execute($direction, $replay = false)
{
if ('down' === $direction && $replay) {
throw new AbortException(
'Cannot run \'down\' and replay it. Use replay with \'up\''
);
}
try {
$start = microtime(true);
$this->s... | [
"public",
"function",
"execute",
"(",
"$",
"direction",
",",
"$",
"replay",
"=",
"false",
")",
"{",
"if",
"(",
"'down'",
"===",
"$",
"direction",
"&&",
"$",
"replay",
")",
"{",
"throw",
"new",
"AbortException",
"(",
"'Cannot run \\'down\\' and replay it. Use r... | Execute this migration version up or down.
@param string $direction The direction to execute the migration
@param bool $replay If the migration is being replayed
@throws \Exception when migration fails | [
"Execute",
"this",
"migration",
"version",
"up",
"or",
"down",
"."
] | 19ba9f04c1c346c6e17882840c209cfc4b000b93 | https://github.com/doesntmattr/mongodb-migrations/blob/19ba9f04c1c346c6e17882840c209cfc4b000b93/src/AntiMattr/MongoDB/Migrations/Version.php#L182-L249 |
222,371 | php-fig/cache-util | src/KeyValidatorTrait.php | KeyValidatorTrait.validateKey | protected function validateKey($key)
{
if (!is_string($key) || $key === '') {
throw new InvalidArgumentException('Key should be a non empty string');
}
$unsupportedMatched = preg_match('#[' . preg_quote($this->getReservedKeyCharacters()) . ']#', $key);
if ($unsupportedMa... | php | protected function validateKey($key)
{
if (!is_string($key) || $key === '') {
throw new InvalidArgumentException('Key should be a non empty string');
}
$unsupportedMatched = preg_match('#[' . preg_quote($this->getReservedKeyCharacters()) . ']#', $key);
if ($unsupportedMa... | [
"protected",
"function",
"validateKey",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"key",
")",
"||",
"$",
"key",
"===",
"''",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Key should be a non empty string'",
")",
";",
... | Determines if the specified key is legal under PSR-6.
@param string $key
The key to validate.
@throws InvalidArgumentException
An exception implementing The Cache InvalidArgumentException interface
will be thrown if the key does not validate.
@return bool
TRUE if the specified key is legal. | [
"Determines",
"if",
"the",
"specified",
"key",
"is",
"legal",
"under",
"PSR",
"-",
"6",
"."
] | 771adf39e9a09325b8c20f35f3d2bdafcb78ac8c | https://github.com/php-fig/cache-util/blob/771adf39e9a09325b8c20f35f3d2bdafcb78ac8c/src/KeyValidatorTrait.php#L34-L46 |
222,372 | idr0id/Papper | src/Papper/FluentSyntax/ExecuteMappingFluentSyntax.php | ExecuteMappingFluentSyntax.to | public function to($destination, $destinationType = null)
{
$this->context->setDestination($destination, $destinationType);
return $this->engine->execute($this->context);
} | php | public function to($destination, $destinationType = null)
{
$this->context->setDestination($destination, $destinationType);
return $this->engine->execute($this->context);
} | [
"public",
"function",
"to",
"(",
"$",
"destination",
",",
"$",
"destinationType",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"context",
"->",
"setDestination",
"(",
"$",
"destination",
",",
"$",
"destinationType",
")",
";",
"return",
"$",
"this",
"->",
"e... | Execute a mapping to the existing destination object.
If no Map exists then one is created.
@param object|object[] $destination Destination object or collection to map into
@param string|null $destinationType Destination type to map
@return object|object[] The mapped destination object, same instance as the $destinati... | [
"Execute",
"a",
"mapping",
"to",
"the",
"existing",
"destination",
"object",
".",
"If",
"no",
"Map",
"exists",
"then",
"one",
"is",
"created",
"."
] | 53682bd058934027dbd4376abab93ac0cd06dffb | https://github.com/idr0id/Papper/blob/53682bd058934027dbd4376abab93ac0cd06dffb/src/Papper/FluentSyntax/ExecuteMappingFluentSyntax.php#L37-L41 |
222,373 | idr0id/Papper | src/Papper/FluentSyntax/ExecuteMappingFluentSyntax.php | ExecuteMappingFluentSyntax.toType | public function toType($destinationType)
{
$this->context->setDestination(null, $destinationType);
return $this->engine->execute($this->context);
} | php | public function toType($destinationType)
{
$this->context->setDestination(null, $destinationType);
return $this->engine->execute($this->context);
} | [
"public",
"function",
"toType",
"(",
"$",
"destinationType",
")",
"{",
"$",
"this",
"->",
"context",
"->",
"setDestination",
"(",
"null",
",",
"$",
"destinationType",
")",
";",
"return",
"$",
"this",
"->",
"engine",
"->",
"execute",
"(",
"$",
"this",
"->... | Execute a mapping to a new destination object.
If no Map exists then one is created.
@param string $destinationType Destination type to create and map
@return object|object[]
@throws NotSupportedException
@throws MappingException | [
"Execute",
"a",
"mapping",
"to",
"a",
"new",
"destination",
"object",
".",
"If",
"no",
"Map",
"exists",
"then",
"one",
"is",
"created",
"."
] | 53682bd058934027dbd4376abab93ac0cd06dffb | https://github.com/idr0id/Papper/blob/53682bd058934027dbd4376abab93ac0cd06dffb/src/Papper/FluentSyntax/ExecuteMappingFluentSyntax.php#L52-L56 |
222,374 | doesntmattr/mongodb-migrations | src/AntiMattr/MongoDB/Migrations/Migration.php | Migration.migrate | public function migrate($to = null)
{
if (null === $to) {
$to = $this->configuration->getLatestVersion();
}
$from = $this->configuration->getCurrentVersion();
$from = (string) $from;
$to = (string) $to;
$migrations = $this->configuration->getMigrations()... | php | public function migrate($to = null)
{
if (null === $to) {
$to = $this->configuration->getLatestVersion();
}
$from = $this->configuration->getCurrentVersion();
$from = (string) $from;
$to = (string) $to;
$migrations = $this->configuration->getMigrations()... | [
"public",
"function",
"migrate",
"(",
"$",
"to",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"to",
")",
"{",
"$",
"to",
"=",
"$",
"this",
"->",
"configuration",
"->",
"getLatestVersion",
"(",
")",
";",
"}",
"$",
"from",
"=",
"$",
"this"... | Run a migration to the current version or the given target version.
@param string $to The version to migrate to
@throws AntiMattr\MongoDB\Migrations\Exception\UnknownVersionException
@throws AntiMattr\MongoDB\Migrations\Exception\NoMigrationsToExecuteException | [
"Run",
"a",
"migration",
"to",
"the",
"current",
"version",
"or",
"the",
"given",
"target",
"version",
"."
] | 19ba9f04c1c346c6e17882840c209cfc4b000b93 | https://github.com/doesntmattr/mongodb-migrations/blob/19ba9f04c1c346c6e17882840c209cfc4b000b93/src/AntiMattr/MongoDB/Migrations/Migration.php#L54-L91 |
222,375 | rezaei121/yii2-jcrop | src/Jcrop.php | Jcrop.registerTranslations | public static function registerTranslations()
{
if (!isset(Yii::$app->i18n->translations['jcrop']) && !isset(Yii::$app->i18n->translations['jcrop/*'])) {
Yii::$app->i18n->translations['jcrop'] = [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@developit/j... | php | public static function registerTranslations()
{
if (!isset(Yii::$app->i18n->translations['jcrop']) && !isset(Yii::$app->i18n->translations['jcrop/*'])) {
Yii::$app->i18n->translations['jcrop'] = [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@developit/j... | [
"public",
"static",
"function",
"registerTranslations",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"Yii",
"::",
"$",
"app",
"->",
"i18n",
"->",
"translations",
"[",
"'jcrop'",
"]",
")",
"&&",
"!",
"isset",
"(",
"Yii",
"::",
"$",
"app",
"->",
"i18n"... | Register widget translations. | [
"Register",
"widget",
"translations",
"."
] | 06e1b7e1c0403b9b0161b1e1e40a4ba8b4f9bb2a | https://github.com/rezaei121/yii2-jcrop/blob/06e1b7e1c0403b9b0161b1e1e40a4ba8b4f9bb2a/src/Jcrop.php#L71-L83 |
222,376 | ADmad/cakephp-tree | src/View/Helper/TreeHelper.php | TreeHelper._markUnrelatedAsHidden | protected function _markUnrelatedAsHidden(&$tree, array $path, $level = 0)
{
extract($this->_config);
$siblingIsActive = false;
foreach ($tree as $key => &$subTree) {
if (is_object($subTree)) {
$subTree = $subTree->toArray();
}
if (!isset($... | php | protected function _markUnrelatedAsHidden(&$tree, array $path, $level = 0)
{
extract($this->_config);
$siblingIsActive = false;
foreach ($tree as $key => &$subTree) {
if (is_object($subTree)) {
$subTree = $subTree->toArray();
}
if (!isset($... | [
"protected",
"function",
"_markUnrelatedAsHidden",
"(",
"&",
"$",
"tree",
",",
"array",
"$",
"path",
",",
"$",
"level",
"=",
"0",
")",
"{",
"extract",
"(",
"$",
"this",
"->",
"_config",
")",
";",
"$",
"siblingIsActive",
"=",
"false",
";",
"foreach",
"(... | Mark unrelated records as hidden using `'hide' => 1`.
In the callback or element you can then return early in this case.
@param array $tree Tree
@param array $path Tree path
@param int $level Level
@return void
@throws \Exception | [
"Mark",
"unrelated",
"records",
"as",
"hidden",
"using",
"hide",
"=",
">",
"1",
".",
"In",
"the",
"callback",
"or",
"element",
"you",
"can",
"then",
"return",
"early",
"in",
"this",
"case",
"."
] | df6575d0c2134291441f6e487ae9126f9c678243 | https://github.com/ADmad/cakephp-tree/blob/df6575d0c2134291441f6e487ae9126f9c678243/src/View/Helper/TreeHelper.php#L520-L551 |
222,377 | wandersonwhcr/romans | src/Filter/RomanToInt.php | RomanToInt.filter | public function filter(string $value) : int
{
return $this->getParser()->parse($this->getLexer()->tokenize($value));
} | php | public function filter(string $value) : int
{
return $this->getParser()->parse($this->getLexer()->tokenize($value));
} | [
"public",
"function",
"filter",
"(",
"string",
"$",
"value",
")",
":",
"int",
"{",
"return",
"$",
"this",
"->",
"getParser",
"(",
")",
"->",
"parse",
"(",
"$",
"this",
"->",
"getLexer",
"(",
")",
"->",
"tokenize",
"(",
"$",
"value",
")",
")",
";",
... | Filter Roman Number to Integer
@param string $value Roman Number
@return int Integer Result | [
"Filter",
"Roman",
"Number",
"to",
"Integer"
] | cb076a6371abc6627a261157b856effc77784320 | https://github.com/wandersonwhcr/romans/blob/cb076a6371abc6627a261157b856effc77784320/src/Filter/RomanToInt.php#L92-L95 |
222,378 | doesntmattr/mongodb-migrations | src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php | Configuration.formatVersion | public static function formatVersion($version)
{
return sprintf('%s-%s-%s %s:%s:%s',
substr($version, 0, 4),
substr($version, 4, 2),
substr($version, 6, 2),
substr($version, 8, 2),
substr($version, 10, 2),
substr($version, 12, 2)
... | php | public static function formatVersion($version)
{
return sprintf('%s-%s-%s %s:%s:%s',
substr($version, 0, 4),
substr($version, 4, 2),
substr($version, 6, 2),
substr($version, 8, 2),
substr($version, 10, 2),
substr($version, 12, 2)
... | [
"public",
"static",
"function",
"formatVersion",
"(",
"$",
"version",
")",
"{",
"return",
"sprintf",
"(",
"'%s-%s-%s %s:%s:%s'",
",",
"substr",
"(",
"$",
"version",
",",
"0",
",",
"4",
")",
",",
"substr",
"(",
"$",
"version",
",",
"4",
",",
"2",
")",
... | Returns a timestamp version as a formatted date.
@param string $version
@return string The formatted version | [
"Returns",
"a",
"timestamp",
"version",
"as",
"a",
"formatted",
"date",
"."
] | 19ba9f04c1c346c6e17882840c209cfc4b000b93 | https://github.com/doesntmattr/mongodb-migrations/blob/19ba9f04c1c346c6e17882840c209cfc4b000b93/src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php#L131-L141 |
222,379 | doesntmattr/mongodb-migrations | src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php | Configuration.getAvailableVersions | public function getAvailableVersions()
{
$availableVersions = [];
foreach ($this->migrations as $migration) {
$availableVersions[] = $migration->getVersion();
}
return $availableVersions;
} | php | public function getAvailableVersions()
{
$availableVersions = [];
foreach ($this->migrations as $migration) {
$availableVersions[] = $migration->getVersion();
}
return $availableVersions;
} | [
"public",
"function",
"getAvailableVersions",
"(",
")",
"{",
"$",
"availableVersions",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"migrations",
"as",
"$",
"migration",
")",
"{",
"$",
"availableVersions",
"[",
"]",
"=",
"$",
"migration",
"->",
... | Returns an array of available migration version numbers.
@return array | [
"Returns",
"an",
"array",
"of",
"available",
"migration",
"version",
"numbers",
"."
] | 19ba9f04c1c346c6e17882840c209cfc4b000b93 | https://github.com/doesntmattr/mongodb-migrations/blob/19ba9f04c1c346c6e17882840c209cfc4b000b93/src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php#L148-L156 |
222,380 | doesntmattr/mongodb-migrations | src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php | Configuration.getMigratedVersions | public function getMigratedVersions()
{
$this->createMigrationCollection();
$cursor = $this->getCollection()->find();
$versions = [];
foreach ($cursor as $record) {
$versions[] = $record['v'];
}
return $versions;
} | php | public function getMigratedVersions()
{
$this->createMigrationCollection();
$cursor = $this->getCollection()->find();
$versions = [];
foreach ($cursor as $record) {
$versions[] = $record['v'];
}
return $versions;
} | [
"public",
"function",
"getMigratedVersions",
"(",
")",
"{",
"$",
"this",
"->",
"createMigrationCollection",
"(",
")",
";",
"$",
"cursor",
"=",
"$",
"this",
"->",
"getCollection",
"(",
")",
"->",
"find",
"(",
")",
";",
"$",
"versions",
"=",
"[",
"]",
";... | Returns all migrated versions from the versions collection, in an array.
@return \AntiMattr\MongoDB\Migrations\Version[] | [
"Returns",
"all",
"migrated",
"versions",
"from",
"the",
"versions",
"collection",
"in",
"an",
"array",
"."
] | 19ba9f04c1c346c6e17882840c209cfc4b000b93 | https://github.com/doesntmattr/mongodb-migrations/blob/19ba9f04c1c346c6e17882840c209cfc4b000b93/src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php#L319-L330 |
222,381 | doesntmattr/mongodb-migrations | src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php | Configuration.getMigratedTimestamp | public function getMigratedTimestamp($version): int
{
$this->createMigrationCollection();
$cursor = $this->getCollection()->find(
['v' => $version]
);
if (!$cursor->count()) {
throw new UnknownVersionException($version);
}
if ($cursor->count... | php | public function getMigratedTimestamp($version): int
{
$this->createMigrationCollection();
$cursor = $this->getCollection()->find(
['v' => $version]
);
if (!$cursor->count()) {
throw new UnknownVersionException($version);
}
if ($cursor->count... | [
"public",
"function",
"getMigratedTimestamp",
"(",
"$",
"version",
")",
":",
"int",
"{",
"$",
"this",
"->",
"createMigrationCollection",
"(",
")",
";",
"$",
"cursor",
"=",
"$",
"this",
"->",
"getCollection",
"(",
")",
"->",
"find",
"(",
"[",
"'v'",
"=>",... | Returns the time a migration occurred.
@param string $version
@return int
@throws AntiMattr\MongoDB\Migrations\Exception\UnknownVersionException Throws exception if migration version does not exist
@throws DomainException If more than one version exists | [
"Returns",
"the",
"time",
"a",
"migration",
"occurred",
"."
] | 19ba9f04c1c346c6e17882840c209cfc4b000b93 | https://github.com/doesntmattr/mongodb-migrations/blob/19ba9f04c1c346c6e17882840c209cfc4b000b93/src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php#L342-L366 |
222,382 | doesntmattr/mongodb-migrations | src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php | Configuration.registerMigration | public function registerMigration($version, $class)
{
$version = (string) $version;
$class = (string) $class;
if (isset($this->migrations[$version])) {
$message = sprintf(
'Migration version %s already registered with class %s',
$version,
... | php | public function registerMigration($version, $class)
{
$version = (string) $version;
$class = (string) $class;
if (isset($this->migrations[$version])) {
$message = sprintf(
'Migration version %s already registered with class %s',
$version,
... | [
"public",
"function",
"registerMigration",
"(",
"$",
"version",
",",
"$",
"class",
")",
"{",
"$",
"version",
"=",
"(",
"string",
")",
"$",
"version",
";",
"$",
"class",
"=",
"(",
"string",
")",
"$",
"class",
";",
"if",
"(",
"isset",
"(",
"$",
"this... | Register a single migration version to be executed by a AbstractMigration
class.
@param string $version The version of the migration in the format YYYYMMDDHHMMSS
@param string $class The migration class to execute for the version
@return Version
@throws AntiMattr\MongoDB\Migrations\Exception\DuplicateVersionExcept... | [
"Register",
"a",
"single",
"migration",
"version",
"to",
"be",
"executed",
"by",
"a",
"AbstractMigration",
"class",
"."
] | 19ba9f04c1c346c6e17882840c209cfc4b000b93 | https://github.com/doesntmattr/mongodb-migrations/blob/19ba9f04c1c346c6e17882840c209cfc4b000b93/src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php#L435-L452 |
222,383 | doesntmattr/mongodb-migrations | src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php | Configuration.registerMigrations | public function registerMigrations(array $migrations)
{
$versions = [];
foreach ($migrations as $version => $class) {
$versions[] = $this->registerMigration($version, $class);
}
return $versions;
} | php | public function registerMigrations(array $migrations)
{
$versions = [];
foreach ($migrations as $version => $class) {
$versions[] = $this->registerMigration($version, $class);
}
return $versions;
} | [
"public",
"function",
"registerMigrations",
"(",
"array",
"$",
"migrations",
")",
"{",
"$",
"versions",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"migrations",
"as",
"$",
"version",
"=>",
"$",
"class",
")",
"{",
"$",
"versions",
"[",
"]",
"=",
"$",
"t... | Register an array of migrations. Each key of the array is the version and
the value is the migration class name.
@param array $migrations
@return Version[] | [
"Register",
"an",
"array",
"of",
"migrations",
".",
"Each",
"key",
"of",
"the",
"array",
"is",
"the",
"version",
"and",
"the",
"value",
"is",
"the",
"migration",
"class",
"name",
"."
] | 19ba9f04c1c346c6e17882840c209cfc4b000b93 | https://github.com/doesntmattr/mongodb-migrations/blob/19ba9f04c1c346c6e17882840c209cfc4b000b93/src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php#L463-L471 |
222,384 | doesntmattr/mongodb-migrations | src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php | Configuration.registerMigrationsFromDirectory | public function registerMigrationsFromDirectory($path)
{
$path = realpath($path);
$path = rtrim($path, '/');
$files = glob($path . '/Version*.php');
$versions = [];
if ($files) {
foreach ($files as $file) {
require_once $file;
$info... | php | public function registerMigrationsFromDirectory($path)
{
$path = realpath($path);
$path = rtrim($path, '/');
$files = glob($path . '/Version*.php');
$versions = [];
if ($files) {
foreach ($files as $file) {
require_once $file;
$info... | [
"public",
"function",
"registerMigrationsFromDirectory",
"(",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"realpath",
"(",
"$",
"path",
")",
";",
"$",
"path",
"=",
"rtrim",
"(",
"$",
"path",
",",
"'/'",
")",
";",
"$",
"files",
"=",
"glob",
"(",
"$",
"... | Register migrations from a given directory. Recursively finds all files
with the pattern VersionYYYYMMDDHHMMSS.php as the filename and registers
them as migrations.
@param string $path The root directory to where some migration classes live
@return Version[] The array of migrations registered | [
"Register",
"migrations",
"from",
"a",
"given",
"directory",
".",
"Recursively",
"finds",
"all",
"files",
"with",
"the",
"pattern",
"VersionYYYYMMDDHHMMSS",
".",
"php",
"as",
"the",
"filename",
"and",
"registers",
"them",
"as",
"migrations",
"."
] | 19ba9f04c1c346c6e17882840c209cfc4b000b93 | https://github.com/doesntmattr/mongodb-migrations/blob/19ba9f04c1c346c6e17882840c209cfc4b000b93/src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php#L482-L499 |
222,385 | doesntmattr/mongodb-migrations | src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php | Configuration.getVersion | public function getVersion($version)
{
if (!isset($this->migrations[$version])) {
throw new UnknownVersionException($version);
}
return $this->migrations[$version];
} | php | public function getVersion($version)
{
if (!isset($this->migrations[$version])) {
throw new UnknownVersionException($version);
}
return $this->migrations[$version];
} | [
"public",
"function",
"getVersion",
"(",
"$",
"version",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"migrations",
"[",
"$",
"version",
"]",
")",
")",
"{",
"throw",
"new",
"UnknownVersionException",
"(",
"$",
"version",
")",
";",
"}",
... | Returns the Version instance for a given version in the format YYYYMMDDHHMMSS.
@param string $version The version string in the format YYYYMMDDHHMMSS
@return \AntiMattr\MongoDB\Migrations\Version
@throws AntiMattr\MongoDB\Migrations\Exception\UnknownVersionException Throws exception if migration version does not exi... | [
"Returns",
"the",
"Version",
"instance",
"for",
"a",
"given",
"version",
"in",
"the",
"format",
"YYYYMMDDHHMMSS",
"."
] | 19ba9f04c1c346c6e17882840c209cfc4b000b93 | https://github.com/doesntmattr/mongodb-migrations/blob/19ba9f04c1c346c6e17882840c209cfc4b000b93/src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php#L510-L517 |
222,386 | doesntmattr/mongodb-migrations | src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php | Configuration.hasVersionMigrated | public function hasVersionMigrated(Version $version)
{
$this->createMigrationCollection();
$record = $this->getCollection()->findOne(['v' => $version->getVersion()]);
return null !== $record;
} | php | public function hasVersionMigrated(Version $version)
{
$this->createMigrationCollection();
$record = $this->getCollection()->findOne(['v' => $version->getVersion()]);
return null !== $record;
} | [
"public",
"function",
"hasVersionMigrated",
"(",
"Version",
"$",
"version",
")",
"{",
"$",
"this",
"->",
"createMigrationCollection",
"(",
")",
";",
"$",
"record",
"=",
"$",
"this",
"->",
"getCollection",
"(",
")",
"->",
"findOne",
"(",
"[",
"'v'",
"=>",
... | Check if a version has been migrated or not yet.
@param \AntiMattr\MongoDB\Migrations\Version $version
@return bool | [
"Check",
"if",
"a",
"version",
"has",
"been",
"migrated",
"or",
"not",
"yet",
"."
] | 19ba9f04c1c346c6e17882840c209cfc4b000b93 | https://github.com/doesntmattr/mongodb-migrations/blob/19ba9f04c1c346c6e17882840c209cfc4b000b93/src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php#L538-L545 |
222,387 | doesntmattr/mongodb-migrations | src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php | Configuration.createMigrationCollection | public function createMigrationCollection()
{
$this->validate();
if (true !== $this->migrationCollectionCreated) {
$collection = $this->getCollection();
$collection->ensureIndex(['v' => -1], ['name' => 'version', 'unique' => true]);
$this->migrationCollectionCrea... | php | public function createMigrationCollection()
{
$this->validate();
if (true !== $this->migrationCollectionCreated) {
$collection = $this->getCollection();
$collection->ensureIndex(['v' => -1], ['name' => 'version', 'unique' => true]);
$this->migrationCollectionCrea... | [
"public",
"function",
"createMigrationCollection",
"(",
")",
"{",
"$",
"this",
"->",
"validate",
"(",
")",
";",
"if",
"(",
"true",
"!==",
"$",
"this",
"->",
"migrationCollectionCreated",
")",
"{",
"$",
"collection",
"=",
"$",
"this",
"->",
"getCollection",
... | Create the migration collection to track migrations with.
@return bool Whether or not the collection was created | [
"Create",
"the",
"migration",
"collection",
"to",
"track",
"migrations",
"with",
"."
] | 19ba9f04c1c346c6e17882840c209cfc4b000b93 | https://github.com/doesntmattr/mongodb-migrations/blob/19ba9f04c1c346c6e17882840c209cfc4b000b93/src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php#L595-L606 |
222,388 | doesntmattr/mongodb-migrations | src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php | Configuration.getMigrationsToExecute | public function getMigrationsToExecute($direction, $to)
{
if ('down' === $direction) {
if (count($this->migrations)) {
$allVersions = array_reverse(array_keys($this->migrations));
$classes = array_reverse(array_values($this->migrations));
$allVersi... | php | public function getMigrationsToExecute($direction, $to)
{
if ('down' === $direction) {
if (count($this->migrations)) {
$allVersions = array_reverse(array_keys($this->migrations));
$classes = array_reverse(array_values($this->migrations));
$allVersi... | [
"public",
"function",
"getMigrationsToExecute",
"(",
"$",
"direction",
",",
"$",
"to",
")",
"{",
"if",
"(",
"'down'",
"===",
"$",
"direction",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"migrations",
")",
")",
"{",
"$",
"allVersions",
"=",
... | Returns the array of migrations to executed based on the given direction
and target version number.
@param string $direction The direction we are migrating
@param string $to The version to migrate to
@return Version[] $migrations The array of migrations we can execute | [
"Returns",
"the",
"array",
"of",
"migrations",
"to",
"executed",
"based",
"on",
"the",
"given",
"direction",
"and",
"target",
"version",
"number",
"."
] | 19ba9f04c1c346c6e17882840c209cfc4b000b93 | https://github.com/doesntmattr/mongodb-migrations/blob/19ba9f04c1c346c6e17882840c209cfc4b000b93/src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php#L617-L639 |
222,389 | doesntmattr/mongodb-migrations | src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php | Configuration.shouldExecuteMigration | private function shouldExecuteMigration($direction, Version $version, $to, $migrated)
{
if ('down' === $direction) {
if (!in_array($version->getVersion(), $migrated)) {
return false;
}
return $version->getVersion() > $to;
}
if ('up' === $... | php | private function shouldExecuteMigration($direction, Version $version, $to, $migrated)
{
if ('down' === $direction) {
if (!in_array($version->getVersion(), $migrated)) {
return false;
}
return $version->getVersion() > $to;
}
if ('up' === $... | [
"private",
"function",
"shouldExecuteMigration",
"(",
"$",
"direction",
",",
"Version",
"$",
"version",
",",
"$",
"to",
",",
"$",
"migrated",
")",
"{",
"if",
"(",
"'down'",
"===",
"$",
"direction",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"versi... | Check if we should execute a migration for a given direction and target
migration version.
@param string $direction The direction we are migrating
@param Version $version The Version instance to check
@param string $to The version we are migrating to
@param array $migrated Migrated versions array
@retur... | [
"Check",
"if",
"we",
"should",
"execute",
"a",
"migration",
"for",
"a",
"given",
"direction",
"and",
"target",
"migration",
"version",
"."
] | 19ba9f04c1c346c6e17882840c209cfc4b000b93 | https://github.com/doesntmattr/mongodb-migrations/blob/19ba9f04c1c346c6e17882840c209cfc4b000b93/src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php#L652-L669 |
222,390 | doesntmattr/mongodb-migrations | src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php | Configuration.validate | public function validate()
{
if (!$this->migrationsDatabaseName) {
$message = 'Migrations Database Name must be configured in order to use AntiMattr migrations.';
throw new ConfigurationValidationException($message);
}
if (!$this->migrationsNamespace) {
$m... | php | public function validate()
{
if (!$this->migrationsDatabaseName) {
$message = 'Migrations Database Name must be configured in order to use AntiMattr migrations.';
throw new ConfigurationValidationException($message);
}
if (!$this->migrationsNamespace) {
$m... | [
"public",
"function",
"validate",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"migrationsDatabaseName",
")",
"{",
"$",
"message",
"=",
"'Migrations Database Name must be configured in order to use AntiMattr migrations.'",
";",
"throw",
"new",
"ConfigurationValidatio... | Validation that this instance has all the required properties configured.
@throws AntiMattr\MongoDB\Migrations\Exception\ConfigurationValidationException | [
"Validation",
"that",
"this",
"instance",
"has",
"all",
"the",
"required",
"properties",
"configured",
"."
] | 19ba9f04c1c346c6e17882840c209cfc4b000b93 | https://github.com/doesntmattr/mongodb-migrations/blob/19ba9f04c1c346c6e17882840c209cfc4b000b93/src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php#L676-L690 |
222,391 | php-soft/laravel-users | packages/Users/Controllers/RoleController.php | RoleController.store | public function store(Request $request)
{
$validator = Validator::make($request->all(), [
'name' => 'required|string|max:255|unique:roles',
'display_name' => 'string|max:255',
'description' => 'max:1000'
]);
if ($validator->fails()) {
... | php | public function store(Request $request)
{
$validator = Validator::make($request->all(), [
'name' => 'required|string|max:255|unique:roles',
'display_name' => 'string|max:255',
'description' => 'max:1000'
]);
if ($validator->fails()) {
... | [
"public",
"function",
"store",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"validator",
"=",
"Validator",
"::",
"make",
"(",
"$",
"request",
"->",
"all",
"(",
")",
",",
"[",
"'name'",
"=>",
"'required|string|max:255|unique:roles'",
",",
"'display_name'",
... | Create role action
@param Request $request
@return Response | [
"Create",
"role",
"action"
] | cd8d696dbf7337002188576d8a143cbc19d86b40 | https://github.com/php-soft/laravel-users/blob/cd8d696dbf7337002188576d8a143cbc19d86b40/packages/Users/Controllers/RoleController.php#L17-L36 |
222,392 | php-soft/laravel-users | packages/Users/Controllers/RoleController.php | RoleController.update | public function update(Request $request, $id = null)
{
// validate data
$validator = Validator::make($request->all(), [
'name' => 'sometimes|required|string|max:255|unique:roles,name,'.$id,
'display_name' => 'string|max:255',
'description' => 'max:1000'
... | php | public function update(Request $request, $id = null)
{
// validate data
$validator = Validator::make($request->all(), [
'name' => 'sometimes|required|string|max:255|unique:roles,name,'.$id,
'display_name' => 'string|max:255',
'description' => 'max:1000'
... | [
"public",
"function",
"update",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
"=",
"null",
")",
"{",
"// validate data",
"$",
"validator",
"=",
"Validator",
"::",
"make",
"(",
"$",
"request",
"->",
"all",
"(",
")",
",",
"[",
"'name'",
"=>",
"'sometim... | Update role action
@param Request $request
@return Response | [
"Update",
"role",
"action"
] | cd8d696dbf7337002188576d8a143cbc19d86b40 | https://github.com/php-soft/laravel-users/blob/cd8d696dbf7337002188576d8a143cbc19d86b40/packages/Users/Controllers/RoleController.php#L43-L75 |
222,393 | php-soft/laravel-users | packages/Users/Controllers/UserController.php | UserController.store | public function store(Request $request)
{
$validator = Validator::make($request->all(), [
'name' => 'required|string|max:255',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|string|confirmed|min:6',
'username' => 'stri... | php | public function store(Request $request)
{
$validator = Validator::make($request->all(), [
'name' => 'required|string|max:255',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|string|confirmed|min:6',
'username' => 'stri... | [
"public",
"function",
"store",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"validator",
"=",
"Validator",
"::",
"make",
"(",
"$",
"request",
"->",
"all",
"(",
")",
",",
"[",
"'name'",
"=>",
"'required|string|max:255'",
",",
"'email'",
"=>",
"'required|e... | Create user action
@param Request $request
@return Response | [
"Create",
"user",
"action"
] | cd8d696dbf7337002188576d8a143cbc19d86b40 | https://github.com/php-soft/laravel-users/blob/cd8d696dbf7337002188576d8a143cbc19d86b40/packages/Users/Controllers/UserController.php#L65-L93 |
222,394 | php-soft/laravel-users | packages/Users/Controllers/UserController.php | UserController.update | public function update(Request $request, $id = null)
{
// validate
$this->registerValidators();
// check auth if update me
if (!$id && !$this->checkAuth()) {
return response()->json(null, 401);
}
// check user
$user = $id ? AppUser::find($id) : A... | php | public function update(Request $request, $id = null)
{
// validate
$this->registerValidators();
// check auth if update me
if (!$id && !$this->checkAuth()) {
return response()->json(null, 401);
}
// check user
$user = $id ? AppUser::find($id) : A... | [
"public",
"function",
"update",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
"=",
"null",
")",
"{",
"// validate",
"$",
"this",
"->",
"registerValidators",
"(",
")",
";",
"// check auth if update me",
"if",
"(",
"!",
"$",
"id",
"&&",
"!",
"$",
"this",... | Update profile action
@param Request $request
@return Response | [
"Update",
"profile",
"action"
] | cd8d696dbf7337002188576d8a143cbc19d86b40 | https://github.com/php-soft/laravel-users/blob/cd8d696dbf7337002188576d8a143cbc19d86b40/packages/Users/Controllers/UserController.php#L100-L151 |
222,395 | php-soft/laravel-users | packages/Users/Controllers/UserController.php | UserController.moveToTrash | public function moveToTrash($id)
{
$user = AppUser::find($id);
if (!$user) {
return response()->json(null, 404);
}
if (!$user->delete()) {
return response()->json(null, 500); // @codeCoverageIgnore
}
return response()->json(null, 204);
} | php | public function moveToTrash($id)
{
$user = AppUser::find($id);
if (!$user) {
return response()->json(null, 404);
}
if (!$user->delete()) {
return response()->json(null, 500); // @codeCoverageIgnore
}
return response()->json(null, 204);
} | [
"public",
"function",
"moveToTrash",
"(",
"$",
"id",
")",
"{",
"$",
"user",
"=",
"AppUser",
"::",
"find",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"$",
"user",
")",
"{",
"return",
"response",
"(",
")",
"->",
"json",
"(",
"null",
",",
"404",
")... | move user to trash
@param int $id
@return Response | [
"move",
"user",
"to",
"trash"
] | cd8d696dbf7337002188576d8a143cbc19d86b40 | https://github.com/php-soft/laravel-users/blob/cd8d696dbf7337002188576d8a143cbc19d86b40/packages/Users/Controllers/UserController.php#L304-L317 |
222,396 | php-soft/laravel-users | packages/Users/Controllers/PermissionController.php | PermissionController.store | public function store(Request $request)
{
$validator = Validator::make($request->all(), [
'name' => 'required|string|max:255|unique:permissions',
'display_name' => 'string|max:255',
'description' => 'max:1000'
]);
if ($validator->fails()) {
... | php | public function store(Request $request)
{
$validator = Validator::make($request->all(), [
'name' => 'required|string|max:255|unique:permissions',
'display_name' => 'string|max:255',
'description' => 'max:1000'
]);
if ($validator->fails()) {
... | [
"public",
"function",
"store",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"validator",
"=",
"Validator",
"::",
"make",
"(",
"$",
"request",
"->",
"all",
"(",
")",
",",
"[",
"'name'",
"=>",
"'required|string|max:255|unique:permissions'",
",",
"'display_name... | Create permission action
@param Request $request
@return Response | [
"Create",
"permission",
"action"
] | cd8d696dbf7337002188576d8a143cbc19d86b40 | https://github.com/php-soft/laravel-users/blob/cd8d696dbf7337002188576d8a143cbc19d86b40/packages/Users/Controllers/PermissionController.php#L17-L36 |
222,397 | php-soft/laravel-users | packages/Users/Controllers/PermissionController.php | PermissionController.update | public function update(Request $request, $id = null)
{
// validate data
$validator = Validator::make($request->all(), [
'name' => 'sometimes|required|string|max:255|unique:permissions,name,'.$id,
'display_name' => 'string|max:255',
'description' => 'max:1... | php | public function update(Request $request, $id = null)
{
// validate data
$validator = Validator::make($request->all(), [
'name' => 'sometimes|required|string|max:255|unique:permissions,name,'.$id,
'display_name' => 'string|max:255',
'description' => 'max:1... | [
"public",
"function",
"update",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
"=",
"null",
")",
"{",
"// validate data",
"$",
"validator",
"=",
"Validator",
"::",
"make",
"(",
"$",
"request",
"->",
"all",
"(",
")",
",",
"[",
"'name'",
"=>",
"'sometim... | Update permission action
@param Request $request
@return Response | [
"Update",
"permission",
"action"
] | cd8d696dbf7337002188576d8a143cbc19d86b40 | https://github.com/php-soft/laravel-users/blob/cd8d696dbf7337002188576d8a143cbc19d86b40/packages/Users/Controllers/PermissionController.php#L43-L75 |
222,398 | php-soft/laravel-users | packages/Users/Models/Role.php | Role.browseByUser | public static function browseByUser($options = [])
{
$find = $options['user']->roles();
$total = $find->count();
if (!empty($options['order'])) {
foreach ($options['order'] as $field => $direction) {
$find = $find->orderBy($field, $direction);
}
... | php | public static function browseByUser($options = [])
{
$find = $options['user']->roles();
$total = $find->count();
if (!empty($options['order'])) {
foreach ($options['order'] as $field => $direction) {
$find = $find->orderBy($field, $direction);
}
... | [
"public",
"static",
"function",
"browseByUser",
"(",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"find",
"=",
"$",
"options",
"[",
"'user'",
"]",
"->",
"roles",
"(",
")",
";",
"$",
"total",
"=",
"$",
"find",
"->",
"count",
"(",
")",
";",
"if",
... | get all role of user
@return role | [
"get",
"all",
"role",
"of",
"user"
] | cd8d696dbf7337002188576d8a143cbc19d86b40 | https://github.com/php-soft/laravel-users/blob/cd8d696dbf7337002188576d8a143cbc19d86b40/packages/Users/Models/Role.php#L84-L110 |
222,399 | loveorigami/yii2-bootstrap-toggle | Toggle.php | Toggle.registerClientScript | public function registerClientScript()
{
$view = $this->view;
ToggleAsset::register($view);
//$this->clientOptions['animate'] = ArrayHelper::getValue($this->clientOptions, 'animate', true);
$options = Json::encode($this->options);
$js[] = "jQuery('$this->selector').bootstrapT... | php | public function registerClientScript()
{
$view = $this->view;
ToggleAsset::register($view);
//$this->clientOptions['animate'] = ArrayHelper::getValue($this->clientOptions, 'animate', true);
$options = Json::encode($this->options);
$js[] = "jQuery('$this->selector').bootstrapT... | [
"public",
"function",
"registerClientScript",
"(",
")",
"{",
"$",
"view",
"=",
"$",
"this",
"->",
"view",
";",
"ToggleAsset",
"::",
"register",
"(",
"$",
"view",
")",
";",
"//$this->clientOptions['animate'] = ArrayHelper::getValue($this->clientOptions, 'animate', true);",... | Registers Bootstrap Switch plugin and related events | [
"Registers",
"Bootstrap",
"Switch",
"plugin",
"and",
"related",
"events"
] | a55c359b2b67ba79e2276c44a78b3a22101d18ca | https://github.com/loveorigami/yii2-bootstrap-toggle/blob/a55c359b2b67ba79e2276c44a78b3a22101d18ca/Toggle.php#L76-L89 |
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.