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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
203,100 | Wedeto/Log | src/Logger.php | Logger.fillPlaceholders | public static function fillPlaceholders(string $message, array $context)
{
$message = (string)$message;
foreach ($context as $key => $value)
{
$placeholder = '{' . $key . '}';
$strval = null;
$pos = 0;
while (($pos = strpos($message, $placehold... | php | public static function fillPlaceholders(string $message, array $context)
{
$message = (string)$message;
foreach ($context as $key => $value)
{
$placeholder = '{' . $key . '}';
$strval = null;
$pos = 0;
while (($pos = strpos($message, $placehold... | [
"public",
"static",
"function",
"fillPlaceholders",
"(",
"string",
"$",
"message",
",",
"array",
"$",
"context",
")",
"{",
"$",
"message",
"=",
"(",
"string",
")",
"$",
"message",
";",
"foreach",
"(",
"$",
"context",
"as",
"$",
"key",
"=>",
"$",
"value... | Fill the place holders in the message with values from the context array
@param string $message The message to format. Any {var} placeholders will be replaced
with a value from the context array.
@param array $context Contains the values to replace the placeholders with.
@return string The message with placeholders rep... | [
"Fill",
"the",
"place",
"holders",
"in",
"the",
"message",
"with",
"values",
"from",
"the",
"context",
"array"
] | 88252c5052089fdcc5dae466d1ad5889bb2b735f | https://github.com/Wedeto/Log/blob/88252c5052089fdcc5dae466d1ad5889bb2b735f/src/Logger.php#L347-L366 |
203,101 | Wedeto/Log | src/Logger.php | Logger.getLevelNumeric | public static function getLevelNumeric(string $level)
{
return isset(self::$LEVEL_NUMERIC[$level]) ? self::$LEVEL_NUMERIC[$level] : 0;
} | php | public static function getLevelNumeric(string $level)
{
return isset(self::$LEVEL_NUMERIC[$level]) ? self::$LEVEL_NUMERIC[$level] : 0;
} | [
"public",
"static",
"function",
"getLevelNumeric",
"(",
"string",
"$",
"level",
")",
"{",
"return",
"isset",
"(",
"self",
"::",
"$",
"LEVEL_NUMERIC",
"[",
"$",
"level",
"]",
")",
"?",
"self",
"::",
"$",
"LEVEL_NUMERIC",
"[",
"$",
"level",
"]",
":",
"0"... | Get the severity number for a specific LogLevel.
@param string $level The LogLevel to convert to a number
@return int The severity - 0 is less important, 7 is most important. | [
"Get",
"the",
"severity",
"number",
"for",
"a",
"specific",
"LogLevel",
"."
] | 88252c5052089fdcc5dae466d1ad5889bb2b735f | https://github.com/Wedeto/Log/blob/88252c5052089fdcc5dae466d1ad5889bb2b735f/src/Logger.php#L373-L376 |
203,102 | squareproton/Bond | src/Bond/Pg/ConnectionFactory.php | ConnectionFactory.get | public function get( $connection, $cache = true )
{
if( !is_string( $connection ) ) {
throw new BadTypeException( $connection, 'string' );
}
// use the multiton
if( !isset( $this->instances[$connection] ) or !$cache ) {
if( !isset( $this->connectionSettings... | php | public function get( $connection, $cache = true )
{
if( !is_string( $connection ) ) {
throw new BadTypeException( $connection, 'string' );
}
// use the multiton
if( !isset( $this->instances[$connection] ) or !$cache ) {
if( !isset( $this->connectionSettings... | [
"public",
"function",
"get",
"(",
"$",
"connection",
",",
"$",
"cache",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"connection",
")",
")",
"{",
"throw",
"new",
"BadTypeException",
"(",
"$",
"connection",
",",
"'string'",
")",
";",
... | Get the singleton pg connection
@param string $connection
@param boolean $cache
@return \Bond\Pg | [
"Get",
"the",
"singleton",
"pg",
"connection"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/ConnectionFactory.php#L56-L82 |
203,103 | squareproton/Bond | src/Bond/Pg/ConnectionFactory.php | ConnectionFactory.remove | public function remove( Resource $resource )
{
$cnt = 0;
if( false !== $key = array_search( $resource, $this->instances, true ) ) {
unset( $this->instances[$key] );
$cnt++;
}
return $cnt;
} | php | public function remove( Resource $resource )
{
$cnt = 0;
if( false !== $key = array_search( $resource, $this->instances, true ) ) {
unset( $this->instances[$key] );
$cnt++;
}
return $cnt;
} | [
"public",
"function",
"remove",
"(",
"Resource",
"$",
"resource",
")",
"{",
"$",
"cnt",
"=",
"0",
";",
"if",
"(",
"false",
"!==",
"$",
"key",
"=",
"array_search",
"(",
"$",
"resource",
",",
"$",
"this",
"->",
"instances",
",",
"true",
")",
")",
"{"... | Remove a resource from the multiton cache
@param Bond\Pg\Resource
@return int | [
"Remove",
"a",
"resource",
"from",
"the",
"multiton",
"cache"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/ConnectionFactory.php#L89-L97 |
203,104 | mrbase/Smesg | src/Smesg/Provider/InMobileProvider.php | InMobileProvider.sendOne | protected function sendOne($dry_run)
{
$message = $this->messages[0];
$adapter = $this->getAdapter();
$adapter->setEndpoint(self::SINGLE_ENDPOINT);
$adapter->setParameters(array(
'user' => $this->config['user'],
'password' => $this->config['password'],
... | php | protected function sendOne($dry_run)
{
$message = $this->messages[0];
$adapter = $this->getAdapter();
$adapter->setEndpoint(self::SINGLE_ENDPOINT);
$adapter->setParameters(array(
'user' => $this->config['user'],
'password' => $this->config['password'],
... | [
"protected",
"function",
"sendOne",
"(",
"$",
"dry_run",
")",
"{",
"$",
"message",
"=",
"$",
"this",
"->",
"messages",
"[",
"0",
"]",
";",
"$",
"adapter",
"=",
"$",
"this",
"->",
"getAdapter",
"(",
")",
";",
"$",
"adapter",
"->",
"setEndpoint",
"(",
... | We use smspush for sending single messages.
@return string $response; | [
"We",
"use",
"smspush",
"for",
"sending",
"single",
"messages",
"."
] | e9692ed5915f5a9cd4dca0df875935a2c528e128 | https://github.com/mrbase/Smesg/blob/e9692ed5915f5a9cd4dca0df875935a2c528e128/src/Smesg/Provider/InMobileProvider.php#L188-L210 |
203,105 | duncan3dc/php-ini | src/Ini.php | Ini.restore | public function restore(string $key): self
{
if (array_key_exists($key, $this->original)) {
ini_set($key, $this->original[$key]);
}
return $this;
} | php | public function restore(string $key): self
{
if (array_key_exists($key, $this->original)) {
ini_set($key, $this->original[$key]);
}
return $this;
} | [
"public",
"function",
"restore",
"(",
"string",
"$",
"key",
")",
":",
"self",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"original",
")",
")",
"{",
"ini_set",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"original",
"[... | Restore a previous ini setting.
@return $this | [
"Restore",
"a",
"previous",
"ini",
"setting",
"."
] | e07435d7ddbbc466e535783e5c4d2b92e3715c7a | https://github.com/duncan3dc/php-ini/blob/e07435d7ddbbc466e535783e5c4d2b92e3715c7a/src/Ini.php#L53-L60 |
203,106 | duncan3dc/php-ini | src/Ini.php | Ini.cleanup | public function cleanup(): self
{
foreach ($this->original as $key => $value) {
ini_set($key, $value);
}
$this->original = [];
return $this;
} | php | public function cleanup(): self
{
foreach ($this->original as $key => $value) {
ini_set($key, $value);
}
$this->original = [];
return $this;
} | [
"public",
"function",
"cleanup",
"(",
")",
":",
"self",
"{",
"foreach",
"(",
"$",
"this",
"->",
"original",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"ini_set",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"}",
"$",
"this",
"->",
"original... | Restore the previous ini settings.
@return $this | [
"Restore",
"the",
"previous",
"ini",
"settings",
"."
] | e07435d7ddbbc466e535783e5c4d2b92e3715c7a | https://github.com/duncan3dc/php-ini/blob/e07435d7ddbbc466e535783e5c4d2b92e3715c7a/src/Ini.php#L68-L77 |
203,107 | zarathustra323/modlr-data | src/Zarathustra/ModlrData/DataTypes/TypeFactory.php | TypeFactory.getType | public function getType($name)
{
if (false === $this->hasType($name)) {
throw new InvalidArgumentException(sprintf('The type "%s" was not found.', $name));
}
if (isset($this->loaded[$name])) {
return $this->loaded[$name];
}
$fqcn = $this->types[$name];... | php | public function getType($name)
{
if (false === $this->hasType($name)) {
throw new InvalidArgumentException(sprintf('The type "%s" was not found.', $name));
}
if (isset($this->loaded[$name])) {
return $this->loaded[$name];
}
$fqcn = $this->types[$name];... | [
"public",
"function",
"getType",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"hasType",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'The type \"%s\" was not found.'",
",",
... | Gets a type object.
@param string $name
@return DataTypes\Types\Type
@throws InvalidArgumentException If the type wasn't found. | [
"Gets",
"a",
"type",
"object",
"."
] | 7c2c767216055f75abf8cf22e2200f11998ed24e | https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/DataTypes/TypeFactory.php#L84-L100 |
203,108 | zarathustra323/modlr-data | src/Zarathustra/ModlrData/DataTypes/TypeFactory.php | TypeFactory.addType | public function addType($name, $fqcn)
{
if (true === $this->hasType($name)) {
throw new InvalidArgumentException(sprintf('The type "%s" already exists.', $name));
}
return $this->setType($name, $fqcn);
} | php | public function addType($name, $fqcn)
{
if (true === $this->hasType($name)) {
throw new InvalidArgumentException(sprintf('The type "%s" already exists.', $name));
}
return $this->setType($name, $fqcn);
} | [
"public",
"function",
"addType",
"(",
"$",
"name",
",",
"$",
"fqcn",
")",
"{",
"if",
"(",
"true",
"===",
"$",
"this",
"->",
"hasType",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'The type \"%s\" alr... | Adds a type object.
@param string $name
@param string $fqcn
@return self
@throws InvalidArgumentException If the type already exists. | [
"Adds",
"a",
"type",
"object",
"."
] | 7c2c767216055f75abf8cf22e2200f11998ed24e | https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/DataTypes/TypeFactory.php#L110-L116 |
203,109 | zarathustra323/modlr-data | src/Zarathustra/ModlrData/DataTypes/TypeFactory.php | TypeFactory.overrideType | public function overrideType($name, $fqcn)
{
if (false === $this->hasType($name)) {
throw new InvalidArgumentException(sprintf('The type "%s" was not found.', $name));
}
return $this->setType($name, $fqcn);
} | php | public function overrideType($name, $fqcn)
{
if (false === $this->hasType($name)) {
throw new InvalidArgumentException(sprintf('The type "%s" was not found.', $name));
}
return $this->setType($name, $fqcn);
} | [
"public",
"function",
"overrideType",
"(",
"$",
"name",
",",
"$",
"fqcn",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"hasType",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'The type \"%s... | Overrides a type object with new class.
@param string $name
@param string $fqcn
@return self
@throws InvalidArgumentException If the type was not found. | [
"Overrides",
"a",
"type",
"object",
"with",
"new",
"class",
"."
] | 7c2c767216055f75abf8cf22e2200f11998ed24e | https://github.com/zarathustra323/modlr-data/blob/7c2c767216055f75abf8cf22e2200f11998ed24e/src/Zarathustra/ModlrData/DataTypes/TypeFactory.php#L126-L132 |
203,110 | bkstg/schedule-bundle | Timeline/EventSubscriber/EventLinkSubscriber.php | EventLinkSubscriber.setInvitedLink | public function setInvitedLink(TimelineLinkEvent $event): void
{
$action = $event->getAction();
if ('invited' != $action->getVerb()) {
return;
}
$event = $action->getComponent('indirectComplement')->getData();
$event->setLink($this->url_generator->generate('bkst... | php | public function setInvitedLink(TimelineLinkEvent $event): void
{
$action = $event->getAction();
if ('invited' != $action->getVerb()) {
return;
}
$event = $action->getComponent('indirectComplement')->getData();
$event->setLink($this->url_generator->generate('bkst... | [
"public",
"function",
"setInvitedLink",
"(",
"TimelineLinkEvent",
"$",
"event",
")",
":",
"void",
"{",
"$",
"action",
"=",
"$",
"event",
"->",
"getAction",
"(",
")",
";",
"if",
"(",
"'invited'",
"!=",
"$",
"action",
"->",
"getVerb",
"(",
")",
")",
"{",... | Set the link for invited actions.
@param TimelineLinkEvent $event The timeline action event.
@return void | [
"Set",
"the",
"link",
"for",
"invited",
"actions",
"."
] | e64ac897aa7b28bc48319470d65de13cd4788afe | https://github.com/bkstg/schedule-bundle/blob/e64ac897aa7b28bc48319470d65de13cd4788afe/Timeline/EventSubscriber/EventLinkSubscriber.php#L54-L67 |
203,111 | bkstg/schedule-bundle | Timeline/EventSubscriber/EventLinkSubscriber.php | EventLinkSubscriber.setScheduledLink | public function setScheduledLink(TimelineLinkEvent $event): void
{
$action = $event->getAction();
if ('scheduled' != $action->getVerb()) {
return;
}
$production = $action->getComponent('indirectComplement')->getData();
$schedule = $action->getComponent('directCo... | php | public function setScheduledLink(TimelineLinkEvent $event): void
{
$action = $event->getAction();
if ('scheduled' != $action->getVerb()) {
return;
}
$production = $action->getComponent('indirectComplement')->getData();
$schedule = $action->getComponent('directCo... | [
"public",
"function",
"setScheduledLink",
"(",
"TimelineLinkEvent",
"$",
"event",
")",
":",
"void",
"{",
"$",
"action",
"=",
"$",
"event",
"->",
"getAction",
"(",
")",
";",
"if",
"(",
"'scheduled'",
"!=",
"$",
"action",
"->",
"getVerb",
"(",
")",
")",
... | Set the link for scheduled actions.
@param TimelineLinkEvent $event The timeline action event.
@return void | [
"Set",
"the",
"link",
"for",
"scheduled",
"actions",
"."
] | e64ac897aa7b28bc48319470d65de13cd4788afe | https://github.com/bkstg/schedule-bundle/blob/e64ac897aa7b28bc48319470d65de13cd4788afe/Timeline/EventSubscriber/EventLinkSubscriber.php#L76-L90 |
203,112 | NukaCode/Front-End-Bootstrap | src/NukaCode/Bootstrap/Filesystem/Config/Theme.php | Theme.updateEntry | public function updateEntry($package, $theme)
{
$this->verifyCommand($package);
$lines = file($this->config);
$config = $this->compactConfig($package);
$lines = $this->updateConfigDetails($theme, $lines, $config);
$this->file->delete($this->config);
$this->file->p... | php | public function updateEntry($package, $theme)
{
$this->verifyCommand($package);
$lines = file($this->config);
$config = $this->compactConfig($package);
$lines = $this->updateConfigDetails($theme, $lines, $config);
$this->file->delete($this->config);
$this->file->p... | [
"public",
"function",
"updateEntry",
"(",
"$",
"package",
",",
"$",
"theme",
")",
"{",
"$",
"this",
"->",
"verifyCommand",
"(",
"$",
"package",
")",
";",
"$",
"lines",
"=",
"file",
"(",
"$",
"this",
"->",
"config",
")",
";",
"$",
"config",
"=",
"$"... | Update the config with the color values for easy retrieval
@param $package
@param $theme | [
"Update",
"the",
"config",
"with",
"the",
"color",
"values",
"for",
"easy",
"retrieval"
] | 46c30fba4c77afb74ec4a4d70c43c9cffd464d6e | https://github.com/NukaCode/Front-End-Bootstrap/blob/46c30fba4c77afb74ec4a4d70c43c9cffd464d6e/src/NukaCode/Bootstrap/Filesystem/Config/Theme.php#L85-L96 |
203,113 | agentmedia/phine-core | src/Core/Logic/Tree/PageTreeProvider.php | PageTreeProvider.TopMost | public function TopMost()
{
$sql = Access::SqlBuilder();
$tbl = Page::Schema()->Table();
$where = $sql->Equals($tbl->Field('Site'), $sql->Value($this->site->GetID()))
->And_($sql->IsNull($tbl->Field('Parent')))
->And_($sql->IsNull($tbl->Field('Previous')));
... | php | public function TopMost()
{
$sql = Access::SqlBuilder();
$tbl = Page::Schema()->Table();
$where = $sql->Equals($tbl->Field('Site'), $sql->Value($this->site->GetID()))
->And_($sql->IsNull($tbl->Field('Parent')))
->And_($sql->IsNull($tbl->Field('Previous')));
... | [
"public",
"function",
"TopMost",
"(",
")",
"{",
"$",
"sql",
"=",
"Access",
"::",
"SqlBuilder",
"(",
")",
";",
"$",
"tbl",
"=",
"Page",
"::",
"Schema",
"(",
")",
"->",
"Table",
"(",
")",
";",
"$",
"where",
"=",
"$",
"sql",
"->",
"Equals",
"(",
"... | Gets the first and root page of the site
@return Page | [
"Gets",
"the",
"first",
"and",
"root",
"page",
"of",
"the",
"site"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Tree/PageTreeProvider.php#L31-L40 |
203,114 | johnnymast/mailreader | src/MailReader/MailReader.php | MailReader.connect | public function connect($credentials = [])
{
if ($diff = array_diff(array_keys($this->settings), array_keys($credentials))) {
throw new \Exception("Missing credentials, the following fields are missing ".implode('/', $diff));
}
$this->settings = array_merge($this->settings, $cre... | php | public function connect($credentials = [])
{
if ($diff = array_diff(array_keys($this->settings), array_keys($credentials))) {
throw new \Exception("Missing credentials, the following fields are missing ".implode('/', $diff));
}
$this->settings = array_merge($this->settings, $cre... | [
"public",
"function",
"connect",
"(",
"$",
"credentials",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"diff",
"=",
"array_diff",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"settings",
")",
",",
"array_keys",
"(",
"$",
"credentials",
")",
")",
")",
"{",
... | Open a connection to a mail server.
@param array $credentials
@return bool
@throws \Exception | [
"Open",
"a",
"connection",
"to",
"a",
"mail",
"server",
"."
] | 9c81843aece984eb6e2a9ba41f3be49733348d10 | https://github.com/johnnymast/mailreader/blob/9c81843aece984eb6e2a9ba41f3be49733348d10/src/MailReader/MailReader.php#L47-L67 |
203,115 | johnnymast/mailreader | src/MailReader/MailReader.php | MailReader.getMailbox | public function getMailbox()
{
$mailbox = str_replace("{".$this->settings['server']."}", '', $this->mailbox);
$mailbox = (substr($mailbox, 0, 6) == 'INBOX.') ? substr($mailbox, -6) : $mailbox;
return $mailbox;
} | php | public function getMailbox()
{
$mailbox = str_replace("{".$this->settings['server']."}", '', $this->mailbox);
$mailbox = (substr($mailbox, 0, 6) == 'INBOX.') ? substr($mailbox, -6) : $mailbox;
return $mailbox;
} | [
"public",
"function",
"getMailbox",
"(",
")",
"{",
"$",
"mailbox",
"=",
"str_replace",
"(",
"\"{\"",
".",
"$",
"this",
"->",
"settings",
"[",
"'server'",
"]",
".",
"\"}\"",
",",
"''",
",",
"$",
"this",
"->",
"mailbox",
")",
";",
"$",
"mailbox",
"=",
... | Return the name of the current mailbox.
@return string | [
"Return",
"the",
"name",
"of",
"the",
"current",
"mailbox",
"."
] | 9c81843aece984eb6e2a9ba41f3be49733348d10 | https://github.com/johnnymast/mailreader/blob/9c81843aece984eb6e2a9ba41f3be49733348d10/src/MailReader/MailReader.php#L111-L117 |
203,116 | johnnymast/mailreader | src/MailReader/MailReader.php | MailReader.subscribeMailbox | public function subscribeMailbox($name = '') {
if (empty($name)) {
return false;
}
$name = imap_utf7_encode($name);
return imap_subscribe ( $this->conn, "{".$this->settings['server']."}INBOX.".$name );
} | php | public function subscribeMailbox($name = '') {
if (empty($name)) {
return false;
}
$name = imap_utf7_encode($name);
return imap_subscribe ( $this->conn, "{".$this->settings['server']."}INBOX.".$name );
} | [
"public",
"function",
"subscribeMailbox",
"(",
"$",
"name",
"=",
"''",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"name",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"name",
"=",
"imap_utf7_encode",
"(",
"$",
"name",
")",
";",
"return",
"imap_subsc... | Subscribe to a mailbox.
@param string $name
@return bool | [
"Subscribe",
"to",
"a",
"mailbox",
"."
] | 9c81843aece984eb6e2a9ba41f3be49733348d10 | https://github.com/johnnymast/mailreader/blob/9c81843aece984eb6e2a9ba41f3be49733348d10/src/MailReader/MailReader.php#L213-L220 |
203,117 | johnnymast/mailreader | src/MailReader/MailReader.php | MailReader.getMessageInformation | public function getMessageInformation($id = '')
{
$message = [];
if (is_array($this->messages) == true) {
foreach($this ->messages as $msg) {
if ($msg['index'] == $id) {
return $msg;
}
}
}
return $message;
... | php | public function getMessageInformation($id = '')
{
$message = [];
if (is_array($this->messages) == true) {
foreach($this ->messages as $msg) {
if ($msg['index'] == $id) {
return $msg;
}
}
}
return $message;
... | [
"public",
"function",
"getMessageInformation",
"(",
"$",
"id",
"=",
"''",
")",
"{",
"$",
"message",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"messages",
")",
"==",
"true",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"mess... | Return message information without reading it from the server
@param string $id
@return mixed | [
"Return",
"message",
"information",
"without",
"reading",
"it",
"from",
"the",
"server"
] | 9c81843aece984eb6e2a9ba41f3be49733348d10 | https://github.com/johnnymast/mailreader/blob/9c81843aece984eb6e2a9ba41f3be49733348d10/src/MailReader/MailReader.php#L408-L419 |
203,118 | johnnymast/mailreader | src/MailReader/MailReader.php | MailReader.getMessage | public function getMessage($id = '')
{
$message = [];
if (is_array($this->messages) == true) {
foreach($this ->messages as $msg) {
if ($msg['index'] == $id) {
$message = $msg;
break;
}
}
}
... | php | public function getMessage($id = '')
{
$message = [];
if (is_array($this->messages) == true) {
foreach($this ->messages as $msg) {
if ($msg['index'] == $id) {
$message = $msg;
break;
}
}
}
... | [
"public",
"function",
"getMessage",
"(",
"$",
"id",
"=",
"''",
")",
"{",
"$",
"message",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"messages",
")",
"==",
"true",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"messages",
"a... | Return a message based on its index in the mailbox.
@param string $id
@return mixed | [
"Return",
"a",
"message",
"based",
"on",
"its",
"index",
"in",
"the",
"mailbox",
"."
] | 9c81843aece984eb6e2a9ba41f3be49733348d10 | https://github.com/johnnymast/mailreader/blob/9c81843aece984eb6e2a9ba41f3be49733348d10/src/MailReader/MailReader.php#L428-L446 |
203,119 | johnnymast/mailreader | src/MailReader/MailReader.php | MailReader.readMailbox | public function readMailbox()
{
$msg_cnt = imap_num_msg($this->conn);
$messages = [];
for ($i = 1; $i <= $msg_cnt; $i++) {
$header = imap_headerinfo($this->conn, $i);
$messages[] = [
'index' => trim($header->Msgno),
'header' => ... | php | public function readMailbox()
{
$msg_cnt = imap_num_msg($this->conn);
$messages = [];
for ($i = 1; $i <= $msg_cnt; $i++) {
$header = imap_headerinfo($this->conn, $i);
$messages[] = [
'index' => trim($header->Msgno),
'header' => ... | [
"public",
"function",
"readMailbox",
"(",
")",
"{",
"$",
"msg_cnt",
"=",
"imap_num_msg",
"(",
"$",
"this",
"->",
"conn",
")",
";",
"$",
"messages",
"=",
"[",
"]",
";",
"for",
"(",
"$",
"i",
"=",
"1",
";",
"$",
"i",
"<=",
"$",
"msg_cnt",
";",
"$... | Retrieve a list of message in the mailbox.
@return array | [
"Retrieve",
"a",
"list",
"of",
"message",
"in",
"the",
"mailbox",
"."
] | 9c81843aece984eb6e2a9ba41f3be49733348d10 | https://github.com/johnnymast/mailreader/blob/9c81843aece984eb6e2a9ba41f3be49733348d10/src/MailReader/MailReader.php#L454-L469 |
203,120 | Wedeto/DB | src/Migrate/Module.php | Module.loadVersion | private function loadVersion()
{
try
{
$this->dao = $this->db->getDAO(DBVersion::class);
$this->db_version =
$this->dao->get(
QB::where(["module" => $this->module]),
QB::order(['migration_date' => 'DESC'])
... | php | private function loadVersion()
{
try
{
$this->dao = $this->db->getDAO(DBVersion::class);
$this->db_version =
$this->dao->get(
QB::where(["module" => $this->module]),
QB::order(['migration_date' => 'DESC'])
... | [
"private",
"function",
"loadVersion",
"(",
")",
"{",
"try",
"{",
"$",
"this",
"->",
"dao",
"=",
"$",
"this",
"->",
"db",
"->",
"getDAO",
"(",
"DBVersion",
"::",
"class",
")",
";",
"$",
"this",
"->",
"db_version",
"=",
"$",
"this",
"->",
"dao",
"->"... | Load the current version from the database | [
"Load",
"the",
"current",
"version",
"from",
"the",
"database"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Migrate/Module.php#L88-L108 |
203,121 | Wedeto/DB | src/Migrate/Module.php | Module.migrateTo | public function migrateTo(int $target_version)
{
if ($this->max_version === null)
$this->scanMigrations();
$current_version = $this->getCurrentVersion();
$trajectory = $this->plan($current_version, $target_version);
$db = $this->db;
foreach ($trajectory as $mig... | php | public function migrateTo(int $target_version)
{
if ($this->max_version === null)
$this->scanMigrations();
$current_version = $this->getCurrentVersion();
$trajectory = $this->plan($current_version, $target_version);
$db = $this->db;
foreach ($trajectory as $mig... | [
"public",
"function",
"migrateTo",
"(",
"int",
"$",
"target_version",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"max_version",
"===",
"null",
")",
"$",
"this",
"->",
"scanMigrations",
"(",
")",
";",
"$",
"current_version",
"=",
"$",
"this",
"->",
"getCurre... | Perform a migration from the current version to the target version
@param int $version The target version
@throws MigrationException Whenever no migration path can be found to the target version
@throws DBException When something goes wrong during the migration | [
"Perform",
"a",
"migration",
"from",
"the",
"current",
"version",
"to",
"the",
"target",
"version"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Migrate/Module.php#L242-L301 |
203,122 | Wedeto/DB | src/Migrate/Module.php | Module.plan | protected function plan(int $from, int $to)
{
$migrations = [];
if ($from === $to)
return $migrations;
$is_downgrade = $to < $from;
$reachable = $this->migrations[$from] ?? [];
// For downgrades, we want the lowest reachable target that is above or equa... | php | protected function plan(int $from, int $to)
{
$migrations = [];
if ($from === $to)
return $migrations;
$is_downgrade = $to < $from;
$reachable = $this->migrations[$from] ?? [];
// For downgrades, we want the lowest reachable target that is above or equa... | [
"protected",
"function",
"plan",
"(",
"int",
"$",
"from",
",",
"int",
"$",
"to",
")",
"{",
"$",
"migrations",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"from",
"===",
"$",
"to",
")",
"return",
"$",
"migrations",
";",
"$",
"is_downgrade",
"=",
"$",
"to"... | Plan a path through available migrations to reach a specified version
from another version. This is always done in one direction,
opportunistically. This means that when downgrading, no intermediate
upgrades are performed, even if they may result in shorter path.
Whenever a more than one step is available, the larger... | [
"Plan",
"a",
"path",
"through",
"available",
"migrations",
"to",
"reach",
"a",
"specified",
"version",
"from",
"another",
"version",
".",
"This",
"is",
"always",
"done",
"in",
"one",
"direction",
"opportunistically",
".",
"This",
"means",
"that",
"when",
"down... | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Migrate/Module.php#L320-L363 |
203,123 | agentmedia/phine-core | src/Core/Logic/Module/FrontendForm.php | FrontendForm.AddUniqueSubmit | protected function AddUniqueSubmit($label)
{
$name = $label . '-' . $this->Content()->GetID();
$fullLabel = $this->Label($label);
$this->AddSubmit($name, Trans($fullLabel));
} | php | protected function AddUniqueSubmit($label)
{
$name = $label . '-' . $this->Content()->GetID();
$fullLabel = $this->Label($label);
$this->AddSubmit($name, Trans($fullLabel));
} | [
"protected",
"function",
"AddUniqueSubmit",
"(",
"$",
"label",
")",
"{",
"$",
"name",
"=",
"$",
"label",
".",
"'-'",
".",
"$",
"this",
"->",
"Content",
"(",
")",
"->",
"GetID",
"(",
")",
";",
"$",
"fullLabel",
"=",
"$",
"this",
"->",
"Label",
"(",
... | Adds a submit button with a unique name
@param string $label The wording label used for the submit button | [
"Adds",
"a",
"submit",
"button",
"with",
"a",
"unique",
"name"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Module/FrontendForm.php#L12-L17 |
203,124 | mullanaphy/variable | src/PHY/Variable/Obj.php | Obj.toArray | public function toArray()
{
$class = $this->get();
$class = (array)$class;
foreach ($class as $key => $value) {
if (is_object($value)) {
$class[$key] = (new static($value))->toArray();
}
}
re... | php | public function toArray()
{
$class = $this->get();
$class = (array)$class;
foreach ($class as $key => $value) {
if (is_object($value)) {
$class[$key] = (new static($value))->toArray();
}
}
re... | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"get",
"(",
")",
";",
"$",
"class",
"=",
"(",
"array",
")",
"$",
"class",
";",
"foreach",
"(",
"$",
"class",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
... | Recursively convert our object into an array.
@return array | [
"Recursively",
"convert",
"our",
"object",
"into",
"an",
"array",
"."
] | e4eb274a1799a25e33e5e21cd260603c74628031 | https://github.com/mullanaphy/variable/blob/e4eb274a1799a25e33e5e21cd260603c74628031/src/PHY/Variable/Obj.php#L88-L98 |
203,125 | Wedeto/Util | src/TypedDictionary.php | TypedDictionary.validateTypes | protected function validateTypes(Dictionary $types, $path = "")
{
$spath = empty($path) ? "" : $path . ".";
foreach ($types as $key => $value)
{
$kpath = $spath . $key;
if ($value instanceof Dictionary)
{
$this->validateTypes($value, $kpath... | php | protected function validateTypes(Dictionary $types, $path = "")
{
$spath = empty($path) ? "" : $path . ".";
foreach ($types as $key => $value)
{
$kpath = $spath . $key;
if ($value instanceof Dictionary)
{
$this->validateTypes($value, $kpath... | [
"protected",
"function",
"validateTypes",
"(",
"Dictionary",
"$",
"types",
",",
"$",
"path",
"=",
"\"\"",
")",
"{",
"$",
"spath",
"=",
"empty",
"(",
"$",
"path",
")",
"?",
"\"\"",
":",
"$",
"path",
".",
"\".\"",
";",
"foreach",
"(",
"$",
"types",
"... | Validate that all provided types are actually type validators
@param Dictionary $types The supplied type validators
@param string $path The key path, used for reporting errors | [
"Validate",
"that",
"all",
"provided",
"types",
"are",
"actually",
"type",
"validators"
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/TypedDictionary.php#L69-L90 |
203,126 | Wedeto/Util | src/TypedDictionary.php | TypedDictionary.setType | public function setType($key, $type)
{
$args = func_get_args();
$type = array_pop($args);
if (!($type instanceof Validator))
$type = new Validator($type);
if ($this->types->has($args))
{
$old_type = $this->types->get($args);
if ($old_typ... | php | public function setType($key, $type)
{
$args = func_get_args();
$type = array_pop($args);
if (!($type instanceof Validator))
$type = new Validator($type);
if ($this->types->has($args))
{
$old_type = $this->types->get($args);
if ($old_typ... | [
"public",
"function",
"setType",
"(",
"$",
"key",
",",
"$",
"type",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"type",
"=",
"array_pop",
"(",
"$",
"args",
")",
";",
"if",
"(",
"!",
"(",
"$",
"type",
"instanceof",
"Validator",
... | Add a type for a parameter
@param string $key The key to set a type for. Can be repeated to go deeper
@param Validator $type The type for the parameter
@return TypedDictionary Provides fluent interface | [
"Add",
"a",
"type",
"for",
"a",
"parameter"
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/TypedDictionary.php#L98-L118 |
203,127 | Wedeto/Util | src/TypedDictionary.php | TypedDictionary.set | public function set($key, $value)
{
if (is_array($key) && $value === null)
$args = $key;
else
$args = func_get_args();
$path = $args;
$value = array_pop($path);
$type = $this->types->dget($path);
$kpath = implode('.', $path);
// Key i... | php | public function set($key, $value)
{
if (is_array($key) && $value === null)
$args = $key;
else
$args = func_get_args();
$path = $args;
$value = array_pop($path);
$type = $this->types->dget($path);
$kpath = implode('.', $path);
// Key i... | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"key",
")",
"&&",
"$",
"value",
"===",
"null",
")",
"$",
"args",
"=",
"$",
"key",
";",
"else",
"$",
"args",
"=",
"func_get_args",
"(",
"... | Set a value, after type checking
@param string $key The key to set. Can be repeated to go deeper
@param mixed $value Whatever to set. Will be type checked
@return TypedDictionary Provides fluent interface | [
"Set",
"a",
"value",
"after",
"type",
"checking"
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/TypedDictionary.php#L126-L178 |
203,128 | Wedeto/Util | src/TypedDictionary.php | TypedDictionary.& | public function &dget($key, $default = null)
{
$args = WF::flatten_array(func_get_args());
if (func_num_args() > 1)
{
$default = array_pop($args);
if (!($default instanceof DefVal))
$default = new DefVal($default);
$args[] = $default;
... | php | public function &dget($key, $default = null)
{
$args = WF::flatten_array(func_get_args());
if (func_num_args() > 1)
{
$default = array_pop($args);
if (!($default instanceof DefVal))
$default = new DefVal($default);
$args[] = $default;
... | [
"public",
"function",
"&",
"dget",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"args",
"=",
"WF",
"::",
"flatten_array",
"(",
"func_get_args",
"(",
")",
")",
";",
"if",
"(",
"func_num_args",
"(",
")",
">",
"1",
")",
"{",
"$"... | We override dget as dget returns a reference, allowing the
TypedDictionary to be modified from the outside. This avoids the checks,
so this needs to be disallowed.
@param string $key The key to set. Can be repeated to go deeper
@param mixed $default A default value to return in absence | [
"We",
"override",
"dget",
"as",
"dget",
"returns",
"a",
"reference",
"allowing",
"the",
"TypedDictionary",
"to",
"be",
"modified",
"from",
"the",
"outside",
".",
"This",
"avoids",
"the",
"checks",
"so",
"this",
"needs",
"to",
"be",
"disallowed",
"."
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/TypedDictionary.php#L188-L220 |
203,129 | Wedeto/Util | src/TypedDictionary.php | TypedDictionary.addAll | public function addAll($values)
{
foreach ($values as $key => $value)
$this->set($key, $value);
return $this;
} | php | public function addAll($values)
{
foreach ($values as $key => $value)
$this->set($key, $value);
return $this;
} | [
"public",
"function",
"addAll",
"(",
"$",
"values",
")",
"{",
"foreach",
"(",
"$",
"values",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"$",
"this",
"->",
"set",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Add all provided values, checking their types
@param array $values Array with values.
@return TypedDictionary Provides fluent interface | [
"Add",
"all",
"provided",
"values",
"checking",
"their",
"types"
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/TypedDictionary.php#L227-L232 |
203,130 | Wedeto/Util | src/TypedDictionary.php | TypedDictionary.wrap | public static function wrap(array &$values)
{
$types = new Dictionary;
self::determineTypes($values, $types);
return new TypedDictionary($types, $values);
} | php | public static function wrap(array &$values)
{
$types = new Dictionary;
self::determineTypes($values, $types);
return new TypedDictionary($types, $values);
} | [
"public",
"static",
"function",
"wrap",
"(",
"array",
"&",
"$",
"values",
")",
"{",
"$",
"types",
"=",
"new",
"Dictionary",
";",
"self",
"::",
"determineTypes",
"(",
"$",
"values",
",",
"$",
"types",
")",
";",
"return",
"new",
"TypedDictionary",
"(",
"... | Customize wrapping of the TypedDictionary - the wrapped array can still
be modified externally so we need to make sure the appropriate types are
propagated
@throws RuntimeException Always | [
"Customize",
"wrapping",
"of",
"the",
"TypedDictionary",
"-",
"the",
"wrapped",
"array",
"can",
"still",
"be",
"modified",
"externally",
"so",
"we",
"need",
"to",
"make",
"sure",
"the",
"appropriate",
"types",
"are",
"propagated"
] | 0e080251bbaa8e7d91ae8d02eb79c029c976744a | https://github.com/Wedeto/Util/blob/0e080251bbaa8e7d91ae8d02eb79c029c976744a/src/TypedDictionary.php#L296-L302 |
203,131 | mwyatt/core | src/FileSystem.php | FileSystem.globRecursive | private function globRecursive($pattern)
{
$paths = glob($pattern);
foreach ($paths as $path) {
if (strpos($path, '.') === false) {
$paths = array_merge($paths, $this->globRecursive($path . '/*'));
}
}
return $paths;
} | php | private function globRecursive($pattern)
{
$paths = glob($pattern);
foreach ($paths as $path) {
if (strpos($path, '.') === false) {
$paths = array_merge($paths, $this->globRecursive($path . '/*'));
}
}
return $paths;
} | [
"private",
"function",
"globRecursive",
"(",
"$",
"pattern",
")",
"{",
"$",
"paths",
"=",
"glob",
"(",
"$",
"pattern",
")",
";",
"foreach",
"(",
"$",
"paths",
"as",
"$",
"path",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"path",
",",
"'.'",
")",
"=... | watch out can be slow!
4.75s for 20k paths
@param string $pattern '/*'
@return array paths | [
"watch",
"out",
"can",
"be",
"slow!",
"4",
".",
"75s",
"for",
"20k",
"paths"
] | 8ea9d67cc84fe6aff17a469c703d5492dbcd93ed | https://github.com/mwyatt/core/blob/8ea9d67cc84fe6aff17a469c703d5492dbcd93ed/src/FileSystem.php#L99-L108 |
203,132 | phossa/phossa-cache | src/Phossa/Cache/Driver/CompositeDriver.php | CompositeDriver.get | public function get(/*# string */ $key)/*# : string */
{
// try front-end cache first
if ($this->frontHas($key)) {
return $this->front->get($key);
}
// get from backend cache
return $this->back->get($key);
} | php | public function get(/*# string */ $key)/*# : string */
{
// try front-end cache first
if ($this->frontHas($key)) {
return $this->front->get($key);
}
// get from backend cache
return $this->back->get($key);
} | [
"public",
"function",
"get",
"(",
"/*# string */",
"$",
"key",
")",
"/*# : string */",
"{",
"// try front-end cache first",
"if",
"(",
"$",
"this",
"->",
"frontHas",
"(",
"$",
"key",
")",
")",
"{",
"return",
"$",
"this",
"->",
"front",
"->",
"get",
"(",
... | Either end get ok is ok
{@inheritDoc} | [
"Either",
"end",
"get",
"ok",
"is",
"ok"
] | ad86bee9c5c646fbae09f6f58a346b379d16276e | https://github.com/phossa/phossa-cache/blob/ad86bee9c5c646fbae09f6f58a346b379d16276e/src/Phossa/Cache/Driver/CompositeDriver.php#L127-L136 |
203,133 | phossa/phossa-cache | src/Phossa/Cache/Driver/CompositeDriver.php | CompositeDriver.has | public function has(/*# string */ $key)/*# : int */
{
// try front-end cache first
$res = $this->frontHas($key);
if ($res) {
return $res;
}
// try backend cache
return $this->backHas($key);
} | php | public function has(/*# string */ $key)/*# : int */
{
// try front-end cache first
$res = $this->frontHas($key);
if ($res) {
return $res;
}
// try backend cache
return $this->backHas($key);
} | [
"public",
"function",
"has",
"(",
"/*# string */",
"$",
"key",
")",
"/*# : int */",
"{",
"// try front-end cache first",
"$",
"res",
"=",
"$",
"this",
"->",
"frontHas",
"(",
"$",
"key",
")",
";",
"if",
"(",
"$",
"res",
")",
"{",
"return",
"$",
"res",
"... | Either end has is ok
{inheritDoc} | [
"Either",
"end",
"has",
"is",
"ok"
] | ad86bee9c5c646fbae09f6f58a346b379d16276e | https://github.com/phossa/phossa-cache/blob/ad86bee9c5c646fbae09f6f58a346b379d16276e/src/Phossa/Cache/Driver/CompositeDriver.php#L169-L179 |
203,134 | phossa/phossa-cache | src/Phossa/Cache/Driver/CompositeDriver.php | CompositeDriver.clear | public function clear()/*# : bool */
{
$ends = [ $this->front, $this->back ];
foreach ($ends as $end) {
if (!$end->clear()) {
return $this->falseAndSetError(
$end->getError(),
$end->getErrorCode()
);
}
... | php | public function clear()/*# : bool */
{
$ends = [ $this->front, $this->back ];
foreach ($ends as $end) {
if (!$end->clear()) {
return $this->falseAndSetError(
$end->getError(),
$end->getErrorCode()
);
}
... | [
"public",
"function",
"clear",
"(",
")",
"/*# : bool */",
"{",
"$",
"ends",
"=",
"[",
"$",
"this",
"->",
"front",
",",
"$",
"this",
"->",
"back",
"]",
";",
"foreach",
"(",
"$",
"ends",
"as",
"$",
"end",
")",
"{",
"if",
"(",
"!",
"$",
"end",
"->... | Need both ends clear ok
{@inheritDoc} | [
"Need",
"both",
"ends",
"clear",
"ok"
] | ad86bee9c5c646fbae09f6f58a346b379d16276e | https://github.com/phossa/phossa-cache/blob/ad86bee9c5c646fbae09f6f58a346b379d16276e/src/Phossa/Cache/Driver/CompositeDriver.php#L186-L198 |
203,135 | phossa/phossa-cache | src/Phossa/Cache/Driver/CompositeDriver.php | CompositeDriver.delete | public function delete(/*# string */ $key)/*# : bool */
{
$ends = [ $this->front, $this->back ];
foreach ($ends as $end) {
if (!$end->delete($key)) {
return $this->falseAndSetError(
$end->getError(),
$end->getErrorCode()
... | php | public function delete(/*# string */ $key)/*# : bool */
{
$ends = [ $this->front, $this->back ];
foreach ($ends as $end) {
if (!$end->delete($key)) {
return $this->falseAndSetError(
$end->getError(),
$end->getErrorCode()
... | [
"public",
"function",
"delete",
"(",
"/*# string */",
"$",
"key",
")",
"/*# : bool */",
"{",
"$",
"ends",
"=",
"[",
"$",
"this",
"->",
"front",
",",
"$",
"this",
"->",
"back",
"]",
";",
"foreach",
"(",
"$",
"ends",
"as",
"$",
"end",
")",
"{",
"if",... | Need both ends delete ok
{@inheritDoc} | [
"Need",
"both",
"ends",
"delete",
"ok"
] | ad86bee9c5c646fbae09f6f58a346b379d16276e | https://github.com/phossa/phossa-cache/blob/ad86bee9c5c646fbae09f6f58a346b379d16276e/src/Phossa/Cache/Driver/CompositeDriver.php#L205-L217 |
203,136 | phossa/phossa-cache | src/Phossa/Cache/Driver/CompositeDriver.php | CompositeDriver.commit | public function commit()/*# : bool */
{
$ends = [ $this->front, $this->back ];
$res = false;
foreach ($ends as $end) {
// commit failed, set error
if (!$end->commit()) {
$this->setError(
$end->getError(),
$end-... | php | public function commit()/*# : bool */
{
$ends = [ $this->front, $this->back ];
$res = false;
foreach ($ends as $end) {
// commit failed, set error
if (!$end->commit()) {
$this->setError(
$end->getError(),
$end-... | [
"public",
"function",
"commit",
"(",
")",
"/*# : bool */",
"{",
"$",
"ends",
"=",
"[",
"$",
"this",
"->",
"front",
",",
"$",
"this",
"->",
"back",
"]",
";",
"$",
"res",
"=",
"false",
";",
"foreach",
"(",
"$",
"ends",
"as",
"$",
"end",
")",
"{",
... | One end commit ok is ok
{@inheritDoc} | [
"One",
"end",
"commit",
"ok",
"is",
"ok"
] | ad86bee9c5c646fbae09f6f58a346b379d16276e | https://github.com/phossa/phossa-cache/blob/ad86bee9c5c646fbae09f6f58a346b379d16276e/src/Phossa/Cache/Driver/CompositeDriver.php#L240-L260 |
203,137 | phossa/phossa-cache | src/Phossa/Cache/Driver/CompositeDriver.php | CompositeDriver.purge | public function purge(/*# int */ $maxlife)/*# : bool */
{
$ends = [ $this->front, $this->back ];
foreach ($ends as $end) {
if (!$end->purge($maxlife)) {
return $this->falseAndSetError(
$end->getError(),
$end->getErrorCode()
... | php | public function purge(/*# int */ $maxlife)/*# : bool */
{
$ends = [ $this->front, $this->back ];
foreach ($ends as $end) {
if (!$end->purge($maxlife)) {
return $this->falseAndSetError(
$end->getError(),
$end->getErrorCode()
... | [
"public",
"function",
"purge",
"(",
"/*# int */",
"$",
"maxlife",
")",
"/*# : bool */",
"{",
"$",
"ends",
"=",
"[",
"$",
"this",
"->",
"front",
",",
"$",
"this",
"->",
"back",
"]",
";",
"foreach",
"(",
"$",
"ends",
"as",
"$",
"end",
")",
"{",
"if",... | Need both ends purge ok
{@inheritDoc} | [
"Need",
"both",
"ends",
"purge",
"ok"
] | ad86bee9c5c646fbae09f6f58a346b379d16276e | https://github.com/phossa/phossa-cache/blob/ad86bee9c5c646fbae09f6f58a346b379d16276e/src/Phossa/Cache/Driver/CompositeDriver.php#L267-L279 |
203,138 | phossa/phossa-cache | src/Phossa/Cache/Driver/CompositeDriver.php | CompositeDriver.protectedSave | protected function protectedSave(
CacheItemInterface $item,
$function = 'save'
)/*# : bool */ {
// write to both ?
$func = $this->tester;
$both = $func($item);
// if $both is true, write to front
$res1 = false;
if ($both) {
if ($this->fron... | php | protected function protectedSave(
CacheItemInterface $item,
$function = 'save'
)/*# : bool */ {
// write to both ?
$func = $this->tester;
$both = $func($item);
// if $both is true, write to front
$res1 = false;
if ($both) {
if ($this->fron... | [
"protected",
"function",
"protectedSave",
"(",
"CacheItemInterface",
"$",
"item",
",",
"$",
"function",
"=",
"'save'",
")",
"/*# : bool */",
"{",
"// write to both ?",
"$",
"func",
"=",
"$",
"this",
"->",
"tester",
";",
"$",
"both",
"=",
"$",
"func",
"(",
... | local save method, one end save ok is ok
@param CacheItemInterface $item
@param string $function save or saveDeferred
@return bool
@access protected | [
"local",
"save",
"method",
"one",
"end",
"save",
"ok",
"is",
"ok"
] | ad86bee9c5c646fbae09f6f58a346b379d16276e | https://github.com/phossa/phossa-cache/blob/ad86bee9c5c646fbae09f6f58a346b379d16276e/src/Phossa/Cache/Driver/CompositeDriver.php#L299-L332 |
203,139 | PascalKleindienst/simple-api-client | src/Model.php | Model.fill | private function fill($attributes)
{
// json
if (is_string($attributes)) {
$attributes = json_decode($attributes, true);
}
// check if attributes are valid
if (!is_array($attributes)) {
throw new \InvalidArgumentException('Attributes must be of type a... | php | private function fill($attributes)
{
// json
if (is_string($attributes)) {
$attributes = json_decode($attributes, true);
}
// check if attributes are valid
if (!is_array($attributes)) {
throw new \InvalidArgumentException('Attributes must be of type a... | [
"private",
"function",
"fill",
"(",
"$",
"attributes",
")",
"{",
"// json",
"if",
"(",
"is_string",
"(",
"$",
"attributes",
")",
")",
"{",
"$",
"attributes",
"=",
"json_decode",
"(",
"$",
"attributes",
",",
"true",
")",
";",
"}",
"// check if attributes ar... | Fill the attributes
@param string|array $attributes
@return void | [
"Fill",
"the",
"attributes"
] | f4e20aa65bb9c340b8aff78acaede7dc62cd2105 | https://github.com/PascalKleindienst/simple-api-client/blob/f4e20aa65bb9c340b8aff78acaede7dc62cd2105/src/Model.php#L35-L50 |
203,140 | PascalKleindienst/simple-api-client | src/Model.php | Model.makeCollection | public function makeCollection(array $values, $class = null)
{
$collection = new Collection($values);
if (!is_null($class) && class_exists($class)) {
$model = new $class();
if ($model instanceof Model) {
foreach ($collection as $key => $item) {
... | php | public function makeCollection(array $values, $class = null)
{
$collection = new Collection($values);
if (!is_null($class) && class_exists($class)) {
$model = new $class();
if ($model instanceof Model) {
foreach ($collection as $key => $item) {
... | [
"public",
"function",
"makeCollection",
"(",
"array",
"$",
"values",
",",
"$",
"class",
"=",
"null",
")",
"{",
"$",
"collection",
"=",
"new",
"Collection",
"(",
"$",
"values",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"class",
")",
"&&",
"class_... | Transform an array of values into a collection of models
@param array $values
@param null $class
@return \Illuminate\Support\Collection | [
"Transform",
"an",
"array",
"of",
"values",
"into",
"a",
"collection",
"of",
"models"
] | f4e20aa65bb9c340b8aff78acaede7dc62cd2105 | https://github.com/PascalKleindienst/simple-api-client/blob/f4e20aa65bb9c340b8aff78acaede7dc62cd2105/src/Model.php#L161-L176 |
203,141 | MichaelRShelton/attribute-translator | src/Providers/AttributeTranslatorServiceProvider.php | AttributeTranslatorServiceProvider.registerService | public function registerService()
{
$this->app->bind('mrs.attributes.translator', function ($attributeMap = []) {
return new AttributeTranslator($attributeMap);
});
$this->app->alias('mrs.attributes.translator', 'attributes.translator');
$this->app->alias('mrs.attributes.... | php | public function registerService()
{
$this->app->bind('mrs.attributes.translator', function ($attributeMap = []) {
return new AttributeTranslator($attributeMap);
});
$this->app->alias('mrs.attributes.translator', 'attributes.translator');
$this->app->alias('mrs.attributes.... | [
"public",
"function",
"registerService",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"bind",
"(",
"'mrs.attributes.translator'",
",",
"function",
"(",
"$",
"attributeMap",
"=",
"[",
"]",
")",
"{",
"return",
"new",
"AttributeTranslator",
"(",
"$",
"attribu... | Register services to the application container. | [
"Register",
"services",
"to",
"the",
"application",
"container",
"."
] | 48a0ef01058647eeeeeeb8954f93b479bd713b82 | https://github.com/MichaelRShelton/attribute-translator/blob/48a0ef01058647eeeeeeb8954f93b479bd713b82/src/Providers/AttributeTranslatorServiceProvider.php#L46-L53 |
203,142 | Palmabit-IT/library | src/Palmabit/Library/ImportExport/CsvFileReader.php | CsvFileReader.readElement | public function readElement()
{
$csv_line_data = $this->spl_file_object->fgetcsv();
if($csv_line_data)
{
$csv_line_data[0] = $this->convertToUtf8($csv_line_data);
if($this->isValidLine($csv_line_data))
{
$csv_line = array_combine($this->columns_name, $csv_line_data);
... | php | public function readElement()
{
$csv_line_data = $this->spl_file_object->fgetcsv();
if($csv_line_data)
{
$csv_line_data[0] = $this->convertToUtf8($csv_line_data);
if($this->isValidLine($csv_line_data))
{
$csv_line = array_combine($this->columns_name, $csv_line_data);
... | [
"public",
"function",
"readElement",
"(",
")",
"{",
"$",
"csv_line_data",
"=",
"$",
"this",
"->",
"spl_file_object",
"->",
"fgetcsv",
"(",
")",
";",
"if",
"(",
"$",
"csv_line_data",
")",
"{",
"$",
"csv_line_data",
"[",
"0",
"]",
"=",
"$",
"this",
"->",... | Reads a single element from the source
then return a Object instance
@return \StdClass|false object instance | [
"Reads",
"a",
"single",
"element",
"from",
"the",
"source",
"then",
"return",
"a",
"Object",
"instance"
] | ec49a3c333eb4e94d9610a0f58d82c9ea1ade4b9 | https://github.com/Palmabit-IT/library/blob/ec49a3c333eb4e94d9610a0f58d82c9ea1ade4b9/src/Palmabit/Library/ImportExport/CsvFileReader.php#L50-L65 |
203,143 | Palmabit-IT/library | src/Palmabit/Library/ImportExport/CsvFileReader.php | CsvFileReader.readElements | public function readElements()
{
$iterator = new ArrayIterator;
do
{
$object = $this->readElement();
if($object) $iterator->append($object);
} while((boolean)$object);
$this->objects = $iterator;
return $this->objects;
} | php | public function readElements()
{
$iterator = new ArrayIterator;
do
{
$object = $this->readElement();
if($object) $iterator->append($object);
} while((boolean)$object);
$this->objects = $iterator;
return $this->objects;
} | [
"public",
"function",
"readElements",
"(",
")",
"{",
"$",
"iterator",
"=",
"new",
"ArrayIterator",
";",
"do",
"{",
"$",
"object",
"=",
"$",
"this",
"->",
"readElement",
"(",
")",
";",
"if",
"(",
"$",
"object",
")",
"$",
"iterator",
"->",
"append",
"(... | Read all the objects from the source
@return \ArrayIterator | [
"Read",
"all",
"the",
"objects",
"from",
"the",
"source"
] | ec49a3c333eb4e94d9610a0f58d82c9ea1ade4b9 | https://github.com/Palmabit-IT/library/blob/ec49a3c333eb4e94d9610a0f58d82c9ea1ade4b9/src/Palmabit/Library/ImportExport/CsvFileReader.php#L81-L92 |
203,144 | Aviogram/Common | src/Hydrator/ByConfigBuilder.php | ByConfigBuilder.addField | public function addField($fieldName, $getMethod, $setMethod, ByConfigBuilder $include = null, $formatter = null)
{
if (method_exists($this->getEntityPrototype(), $getMethod) === false) {
throw new Exception\ConfigFailed(sprintf($this->exceptions[2], $getMethod, $this->entityClassName), 2);
... | php | public function addField($fieldName, $getMethod, $setMethod, ByConfigBuilder $include = null, $formatter = null)
{
if (method_exists($this->getEntityPrototype(), $getMethod) === false) {
throw new Exception\ConfigFailed(sprintf($this->exceptions[2], $getMethod, $this->entityClassName), 2);
... | [
"public",
"function",
"addField",
"(",
"$",
"fieldName",
",",
"$",
"getMethod",
",",
"$",
"setMethod",
",",
"ByConfigBuilder",
"$",
"include",
"=",
"null",
",",
"$",
"formatter",
"=",
"null",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"this",
"->",
... | Set a mapping
@param string $fieldName
@param string $getMethod
@param string $setMethod
@param ByConfigBuilder $include
@param Closure $formatter
@return $this | [
"Set",
"a",
"mapping"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/Hydrator/ByConfigBuilder.php#L91-L109 |
203,145 | Aviogram/Common | src/Hydrator/ByConfigBuilder.php | ByConfigBuilder.isInclude | public function isInclude($fieldName)
{
if ($this->hasField($fieldName) === false) {
return false;
}
$class = __CLASS__;
return ($this->mapping[$fieldName]['include'] instanceof $class);
} | php | public function isInclude($fieldName)
{
if ($this->hasField($fieldName) === false) {
return false;
}
$class = __CLASS__;
return ($this->mapping[$fieldName]['include'] instanceof $class);
} | [
"public",
"function",
"isInclude",
"(",
"$",
"fieldName",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasField",
"(",
"$",
"fieldName",
")",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"$",
"class",
"=",
"__CLASS__",
";",
"return",
"(",
"$",
... | Check if the given fieldName is an include
@param string $fieldName
@return bool TRUE on include | FALSE when field does not exists or field is not a include | [
"Check",
"if",
"the",
"given",
"fieldName",
"is",
"an",
"include"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/Hydrator/ByConfigBuilder.php#L130-L139 |
203,146 | Aviogram/Common | src/Hydrator/ByConfigBuilder.php | ByConfigBuilder.getSetter | public function getSetter($fieldName)
{
if ($this->hasField($fieldName) === false) {
return false;
}
return $this->mapping[$fieldName]['setter'];
} | php | public function getSetter($fieldName)
{
if ($this->hasField($fieldName) === false) {
return false;
}
return $this->mapping[$fieldName]['setter'];
} | [
"public",
"function",
"getSetter",
"(",
"$",
"fieldName",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasField",
"(",
"$",
"fieldName",
")",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"mapping",
"[",
"$",
"fieldN... | Return the setter name
@param string $fieldName
@return string | bool FALSE when field does not exists | [
"Return",
"the",
"setter",
"name"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/Hydrator/ByConfigBuilder.php#L148-L155 |
203,147 | Aviogram/Common | src/Hydrator/ByConfigBuilder.php | ByConfigBuilder.getGetter | public function getGetter($fieldName)
{
if ($this->hasField($fieldName) === false)
{
return false;
}
return $this->mapping[$fieldName]['getter'];
} | php | public function getGetter($fieldName)
{
if ($this->hasField($fieldName) === false)
{
return false;
}
return $this->mapping[$fieldName]['getter'];
} | [
"public",
"function",
"getGetter",
"(",
"$",
"fieldName",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasField",
"(",
"$",
"fieldName",
")",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"mapping",
"[",
"$",
"fieldN... | Return the getter name
@param string $fieldName
@return string | bool FALSE when field does not exists | [
"Return",
"the",
"getter",
"name"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/Hydrator/ByConfigBuilder.php#L164-L171 |
203,148 | Aviogram/Common | src/Hydrator/ByConfigBuilder.php | ByConfigBuilder.getInclude | public function getInclude($fieldName)
{
if ($this->isInclude($fieldName) === false) {
return false;
}
return $this->mapping[$fieldName]['include'];
} | php | public function getInclude($fieldName)
{
if ($this->isInclude($fieldName) === false) {
return false;
}
return $this->mapping[$fieldName]['include'];
} | [
"public",
"function",
"getInclude",
"(",
"$",
"fieldName",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isInclude",
"(",
"$",
"fieldName",
")",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"mapping",
"[",
"$",
"fiel... | Get the include config
@param string $fieldName
@return ByConfigBuilder | bool FALSE when fieldName is not a include | [
"Get",
"the",
"include",
"config"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/Hydrator/ByConfigBuilder.php#L180-L187 |
203,149 | Aviogram/Common | src/Hydrator/ByConfigBuilder.php | ByConfigBuilder.setCatchAllSetter | public function setCatchAllSetter($setMethod)
{
if (method_exists($this->getEntityPrototype(), $setMethod) === false) {
throw new Exception\ConfigFailed(sprintf($this->exceptions[2], $setMethod, $this->entityClassName), 2);
}
$this->catchAllSetter = $setMethod;
... | php | public function setCatchAllSetter($setMethod)
{
if (method_exists($this->getEntityPrototype(), $setMethod) === false) {
throw new Exception\ConfigFailed(sprintf($this->exceptions[2], $setMethod, $this->entityClassName), 2);
}
$this->catchAllSetter = $setMethod;
... | [
"public",
"function",
"setCatchAllSetter",
"(",
"$",
"setMethod",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"this",
"->",
"getEntityPrototype",
"(",
")",
",",
"$",
"setMethod",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"Config... | Sets an catchall Setter
@param string $setMethod
@return $this | [
"Sets",
"an",
"catchall",
"Setter"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/Hydrator/ByConfigBuilder.php#L244-L253 |
203,150 | ScaraMVC/Framework | src/Scara/Session/SessionInitializer.php | SessionInitializer.init | public static function init()
{
$c = new Configuration();
$cc = $c->from('app')->get('session');
if (strtolower($cc) == 'session') {
return new Session();
} elseif (strtolower($cc) == 'file') {
return new File();
} elseif (strtolower($cc) == 'cookie')... | php | public static function init()
{
$c = new Configuration();
$cc = $c->from('app')->get('session');
if (strtolower($cc) == 'session') {
return new Session();
} elseif (strtolower($cc) == 'file') {
return new File();
} elseif (strtolower($cc) == 'cookie')... | [
"public",
"static",
"function",
"init",
"(",
")",
"{",
"$",
"c",
"=",
"new",
"Configuration",
"(",
")",
";",
"$",
"cc",
"=",
"$",
"c",
"->",
"from",
"(",
"'app'",
")",
"->",
"get",
"(",
"'session'",
")",
";",
"if",
"(",
"strtolower",
"(",
"$",
... | Initializes session handler.
@return mixed | [
"Initializes",
"session",
"handler",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Session/SessionInitializer.php#L17-L31 |
203,151 | kambalabs/KmbPuppetDb | src/KmbPuppetDb/Service/Node.php | Node.getByName | public function getByName($name)
{
$response = $this->getPuppetDbClient()->send(new KmbPuppetDb\Request('/nodes/' . $name));
return $this->createNodeFromData($response->getData());
} | php | public function getByName($name)
{
$response = $this->getPuppetDbClient()->send(new KmbPuppetDb\Request('/nodes/' . $name));
return $this->createNodeFromData($response->getData());
} | [
"public",
"function",
"getByName",
"(",
"$",
"name",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"getPuppetDbClient",
"(",
")",
"->",
"send",
"(",
"new",
"KmbPuppetDb",
"\\",
"Request",
"(",
"'/nodes/'",
".",
"$",
"name",
")",
")",
";",
"return"... | Retrieves a node by its name.
@param string $name
@return Model\NodeInterface
@throws InvalidArgumentException | [
"Retrieves",
"a",
"node",
"by",
"its",
"name",
"."
] | df56a275cf00f4402cf121a2e99149168f1f8b2d | https://github.com/kambalabs/KmbPuppetDb/blob/df56a275cf00f4402cf121a2e99149168f1f8b2d/src/KmbPuppetDb/Service/Node.php#L59-L63 |
203,152 | romm/configuration_object | Classes/Core/Service/CacheService.php | CacheService.registerInternalCache | public function registerInternalCache()
{
$cacheManager = $this->getCacheManager();
if (false === $cacheManager->hasCache(self::CACHE_IDENTIFIER)) {
$cacheManager->setCacheConfigurations([self::CACHE_IDENTIFIER => $this->cacheOptions]);
}
} | php | public function registerInternalCache()
{
$cacheManager = $this->getCacheManager();
if (false === $cacheManager->hasCache(self::CACHE_IDENTIFIER)) {
$cacheManager->setCacheConfigurations([self::CACHE_IDENTIFIER => $this->cacheOptions]);
}
} | [
"public",
"function",
"registerInternalCache",
"(",
")",
"{",
"$",
"cacheManager",
"=",
"$",
"this",
"->",
"getCacheManager",
"(",
")",
";",
"if",
"(",
"false",
"===",
"$",
"cacheManager",
"->",
"hasCache",
"(",
"self",
"::",
"CACHE_IDENTIFIER",
")",
")",
... | Function called from `ext_localconf` file which will register the
internal cache earlier.
@internal | [
"Function",
"called",
"from",
"ext_localconf",
"file",
"which",
"will",
"register",
"the",
"internal",
"cache",
"earlier",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Core/Service/CacheService.php#L50-L57 |
203,153 | romm/configuration_object | Classes/Core/Service/CacheService.php | CacheService.registerDynamicCaches | public function registerDynamicCaches()
{
$dynamicCaches = $this->getCache()->getByTag(self::CACHE_TAG_DYNAMIC_CACHE);
foreach ($dynamicCaches as $cacheData) {
$identifier = $cacheData['identifier'];
$options = $cacheData['options'];
$this->registerCacheInternal... | php | public function registerDynamicCaches()
{
$dynamicCaches = $this->getCache()->getByTag(self::CACHE_TAG_DYNAMIC_CACHE);
foreach ($dynamicCaches as $cacheData) {
$identifier = $cacheData['identifier'];
$options = $cacheData['options'];
$this->registerCacheInternal... | [
"public",
"function",
"registerDynamicCaches",
"(",
")",
"{",
"$",
"dynamicCaches",
"=",
"$",
"this",
"->",
"getCache",
"(",
")",
"->",
"getByTag",
"(",
"self",
"::",
"CACHE_TAG_DYNAMIC_CACHE",
")",
";",
"foreach",
"(",
"$",
"dynamicCaches",
"as",
"$",
"cach... | This function will take care of initializing all caches that were defined
previously by the `CacheService` which allows dynamic caches to be used
for every configuration object type.
@see \Romm\ConfigurationObject\Service\Items\Cache\CacheService::initialize()
@internal | [
"This",
"function",
"will",
"take",
"care",
"of",
"initializing",
"all",
"caches",
"that",
"were",
"defined",
"previously",
"by",
"the",
"CacheService",
"which",
"allows",
"dynamic",
"caches",
"to",
"be",
"used",
"for",
"every",
"configuration",
"object",
"type"... | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Core/Service/CacheService.php#L67-L77 |
203,154 | Wedeto/HTML | src/AssetManager.php | AssetManager.injectInstance | public static function injectInstance(Resolver $resolver)
{
$sub = $resolver->getResolver('assets');
return $sub !== null ? new static($sub) : null;
} | php | public static function injectInstance(Resolver $resolver)
{
$sub = $resolver->getResolver('assets');
return $sub !== null ? new static($sub) : null;
} | [
"public",
"static",
"function",
"injectInstance",
"(",
"Resolver",
"$",
"resolver",
")",
"{",
"$",
"sub",
"=",
"$",
"resolver",
"->",
"getResolver",
"(",
"'assets'",
")",
";",
"return",
"$",
"sub",
"!==",
"null",
"?",
"new",
"static",
"(",
"$",
"sub",
... | Generate an instance for the injector | [
"Generate",
"an",
"instance",
"for",
"the",
"injector"
] | 9e725288098c42d0d2953a929faebe628ff4e389 | https://github.com/Wedeto/HTML/blob/9e725288098c42d0d2953a929faebe628ff4e389/src/AssetManager.php#L96-L100 |
203,155 | Wedeto/HTML | src/AssetManager.php | AssetManager.addScript | public function addScript(string $script, $depends = null)
{
$script = $this->stripSuffix($script, ".min", ".js");
$this->scripts[$script] = array("path" => $script, "depends" => $depends);
return $this;
} | php | public function addScript(string $script, $depends = null)
{
$script = $this->stripSuffix($script, ".min", ".js");
$this->scripts[$script] = array("path" => $script, "depends" => $depends);
return $this;
} | [
"public",
"function",
"addScript",
"(",
"string",
"$",
"script",
",",
"$",
"depends",
"=",
"null",
")",
"{",
"$",
"script",
"=",
"$",
"this",
"->",
"stripSuffix",
"(",
"$",
"script",
",",
"\".min\"",
",",
"\".js\"",
")",
";",
"$",
"this",
"->",
"scri... | Add a javascript file to be loaded. This will strip the .min and .js suffixes
and add them to the stack of included scripts.
@param string $script The script to be loaded
@return AssetManager Provides fluent interface | [
"Add",
"a",
"javascript",
"file",
"to",
"be",
"loaded",
".",
"This",
"will",
"strip",
"the",
".",
"min",
"and",
".",
"js",
"suffixes",
"and",
"add",
"them",
"to",
"the",
"stack",
"of",
"included",
"scripts",
"."
] | 9e725288098c42d0d2953a929faebe628ff4e389 | https://github.com/Wedeto/HTML/blob/9e725288098c42d0d2953a929faebe628ff4e389/src/AssetManager.php#L167-L172 |
203,156 | Wedeto/HTML | src/AssetManager.php | AssetManager.addCSS | public function addCSS(string $stylesheet, $media = "screen")
{
$stylesheet = $this->stripSuffix($stylesheet, ".min", ".css");
$this->CSS[$stylesheet] = array("path" => $stylesheet, "media" => $media);
return $this;
} | php | public function addCSS(string $stylesheet, $media = "screen")
{
$stylesheet = $this->stripSuffix($stylesheet, ".min", ".css");
$this->CSS[$stylesheet] = array("path" => $stylesheet, "media" => $media);
return $this;
} | [
"public",
"function",
"addCSS",
"(",
"string",
"$",
"stylesheet",
",",
"$",
"media",
"=",
"\"screen\"",
")",
"{",
"$",
"stylesheet",
"=",
"$",
"this",
"->",
"stripSuffix",
"(",
"$",
"stylesheet",
",",
"\".min\"",
",",
"\".css\"",
")",
";",
"$",
"this",
... | Add a CSS stylesheet to be loaded. This will strip the .min and .css suffixes
and add them to the stack of included stylesheets.
@param string $style The style sheet to be loaded
@return AssetManager Provides fluent interface | [
"Add",
"a",
"CSS",
"stylesheet",
"to",
"be",
"loaded",
".",
"This",
"will",
"strip",
"the",
".",
"min",
"and",
".",
"css",
"suffixes",
"and",
"add",
"them",
"to",
"the",
"stack",
"of",
"included",
"stylesheets",
"."
] | 9e725288098c42d0d2953a929faebe628ff4e389 | https://github.com/Wedeto/HTML/blob/9e725288098c42d0d2953a929faebe628ff4e389/src/AssetManager.php#L189-L194 |
203,157 | Wedeto/HTML | src/AssetManager.php | AssetManager.addVariable | public function addVariable(string $name, $value)
{
// Convert value to something usable in the output
if (WF::is_array_like($value))
{
$value = WF::to_array($value);
}
elseif (is_subclass_of($value, JSONSerializable::class))
{
$value = $value-... | php | public function addVariable(string $name, $value)
{
// Convert value to something usable in the output
if (WF::is_array_like($value))
{
$value = WF::to_array($value);
}
elseif (is_subclass_of($value, JSONSerializable::class))
{
$value = $value-... | [
"public",
"function",
"addVariable",
"(",
"string",
"$",
"name",
",",
"$",
"value",
")",
"{",
"// Convert value to something usable in the output",
"if",
"(",
"WF",
"::",
"is_array_like",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"WF",
"::",
"to_a... | Add a javascript variable to be added to the output document. A script will
be generated to definie these variables on page load.
@param string $name The name of the variable. Must be a valid javascript
variable name.
@param mixed The value to set. Should be scalar, array or JSONSerializable | [
"Add",
"a",
"javascript",
"variable",
"to",
"be",
"added",
"to",
"the",
"output",
"document",
".",
"A",
"script",
"will",
"be",
"generated",
"to",
"definie",
"these",
"variables",
"on",
"page",
"load",
"."
] | 9e725288098c42d0d2953a929faebe628ff4e389 | https://github.com/Wedeto/HTML/blob/9e725288098c42d0d2953a929faebe628ff4e389/src/AssetManager.php#L231-L249 |
203,158 | Wedeto/HTML | src/AssetManager.php | AssetManager.stripSuffix | protected function stripSuffix(string $path, string $suffix1, string $suffix2)
{
if (substr($path, -strlen($suffix2)) === $suffix2)
$path = substr($path, 0, -strlen($suffix2));
if (substr($path, -strlen($suffix1)) === $suffix1)
$path = substr($path, 0, -strlen($suffix1));
... | php | protected function stripSuffix(string $path, string $suffix1, string $suffix2)
{
if (substr($path, -strlen($suffix2)) === $suffix2)
$path = substr($path, 0, -strlen($suffix2));
if (substr($path, -strlen($suffix1)) === $suffix1)
$path = substr($path, 0, -strlen($suffix1));
... | [
"protected",
"function",
"stripSuffix",
"(",
"string",
"$",
"path",
",",
"string",
"$",
"suffix1",
",",
"string",
"$",
"suffix2",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"path",
",",
"-",
"strlen",
"(",
"$",
"suffix2",
")",
")",
"===",
"$",
"suffix2... | Remove the suffix from a file name, such as .min.css or .min.js
@param string $path The file to strip
@param string $suffix1 One suffix to strip. This one is stripped after
the second, so it should come second-last.
This probably should be .min
@param string $suffix2 Another suffix to strip. This one is stripped
from t... | [
"Remove",
"the",
"suffix",
"from",
"a",
"file",
"name",
"such",
"as",
".",
"min",
".",
"css",
"or",
".",
"min",
".",
"js"
] | 9e725288098c42d0d2953a929faebe628ff4e389 | https://github.com/Wedeto/HTML/blob/9e725288098c42d0d2953a929faebe628ff4e389/src/AssetManager.php#L270-L277 |
203,159 | Wedeto/HTML | src/AssetManager.php | AssetManager.executeHook | public function executeHook(Dictionary $params)
{
$responder = $params['responder'] ?? null;
$mime = $params['mime'] ?? null;
$result = empty($responder) ? null : $responder->getResult();
$response = empty($result) ? null : $result->getResponse();
if ($response instanceof H... | php | public function executeHook(Dictionary $params)
{
$responder = $params['responder'] ?? null;
$mime = $params['mime'] ?? null;
$result = empty($responder) ? null : $responder->getResult();
$response = empty($result) ? null : $result->getResponse();
if ($response instanceof H... | [
"public",
"function",
"executeHook",
"(",
"Dictionary",
"$",
"params",
")",
"{",
"$",
"responder",
"=",
"$",
"params",
"[",
"'responder'",
"]",
"??",
"null",
";",
"$",
"mime",
"=",
"$",
"params",
"[",
"'mime'",
"]",
"??",
"null",
";",
"$",
"result",
... | Execute the hook to replace the Javascript and CSS tokens in the HTTP Responder. This will
be called by Wedeto\Util\Hook through Wedeto\HTTP. It can be called directly
when you want to replace the content at a different time.
@param Dictionary $params The parameters. Should contain a key 'response' and 'mime'. The res | [
"Execute",
"the",
"hook",
"to",
"replace",
"the",
"Javascript",
"and",
"CSS",
"tokens",
"in",
"the",
"HTTP",
"Responder",
".",
"This",
"will",
"be",
"called",
"by",
"Wedeto",
"\\",
"Util",
"\\",
"Hook",
"through",
"Wedeto",
"\\",
"HTTP",
".",
"It",
"can"... | 9e725288098c42d0d2953a929faebe628ff4e389 | https://github.com/Wedeto/HTML/blob/9e725288098c42d0d2953a929faebe628ff4e389/src/AssetManager.php#L529-L546 |
203,160 | Ydle/HubBundle | Controller/RestRoomController.php | RestRoomController.getRoomsListAction | public function getRoomsListAction(ParamFetcher $paramFetcher)
{
$page = $paramFetcher->get('page');
$count = $paramFetcher->get('count');
$pager = $this->getRoomManager()->getPager($this->filterCriteria($paramFetcher), $page, $count);
return $pager;
} | php | public function getRoomsListAction(ParamFetcher $paramFetcher)
{
$page = $paramFetcher->get('page');
$count = $paramFetcher->get('count');
$pager = $this->getRoomManager()->getPager($this->filterCriteria($paramFetcher), $page, $count);
return $pager;
} | [
"public",
"function",
"getRoomsListAction",
"(",
"ParamFetcher",
"$",
"paramFetcher",
")",
"{",
"$",
"page",
"=",
"$",
"paramFetcher",
"->",
"get",
"(",
"'page'",
")",
";",
"$",
"count",
"=",
"$",
"paramFetcher",
"->",
"get",
"(",
"'count'",
")",
";",
"$... | Retrieve the list of available rooms
@QueryParam(name="page", requirements="\d+", default="0", description="Number of page")
@QueryParam(name="count", requirements="\d+", default="0", description="Number of room by page")
@param ParamFetcher $paramFetcher | [
"Retrieve",
"the",
"list",
"of",
"available",
"rooms"
] | 7fa423241246bcfd115f2ed3ad3997b4b63adb01 | https://github.com/Ydle/HubBundle/blob/7fa423241246bcfd115f2ed3ad3997b4b63adb01/Controller/RestRoomController.php#L38-L46 |
203,161 | hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase.query | public function query($statement, $params=array())
{
if (!is_array($params)) {
$params = array($params);
}
return $this->_link->query($statement, $params);
} | php | public function query($statement, $params=array())
{
if (!is_array($params)) {
$params = array($params);
}
return $this->_link->query($statement, $params);
} | [
"public",
"function",
"query",
"(",
"$",
"statement",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"params",
")",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"$",
"params",
")",
";",
"}",
"return",
... | Run database query and return complete result set
This method is intended to be used internally by NADA. Application code
should preferrably use methods from the underlying database abstraction
layer.
This method is intended for SELECT and similar commands that return a
result set. The result is returned as a 2-dimen... | [
"Run",
"database",
"query",
"and",
"return",
"complete",
"result",
"set"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L196-L202 |
203,162 | hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase.exec | public function exec($statement, $params=array())
{
if (!is_array($params)) {
$params = array($params);
}
return $this->_link->exec($statement, $params);
} | php | public function exec($statement, $params=array())
{
if (!is_array($params)) {
$params = array($params);
}
return $this->_link->exec($statement, $params);
} | [
"public",
"function",
"exec",
"(",
"$",
"statement",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"params",
")",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"$",
"params",
")",
";",
"}",
"return",
... | Execute a database statement that does not return a result set
This method is intended to be used internally by NADA. Application code
should preferrably use methods from the underlying database abstraction
layer.
SQL commands like UPDATE, INSERT, DELETE, SET etc. don't return a result
set. This method is intended fo... | [
"Execute",
"a",
"database",
"statement",
"that",
"does",
"not",
"return",
"a",
"result",
"set"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L220-L226 |
203,163 | hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase.prepareValue | public function prepareValue($value, $datatype)
{
if ($value === null) {
return 'NULL';
}
switch ($datatype) {
case Column::TYPE_INTEGER:
// Filter explicitly because some DBAL silently convert/truncate to integer
$filtered = filter_va... | php | public function prepareValue($value, $datatype)
{
if ($value === null) {
return 'NULL';
}
switch ($datatype) {
case Column::TYPE_INTEGER:
// Filter explicitly because some DBAL silently convert/truncate to integer
$filtered = filter_va... | [
"public",
"function",
"prepareValue",
"(",
"$",
"value",
",",
"$",
"datatype",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"'NULL'",
";",
"}",
"switch",
"(",
"$",
"datatype",
")",
"{",
"case",
"Column",
"::",
"TYPE_INTEGER",
... | Prepare a literal value for insertion into an SQL statement
@param mixed $value Value to prepare
@param string $datatype The value's datatype
@return string Value, processed, quoted and escaped if necessary | [
"Prepare",
"a",
"literal",
"value",
"for",
"insertion",
"into",
"an",
"SQL",
"statement"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L464-L501 |
203,164 | hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase.getName | public function getName()
{
if (!$this->_name) {
$result = $this->query(
'select catalog_name from information_schema.information_schema_catalog_name'
);
$this->_name = $result[0]['catalog_name'];
}
return $this->_name;
} | php | public function getName()
{
if (!$this->_name) {
$result = $this->query(
'select catalog_name from information_schema.information_schema_catalog_name'
);
$this->_name = $result[0]['catalog_name'];
}
return $this->_name;
} | [
"public",
"function",
"getName",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_name",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"query",
"(",
"'select catalog_name from information_schema.information_schema_catalog_name'",
")",
";",
"$",
"this",
"... | Return name of the database that the current connection points to
@return string Database name | [
"Return",
"name",
"of",
"the",
"database",
"that",
"the",
"current",
"connection",
"points",
"to"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L535-L544 |
203,165 | hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase.getTable | public function getTable($name)
{
if ($name != strtolower($name)) {
throw new \DomainException('Table name must be lowercase: ' . $name);
}
if (!isset($this->_tables[$name])) {
$class = 'Nada\Table\\' . $this->getDbmsSuffix();
$this->_tables[$name] = new ... | php | public function getTable($name)
{
if ($name != strtolower($name)) {
throw new \DomainException('Table name must be lowercase: ' . $name);
}
if (!isset($this->_tables[$name])) {
$class = 'Nada\Table\\' . $this->getDbmsSuffix();
$this->_tables[$name] = new ... | [
"public",
"function",
"getTable",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"name",
"!=",
"strtolower",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"\\",
"DomainException",
"(",
"'Table name must be lowercase: '",
".",
"$",
"name",
")",
";",
"}",
... | Get access to a specific table
The returned object provides access to the given table and its associated
database objects (columns etc.). The result is cached internally, so that
subsequent calls won't hurt performance.
@param string $name Table name (lowercase). An exception gets thrown if the name does not exist.
@r... | [
"Get",
"access",
"to",
"a",
"specific",
"table"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L556-L567 |
203,166 | hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase.getTables | public function getTables()
{
if (!$this->_allTablesFetched) { // Fetch only once
$tables = $this->getTableNames();
// Fetch missing tables
foreach ($tables as $table) {
$this->getTable($table); // Discard result, still available in cache
}
... | php | public function getTables()
{
if (!$this->_allTablesFetched) { // Fetch only once
$tables = $this->getTableNames();
// Fetch missing tables
foreach ($tables as $table) {
$this->getTable($table); // Discard result, still available in cache
}
... | [
"public",
"function",
"getTables",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_allTablesFetched",
")",
"{",
"// Fetch only once",
"$",
"tables",
"=",
"$",
"this",
"->",
"getTableNames",
"(",
")",
";",
"// Fetch missing tables",
"foreach",
"(",
"$",
... | Return all tables
The result is cached internally, so that subsequent calls won't hurt performance.
@return array Array with table names as keys and \Nada\Table\AbstractTable objects as values | [
"Return",
"all",
"tables"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L576-L590 |
203,167 | hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase.getViewNames | public function getViewNames()
{
$names = $this->query(
'SELECT table_name FROM information_schema.tables WHERE table_schema=? AND table_type=?',
array(
$this->getTableSchema(),
'VIEW'
)
);
// Flatten array
foreach (... | php | public function getViewNames()
{
$names = $this->query(
'SELECT table_name FROM information_schema.tables WHERE table_schema=? AND table_type=?',
array(
$this->getTableSchema(),
'VIEW'
)
);
// Flatten array
foreach (... | [
"public",
"function",
"getViewNames",
"(",
")",
"{",
"$",
"names",
"=",
"$",
"this",
"->",
"query",
"(",
"'SELECT table_name FROM information_schema.tables WHERE table_schema=? AND table_type=?'",
",",
"array",
"(",
"$",
"this",
"->",
"getTableSchema",
"(",
")",
",",
... | Return list of all view names
The default implementation queries information_schema. This can be
overridden where information_schema is not available.
@return array | [
"Return",
"list",
"of",
"all",
"view",
"names"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L624-L638 |
203,168 | hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase.getNativeDatatype | public function getNativeDatatype($type, $length=null, $cast=false)
{
switch ($type) {
case Column::TYPE_INTEGER:
if ($length === null) {
$length = Column::DEFAULT_LENGTH_INTEGER;
}
switch ($length) {
case 16... | php | public function getNativeDatatype($type, $length=null, $cast=false)
{
switch ($type) {
case Column::TYPE_INTEGER:
if ($length === null) {
$length = Column::DEFAULT_LENGTH_INTEGER;
}
switch ($length) {
case 16... | [
"public",
"function",
"getNativeDatatype",
"(",
"$",
"type",
",",
"$",
"length",
"=",
"null",
",",
"$",
"cast",
"=",
"false",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"Column",
"::",
"TYPE_INTEGER",
":",
"if",
"(",
"$",
"length",
"==="... | Get DBMS-specific datatype for abstract NADA datatype
@param string $type One of \Nada\Column\AbstractColumn's TYPE_* constants
@param mixed $length Optional length modifier (default provided for some datatypes)
@param bool $cast The result is used for a typecast operation. Some DBMS require different specifiers for ca... | [
"Get",
"DBMS",
"-",
"specific",
"datatype",
"for",
"abstract",
"NADA",
"datatype"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L681-L731 |
203,169 | hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase.createColumn | public function createColumn(
$name,
$type,
$length=null,
$notnull=false,
$default=null,
$autoIncrement=false,
$comment=null
)
{
$column = $this->createColumnObject();
$column->constructNew($this, $name, $type, $length, $notnull, $default, ... | php | public function createColumn(
$name,
$type,
$length=null,
$notnull=false,
$default=null,
$autoIncrement=false,
$comment=null
)
{
$column = $this->createColumnObject();
$column->constructNew($this, $name, $type, $length, $notnull, $default, ... | [
"public",
"function",
"createColumn",
"(",
"$",
"name",
",",
"$",
"type",
",",
"$",
"length",
"=",
"null",
",",
"$",
"notnull",
"=",
"false",
",",
"$",
"default",
"=",
"null",
",",
"$",
"autoIncrement",
"=",
"false",
",",
"$",
"comment",
"=",
"null",... | Construct a new column
Input is not validated at this point, i.e. this method always succeeds.
Invalid input is detected once the column data is actually used.
The returned object is not linked to a table. It should only be used for
adding it to a table. It can be discarded afterwards.
@param string $name Column name... | [
"Construct",
"a",
"new",
"column"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L761-L774 |
203,170 | hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase.createColumnFromArray | public function createColumnFromArray(array $data)
{
return $this->createColumn(
$data['name'],
$data['type'],
$data['length'],
!empty($data['notnull']),
@$data['default'],
!empty($data['autoincrement']),
@$data['comment']
... | php | public function createColumnFromArray(array $data)
{
return $this->createColumn(
$data['name'],
$data['type'],
$data['length'],
!empty($data['notnull']),
@$data['default'],
!empty($data['autoincrement']),
@$data['comment']
... | [
"public",
"function",
"createColumnFromArray",
"(",
"array",
"$",
"data",
")",
"{",
"return",
"$",
"this",
"->",
"createColumn",
"(",
"$",
"data",
"[",
"'name'",
"]",
",",
"$",
"data",
"[",
"'type'",
"]",
",",
"$",
"data",
"[",
"'length'",
"]",
",",
... | Construct a new column with data from an array
This is a wrapper around createColumn() which gets column data from an
associative array.
The "name", "type" and "length" elements must always be present. The
"notnull" and "autoincrement" elements default to FALSE if not given. The
"default" and "comment" elements defau... | [
"Construct",
"a",
"new",
"column",
"with",
"data",
"from",
"an",
"array"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L789-L800 |
203,171 | hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase.createTable | public function createTable($name, array $columns, $primaryKey=null)
{
$name = strtolower($name);
if (strpos($name, 'sqlite_') === 0) {
throw new \InvalidArgumentException('Created table name must not begin with sqlite_');
}
if (empty($columns)) {
throw new \I... | php | public function createTable($name, array $columns, $primaryKey=null)
{
$name = strtolower($name);
if (strpos($name, 'sqlite_') === 0) {
throw new \InvalidArgumentException('Created table name must not begin with sqlite_');
}
if (empty($columns)) {
throw new \I... | [
"public",
"function",
"createTable",
"(",
"$",
"name",
",",
"array",
"$",
"columns",
",",
"$",
"primaryKey",
"=",
"null",
")",
"{",
"$",
"name",
"=",
"strtolower",
"(",
"$",
"name",
")",
";",
"if",
"(",
"strpos",
"(",
"$",
"name",
",",
"'sqlite_'",
... | Create a table
Some constraints are checked before the creation is attempted:
- There can be at most 1 autoincrement column.
- If there is an autoincrement column, it must be the primary key.
- Otherwise, $primaryKey must not be empty.
- Table names must not begin with sqlite_. For maximum compatibility,
this constra... | [
"Create",
"a",
"table"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L824-L879 |
203,172 | hschletz/NADA | src/Database/AbstractDatabase.php | AbstractDatabase._getTablePkDeclaration | protected function _getTablePkDeclaration(array $primaryKey, $autoIncrement)
{
foreach ($primaryKey as &$column) {
$column = $this->prepareIdentifier($column);
}
return ",\nPRIMARY KEY (" . implode(', ', $primaryKey) . ')';
} | php | protected function _getTablePkDeclaration(array $primaryKey, $autoIncrement)
{
foreach ($primaryKey as &$column) {
$column = $this->prepareIdentifier($column);
}
return ",\nPRIMARY KEY (" . implode(', ', $primaryKey) . ')';
} | [
"protected",
"function",
"_getTablePkDeclaration",
"(",
"array",
"$",
"primaryKey",
",",
"$",
"autoIncrement",
")",
"{",
"foreach",
"(",
"$",
"primaryKey",
"as",
"&",
"$",
"column",
")",
"{",
"$",
"column",
"=",
"$",
"this",
"->",
"prepareIdentifier",
"(",
... | Get the declaration for a table's primary key
This is called by createTable() to get the PRIMARY KEY declaration to be
inserted into a CREATE TABLE statement. The default implementation
unconditionally returns ", PRIMARY KEY ($column[,$column...])". Other
implementations may override this, depending on $autoIncrement.... | [
"Get",
"the",
"declaration",
"for",
"a",
"table",
"s",
"primary",
"key"
] | 4ead798354089fd360f917ce64dd1432d5650df0 | https://github.com/hschletz/NADA/blob/4ead798354089fd360f917ce64dd1432d5650df0/src/Database/AbstractDatabase.php#L893-L899 |
203,173 | geoffadams/bedrest-core | library/BedRest/Mapping/Driver/AbstractAnnotationDriver.php | AbstractAnnotationDriver.indexAnnotationsByType | protected function indexAnnotationsByType(array $annotations)
{
$indexed = array();
// if we are receiving annotations indexed by number, transform it to by class name
if ($annotations && is_numeric(key($annotations))) {
foreach ($annotations as $annotation) {
$a... | php | protected function indexAnnotationsByType(array $annotations)
{
$indexed = array();
// if we are receiving annotations indexed by number, transform it to by class name
if ($annotations && is_numeric(key($annotations))) {
foreach ($annotations as $annotation) {
$a... | [
"protected",
"function",
"indexAnnotationsByType",
"(",
"array",
"$",
"annotations",
")",
"{",
"$",
"indexed",
"=",
"array",
"(",
")",
";",
"// if we are receiving annotations indexed by number, transform it to by class name",
"if",
"(",
"$",
"annotations",
"&&",
"is_nume... | Indexes a numerically-indexed array of annotation instances by their class names.
@param array $annotations
@return array | [
"Indexes",
"a",
"numerically",
"-",
"indexed",
"array",
"of",
"annotation",
"instances",
"by",
"their",
"class",
"names",
"."
] | a77bf8b7492dfbfb720b201f7ec91a4f03417b5c | https://github.com/geoffadams/bedrest-core/blob/a77bf8b7492dfbfb720b201f7ec91a4f03417b5c/library/BedRest/Mapping/Driver/AbstractAnnotationDriver.php#L56-L76 |
203,174 | johnkrovitch/Sam | Filter/FilterBuilder.php | FilterBuilder.build | public function build(array $filterConfigurations)
{
$resolver = new OptionsResolver();
$filters = [];
foreach ($filterConfigurations as $filterName => $filterConfiguration) {
$resolver->clear();
if ($filterConfiguration === null) {
$filterConfigurat... | php | public function build(array $filterConfigurations)
{
$resolver = new OptionsResolver();
$filters = [];
foreach ($filterConfigurations as $filterName => $filterConfiguration) {
$resolver->clear();
if ($filterConfiguration === null) {
$filterConfigurat... | [
"public",
"function",
"build",
"(",
"array",
"$",
"filterConfigurations",
")",
"{",
"$",
"resolver",
"=",
"new",
"OptionsResolver",
"(",
")",
";",
"$",
"filters",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"filterConfigurations",
"as",
"$",
"filterName",
"=>... | Build the filter with the given configuration.
@param array $filterConfigurations
@return FilterInterface[]
@throws Exception | [
"Build",
"the",
"filter",
"with",
"the",
"given",
"configuration",
"."
] | fbd3770c11eecc0a6d8070f439f149062316f606 | https://github.com/johnkrovitch/Sam/blob/fbd3770c11eecc0a6d8070f439f149062316f606/Filter/FilterBuilder.php#L54-L86 |
203,175 | johnkrovitch/Sam | Filter/FilterBuilder.php | FilterBuilder.getFilterConfiguration | protected function getFilterConfiguration($filter)
{
if (!array_key_exists($filter, $this->mapping)) {
throw new Exception($filter.' filter not found in assets mapping. Check your configuration');
}
$class = $this->mapping[$filter].'Configuration';
if (!class_exists($cla... | php | protected function getFilterConfiguration($filter)
{
if (!array_key_exists($filter, $this->mapping)) {
throw new Exception($filter.' filter not found in assets mapping. Check your configuration');
}
$class = $this->mapping[$filter].'Configuration';
if (!class_exists($cla... | [
"protected",
"function",
"getFilterConfiguration",
"(",
"$",
"filter",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"filter",
",",
"$",
"this",
"->",
"mapping",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"$",
"filter",
".",
"' filter not f... | Return filter configuration instance using the configured mapping.
@param $filter
@return ConfigurationInterface
@throws Exception | [
"Return",
"filter",
"configuration",
"instance",
"using",
"the",
"configured",
"mapping",
"."
] | fbd3770c11eecc0a6d8070f439f149062316f606 | https://github.com/johnkrovitch/Sam/blob/fbd3770c11eecc0a6d8070f439f149062316f606/Filter/FilterBuilder.php#L95-L112 |
203,176 | codeinchq/psr7-responses | src/JsonResponse.php | JsonResponse.getDecodedJson | public function getDecodedJson():array
{
if (!($array = json_decode($this->json, true))) {
throw new \RuntimeException("Unable to decode the response's JSON");
}
return json_decode($this->json, true);
} | php | public function getDecodedJson():array
{
if (!($array = json_decode($this->json, true))) {
throw new \RuntimeException("Unable to decode the response's JSON");
}
return json_decode($this->json, true);
} | [
"public",
"function",
"getDecodedJson",
"(",
")",
":",
"array",
"{",
"if",
"(",
"!",
"(",
"$",
"array",
"=",
"json_decode",
"(",
"$",
"this",
"->",
"json",
",",
"true",
")",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"\"Unable to dec... | Returns the decoded JSON string.
@uses json_decode()
@return array | [
"Returns",
"the",
"decoded",
"JSON",
"string",
"."
] | d4bb6bc9b4219694e7c1f5ee9b40b75b22362fce | https://github.com/codeinchq/psr7-responses/blob/d4bb6bc9b4219694e7c1f5ee9b40b75b22362fce/src/JsonResponse.php#L113-L119 |
203,177 | DreadLabs/VantomasWebsite | src/ThreatDefense/ReCaptchaResponse.php | ReCaptchaResponse.fromString | public static function fromString($string)
{
if (is_null($string) || empty($string) || !is_string($string)) {
throw new \InvalidArgumentException('The given ReCaptcha response data is invalid.', 1452283305);
}
$value = (string) $string;
$value = filter_var(
... | php | public static function fromString($string)
{
if (is_null($string) || empty($string) || !is_string($string)) {
throw new \InvalidArgumentException('The given ReCaptcha response data is invalid.', 1452283305);
}
$value = (string) $string;
$value = filter_var(
... | [
"public",
"static",
"function",
"fromString",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"string",
")",
"||",
"empty",
"(",
"$",
"string",
")",
"||",
"!",
"is_string",
"(",
"$",
"string",
")",
")",
"{",
"throw",
"new",
"\\",
"Inv... | Creates the ReCaptchaResponse data object
@param string $string The value
@return self
@throws \InvalidArgumentException | [
"Creates",
"the",
"ReCaptchaResponse",
"data",
"object"
] | 7f85f2b45bdf5ed9fa9d320c805c416bf99cd668 | https://github.com/DreadLabs/VantomasWebsite/blob/7f85f2b45bdf5ed9fa9d320c805c416bf99cd668/src/ThreatDefense/ReCaptchaResponse.php#L48-L69 |
203,178 | buflix/SimpleCollection | src/SimpleCollection/Entity/AbstractEntity.php | AbstractEntity.toArray | public function toArray()
{
$aReturn = array();
foreach (get_object_vars($this) as $sKey => $mValue) {
if (is_object($mValue) and true === method_exists($mValue, 'toArray')) {
$aReturn[$sKey] = $mValue->toArray();
} else {
$aReturn[$sKey] = $m... | php | public function toArray()
{
$aReturn = array();
foreach (get_object_vars($this) as $sKey => $mValue) {
if (is_object($mValue) and true === method_exists($mValue, 'toArray')) {
$aReturn[$sKey] = $mValue->toArray();
} else {
$aReturn[$sKey] = $m... | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"aReturn",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"get_object_vars",
"(",
"$",
"this",
")",
"as",
"$",
"sKey",
"=>",
"$",
"mValue",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"mValue",
")"... | return this entity as array
@see EntityInterface::toArray
@return array | [
"return",
"this",
"entity",
"as",
"array"
] | 405504d8be6415a872a5a49ce8223c22a932831a | https://github.com/buflix/SimpleCollection/blob/405504d8be6415a872a5a49ce8223c22a932831a/src/SimpleCollection/Entity/AbstractEntity.php#L19-L32 |
203,179 | Vectrex/vxPHP | src/Form/FormElement/FormElementFactory.php | FormElementFactory.create | public static function create($type, $name, $value = null, array $attributes = [], array $options = [], $required = false, array $modifiers = [], array $validators = [], $validationErrorMessage = null) {
$type = strtolower($type);
if(is_array($value) && $type !== 'multipleselect') {
$elem = self::createSingleE... | php | public static function create($type, $name, $value = null, array $attributes = [], array $options = [], $required = false, array $modifiers = [], array $validators = [], $validationErrorMessage = null) {
$type = strtolower($type);
if(is_array($value) && $type !== 'multipleselect') {
$elem = self::createSingleE... | [
"public",
"static",
"function",
"create",
"(",
"$",
"type",
",",
"$",
"name",
",",
"$",
"value",
"=",
"null",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"required",
"=",
"false",
",",
"a... | create either single FormElement or array of FormElements
@param string $type , type of element
@param string $name , name of element
@param mixed $value
@param array $attributes
@param array $options , array for initializing SelectOptionElements or RadioOptionElements
@param boolean $required
@param array $modifiers
... | [
"create",
"either",
"single",
"FormElement",
"or",
"array",
"of",
"FormElements"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/FormElement/FormElementFactory.php#L47-L72 |
203,180 | Vectrex/vxPHP | src/Form/FormElement/FormElementFactory.php | FormElementFactory.createSingleElement | private static function createSingleElement($type, $name, $value, $attributes, $options, $required, $modifiers, $validators, $validationErrorMessage) {
switch($type) {
case 'input':
$elem = new InputElement($name);
break;
case 'file':
$elem = new FileInputElement($name);
... | php | private static function createSingleElement($type, $name, $value, $attributes, $options, $required, $modifiers, $validators, $validationErrorMessage) {
switch($type) {
case 'input':
$elem = new InputElement($name);
break;
case 'file':
$elem = new FileInputElement($name);
... | [
"private",
"static",
"function",
"createSingleElement",
"(",
"$",
"type",
",",
"$",
"name",
",",
"$",
"value",
",",
"$",
"attributes",
",",
"$",
"options",
",",
"$",
"required",
",",
"$",
"modifiers",
",",
"$",
"validators",
",",
"$",
"validationErrorMessa... | generate a single form element
@param $type
@param $name
@param $value
@param $attributes
@param $options
@param $required
@param $modifiers
@param $validators
@param $validationErrorMessage
@return ButtonElement|CheckboxElement|ImageElement|InputElement|PasswordInputElement|SubmitInputElement|TextareaElement
@throws... | [
"generate",
"a",
"single",
"form",
"element"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/FormElement/FormElementFactory.php#L90-L164 |
203,181 | anime-db/shikimori-related-items-widget-bundle | src/Controller/WidgetController.php | WidgetController.filter | protected function filter(array $list)
{
$tmp = [];
foreach ($list as $item) {
if ($item['anime']) {
$tmp[] = $item;
}
}
return $tmp;
} | php | protected function filter(array $list)
{
$tmp = [];
foreach ($list as $item) {
if ($item['anime']) {
$tmp[] = $item;
}
}
return $tmp;
} | [
"protected",
"function",
"filter",
"(",
"array",
"$",
"list",
")",
"{",
"$",
"tmp",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"list",
"as",
"$",
"item",
")",
"{",
"if",
"(",
"$",
"item",
"[",
"'anime'",
"]",
")",
"{",
"$",
"tmp",
"[",
"]",
"="... | Filter a list items
@param array $list
@return array | [
"Filter",
"a",
"list",
"items"
] | ee77d08513efe0f099790ef899ba6080a11abdb3 | https://github.com/anime-db/shikimori-related-items-widget-bundle/blob/ee77d08513efe0f099790ef899ba6080a11abdb3/src/Controller/WidgetController.php#L94-L103 |
203,182 | fardus/CRUDBundle | Fardus/Bundle/CrudBundle/Controller/ApiController.php | ApiController.deleteAction | public function deleteAction($entity, $id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($entity)->find($id);
if (!$entity) {
throw $this->createNotFoundException("Unable to find $entity entity.");
}
$em->remove($entity);
$em->... | php | public function deleteAction($entity, $id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($entity)->find($id);
if (!$entity) {
throw $this->createNotFoundException("Unable to find $entity entity.");
}
$em->remove($entity);
$em->... | [
"public",
"function",
"deleteAction",
"(",
"$",
"entity",
",",
"$",
"id",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"$",
"entity",
"=",
"$",
"em",
"->",
"getRepository",
"(",
"$",
"enti... | Delete any entity.
@param string $entity
@param int $id
@return Response
@throws NotFoundHttpException | [
"Delete",
"any",
"entity",
"."
] | 5d4180f2a1f30da0fc4cbb16a70f656e9e083c5c | https://github.com/fardus/CRUDBundle/blob/5d4180f2a1f30da0fc4cbb16a70f656e9e083c5c/Fardus/Bundle/CrudBundle/Controller/ApiController.php#L24-L46 |
203,183 | bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.FromFloat | public static function FromFloat( $value, $detail = true )
{
if ( $value instanceof XPath2Item )
{
$value = $value->getTypedValue();
}
if ( $value instanceof DecimalValue ) return $value;
if ( ( ! is_numeric( $value ) ) || is_infinite( $value ) || is_nan( $value ) )
{
throw XPath2Exception... | php | public static function FromFloat( $value, $detail = true )
{
if ( $value instanceof XPath2Item )
{
$value = $value->getTypedValue();
}
if ( $value instanceof DecimalValue ) return $value;
if ( ( ! is_numeric( $value ) ) || is_infinite( $value ) || is_nan( $value ) )
{
throw XPath2Exception... | [
"public",
"static",
"function",
"FromFloat",
"(",
"$",
"value",
",",
"$",
"detail",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"XPath2Item",
")",
"{",
"$",
"value",
"=",
"$",
"value",
"->",
"getTypedValue",
"(",
")",
";",
"}",
"if"... | Creates an instance from a Float value
@param float $value
@param bool $detail (optional: default = true) Expand the number to the most digits | [
"Creates",
"an",
"instance",
"from",
"a",
"Float",
"value"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L159-L199 |
203,184 | bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.Compare | public function Compare( $number, $scale = false )
{
if ( ! is_numeric( $number ) )
{
if ( ! $number instanceof DecimalValue && ! $number instanceof Integer )
{
return false;
}
$number = $number->getValue();
}
if ( $scale === false )
{
$scale = max( $this->getScale(), $this... | php | public function Compare( $number, $scale = false )
{
if ( ! is_numeric( $number ) )
{
if ( ! $number instanceof DecimalValue && ! $number instanceof Integer )
{
return false;
}
$number = $number->getValue();
}
if ( $scale === false )
{
$scale = max( $this->getScale(), $this... | [
"public",
"function",
"Compare",
"(",
"$",
"number",
",",
"$",
"scale",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"number",
")",
")",
"{",
"if",
"(",
"!",
"$",
"number",
"instanceof",
"DecimalValue",
"&&",
"!",
"$",
"number",
... | Compares this number with another number
@param string $number
@param int $scale
@return int 0 if the number is the same as this number, 1 if this number is larger than the supplied number, -1 otherwise. | [
"Compares",
"this",
"number",
"with",
"another",
"number"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L253-L271 |
203,185 | bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.normalize | private function normalize( $number = null )
{
if ( is_null( $number ) ) $number =& $this->_value;
// Handle the case of -0
if ( $this->_value == "-0" ) $this->_value = "0";
if ( strpos( $this->_value, '.' ) === false ) return;
$number = trim( $number );
$number = rtrim( $number, '0');
$num... | php | private function normalize( $number = null )
{
if ( is_null( $number ) ) $number =& $this->_value;
// Handle the case of -0
if ( $this->_value == "-0" ) $this->_value = "0";
if ( strpos( $this->_value, '.' ) === false ) return;
$number = trim( $number );
$number = rtrim( $number, '0');
$num... | [
"private",
"function",
"normalize",
"(",
"$",
"number",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"number",
")",
")",
"$",
"number",
"=",
"&",
"$",
"this",
"->",
"_value",
";",
"// Handle the case of -0\r",
"if",
"(",
"$",
"this",
"->",
... | Remove spaces and any trailing zeros
@param string $number
@return string | [
"Remove",
"spaces",
"and",
"any",
"trailing",
"zeros"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L446-L466 |
203,186 | bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.getIsDecimal | public function getIsDecimal( $number = false )
{
return strpos( $number === false ? $this->_value : $number, "." ) !== false &&
trim( substr( $number === false ? $this->_value : $number, strpos( $number === false ? $this->_value : $number, "." ) + 1 ), "0" );
} | php | public function getIsDecimal( $number = false )
{
return strpos( $number === false ? $this->_value : $number, "." ) !== false &&
trim( substr( $number === false ? $this->_value : $number, strpos( $number === false ? $this->_value : $number, "." ) + 1 ), "0" );
} | [
"public",
"function",
"getIsDecimal",
"(",
"$",
"number",
"=",
"false",
")",
"{",
"return",
"strpos",
"(",
"$",
"number",
"===",
"false",
"?",
"$",
"this",
"->",
"_value",
":",
"$",
"number",
",",
"\".\"",
")",
"!==",
"false",
"&&",
"trim",
"(",
"sub... | True if the number has a fractional part and it is not zero
@param double $number
@return bool | [
"True",
"if",
"the",
"number",
"has",
"a",
"fractional",
"part",
"and",
"it",
"is",
"not",
"zero"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L482-L486 |
203,187 | bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.getCeil | public function getCeil()
{
if ( $this->getIsDecimal() === false )
{
return $this;
}
if ( $this->getIsNegative() === true )
{
return new DecimalValue( bcadd( $this->_value, '0', 0 ) );
}
return new DecimalValue( bcadd( $this->_value, '1', 0 ) ); // Add one and truncate
} | php | public function getCeil()
{
if ( $this->getIsDecimal() === false )
{
return $this;
}
if ( $this->getIsNegative() === true )
{
return new DecimalValue( bcadd( $this->_value, '0', 0 ) );
}
return new DecimalValue( bcadd( $this->_value, '1', 0 ) ); // Add one and truncate
} | [
"public",
"function",
"getCeil",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getIsDecimal",
"(",
")",
"===",
"false",
")",
"{",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getIsNegative",
"(",
")",
"===",
"true",
")",
"{",
"... | Get the ceiling value of the decimal number
@return DecimalValue | [
"Get",
"the",
"ceiling",
"value",
"of",
"the",
"decimal",
"number"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L501-L514 |
203,188 | bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.getFloor | public function getFloor( $scale = false )
{
if ( $this->getIsDecimal() === false )
{
return $this;
}
if ( $this->getIsNegative() === true )
{
return new DecimalValue( bcadd( $this->_value, '-1', 0 ) ); // Subtract 1 and truncate
}
return new DecimalValue( bcadd( $this->_value, '0', 0... | php | public function getFloor( $scale = false )
{
if ( $this->getIsDecimal() === false )
{
return $this;
}
if ( $this->getIsNegative() === true )
{
return new DecimalValue( bcadd( $this->_value, '-1', 0 ) ); // Subtract 1 and truncate
}
return new DecimalValue( bcadd( $this->_value, '0', 0... | [
"public",
"function",
"getFloor",
"(",
"$",
"scale",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getIsDecimal",
"(",
")",
"===",
"false",
")",
"{",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getIsNegative",
"(",
")",... | Get the number that is one
@param int $scale
@return DecimalValue | [
"Get",
"the",
"number",
"that",
"is",
"one"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L521-L534 |
203,189 | bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.roundDigit | private function roundDigit( $scale, $mode = PHP_ROUND_HALF_UP )
{
if ( $this->getIsCloserToNext( $scale, $mode ) )
{
return bcadd( $this->_value, $this->getIsNegative() ? -1 : 1, 0 );
}
return bcadd( $this->_value, '0', 0 );
} | php | private function roundDigit( $scale, $mode = PHP_ROUND_HALF_UP )
{
if ( $this->getIsCloserToNext( $scale, $mode ) )
{
return bcadd( $this->_value, $this->getIsNegative() ? -1 : 1, 0 );
}
return bcadd( $this->_value, '0', 0 );
} | [
"private",
"function",
"roundDigit",
"(",
"$",
"scale",
",",
"$",
"mode",
"=",
"PHP_ROUND_HALF_UP",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getIsCloserToNext",
"(",
"$",
"scale",
",",
"$",
"mode",
")",
")",
"{",
"return",
"bcadd",
"(",
"$",
"this",
... | Round the value to the required precision and using the required mode
@param $scale The scale to use for rounding. The digit at this position will
be rounded in the decimal part of the number will be rounded.
@param int $mode PHP_ROUND_HALF_UP (default), PHP_ROUND_HALF_DOWN, PHP_ROUND_HALF_EVEN, PHP_ROUND_HALF_ODD
@re... | [
"Round",
"the",
"value",
"to",
"the",
"required",
"precision",
"and",
"using",
"the",
"required",
"mode"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L676-L684 |
203,190 | bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.getIntegerPart | public function getIntegerPart()
{
if ( ! $this->getIsDecimal() ) return $this->_value;
return substr( $this->_value, 0, strpos( $this->_value, "." ) );
} | php | public function getIntegerPart()
{
if ( ! $this->getIsDecimal() ) return $this->_value;
return substr( $this->_value, 0, strpos( $this->_value, "." ) );
} | [
"public",
"function",
"getIntegerPart",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getIsDecimal",
"(",
")",
")",
"return",
"$",
"this",
"->",
"_value",
";",
"return",
"substr",
"(",
"$",
"this",
"->",
"_value",
",",
"0",
",",
"strpos",
"(",
... | Return the part of the number before the decimal point
Does not taken into account the size of any fraction.
@return string | [
"Return",
"the",
"part",
"of",
"the",
"number",
"before",
"the",
"decimal",
"point",
"Does",
"not",
"taken",
"into",
"account",
"the",
"size",
"of",
"any",
"fraction",
"."
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L712-L716 |
203,191 | bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.getDecimalIsHalf | public function getDecimalIsHalf( $scale = false )
{
if ( ! $this->getIsDecimal() ) {
return false;
}
if ( $scale === false ) $scale = $this->scale( $this->_value );
if ( $scale < 0 ) $scale = $scale = 0;
$decimalPart = $this->getDecimalPart();
if ( $scale >= strlen( $decimalPart ) ) return ... | php | public function getDecimalIsHalf( $scale = false )
{
if ( ! $this->getIsDecimal() ) {
return false;
}
if ( $scale === false ) $scale = $this->scale( $this->_value );
if ( $scale < 0 ) $scale = $scale = 0;
$decimalPart = $this->getDecimalPart();
if ( $scale >= strlen( $decimalPart ) ) return ... | [
"public",
"function",
"getDecimalIsHalf",
"(",
"$",
"scale",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getIsDecimal",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"scale",
"===",
"false",
")",
"$",
"scale",
"="... | Test to see if the digit at scale + 1 is a 5
@param int $scale
@return bool | [
"Test",
"to",
"see",
"if",
"the",
"digit",
"at",
"scale",
"+",
"1",
"is",
"a",
"5"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L723-L738 |
203,192 | bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.getIsDecimalEven | public function getIsDecimalEven( $precision = false )
{
if ( ! $this->getIsDecimal() ) {
return false;
}
if ( $precision === false ) $precision = $this->scale( $this->_value );
if ( $precision < 0 ) $precision = $precision = 0;
$decimalPart = $this->getDecimalPart();
if ( $precision >= strl... | php | public function getIsDecimalEven( $precision = false )
{
if ( ! $this->getIsDecimal() ) {
return false;
}
if ( $precision === false ) $precision = $this->scale( $this->_value );
if ( $precision < 0 ) $precision = $precision = 0;
$decimalPart = $this->getDecimalPart();
if ( $precision >= strl... | [
"public",
"function",
"getIsDecimalEven",
"(",
"$",
"precision",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getIsDecimal",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"precision",
"===",
"false",
")",
"$",
"preci... | Returns true if the digit at the required level of precision is even
@param string $precision
@return bool | [
"Returns",
"true",
"if",
"the",
"digit",
"at",
"the",
"required",
"level",
"of",
"precision",
"is",
"even"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L764-L779 |
203,193 | bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.getIsCloserToNext | public function getIsCloserToNext( $precision = false, $mode = PHP_ROUND_HALF_UP )
{
if ( ! $this->getIsDecimal() ) {
return false;
}
if ( $precision === false ) $precision = $this->scale( $this->_value );
if ( $precision < 0 ) $precision = $precision = 0;
$decimalPart = $this->getDecimalPart()... | php | public function getIsCloserToNext( $precision = false, $mode = PHP_ROUND_HALF_UP )
{
if ( ! $this->getIsDecimal() ) {
return false;
}
if ( $precision === false ) $precision = $this->scale( $this->_value );
if ( $precision < 0 ) $precision = $precision = 0;
$decimalPart = $this->getDecimalPart()... | [
"public",
"function",
"getIsCloserToNext",
"(",
"$",
"precision",
"=",
"false",
",",
"$",
"mode",
"=",
"PHP_ROUND_HALF_UP",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getIsDecimal",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
... | Returns true if the number at the scale position in the decimal part of the number is closer to the next power.
@param int $precision
@param int $mode PHP_ROUND_HALF_UP (default), PHP_ROUND_HALF_DOWN, PHP_ROUND_HALF_EVEN, PHP_ROUND_HALF_ODD
@return bool | [
"Returns",
"true",
"if",
"the",
"number",
"at",
"the",
"scale",
"position",
"in",
"the",
"decimal",
"part",
"of",
"the",
"number",
"is",
"closer",
"to",
"the",
"next",
"power",
"."
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L787-L803 |
203,194 | bseddon/XPath20 | Value/DecimalValue.php | DecimalValue.dec2bin | private function dec2bin( $decimal )
{
bcscale(0);
$binary = '';
do
{
$binary = bcmod( $decimal, '2' ) . $binary;
$decimal = bcdiv( $decimal, '2' );
} while ( bccomp( $decimal, '0' ) );
return( $binary );
} | php | private function dec2bin( $decimal )
{
bcscale(0);
$binary = '';
do
{
$binary = bcmod( $decimal, '2' ) . $binary;
$decimal = bcdiv( $decimal, '2' );
} while ( bccomp( $decimal, '0' ) );
return( $binary );
} | [
"private",
"function",
"dec2bin",
"(",
"$",
"decimal",
")",
"{",
"bcscale",
"(",
"0",
")",
";",
"$",
"binary",
"=",
"''",
";",
"do",
"{",
"$",
"binary",
"=",
"bcmod",
"(",
"$",
"decimal",
",",
"'2'",
")",
".",
"$",
"binary",
";",
"$",
"decimal",
... | Create a binary representation of the current value
@param string $decimal The number to be converted
@return string | [
"Create",
"a",
"binary",
"representation",
"of",
"the",
"current",
"value"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DecimalValue.php#L989-L1000 |
203,195 | naucon/Utility | src/CollectionAbstract.php | CollectionAbstract.getIterator | public function getIterator()
{
if (is_null($this->_iterator)) {
$this->_iterator = new Iterator($this->_items);
}
return $this->_iterator;
} | php | public function getIterator()
{
if (is_null($this->_iterator)) {
$this->_iterator = new Iterator($this->_items);
}
return $this->_iterator;
} | [
"public",
"function",
"getIterator",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_iterator",
")",
")",
"{",
"$",
"this",
"->",
"_iterator",
"=",
"new",
"Iterator",
"(",
"$",
"this",
"->",
"_items",
")",
";",
"}",
"return",
"$",
"t... | return a iterator
@return IteratorInterface | [
"return",
"a",
"iterator"
] | d225bb5d09d82400917f710c9d502949a66442c4 | https://github.com/naucon/Utility/blob/d225bb5d09d82400917f710c9d502949a66442c4/src/CollectionAbstract.php#L100-L106 |
203,196 | naucon/Utility | src/CollectionAbstract.php | CollectionAbstract.remove | public function remove($element)
{
$index = $this->indexOf($element);
if ($index !== false) {
unset($this->_items[$index]);
$this->_items = array_values($this->_items);
$this->_iterator = null;
return true;
}
return false;
} | php | public function remove($element)
{
$index = $this->indexOf($element);
if ($index !== false) {
unset($this->_items[$index]);
$this->_items = array_values($this->_items);
$this->_iterator = null;
return true;
}
return false;
} | [
"public",
"function",
"remove",
"(",
"$",
"element",
")",
"{",
"$",
"index",
"=",
"$",
"this",
"->",
"indexOf",
"(",
"$",
"element",
")",
";",
"if",
"(",
"$",
"index",
"!==",
"false",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"_items",
"[",
"$",... | remove a specified element from the collection
@param mixed $element element
@return bool | [
"remove",
"a",
"specified",
"element",
"from",
"the",
"collection"
] | d225bb5d09d82400917f710c9d502949a66442c4 | https://github.com/naucon/Utility/blob/d225bb5d09d82400917f710c9d502949a66442c4/src/CollectionAbstract.php#L124-L135 |
203,197 | fuelphp-storage/security | src/Filter/Base.php | Base.clean | public function clean($input)
{
// Nothing to escape for non-string scalars, or for already processed values
if (is_bool($input) or is_int($input) or is_float($input) or $this->parent->isCleaned($input))
{
return $input;
}
if (is_string($input))
{
$input = $this->cleanString($input);
}
elseif (... | php | public function clean($input)
{
// Nothing to escape for non-string scalars, or for already processed values
if (is_bool($input) or is_int($input) or is_float($input) or $this->parent->isCleaned($input))
{
return $input;
}
if (is_string($input))
{
$input = $this->cleanString($input);
}
elseif (... | [
"public",
"function",
"clean",
"(",
"$",
"input",
")",
"{",
"// Nothing to escape for non-string scalars, or for already processed values",
"if",
"(",
"is_bool",
"(",
"$",
"input",
")",
"or",
"is_int",
"(",
"$",
"input",
")",
"or",
"is_float",
"(",
"$",
"input",
... | Cleans string, object or array
@param mixed $input
@return mixed
@throws \RuntimeException if the variable passed can not be cleaned | [
"Cleans",
"string",
"object",
"or",
"array"
] | 2cad42a8432bc9c9de46486623b71e105ff84b1b | https://github.com/fuelphp-storage/security/blob/2cad42a8432bc9c9de46486623b71e105ff84b1b/src/Filter/Base.php#L39-L88 |
203,198 | fuelphp-storage/security | src/Filter/Base.php | Base.cleanArray | protected function cleanArray($input)
{
// add to the cleaned list when object
if (is_object($input))
{
$this->parent->isClean($input);
}
foreach ($input as $k => $v)
{
$input[$k] = $this->clean($v);
}
return $input;
} | php | protected function cleanArray($input)
{
// add to the cleaned list when object
if (is_object($input))
{
$this->parent->isClean($input);
}
foreach ($input as $k => $v)
{
$input[$k] = $this->clean($v);
}
return $input;
} | [
"protected",
"function",
"cleanArray",
"(",
"$",
"input",
")",
"{",
"// add to the cleaned list when object",
"if",
"(",
"is_object",
"(",
"$",
"input",
")",
")",
"{",
"$",
"this",
"->",
"parent",
"->",
"isClean",
"(",
"$",
"input",
")",
";",
"}",
"foreach... | cleanArray base method
@param string $input
@return string | [
"cleanArray",
"base",
"method"
] | 2cad42a8432bc9c9de46486623b71e105ff84b1b | https://github.com/fuelphp-storage/security/blob/2cad42a8432bc9c9de46486623b71e105ff84b1b/src/Filter/Base.php#L109-L123 |
203,199 | fuelphp-storage/security | src/Filter/Base.php | Base.cleanObject | protected function cleanObject($input)
{
// add to the cleaned list
$this->parent->isClean($input);
foreach ($value as $k => $v)
{
$value->{$k} = $this->clean($v);
}
return $input;
} | php | protected function cleanObject($input)
{
// add to the cleaned list
$this->parent->isClean($input);
foreach ($value as $k => $v)
{
$value->{$k} = $this->clean($v);
}
return $input;
} | [
"protected",
"function",
"cleanObject",
"(",
"$",
"input",
")",
"{",
"// add to the cleaned list",
"$",
"this",
"->",
"parent",
"->",
"isClean",
"(",
"$",
"input",
")",
";",
"foreach",
"(",
"$",
"value",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
... | cleanObject base method. Not defined as abstract become some filters might not implement cleaning objects
@param object $input
@return object | [
"cleanObject",
"base",
"method",
".",
"Not",
"defined",
"as",
"abstract",
"become",
"some",
"filters",
"might",
"not",
"implement",
"cleaning",
"objects"
] | 2cad42a8432bc9c9de46486623b71e105ff84b1b | https://github.com/fuelphp-storage/security/blob/2cad42a8432bc9c9de46486623b71e105ff84b1b/src/Filter/Base.php#L132-L142 |
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.