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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
192,800 | horntell/php-sdk | lib/guzzle/GuzzleHttp/Query.php | Query.walkQuery | public static function walkQuery(array $query, $keyPrefix, callable $prefixer)
{
$result = [];
foreach ($query as $key => $value) {
if ($keyPrefix) {
$key = $prefixer($key, $keyPrefix);
}
if (is_array($value)) {
$result += self::wal... | php | public static function walkQuery(array $query, $keyPrefix, callable $prefixer)
{
$result = [];
foreach ($query as $key => $value) {
if ($keyPrefix) {
$key = $prefixer($key, $keyPrefix);
}
if (is_array($value)) {
$result += self::wal... | [
"public",
"static",
"function",
"walkQuery",
"(",
"array",
"$",
"query",
",",
"$",
"keyPrefix",
",",
"callable",
"$",
"prefixer",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"query",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
... | Easily create query aggregation functions by providing a key prefix
function to this query string array walker.
@param array $query Query string to walk
@param string $keyPrefix Key prefix (start with '')
@param callable $prefixer Function used to create a key prefix
@return array | [
"Easily",
"create",
"query",
"aggregation",
"functions",
"by",
"providing",
"a",
"key",
"prefix",
"function",
"to",
"this",
"query",
"string",
"array",
"walker",
"."
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Query.php#L198-L215 |
192,801 | koolkode/config | src/Configuration.php | Configuration.getInteger | public function getInteger($key)
{
$resolved = false;
$value = $this->getByKey($key, $this->data, $resolved);
if($resolved)
{
return (int)$value;
}
if(func_num_args() > 1)
{
return func_get_arg(1);
}
throw new \OutOfBoundsException('Configuration setting not found: "' . $key . '"');
} | php | public function getInteger($key)
{
$resolved = false;
$value = $this->getByKey($key, $this->data, $resolved);
if($resolved)
{
return (int)$value;
}
if(func_num_args() > 1)
{
return func_get_arg(1);
}
throw new \OutOfBoundsException('Configuration setting not found: "' . $key . '"');
} | [
"public",
"function",
"getInteger",
"(",
"$",
"key",
")",
"{",
"$",
"resolved",
"=",
"false",
";",
"$",
"value",
"=",
"$",
"this",
"->",
"getByKey",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"data",
",",
"$",
"resolved",
")",
";",
"if",
"(",
"$",
... | Get an integer value by key.
@param string $key
@param integer $default
@return integer
@throws \OutOfBoundsException When the key was not found and no default value is given. | [
"Get",
"an",
"integer",
"value",
"by",
"key",
"."
] | ad97d80f6e4ae5f8925839488abf2d9bfcb6d7f6 | https://github.com/koolkode/config/blob/ad97d80f6e4ae5f8925839488abf2d9bfcb6d7f6/src/Configuration.php#L209-L225 |
192,802 | koolkode/config | src/Configuration.php | Configuration.getFloat | public function getFloat($key)
{
$resolved = false;
$value = $this->getByKey($key, $this->data, $resolved);
if($resolved)
{
return floatval($value);
}
if(func_num_args() > 1)
{
return func_get_arg(1);
}
throw new \OutOfBoundsException('Configuration setting not found: "' . $key . '"');... | php | public function getFloat($key)
{
$resolved = false;
$value = $this->getByKey($key, $this->data, $resolved);
if($resolved)
{
return floatval($value);
}
if(func_num_args() > 1)
{
return func_get_arg(1);
}
throw new \OutOfBoundsException('Configuration setting not found: "' . $key . '"');... | [
"public",
"function",
"getFloat",
"(",
"$",
"key",
")",
"{",
"$",
"resolved",
"=",
"false",
";",
"$",
"value",
"=",
"$",
"this",
"->",
"getByKey",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"data",
",",
"$",
"resolved",
")",
";",
"if",
"(",
"$",
... | Get a floating point value by key.
@param string $key
@param float $default
@return float
@throws \OutOfBoundsException When the key was not found and no default value is given. | [
"Get",
"a",
"floating",
"point",
"value",
"by",
"key",
"."
] | ad97d80f6e4ae5f8925839488abf2d9bfcb6d7f6 | https://github.com/koolkode/config/blob/ad97d80f6e4ae5f8925839488abf2d9bfcb6d7f6/src/Configuration.php#L236-L252 |
192,803 | nattreid/tracking | src/Tracking.php | Tracking.leave | public function leave(): void
{
if ($this->canTrack()) {
$track = $this->orm->tracking->getLatest($this->user->getUid());
if ($track) {
$timeOnPage = time() - $track->inserted->getTimestamp();
if ($timeOnPage < ($this->minTimeBetweenVisits * 60)) {
$track->timeOnPage = $timeOnPage;
$this->o... | php | public function leave(): void
{
if ($this->canTrack()) {
$track = $this->orm->tracking->getLatest($this->user->getUid());
if ($track) {
$timeOnPage = time() - $track->inserted->getTimestamp();
if ($timeOnPage < ($this->minTimeBetweenVisits * 60)) {
$track->timeOnPage = $timeOnPage;
$this->o... | [
"public",
"function",
"leave",
"(",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"canTrack",
"(",
")",
")",
"{",
"$",
"track",
"=",
"$",
"this",
"->",
"orm",
"->",
"tracking",
"->",
"getLatest",
"(",
"$",
"this",
"->",
"user",
"->",
"getU... | Zaznam odchodu ze stranky | [
"Zaznam",
"odchodu",
"ze",
"stranky"
] | 5fc7c993c08774945405c79a393584ef2ed589f7 | https://github.com/nattreid/tracking/blob/5fc7c993c08774945405c79a393584ef2ed589f7/src/Tracking.php#L95-L109 |
192,804 | nattreid/tracking | src/Tracking.php | Tracking.track | public function track(): void
{
if ($this->canTrack()) {
$track = new TrackingEntity;
$track->uid = $this->user->getUid();
$track->inserted = new DateTime;
$track->url = $this->getParam('url');
$track->referer = $this->getParam('referer');
$track->ip = $this->getIp();
$track->browser = $this->g... | php | public function track(): void
{
if ($this->canTrack()) {
$track = new TrackingEntity;
$track->uid = $this->user->getUid();
$track->inserted = new DateTime;
$track->url = $this->getParam('url');
$track->referer = $this->getParam('referer');
$track->ip = $this->getIp();
$track->browser = $this->g... | [
"public",
"function",
"track",
"(",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"canTrack",
"(",
")",
")",
"{",
"$",
"track",
"=",
"new",
"TrackingEntity",
";",
"$",
"track",
"->",
"uid",
"=",
"$",
"this",
"->",
"user",
"->",
"getUid",
"... | Zaznam prichodu na stranku | [
"Zaznam",
"prichodu",
"na",
"stranku"
] | 5fc7c993c08774945405c79a393584ef2ed589f7 | https://github.com/nattreid/tracking/blob/5fc7c993c08774945405c79a393584ef2ed589f7/src/Tracking.php#L114-L131 |
192,805 | nattreid/tracking | src/Tracking.php | Tracking.checkVisits | private function checkVisits(Range $interval): void
{
foreach ($this->orm->trackingVisits->findCalculateDate($interval) as $date) {
if ($date !== null) {
$date = $date->setTime(0, 0, 0);
$to = $date->modify('+23 hour');
$to = $to->modify('+59 minute');
$to = $to->modify('+59 second');
$pages ... | php | private function checkVisits(Range $interval): void
{
foreach ($this->orm->trackingVisits->findCalculateDate($interval) as $date) {
if ($date !== null) {
$date = $date->setTime(0, 0, 0);
$to = $date->modify('+23 hour');
$to = $to->modify('+59 minute');
$to = $to->modify('+59 second');
$pages ... | [
"private",
"function",
"checkVisits",
"(",
"Range",
"$",
"interval",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"this",
"->",
"orm",
"->",
"trackingVisits",
"->",
"findCalculateDate",
"(",
"$",
"interval",
")",
"as",
"$",
"date",
")",
"{",
"if",
"(",
... | Ulozeni zaznamu pokud jeste nejsou prepocitane
@param Range $interval
@throws QueryException | [
"Ulozeni",
"zaznamu",
"pokud",
"jeste",
"nejsou",
"prepocitane"
] | 5fc7c993c08774945405c79a393584ef2ed589f7 | https://github.com/nattreid/tracking/blob/5fc7c993c08774945405c79a393584ef2ed589f7/src/Tracking.php#L226-L249 |
192,806 | nattreid/tracking | src/Tracking.php | Tracking.findClicksValue | public function findClicksValue(int $groupId, Range $interval): ?Result
{
return $this->orm->clickTracking->findClicksByValue($groupId, $interval);
} | php | public function findClicksValue(int $groupId, Range $interval): ?Result
{
return $this->orm->clickTracking->findClicksByValue($groupId, $interval);
} | [
"public",
"function",
"findClicksValue",
"(",
"int",
"$",
"groupId",
",",
"Range",
"$",
"interval",
")",
":",
"?",
"Result",
"{",
"return",
"$",
"this",
"->",
"orm",
"->",
"clickTracking",
"->",
"findClicksByValue",
"(",
"$",
"groupId",
",",
"$",
"interval... | Pocet kliku podle hondoty
@param int $groupId
@param Range $interval
@return Result|null | [
"Pocet",
"kliku",
"podle",
"hondoty"
] | 5fc7c993c08774945405c79a393584ef2ed589f7 | https://github.com/nattreid/tracking/blob/5fc7c993c08774945405c79a393584ef2ed589f7/src/Tracking.php#L285-L288 |
192,807 | as3io/As3ModlrBundle | DependencyInjection/Configuration.php | Configuration.getAdapterNode | private function getAdapterNode()
{
$node = $this->createRootNode('adapter');
return $node
->isRequired()
->addDefaultsIfNotSet()
->children()
->enumNode('type')
->values(['jsonapiorg', null])
->end()
... | php | private function getAdapterNode()
{
$node = $this->createRootNode('adapter');
return $node
->isRequired()
->addDefaultsIfNotSet()
->children()
->enumNode('type')
->values(['jsonapiorg', null])
->end()
... | [
"private",
"function",
"getAdapterNode",
"(",
")",
"{",
"$",
"node",
"=",
"$",
"this",
"->",
"createRootNode",
"(",
"'adapter'",
")",
";",
"return",
"$",
"node",
"->",
"isRequired",
"(",
")",
"->",
"addDefaultsIfNotSet",
"(",
")",
"->",
"children",
"(",
... | Gets the api adapter configuration node.
@return \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition | [
"Gets",
"the",
"api",
"adapter",
"configuration",
"node",
"."
] | 7ce2abb7390c7eaf4081c5b7e00b96e7001774a4 | https://github.com/as3io/As3ModlrBundle/blob/7ce2abb7390c7eaf4081c5b7e00b96e7001774a4/DependencyInjection/Configuration.php#L62-L81 |
192,808 | as3io/As3ModlrBundle | DependencyInjection/Configuration.php | Configuration.getMetadataNode | private function getMetadataNode()
{
$node = $this->createRootNode('metadata');
return $node
->addDefaultsIfNotSet()
->children()
->arrayNode('drivers')
->defaultValue(['default' => ['type' => 'yml']])
->useAttributeAsKe... | php | private function getMetadataNode()
{
$node = $this->createRootNode('metadata');
return $node
->addDefaultsIfNotSet()
->children()
->arrayNode('drivers')
->defaultValue(['default' => ['type' => 'yml']])
->useAttributeAsKe... | [
"private",
"function",
"getMetadataNode",
"(",
")",
"{",
"$",
"node",
"=",
"$",
"this",
"->",
"createRootNode",
"(",
"'metadata'",
")",
";",
"return",
"$",
"node",
"->",
"addDefaultsIfNotSet",
"(",
")",
"->",
"children",
"(",
")",
"->",
"arrayNode",
"(",
... | Gets the metadata configuration node.
@return \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition | [
"Gets",
"the",
"metadata",
"configuration",
"node",
"."
] | 7ce2abb7390c7eaf4081c5b7e00b96e7001774a4 | https://github.com/as3io/As3ModlrBundle/blob/7ce2abb7390c7eaf4081c5b7e00b96e7001774a4/DependencyInjection/Configuration.php#L88-L146 |
192,809 | as3io/As3ModlrBundle | DependencyInjection/Configuration.php | Configuration.getPersistersNode | private function getPersistersNode()
{
$node = $this->createRootNode('persisters');
return $node
->isRequired()
->useAttributeAsKey('name')
->prototype('array')
->children()
->enumNode('type')
->values([... | php | private function getPersistersNode()
{
$node = $this->createRootNode('persisters');
return $node
->isRequired()
->useAttributeAsKey('name')
->prototype('array')
->children()
->enumNode('type')
->values([... | [
"private",
"function",
"getPersistersNode",
"(",
")",
"{",
"$",
"node",
"=",
"$",
"this",
"->",
"createRootNode",
"(",
"'persisters'",
")",
";",
"return",
"$",
"node",
"->",
"isRequired",
"(",
")",
"->",
"useAttributeAsKey",
"(",
"'name'",
")",
"->",
"prot... | Gets the persisters configuration node.
@return \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition | [
"Gets",
"the",
"persisters",
"configuration",
"node",
"."
] | 7ce2abb7390c7eaf4081c5b7e00b96e7001774a4 | https://github.com/as3io/As3ModlrBundle/blob/7ce2abb7390c7eaf4081c5b7e00b96e7001774a4/DependencyInjection/Configuration.php#L153-L180 |
192,810 | as3io/As3ModlrBundle | DependencyInjection/Configuration.php | Configuration.getRestNode | private function getRestNode()
{
$node = $this->createRootNode('rest');
return $node
->addDefaultsIfNotSet()
->children()
->scalarNode('root_endpoint')->isRequired()->cannotBeEmpty()->defaultValue('modlr/api')
->validate()
... | php | private function getRestNode()
{
$node = $this->createRootNode('rest');
return $node
->addDefaultsIfNotSet()
->children()
->scalarNode('root_endpoint')->isRequired()->cannotBeEmpty()->defaultValue('modlr/api')
->validate()
... | [
"private",
"function",
"getRestNode",
"(",
")",
"{",
"$",
"node",
"=",
"$",
"this",
"->",
"createRootNode",
"(",
"'rest'",
")",
";",
"return",
"$",
"node",
"->",
"addDefaultsIfNotSet",
"(",
")",
"->",
"children",
"(",
")",
"->",
"scalarNode",
"(",
"'root... | Gets the rest configuration node.
@return \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition | [
"Gets",
"the",
"rest",
"configuration",
"node",
"."
] | 7ce2abb7390c7eaf4081c5b7e00b96e7001774a4 | https://github.com/as3io/As3ModlrBundle/blob/7ce2abb7390c7eaf4081c5b7e00b96e7001774a4/DependencyInjection/Configuration.php#L187-L205 |
192,811 | as3io/As3ModlrBundle | DependencyInjection/Configuration.php | Configuration.validateLibClassExists | private function validateLibClassExists($subClass, $path)
{
$class = Utility::getLibraryClass($subClass);
if (false === class_exists($class)) {
throw new InvalidConfigurationException(sprintf('The library class "%s" was not found for "%s" - was the library installed?', $class, $path));
... | php | private function validateLibClassExists($subClass, $path)
{
$class = Utility::getLibraryClass($subClass);
if (false === class_exists($class)) {
throw new InvalidConfigurationException(sprintf('The library class "%s" was not found for "%s" - was the library installed?', $class, $path));
... | [
"private",
"function",
"validateLibClassExists",
"(",
"$",
"subClass",
",",
"$",
"path",
")",
"{",
"$",
"class",
"=",
"Utility",
"::",
"getLibraryClass",
"(",
"$",
"subClass",
")",
";",
"if",
"(",
"false",
"===",
"class_exists",
"(",
"$",
"class",
")",
"... | Validates that a library class name exists.
@param string $subClass
@param string $path
@throws InvalidConfigurationException | [
"Validates",
"that",
"a",
"library",
"class",
"name",
"exists",
"."
] | 7ce2abb7390c7eaf4081c5b7e00b96e7001774a4 | https://github.com/as3io/As3ModlrBundle/blob/7ce2abb7390c7eaf4081c5b7e00b96e7001774a4/DependencyInjection/Configuration.php#L268-L274 |
192,812 | as3io/As3ModlrBundle | DependencyInjection/Configuration.php | Configuration.validateMetadataCache | private function validateMetadataCache(array $config)
{
if (false === $config['enabled']) {
return $this;
}
$this->validateTypeAndService($config, 'as3_modlr.metadata.cache');
switch ($config['type']) {
case 'redis':
$this->validateMetadataCac... | php | private function validateMetadataCache(array $config)
{
if (false === $config['enabled']) {
return $this;
}
$this->validateTypeAndService($config, 'as3_modlr.metadata.cache');
switch ($config['type']) {
case 'redis':
$this->validateMetadataCac... | [
"private",
"function",
"validateMetadataCache",
"(",
"array",
"$",
"config",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"config",
"[",
"'enabled'",
"]",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$",
"this",
"->",
"validateTypeAndService",
"(",
"$",
"con... | Validates the metadata cache config.
@param array $config
@return self
@throws InvalidConfigurationException | [
"Validates",
"the",
"metadata",
"cache",
"config",
"."
] | 7ce2abb7390c7eaf4081c5b7e00b96e7001774a4 | https://github.com/as3io/As3ModlrBundle/blob/7ce2abb7390c7eaf4081c5b7e00b96e7001774a4/DependencyInjection/Configuration.php#L283-L298 |
192,813 | as3io/As3ModlrBundle | DependencyInjection/Configuration.php | Configuration.validateMetadataDrivers | private function validateMetadataDrivers(array $drivers)
{
foreach ($drivers as $name => $config) {
$this->validateTypeAndService($config, sprintf('as3_modlr.metadata.drivers.%s', $name));
}
return $this;
} | php | private function validateMetadataDrivers(array $drivers)
{
foreach ($drivers as $name => $config) {
$this->validateTypeAndService($config, sprintf('as3_modlr.metadata.drivers.%s', $name));
}
return $this;
} | [
"private",
"function",
"validateMetadataDrivers",
"(",
"array",
"$",
"drivers",
")",
"{",
"foreach",
"(",
"$",
"drivers",
"as",
"$",
"name",
"=>",
"$",
"config",
")",
"{",
"$",
"this",
"->",
"validateTypeAndService",
"(",
"$",
"config",
",",
"sprintf",
"("... | Validates the metadata drivers config.
@param array $drivers
@return self
@throws InvalidConfigurationException | [
"Validates",
"the",
"metadata",
"drivers",
"config",
"."
] | 7ce2abb7390c7eaf4081c5b7e00b96e7001774a4 | https://github.com/as3io/As3ModlrBundle/blob/7ce2abb7390c7eaf4081c5b7e00b96e7001774a4/DependencyInjection/Configuration.php#L320-L326 |
192,814 | as3io/As3ModlrBundle | DependencyInjection/Configuration.php | Configuration.validatePersisters | private function validatePersisters(array $persisters)
{
foreach ($persisters as $name => $config) {
$this->validateTypeAndService($config, sprintf('as3_modlr.persisters.%s', $name));
switch ($config['type']) {
case 'mongodb':
$this->validateLibCla... | php | private function validatePersisters(array $persisters)
{
foreach ($persisters as $name => $config) {
$this->validateTypeAndService($config, sprintf('as3_modlr.persisters.%s', $name));
switch ($config['type']) {
case 'mongodb':
$this->validateLibCla... | [
"private",
"function",
"validatePersisters",
"(",
"array",
"$",
"persisters",
")",
"{",
"foreach",
"(",
"$",
"persisters",
"as",
"$",
"name",
"=>",
"$",
"config",
")",
"{",
"$",
"this",
"->",
"validateTypeAndService",
"(",
"$",
"config",
",",
"sprintf",
"(... | Validates the persisters config.
@param array $persisters
@return self
@throws InvalidConfigurationException | [
"Validates",
"the",
"persisters",
"config",
"."
] | 7ce2abb7390c7eaf4081c5b7e00b96e7001774a4 | https://github.com/as3io/As3ModlrBundle/blob/7ce2abb7390c7eaf4081c5b7e00b96e7001774a4/DependencyInjection/Configuration.php#L348-L361 |
192,815 | as3io/As3ModlrBundle | DependencyInjection/Configuration.php | Configuration.validateSearchClients | private function validateSearchClients(array $clients)
{
foreach ($clients as $name => $config) {
$this->validateTypeAndService($config, sprintf('as3_modlr.search_clients.%s', $name));
switch ($config['type']) {
case 'elastic':
$this->validateLibCl... | php | private function validateSearchClients(array $clients)
{
foreach ($clients as $name => $config) {
$this->validateTypeAndService($config, sprintf('as3_modlr.search_clients.%s', $name));
switch ($config['type']) {
case 'elastic':
$this->validateLibCl... | [
"private",
"function",
"validateSearchClients",
"(",
"array",
"$",
"clients",
")",
"{",
"foreach",
"(",
"$",
"clients",
"as",
"$",
"name",
"=>",
"$",
"config",
")",
"{",
"$",
"this",
"->",
"validateTypeAndService",
"(",
"$",
"config",
",",
"sprintf",
"(",
... | Validates the search clients config.
@param array $clients
@return self
@throws InvalidConfigurationException | [
"Validates",
"the",
"search",
"clients",
"config",
"."
] | 7ce2abb7390c7eaf4081c5b7e00b96e7001774a4 | https://github.com/as3io/As3ModlrBundle/blob/7ce2abb7390c7eaf4081c5b7e00b96e7001774a4/DependencyInjection/Configuration.php#L370-L382 |
192,816 | as3io/As3ModlrBundle | DependencyInjection/Configuration.php | Configuration.validateTypeAndService | private function validateTypeAndService(array $config, $path)
{
if (!isset($config['type']) && !isset($config['service'])) {
throw new InvalidConfigurationException(sprintf('You must set one of "type" or "service" for "%s"', $path));
}
if (isset($config['type']) && isset($config[... | php | private function validateTypeAndService(array $config, $path)
{
if (!isset($config['type']) && !isset($config['service'])) {
throw new InvalidConfigurationException(sprintf('You must set one of "type" or "service" for "%s"', $path));
}
if (isset($config['type']) && isset($config[... | [
"private",
"function",
"validateTypeAndService",
"(",
"array",
"$",
"config",
",",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"config",
"[",
"'type'",
"]",
")",
"&&",
"!",
"isset",
"(",
"$",
"config",
"[",
"'service'",
"]",
")",
")",
... | Validates a configuration that uses type and service as options.
@param array $config
@param string $path
@throws InvalidArgumentException | [
"Validates",
"a",
"configuration",
"that",
"uses",
"type",
"and",
"service",
"as",
"options",
"."
] | 7ce2abb7390c7eaf4081c5b7e00b96e7001774a4 | https://github.com/as3io/As3ModlrBundle/blob/7ce2abb7390c7eaf4081c5b7e00b96e7001774a4/DependencyInjection/Configuration.php#L391-L399 |
192,817 | MichaelJ2324/PHP-REST-Client | src/Client/AbstractClient.php | AbstractClient.setCurrentEndpoint | protected function setCurrentEndpoint(EndpointInterface $Endpoint)
{
if (isset($this->currentEndPoint)){
unset($this->lastEndPoint);
$this->lastEndPoint = $this->currentEndPoint;
unset($this->currentEndPoint);
}
$this->currentEndPoint = $Endpoint;
... | php | protected function setCurrentEndpoint(EndpointInterface $Endpoint)
{
if (isset($this->currentEndPoint)){
unset($this->lastEndPoint);
$this->lastEndPoint = $this->currentEndPoint;
unset($this->currentEndPoint);
}
$this->currentEndPoint = $Endpoint;
... | [
"protected",
"function",
"setCurrentEndpoint",
"(",
"EndpointInterface",
"$",
"Endpoint",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"currentEndPoint",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"lastEndPoint",
")",
";",
"$",
"this",
"->",
... | Rotates current Endpoint to Last Endpoint, and sets Current Endpoint with passed in Endpoint
@param EndpointInterface $Endpoint
@return self | [
"Rotates",
"current",
"Endpoint",
"to",
"Last",
"Endpoint",
"and",
"sets",
"Current",
"Endpoint",
"with",
"passed",
"in",
"Endpoint"
] | b8a2caaf6456eccaa845ba5c5098608aa9645c92 | https://github.com/MichaelJ2324/PHP-REST-Client/blob/b8a2caaf6456eccaa845ba5c5098608aa9645c92/src/Client/AbstractClient.php#L183-L192 |
192,818 | CraryPrimitiveMan/php-resque | src/core/Job.php | Job.reserve | public static function reserve($queue)
{
$payload = Resque::pop($queue);
if(!is_array($payload)) {
return false;
}
return new Job($queue, $payload);
} | php | public static function reserve($queue)
{
$payload = Resque::pop($queue);
if(!is_array($payload)) {
return false;
}
return new Job($queue, $payload);
} | [
"public",
"static",
"function",
"reserve",
"(",
"$",
"queue",
")",
"{",
"$",
"payload",
"=",
"Resque",
"::",
"pop",
"(",
"$",
"queue",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"payload",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
... | Find the next available job from the specified queue and return an
instance of Job for it.
@param string $queue The name of the queue to check for a job in.
@return null|object Null when there aren't any waiting jobs, instance of Job when a job was found. | [
"Find",
"the",
"next",
"available",
"job",
"from",
"the",
"specified",
"queue",
"and",
"return",
"an",
"instance",
"of",
"Job",
"for",
"it",
"."
] | eff3beba81b7f5e8d6fddb8d24c8dcde6553e209 | https://github.com/CraryPrimitiveMan/php-resque/blob/eff3beba81b7f5e8d6fddb8d24c8dcde6553e209/src/core/Job.php#L89-L97 |
192,819 | Linkvalue-Interne/MajoraGeneratorBundle | src/Majora/Bundle/GeneratorBundle/Generator/FileGenerator.php | FileGenerator.generatePath | protected function generatePath(SplFileInfo $fileinfo, $skeletonPath, $targetPath, Inflector $inflector)
{
return $inflector->translate(sprintf('%s%s',
$targetPath,
str_replace($skeletonPath, '', $fileinfo->getRealPath())
));
} | php | protected function generatePath(SplFileInfo $fileinfo, $skeletonPath, $targetPath, Inflector $inflector)
{
return $inflector->translate(sprintf('%s%s',
$targetPath,
str_replace($skeletonPath, '', $fileinfo->getRealPath())
));
} | [
"protected",
"function",
"generatePath",
"(",
"SplFileInfo",
"$",
"fileinfo",
",",
"$",
"skeletonPath",
",",
"$",
"targetPath",
",",
"Inflector",
"$",
"inflector",
")",
"{",
"return",
"$",
"inflector",
"->",
"translate",
"(",
"sprintf",
"(",
"'%s%s'",
",",
"... | generate targer file path from source path.
@param SplFileInfo $fileinfo
@param string $skeletonPath
@param string $targetPath
@param Inflector $inflector
@return string | [
"generate",
"targer",
"file",
"path",
"from",
"source",
"path",
"."
] | 9f745c1f64e913df90d86b4fd0770121c563552d | https://github.com/Linkvalue-Interne/MajoraGeneratorBundle/blob/9f745c1f64e913df90d86b4fd0770121c563552d/src/Majora/Bundle/GeneratorBundle/Generator/FileGenerator.php#L73-L79 |
192,820 | Linkvalue-Interne/MajoraGeneratorBundle | src/Majora/Bundle/GeneratorBundle/Generator/FileGenerator.php | FileGenerator.getMetadata | protected function getMetadata($templateFileContent)
{
$regex = '/\@MajoraGenerator\((.+)\)/';
$templateFileMetadata = array('force_generation' => false);
if (!preg_match_all($regex, $templateFileContent, $matches, PREG_SET_ORDER)) {
return $templateFileMetadata;
... | php | protected function getMetadata($templateFileContent)
{
$regex = '/\@MajoraGenerator\((.+)\)/';
$templateFileMetadata = array('force_generation' => false);
if (!preg_match_all($regex, $templateFileContent, $matches, PREG_SET_ORDER)) {
return $templateFileMetadata;
... | [
"protected",
"function",
"getMetadata",
"(",
"$",
"templateFileContent",
")",
"{",
"$",
"regex",
"=",
"'/\\@MajoraGenerator\\((.+)\\)/'",
";",
"$",
"templateFileMetadata",
"=",
"array",
"(",
"'force_generation'",
"=>",
"false",
")",
";",
"if",
"(",
"!",
"preg_matc... | parse metadata from given template content.
@param string $templateFileContent
@return array<alias, array> | [
"parse",
"metadata",
"from",
"given",
"template",
"content",
"."
] | 9f745c1f64e913df90d86b4fd0770121c563552d | https://github.com/Linkvalue-Interne/MajoraGeneratorBundle/blob/9f745c1f64e913df90d86b4fd0770121c563552d/src/Majora/Bundle/GeneratorBundle/Generator/FileGenerator.php#L88-L111 |
192,821 | Linkvalue-Interne/MajoraGeneratorBundle | src/Majora/Bundle/GeneratorBundle/Generator/FileGenerator.php | FileGenerator.generateDir | protected function generateDir($destDirPath)
{
// don't override dirs
if ($this->filesystem->exists($destDirPath)) {
return;
}
$this->filesystem->mkdir($destDirPath);
$this->logger->info(sprintf('dir created: %s', $destDirPath));
} | php | protected function generateDir($destDirPath)
{
// don't override dirs
if ($this->filesystem->exists($destDirPath)) {
return;
}
$this->filesystem->mkdir($destDirPath);
$this->logger->info(sprintf('dir created: %s', $destDirPath));
} | [
"protected",
"function",
"generateDir",
"(",
"$",
"destDirPath",
")",
"{",
"// don't override dirs",
"if",
"(",
"$",
"this",
"->",
"filesystem",
"->",
"exists",
"(",
"$",
"destDirPath",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"filesystem",
"-... | generate dest dir.
@param string $destDirPath | [
"generate",
"dest",
"dir",
"."
] | 9f745c1f64e913df90d86b4fd0770121c563552d | https://github.com/Linkvalue-Interne/MajoraGeneratorBundle/blob/9f745c1f64e913df90d86b4fd0770121c563552d/src/Majora/Bundle/GeneratorBundle/Generator/FileGenerator.php#L118-L127 |
192,822 | Linkvalue-Interne/MajoraGeneratorBundle | src/Majora/Bundle/GeneratorBundle/Generator/FileGenerator.php | FileGenerator.modify | public function modify(SplFileInfo $generatedFile, SplFileInfo $templateFile, array $modifiers, Inflector $inflector)
{
foreach ($modifiers as $modifierAlias => $modifierData) {
if ($modifier = $this->contentModifiers->get($modifierAlias)) {
$this->filesystem->dumpFile(
... | php | public function modify(SplFileInfo $generatedFile, SplFileInfo $templateFile, array $modifiers, Inflector $inflector)
{
foreach ($modifiers as $modifierAlias => $modifierData) {
if ($modifier = $this->contentModifiers->get($modifierAlias)) {
$this->filesystem->dumpFile(
... | [
"public",
"function",
"modify",
"(",
"SplFileInfo",
"$",
"generatedFile",
",",
"SplFileInfo",
"$",
"templateFile",
",",
"array",
"$",
"modifiers",
",",
"Inflector",
"$",
"inflector",
")",
"{",
"foreach",
"(",
"$",
"modifiers",
"as",
"$",
"modifierAlias",
"=>",... | run content modifiers on given file content.
@param SplFileInfo $generatedFile
@param SplFileInfo $templateFile
@param array $modifiers
@param Inflector $inflector
@return string | [
"run",
"content",
"modifiers",
"on",
"given",
"file",
"content",
"."
] | 9f745c1f64e913df90d86b4fd0770121c563552d | https://github.com/Linkvalue-Interne/MajoraGeneratorBundle/blob/9f745c1f64e913df90d86b4fd0770121c563552d/src/Majora/Bundle/GeneratorBundle/Generator/FileGenerator.php#L139-L154 |
192,823 | bseddon/XPath20 | lyquidity/Log.php | Log.createLog | public function createLog( $handler, $name, $ident, $conf = null, $level = null )
{
$this->log = \Log::singleton( $handler, $name, $ident, $conf, $level );
} | php | public function createLog( $handler, $name, $ident, $conf = null, $level = null )
{
$this->log = \Log::singleton( $handler, $name, $ident, $conf, $level );
} | [
"public",
"function",
"createLog",
"(",
"$",
"handler",
",",
"$",
"name",
",",
"$",
"ident",
",",
"$",
"conf",
"=",
"null",
",",
"$",
"level",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"log",
"=",
"\\",
"Log",
"::",
"singleton",
"(",
"$",
"handle... | This creates a specific type of log instance
@param string $handler The type of Log handler to construct
@param string $name The name of the log resource to which the events
will be logged. Defaults to an empty string.
@param string $ident An identification string that will be included in
all log events logged by t... | [
"This",
"creates",
"a",
"specific",
"type",
"of",
"log",
"instance"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/lyquidity/Log.php#L95-L98 |
192,824 | bseddon/XPath20 | lyquidity/Log.php | Log.fromXPath2Exception | public function fromXPath2Exception( $ex )
{
if ( ! $this->log ) return;
return $this->log->warning( $ex->ErrorCode . " " . $ex->getMessage() );
} | php | public function fromXPath2Exception( $ex )
{
if ( ! $this->log ) return;
return $this->log->warning( $ex->ErrorCode . " " . $ex->getMessage() );
} | [
"public",
"function",
"fromXPath2Exception",
"(",
"$",
"ex",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"log",
")",
"return",
";",
"return",
"$",
"this",
"->",
"log",
"->",
"warning",
"(",
"$",
"ex",
"->",
"ErrorCode",
".",
"\" \"",
".",
"$",
"ex... | A convenience function for logging a event about an XPath conformance issue.
It will log a message at the PEAR_LOG_DEBUG log level.
PEAR_LOG_WARNING
@param XPath2Exception $ex An exception reference
@return boolean True if the message was successfully logged. | [
"A",
"convenience",
"function",
"for",
"logging",
"a",
"event",
"about",
"an",
"XPath",
"conformance",
"issue",
".",
"It",
"will",
"log",
"a",
"message",
"at",
"the",
"PEAR_LOG_DEBUG",
"log",
"level",
"."
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/lyquidity/Log.php#L244-L248 |
192,825 | bseddon/XPath20 | lyquidity/Log.php | Log.setDebugLog | public function setDebugLog()
{
$logConsole = \Log::singleton( 'console', '', 'console',
array(
'lineFormat' => '%{timestamp} [%{priority}] %{message}',
'timeFormat' => '%Y-%m-%d %H:%M:%S',
)
);
$logError = \Log::singleton( 'error_log', PEAR_LOG_TYPE_SYSTEM, 'error_log',
array(
... | php | public function setDebugLog()
{
$logConsole = \Log::singleton( 'console', '', 'console',
array(
'lineFormat' => '%{timestamp} [%{priority}] %{message}',
'timeFormat' => '%Y-%m-%d %H:%M:%S',
)
);
$logError = \Log::singleton( 'error_log', PEAR_LOG_TYPE_SYSTEM, 'error_log',
array(
... | [
"public",
"function",
"setDebugLog",
"(",
")",
"{",
"$",
"logConsole",
"=",
"\\",
"Log",
"::",
"singleton",
"(",
"'console'",
",",
"''",
",",
"'console'",
",",
"array",
"(",
"'lineFormat'",
"=>",
"'%{timestamp} [%{priority}] %{message}'",
",",
"'timeFormat'",
"=... | Set log output for console and error_log
@return void | [
"Set",
"log",
"output",
"for",
"console",
"and",
"error_log"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/lyquidity/Log.php#L270-L290 |
192,826 | gplcart/ga_report | Main.php | Main.hookDashboardHandlers | public function hookDashboardHandlers(array &$handlers)
{
$weight = count($handlers);
$model = $this->getModel();
$settings = $this->module->getSettings('ga_report');
foreach ($model->getHandlers() as $id => $handler) {
if (!in_array($id, $settings['dashboard'])) {
... | php | public function hookDashboardHandlers(array &$handlers)
{
$weight = count($handlers);
$model = $this->getModel();
$settings = $this->module->getSettings('ga_report');
foreach ($model->getHandlers() as $id => $handler) {
if (!in_array($id, $settings['dashboard'])) {
... | [
"public",
"function",
"hookDashboardHandlers",
"(",
"array",
"&",
"$",
"handlers",
")",
"{",
"$",
"weight",
"=",
"count",
"(",
"$",
"handlers",
")",
";",
"$",
"model",
"=",
"$",
"this",
"->",
"getModel",
"(",
")",
";",
"$",
"settings",
"=",
"$",
"thi... | Implements hook "dashboard.handlers"
@param array $handlers | [
"Implements",
"hook",
"dashboard",
".",
"handlers"
] | 856a480e394bb3feaeea4785ccccad56abaac499 | https://github.com/gplcart/ga_report/blob/856a480e394bb3feaeea4785ccccad56abaac499/Main.php#L72-L104 |
192,827 | gplcart/ga_report | Main.php | Main.hookConstructControllerBackend | public function hookConstructControllerBackend($controller)
{
if ($controller->isQuery('ga.update')) {
$store_id = $controller->getQuery('ga.update.store_id', '');
$handler_id = $controller->getQuery('ga.update.handler_id', '');
$this->getModel()->clearCache($handler_id, ... | php | public function hookConstructControllerBackend($controller)
{
if ($controller->isQuery('ga.update')) {
$store_id = $controller->getQuery('ga.update.store_id', '');
$handler_id = $controller->getQuery('ga.update.handler_id', '');
$this->getModel()->clearCache($handler_id, ... | [
"public",
"function",
"hookConstructControllerBackend",
"(",
"$",
"controller",
")",
"{",
"if",
"(",
"$",
"controller",
"->",
"isQuery",
"(",
"'ga.update'",
")",
")",
"{",
"$",
"store_id",
"=",
"$",
"controller",
"->",
"getQuery",
"(",
"'ga.update.store_id'",
... | Implements hook "construct.controller.backend"
@param \gplcart\core\controllers\backend\Controller $controller | [
"Implements",
"hook",
"construct",
".",
"controller",
".",
"backend"
] | 856a480e394bb3feaeea4785ccccad56abaac499 | https://github.com/gplcart/ga_report/blob/856a480e394bb3feaeea4785ccccad56abaac499/Main.php#L110-L118 |
192,828 | gplcart/ga_report | Main.php | Main.getReport | public function getReport($handler, $settings = null)
{
if (!is_array($handler)) {
$handler = $this->getHandler($handler);
}
if (!isset($settings)) {
$settings = $this->module->getSettings('ga_report');
}
return $this->getModel()->get($handler, $sett... | php | public function getReport($handler, $settings = null)
{
if (!is_array($handler)) {
$handler = $this->getHandler($handler);
}
if (!isset($settings)) {
$settings = $this->module->getSettings('ga_report');
}
return $this->getModel()->get($handler, $sett... | [
"public",
"function",
"getReport",
"(",
"$",
"handler",
",",
"$",
"settings",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"handler",
")",
")",
"{",
"$",
"handler",
"=",
"$",
"this",
"->",
"getHandler",
"(",
"$",
"handler",
")",
";"... | Returns an array of Google Anylytics report
@param array|string $handler Either an array of handler data or a handler ID
@param array|null $settings An array of settings. If not provided, the module settings will be used
@return array | [
"Returns",
"an",
"array",
"of",
"Google",
"Anylytics",
"report"
] | 856a480e394bb3feaeea4785ccccad56abaac499 | https://github.com/gplcart/ga_report/blob/856a480e394bb3feaeea4785ccccad56abaac499/Main.php#L145-L156 |
192,829 | dmj/PicaRecord | src/HAB/Pica/Record/AuthorityRecord.php | AuthorityRecord.setPPN | public function setPPN ($ppn)
{
$ppnField = $this->getFirstMatchingField('003@/00');
if ($ppnField) {
$ppnSubfield = $ppnField->getNthSubfield('0', 0);
if ($ppnSubfield) {
$ppnSubfield->setValue($ppn);
} else {
$ppnField->append(new... | php | public function setPPN ($ppn)
{
$ppnField = $this->getFirstMatchingField('003@/00');
if ($ppnField) {
$ppnSubfield = $ppnField->getNthSubfield('0', 0);
if ($ppnSubfield) {
$ppnSubfield->setValue($ppn);
} else {
$ppnField->append(new... | [
"public",
"function",
"setPPN",
"(",
"$",
"ppn",
")",
"{",
"$",
"ppnField",
"=",
"$",
"this",
"->",
"getFirstMatchingField",
"(",
"'003@/00'",
")",
";",
"if",
"(",
"$",
"ppnField",
")",
"{",
"$",
"ppnSubfield",
"=",
"$",
"ppnField",
"->",
"getNthSubfield... | Set the Pica production number.
Create a field 003@/00 if necessary.
@param string $ppn Pica production number
@return void | [
"Set",
"the",
"Pica",
"production",
"number",
"."
] | bd5577b9a4333aa6156398b94cc870a9377061b8 | https://github.com/dmj/PicaRecord/blob/bd5577b9a4333aa6156398b94cc870a9377061b8/src/HAB/Pica/Record/AuthorityRecord.php#L78-L91 |
192,830 | bound1ess/essence | src/Essence/Essence.php | Essence.getMatcherConfiguration | public function getMatcherConfiguration($matcherClass)
{
if ( ! array_key_exists($matcherClass, $this->configuration["matcher_settings"])) {
return null;
}
$configuration = $this->configuration["matcher_settings"][$matcherClass];
unset($this->configuration["matcher_sett... | php | public function getMatcherConfiguration($matcherClass)
{
if ( ! array_key_exists($matcherClass, $this->configuration["matcher_settings"])) {
return null;
}
$configuration = $this->configuration["matcher_settings"][$matcherClass];
unset($this->configuration["matcher_sett... | [
"public",
"function",
"getMatcherConfiguration",
"(",
"$",
"matcherClass",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"matcherClass",
",",
"$",
"this",
"->",
"configuration",
"[",
"\"matcher_settings\"",
"]",
")",
")",
"{",
"return",
"null",
";",
... | Returns the configuration for the given matcher, or null.
@param string $matcherClass
@return array|null | [
"Returns",
"the",
"configuration",
"for",
"the",
"given",
"matcher",
"or",
"null",
"."
] | b773d3f17e192d7c7184ffd3640c668e7d74f69b | https://github.com/bound1ess/essence/blob/b773d3f17e192d7c7184ffd3640c668e7d74f69b/src/Essence/Essence.php#L131-L142 |
192,831 | bound1ess/essence | src/Essence/Essence.php | Essence.configure | public function configure(Closure $callback)
{
if ( ! is_array($configuration = $callback($this->configuration))) {
throw new Exceptions\InvalidConfigurationException($configuration);
}
$this->configuration = array_merge($this->defaultConfiguration, $configuration);
} | php | public function configure(Closure $callback)
{
if ( ! is_array($configuration = $callback($this->configuration))) {
throw new Exceptions\InvalidConfigurationException($configuration);
}
$this->configuration = array_merge($this->defaultConfiguration, $configuration);
} | [
"public",
"function",
"configure",
"(",
"Closure",
"$",
"callback",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"configuration",
"=",
"$",
"callback",
"(",
"$",
"this",
"->",
"configuration",
")",
")",
")",
"{",
"throw",
"new",
"Exceptions",
"\\",
... | Configures Essence via the given Closure.
@throws Essence\Exceptions\InvalidConfiguraitonException
@param Closure $callback
@return void | [
"Configures",
"Essence",
"via",
"the",
"given",
"Closure",
"."
] | b773d3f17e192d7c7184ffd3640c668e7d74f69b | https://github.com/bound1ess/essence/blob/b773d3f17e192d7c7184ffd3640c668e7d74f69b/src/Essence/Essence.php#L163-L170 |
192,832 | bound1ess/essence | src/Essence/Essence.php | Essence.setBuilder | public function setBuilder(AssertionBuilder $builder)
{
if ( ! is_null($this->builder) and $this->configuration["implicit_validation"]) {
$this->go();
}
$this->builders[] = $builder;
$this->builder = $builder;
} | php | public function setBuilder(AssertionBuilder $builder)
{
if ( ! is_null($this->builder) and $this->configuration["implicit_validation"]) {
$this->go();
}
$this->builders[] = $builder;
$this->builder = $builder;
} | [
"public",
"function",
"setBuilder",
"(",
"AssertionBuilder",
"$",
"builder",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"builder",
")",
"and",
"$",
"this",
"->",
"configuration",
"[",
"\"implicit_validation\"",
"]",
")",
"{",
"$",
"this",... | Replaces the stored AssertionBuilder instance with the given one.
@see Essence\Essence::$builder
@see Essence\Essence::$builders
@see Essence\Essence::getBuilder
@param Essence\AssertionBuilder $builder
@return void | [
"Replaces",
"the",
"stored",
"AssertionBuilder",
"instance",
"with",
"the",
"given",
"one",
"."
] | b773d3f17e192d7c7184ffd3640c668e7d74f69b | https://github.com/bound1ess/essence/blob/b773d3f17e192d7c7184ffd3640c668e7d74f69b/src/Essence/Essence.php#L229-L237 |
192,833 | bound1ess/essence | src/Essence/Essence.php | Essence.go | public function go($verbose = false)
{
$this->builder->setLinks($this->configuration["links"]);
$this->builder->setMatchers($this->configuration["matchers"]);
if ( ! $this->builder->validate()) {
// @codeCoverageIgnoreStart
if ($verbose) {
$this->dump... | php | public function go($verbose = false)
{
$this->builder->setLinks($this->configuration["links"]);
$this->builder->setMatchers($this->configuration["matchers"]);
if ( ! $this->builder->validate()) {
// @codeCoverageIgnoreStart
if ($verbose) {
$this->dump... | [
"public",
"function",
"go",
"(",
"$",
"verbose",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"builder",
"->",
"setLinks",
"(",
"$",
"this",
"->",
"configuration",
"[",
"\"links\"",
"]",
")",
";",
"$",
"this",
"->",
"builder",
"->",
"setMatchers",
"(",
... | Explicitly performs the validation.
@throws Essence\Exceptions\AssertionException|object
@param boolean $verbose
@return boolean | [
"Explicitly",
"performs",
"the",
"validation",
"."
] | b773d3f17e192d7c7184ffd3640c668e7d74f69b | https://github.com/bound1ess/essence/blob/b773d3f17e192d7c7184ffd3640c668e7d74f69b/src/Essence/Essence.php#L246-L262 |
192,834 | bound1ess/essence | src/Essence/Essence.php | Essence.dumpValueAndArguments | protected function dumpValueAndArguments(Matchers\AbstractMatcher $matcher)
{
printf("Value: %s" . PHP_EOL, $matcher->getDumper()->dump($matcher->getValue()));
print ("Arguments:" . PHP_EOL);
foreach ($matcher->getArguments() as $key => $argument) {
printf(" #%s: %s" . PHP_EOL,... | php | protected function dumpValueAndArguments(Matchers\AbstractMatcher $matcher)
{
printf("Value: %s" . PHP_EOL, $matcher->getDumper()->dump($matcher->getValue()));
print ("Arguments:" . PHP_EOL);
foreach ($matcher->getArguments() as $key => $argument) {
printf(" #%s: %s" . PHP_EOL,... | [
"protected",
"function",
"dumpValueAndArguments",
"(",
"Matchers",
"\\",
"AbstractMatcher",
"$",
"matcher",
")",
"{",
"printf",
"(",
"\"Value: %s\"",
".",
"PHP_EOL",
",",
"$",
"matcher",
"->",
"getDumper",
"(",
")",
"->",
"dump",
"(",
"$",
"matcher",
"->",
"... | "Dumps" given matcher's value and its arguments.
@codeCoverageIgnore
@param Essence\Matchers\AbstractMatcher
@return void | [
"Dumps",
"given",
"matcher",
"s",
"value",
"and",
"its",
"arguments",
"."
] | b773d3f17e192d7c7184ffd3640c668e7d74f69b | https://github.com/bound1ess/essence/blob/b773d3f17e192d7c7184ffd3640c668e7d74f69b/src/Essence/Essence.php#L303-L313 |
192,835 | RocketPropelledTortoise/Core | src/Entities/Entity.php | Entity.initialize | protected function initialize(array $fields)
{
$this->content = new Content;
$this->revision = new Revision;
foreach ($fields as $field => $settings) {
$this->data[$field] = $this->initializeField($field, $settings);
}
} | php | protected function initialize(array $fields)
{
$this->content = new Content;
$this->revision = new Revision;
foreach ($fields as $field => $settings) {
$this->data[$field] = $this->initializeField($field, $settings);
}
} | [
"protected",
"function",
"initialize",
"(",
"array",
"$",
"fields",
")",
"{",
"$",
"this",
"->",
"content",
"=",
"new",
"Content",
";",
"$",
"this",
"->",
"revision",
"=",
"new",
"Revision",
";",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"field",
"=>",... | Creates the Content, Revision and FieldCollections
@param array $fields The fields and their configurations
@throws InvalidFieldTypeException
@throws ReservedFieldNameException | [
"Creates",
"the",
"Content",
"Revision",
"and",
"FieldCollections"
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/Entity.php#L90-L98 |
192,836 | RocketPropelledTortoise/Core | src/Entities/Entity.php | Entity.initializeField | protected function initializeField($field, $settings)
{
if ($this->isContentField($field) || $this->isRevisionField($field)) {
throw new ReservedFieldNameException(
"The field '$field' cannot be used in '" . get_class($this) . "' as it is a reserved name"
);
}... | php | protected function initializeField($field, $settings)
{
if ($this->isContentField($field) || $this->isRevisionField($field)) {
throw new ReservedFieldNameException(
"The field '$field' cannot be used in '" . get_class($this) . "' as it is a reserved name"
);
}... | [
"protected",
"function",
"initializeField",
"(",
"$",
"field",
",",
"$",
"settings",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isContentField",
"(",
"$",
"field",
")",
"||",
"$",
"this",
"->",
"isRevisionField",
"(",
"$",
"field",
")",
")",
"{",
"throw"... | Validate configuration and prepare a FieldCollection
@param string $field
@param array $settings
@throws InvalidFieldTypeException
@throws ReservedFieldNameException
@return FieldCollection | [
"Validate",
"configuration",
"and",
"prepare",
"a",
"FieldCollection"
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/Entity.php#L109-L126 |
192,837 | RocketPropelledTortoise/Core | src/Entities/Entity.php | Entity.newRevision | public function newRevision($language_id = null)
{
$created = new static($language_id ?: $this->language_id);
$created->content = $this->content;
return $created;
} | php | public function newRevision($language_id = null)
{
$created = new static($language_id ?: $this->language_id);
$created->content = $this->content;
return $created;
} | [
"public",
"function",
"newRevision",
"(",
"$",
"language_id",
"=",
"null",
")",
"{",
"$",
"created",
"=",
"new",
"static",
"(",
"$",
"language_id",
"?",
":",
"$",
"this",
"->",
"language_id",
")",
";",
"$",
"created",
"->",
"content",
"=",
"$",
"this",... | Create a new revision based on the same content ID but without the content.
Very useful if you want to add a new language
@param int $language_id
@return static | [
"Create",
"a",
"new",
"revision",
"based",
"on",
"the",
"same",
"content",
"ID",
"but",
"without",
"the",
"content",
".",
"Very",
"useful",
"if",
"you",
"want",
"to",
"add",
"a",
"new",
"language"
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/Entity.php#L152-L158 |
192,838 | RocketPropelledTortoise/Core | src/Entities/Entity.php | Entity.setOnField | protected function setOnField(FieldCollection $field, $value)
{
if (!is_array($value)) {
if ($field->getMaxItems() != 1) {
throw new MultipleFieldAssignmentException('You cannot assign a value to replace a multiple field');
}
$field->offsetSet(static::$SI... | php | protected function setOnField(FieldCollection $field, $value)
{
if (!is_array($value)) {
if ($field->getMaxItems() != 1) {
throw new MultipleFieldAssignmentException('You cannot assign a value to replace a multiple field');
}
$field->offsetSet(static::$SI... | [
"protected",
"function",
"setOnField",
"(",
"FieldCollection",
"$",
"field",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"if",
"(",
"$",
"field",
"->",
"getMaxItems",
"(",
")",
"!=",
"1",
")",
"{",
"th... | Set values on a field
@param FieldCollection $field
@param $value
@throws MultipleFieldAssignmentException | [
"Set",
"values",
"on",
"a",
"field"
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/Entity.php#L289-L310 |
192,839 | RocketPropelledTortoise/Core | src/Entities/Entity.php | Entity.getFieldTypes | protected function getFieldTypes()
{
return (new Collection($this->getFields()))
->map(function ($options) {
return $options['type'];
})
->values()
->unique()
->map(function ($type) {
return self::$types[$type];
... | php | protected function getFieldTypes()
{
return (new Collection($this->getFields()))
->map(function ($options) {
return $options['type'];
})
->values()
->unique()
->map(function ($type) {
return self::$types[$type];
... | [
"protected",
"function",
"getFieldTypes",
"(",
")",
"{",
"return",
"(",
"new",
"Collection",
"(",
"$",
"this",
"->",
"getFields",
"(",
")",
")",
")",
"->",
"map",
"(",
"function",
"(",
"$",
"options",
")",
"{",
"return",
"$",
"options",
"[",
"'type'",
... | Get all field types in this Entity.
@return Collection | [
"Get",
"all",
"field",
"types",
"in",
"this",
"Entity",
"."
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/Entity.php#L317-L328 |
192,840 | RocketPropelledTortoise/Core | src/Entities/Entity.php | Entity.findRevision | protected static function findRevision($id, $language_id, $revision_id = null)
{
try {
if (is_numeric($revision_id) && $revision_id != 0) {
$revision = Revision::findOrFail($revision_id);
if ($revision->content_id != $id) {
throw new RevisionE... | php | protected static function findRevision($id, $language_id, $revision_id = null)
{
try {
if (is_numeric($revision_id) && $revision_id != 0) {
$revision = Revision::findOrFail($revision_id);
if ($revision->content_id != $id) {
throw new RevisionE... | [
"protected",
"static",
"function",
"findRevision",
"(",
"$",
"id",
",",
"$",
"language_id",
",",
"$",
"revision_id",
"=",
"null",
")",
"{",
"try",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"revision_id",
")",
"&&",
"$",
"revision_id",
"!=",
"0",
")",
"{"... | Find the requested Revision.
If a revision_id it will be requested against the requested ID and Language.
If none is requested, it will find the revision that is published in that language.
@param int $id The content ID
@param int $language_id The language ID
@param int $revision_id The revision ID which you want to... | [
"Find",
"the",
"requested",
"Revision",
"."
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/Entity.php#L346-L382 |
192,841 | RocketPropelledTortoise/Core | src/Entities/Entity.php | Entity.find | public static function find($id, $language_id, $revision_id = null)
{
$instance = new static($language_id);
try {
$instance->content = Content::findOrFail($id);
} catch (ModelNotFoundException $e) {
throw new EntityNotFoundException("The entity with id '$id' doesn't ... | php | public static function find($id, $language_id, $revision_id = null)
{
$instance = new static($language_id);
try {
$instance->content = Content::findOrFail($id);
} catch (ModelNotFoundException $e) {
throw new EntityNotFoundException("The entity with id '$id' doesn't ... | [
"public",
"static",
"function",
"find",
"(",
"$",
"id",
",",
"$",
"language_id",
",",
"$",
"revision_id",
"=",
"null",
")",
"{",
"$",
"instance",
"=",
"new",
"static",
"(",
"$",
"language_id",
")",
";",
"try",
"{",
"$",
"instance",
"->",
"content",
"... | Find the latest valid revision for this entity
@param int $id The content ID
@param int $language_id The language ID
@param int $revision_id The revision ID which you want to load, this is optional
@throws EntityNotFoundException
@throws NoPublishedRevisionForLanguageException
@throws NoRevisionForLanguageException
@t... | [
"Find",
"the",
"latest",
"valid",
"revision",
"for",
"this",
"entity"
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/Entity.php#L397-L419 |
192,842 | RocketPropelledTortoise/Core | src/Entities/Entity.php | Entity.save | public function save($newRevision = false, $publishRevision = true)
{
if ($newRevision) {
$revision = new Revision;
$revision->language_id = $this->revision->language_id;
$this->revision = $revision;
}
DB::transaction(
function () use ($newRe... | php | public function save($newRevision = false, $publishRevision = true)
{
if ($newRevision) {
$revision = new Revision;
$revision->language_id = $this->revision->language_id;
$this->revision = $revision;
}
DB::transaction(
function () use ($newRe... | [
"public",
"function",
"save",
"(",
"$",
"newRevision",
"=",
"false",
",",
"$",
"publishRevision",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"newRevision",
")",
"{",
"$",
"revision",
"=",
"new",
"Revision",
";",
"$",
"revision",
"->",
"language_id",
"=",
"... | Save a revision
@param bool $newRevision Should we create a new revision, false by default
@param bool $publishRevision Should we immediately publish this revision, true by default | [
"Save",
"a",
"revision"
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/Entity.php#L427-L463 |
192,843 | RocketPropelledTortoise/Core | src/Entities/Entity.php | Entity.saveRevision | protected function saveRevision($publishRevision)
{
if (!$this->revision->exists && !$publishRevision) {
$this->revision->published = $publishRevision;
}
$this->revision->content_id = $this->content->id;
$this->revision->save();
if ($publishRevision) {
... | php | protected function saveRevision($publishRevision)
{
if (!$this->revision->exists && !$publishRevision) {
$this->revision->published = $publishRevision;
}
$this->revision->content_id = $this->content->id;
$this->revision->save();
if ($publishRevision) {
... | [
"protected",
"function",
"saveRevision",
"(",
"$",
"publishRevision",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"revision",
"->",
"exists",
"&&",
"!",
"$",
"publishRevision",
")",
"{",
"$",
"this",
"->",
"revision",
"->",
"published",
"=",
"$",
"publi... | Save the revision
@param bool $publishRevision Should we immediately publish this revision, true by default | [
"Save",
"the",
"revision"
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/Entity.php#L478-L490 |
192,844 | RocketPropelledTortoise/Core | src/Entities/Entity.php | Entity.unpublishOtherRevisions | protected function unpublishOtherRevisions()
{
if ($this->content->wasRecentlyCreated) {
return;
}
// Unpublish all other revisions
Revision::where('content_id', $this->content->id)
->where('language_id', $this->revision->language_id)
->where('id'... | php | protected function unpublishOtherRevisions()
{
if ($this->content->wasRecentlyCreated) {
return;
}
// Unpublish all other revisions
Revision::where('content_id', $this->content->id)
->where('language_id', $this->revision->language_id)
->where('id'... | [
"protected",
"function",
"unpublishOtherRevisions",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"content",
"->",
"wasRecentlyCreated",
")",
"{",
"return",
";",
"}",
"// Unpublish all other revisions",
"Revision",
"::",
"where",
"(",
"'content_id'",
",",
"$",
"t... | Unpublish the revisions other than this one.
Only for the same content_id and language_id | [
"Unpublish",
"the",
"revisions",
"other",
"than",
"this",
"one",
".",
"Only",
"for",
"the",
"same",
"content_id",
"and",
"language_id"
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/Entity.php#L496-L507 |
192,845 | RocketPropelledTortoise/Core | src/Entities/Entity.php | Entity.saveField | protected function saveField(Field $field, $newRevision)
{
// If we create a new revision, this will
// reinit the field to a non-saved field
// and create a new row in the database
if ($newRevision) {
$field->id = null;
$field->exists = false;
}
... | php | protected function saveField(Field $field, $newRevision)
{
// If we create a new revision, this will
// reinit the field to a non-saved field
// and create a new row in the database
if ($newRevision) {
$field->id = null;
$field->exists = false;
}
... | [
"protected",
"function",
"saveField",
"(",
"Field",
"$",
"field",
",",
"$",
"newRevision",
")",
"{",
"// If we create a new revision, this will",
"// reinit the field to a non-saved field",
"// and create a new row in the database",
"if",
"(",
"$",
"newRevision",
")",
"{",
... | Save a single field instance
@param Field $field The field instance to save
@param bool $newRevision Should we create a new revision? | [
"Save",
"a",
"single",
"field",
"instance"
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/Entity.php#L515-L528 |
192,846 | RocketPropelledTortoise/Core | src/Entities/Entity.php | Entity.toArray | public function toArray()
{
$content = [
'id' => $this->content->id,
'_content' => $this->content->toArray(),
'_revision' => $this->revision->toArray(),
];
foreach ($this->data as $field => $data) {
$content[$field] = $data->toArray();
... | php | public function toArray()
{
$content = [
'id' => $this->content->id,
'_content' => $this->content->toArray(),
'_revision' => $this->revision->toArray(),
];
foreach ($this->data as $field => $data) {
$content[$field] = $data->toArray();
... | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"content",
"=",
"[",
"'id'",
"=>",
"$",
"this",
"->",
"content",
"->",
"id",
",",
"'_content'",
"=>",
"$",
"this",
"->",
"content",
"->",
"toArray",
"(",
")",
",",
"'_revision'",
"=>",
"$",
"this",... | Convert the Entity to an array.
@return array | [
"Convert",
"the",
"Entity",
"to",
"an",
"array",
"."
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/Entity.php#L535-L548 |
192,847 | RocketPropelledTortoise/Core | src/Entities/Entity.php | Entity.delete | public function delete($clear = true)
{
$revisions = Revision::where('content_id', $this->content->id)->get();
$ids = $revisions->pluck('id');
$this->getFieldTypes()->each(function ($type) use ($ids) {
$type::whereIn('revision_id', $ids)->delete();
});
Revision... | php | public function delete($clear = true)
{
$revisions = Revision::where('content_id', $this->content->id)->get();
$ids = $revisions->pluck('id');
$this->getFieldTypes()->each(function ($type) use ($ids) {
$type::whereIn('revision_id', $ids)->delete();
});
Revision... | [
"public",
"function",
"delete",
"(",
"$",
"clear",
"=",
"true",
")",
"{",
"$",
"revisions",
"=",
"Revision",
"::",
"where",
"(",
"'content_id'",
",",
"$",
"this",
"->",
"content",
"->",
"id",
")",
"->",
"get",
"(",
")",
";",
"$",
"ids",
"=",
"$",
... | Delete this entity and all the underlying Revisions.
@param bool $clear Should we clear the fields after deleting the revision ? | [
"Delete",
"this",
"entity",
"and",
"all",
"the",
"underlying",
"Revisions",
"."
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/Entity.php#L555-L577 |
192,848 | RocketPropelledTortoise/Core | src/Entities/Entity.php | Entity.deleteRevision | public function deleteRevision($clear = true)
{
$this->getFieldTypes()->each(function ($type) {
$type::where('revision_id', $this->revision->id)->delete();
});
// If this revision is currently
// published, we need to publish
// another revision in place.
... | php | public function deleteRevision($clear = true)
{
$this->getFieldTypes()->each(function ($type) {
$type::where('revision_id', $this->revision->id)->delete();
});
// If this revision is currently
// published, we need to publish
// another revision in place.
... | [
"public",
"function",
"deleteRevision",
"(",
"$",
"clear",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"getFieldTypes",
"(",
")",
"->",
"each",
"(",
"function",
"(",
"$",
"type",
")",
"{",
"$",
"type",
"::",
"where",
"(",
"'revision_id'",
",",
"$",
"th... | Delete the current revision.
@param bool $clear Should we clear the fields after deleting the revision ? | [
"Delete",
"the",
"current",
"revision",
"."
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/Entity.php#L584-L606 |
192,849 | RocketPropelledTortoise/Core | src/Entities/Entity.php | Entity.clearFields | protected function clearFields()
{
// Void all the fields
foreach (array_keys($this->data) as $fieldName) {
/** @var FieldCollection $field */
$field = $this->data[$fieldName];
$field->clear();
$field->syncOriginal();
}
} | php | protected function clearFields()
{
// Void all the fields
foreach (array_keys($this->data) as $fieldName) {
/** @var FieldCollection $field */
$field = $this->data[$fieldName];
$field->clear();
$field->syncOriginal();
}
} | [
"protected",
"function",
"clearFields",
"(",
")",
"{",
"// Void all the fields",
"foreach",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"data",
")",
"as",
"$",
"fieldName",
")",
"{",
"/** @var FieldCollection $field */",
"$",
"field",
"=",
"$",
"this",
"->",
"d... | Clear all the fields from their content | [
"Clear",
"all",
"the",
"fields",
"from",
"their",
"content"
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/Entity.php#L611-L621 |
192,850 | RocketPropelledTortoise/Core | src/Entities/Entity.php | Entity.publishRevision | public function publishRevision()
{
$this->revision->published = true;
$this->revision->save();
$this->unpublishOtherRevisions();
} | php | public function publishRevision()
{
$this->revision->published = true;
$this->revision->save();
$this->unpublishOtherRevisions();
} | [
"public",
"function",
"publishRevision",
"(",
")",
"{",
"$",
"this",
"->",
"revision",
"->",
"published",
"=",
"true",
";",
"$",
"this",
"->",
"revision",
"->",
"save",
"(",
")",
";",
"$",
"this",
"->",
"unpublishOtherRevisions",
"(",
")",
";",
"}"
] | Publish the current revision and unpublish the other revisions of the same language. | [
"Publish",
"the",
"current",
"revision",
"and",
"unpublish",
"the",
"other",
"revisions",
"of",
"the",
"same",
"language",
"."
] | 78b65663fc463e21e494257140ddbed0a9ccb3c3 | https://github.com/RocketPropelledTortoise/Core/blob/78b65663fc463e21e494257140ddbed0a9ccb3c3/src/Entities/Entity.php#L626-L632 |
192,851 | Kris-Kuiper/sFire-Framework | src/MVC/Mapper.php | Mapper.dbtable | public function dbtable($dbtable = null) {
if(true === isset($this -> dbtable) && null === $dbtable) {
$dbtable = $this -> dbtable;
}
if($dbtable !== null && false === is_string($dbtable)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD_... | php | public function dbtable($dbtable = null) {
if(true === isset($this -> dbtable) && null === $dbtable) {
$dbtable = $this -> dbtable;
}
if($dbtable !== null && false === is_string($dbtable)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD_... | [
"public",
"function",
"dbtable",
"(",
"$",
"dbtable",
"=",
"null",
")",
"{",
"if",
"(",
"true",
"===",
"isset",
"(",
"$",
"this",
"->",
"dbtable",
")",
"&&",
"null",
"===",
"$",
"dbtable",
")",
"{",
"$",
"dbtable",
"=",
"$",
"this",
"->",
"dbtable"... | Loads and stores a new DBTable and returns it
@param string $dbtable
@return mixed | [
"Loads",
"and",
"stores",
"a",
"new",
"DBTable",
"and",
"returns",
"it"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/MVC/Mapper.php#L40-L101 |
192,852 | Kris-Kuiper/sFire-Framework | src/MVC/Mapper.php | Mapper.setDBTable | protected function setDBTable($dbtable) {
if(false === is_string($dbtable)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($dbtable)), E_USER_ERROR);
}
$this -> dbtable = $dbtable;
} | php | protected function setDBTable($dbtable) {
if(false === is_string($dbtable)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($dbtable)), E_USER_ERROR);
}
$this -> dbtable = $dbtable;
} | [
"protected",
"function",
"setDBTable",
"(",
"$",
"dbtable",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"dbtable",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type string, \"%s\" given'",
... | Set the dbtable
@param string $dbtable | [
"Set",
"the",
"dbtable"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/MVC/Mapper.php#L108-L115 |
192,853 | miaoxing/plugin | src/Service/Migration.php | Migration.status | public function status()
{
$status = $this->getStatus();
if (!$status) {
$this->writeln('No migrations found.');
return;
}
$this->writeln(' Ran? Name ');
$this->writeln('--------------');
foreach ($status as $row) {
if ($row['... | php | public function status()
{
$status = $this->getStatus();
if (!$status) {
$this->writeln('No migrations found.');
return;
}
$this->writeln(' Ran? Name ');
$this->writeln('--------------');
foreach ($status as $row) {
if ($row['... | [
"public",
"function",
"status",
"(",
")",
"{",
"$",
"status",
"=",
"$",
"this",
"->",
"getStatus",
"(",
")",
";",
"if",
"(",
"!",
"$",
"status",
")",
"{",
"$",
"this",
"->",
"writeln",
"(",
"'No migrations found.'",
")",
";",
"return",
";",
"}",
"$... | Output the migration status table | [
"Output",
"the",
"migration",
"status",
"table"
] | f287a1e6c97abba6f06906255b8c26e8ab0afe61 | https://github.com/miaoxing/plugin/blob/f287a1e6c97abba6f06906255b8c26e8ab0afe61/src/Service/Migration.php#L161-L181 |
192,854 | nails/module-blog | admin/controllers/Post.php | Post.delete | public function delete()
{
if (!userHasPermission('admin:blog:post:' . $this->blog->id . ':delete')) {
unauthorised();
}
// --------------------------------------------------------------------------
// Fetch and check post
$iPostId = (int) $this->uri->segment(... | php | public function delete()
{
if (!userHasPermission('admin:blog:post:' . $this->blog->id . ':delete')) {
unauthorised();
}
// --------------------------------------------------------------------------
// Fetch and check post
$iPostId = (int) $this->uri->segment(... | [
"public",
"function",
"delete",
"(",
")",
"{",
"if",
"(",
"!",
"userHasPermission",
"(",
"'admin:blog:post:'",
".",
"$",
"this",
"->",
"blog",
"->",
"id",
".",
"':delete'",
")",
")",
"{",
"unauthorised",
"(",
")",
";",
"}",
"// ------------------------------... | Delete a blog post
@return void | [
"Delete",
"a",
"blog",
"post"
] | 7b369c5209f4343fff7c7e2a22c237d5a95c8c24 | https://github.com/nails/module-blog/blob/7b369c5209f4343fff7c7e2a22c237d5a95c8c24/admin/controllers/Post.php#L814-L855 |
192,855 | nails/module-blog | admin/controllers/Post.php | Post.restore | public function restore()
{
if (!userHasPermission('admin:blog:post:' . $this->blog->id . ':restore')) {
unauthorised();
}
// --------------------------------------------------------------------------
// Fetch and check post
$iPostId = (int) $this->uri->segmen... | php | public function restore()
{
if (!userHasPermission('admin:blog:post:' . $this->blog->id . ':restore')) {
unauthorised();
}
// --------------------------------------------------------------------------
// Fetch and check post
$iPostId = (int) $this->uri->segmen... | [
"public",
"function",
"restore",
"(",
")",
"{",
"if",
"(",
"!",
"userHasPermission",
"(",
"'admin:blog:post:'",
".",
"$",
"this",
"->",
"blog",
"->",
"id",
".",
"':restore'",
")",
")",
"{",
"unauthorised",
"(",
")",
";",
"}",
"// ----------------------------... | Restore a blog post
@return void | [
"Restore",
"a",
"blog",
"post"
] | 7b369c5209f4343fff7c7e2a22c237d5a95c8c24 | https://github.com/nails/module-blog/blob/7b369c5209f4343fff7c7e2a22c237d5a95c8c24/admin/controllers/Post.php#L863-L902 |
192,856 | nails/module-blog | admin/controllers/Post.php | Post.callbackValidAudioUrl | public function callbackValidAudioUrl($sUrl)
{
$sId = $this->blog_post_model->extractSpotifyId($sUrl);
if (!empty($sId)) {
return true;
} else {
$oFormValidation = Factory::service('FormValidation');
$oFormValidation->set_message('callbackValidAudioUrl... | php | public function callbackValidAudioUrl($sUrl)
{
$sId = $this->blog_post_model->extractSpotifyId($sUrl);
if (!empty($sId)) {
return true;
} else {
$oFormValidation = Factory::service('FormValidation');
$oFormValidation->set_message('callbackValidAudioUrl... | [
"public",
"function",
"callbackValidAudioUrl",
"(",
"$",
"sUrl",
")",
"{",
"$",
"sId",
"=",
"$",
"this",
"->",
"blog_post_model",
"->",
"extractSpotifyId",
"(",
"$",
"sUrl",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"sId",
")",
")",
"{",
"return",
... | Form Validation callback, checks that a Spotify ID can be extracted from the string
@param string $sUrl The URL to check
@return boolean | [
"Form",
"Validation",
"callback",
"checks",
"that",
"a",
"Spotify",
"ID",
"can",
"be",
"extracted",
"from",
"the",
"string"
] | 7b369c5209f4343fff7c7e2a22c237d5a95c8c24 | https://github.com/nails/module-blog/blob/7b369c5209f4343fff7c7e2a22c237d5a95c8c24/admin/controllers/Post.php#L922-L936 |
192,857 | nails/module-blog | admin/controllers/Post.php | Post.callbackValidVideoUrl | public function callbackValidVideoUrl($sUrl)
{
$sId = $this->blog_post_model->extractYoutubeId($sUrl);
if (!empty($sId)) {
return true;
} else {
$sId = $this->blog_post_model->extractVimeoId($sUrl);
if (!empty($sId)) {
return true;
... | php | public function callbackValidVideoUrl($sUrl)
{
$sId = $this->blog_post_model->extractYoutubeId($sUrl);
if (!empty($sId)) {
return true;
} else {
$sId = $this->blog_post_model->extractVimeoId($sUrl);
if (!empty($sId)) {
return true;
... | [
"public",
"function",
"callbackValidVideoUrl",
"(",
"$",
"sUrl",
")",
"{",
"$",
"sId",
"=",
"$",
"this",
"->",
"blog_post_model",
"->",
"extractYoutubeId",
"(",
"$",
"sUrl",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"sId",
")",
")",
"{",
"return",
... | Form Validation callback, checks that a YouTube or Vimeo ID can be extracted from the string
@param string $sUrl The URL to check
@return boolean | [
"Form",
"Validation",
"callback",
"checks",
"that",
"a",
"YouTube",
"or",
"Vimeo",
"ID",
"can",
"be",
"extracted",
"from",
"the",
"string"
] | 7b369c5209f4343fff7c7e2a22c237d5a95c8c24 | https://github.com/nails/module-blog/blob/7b369c5209f4343fff7c7e2a22c237d5a95c8c24/admin/controllers/Post.php#L945-L968 |
192,858 | zhaoxianfang/tools | src/Symfony/Component/Config/Definition/ArrayNode.php | ArrayNode.validateType | protected function validateType($value)
{
if (!is_array($value) && (!$this->allowFalse || false !== $value)) {
$ex = new InvalidTypeException(sprintf(
'Invalid type for path "%s". Expected array, but got %s',
$this->getPath(),
gettype($value)
... | php | protected function validateType($value)
{
if (!is_array($value) && (!$this->allowFalse || false !== $value)) {
$ex = new InvalidTypeException(sprintf(
'Invalid type for path "%s". Expected array, but got %s',
$this->getPath(),
gettype($value)
... | [
"protected",
"function",
"validateType",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"value",
")",
"&&",
"(",
"!",
"$",
"this",
"->",
"allowFalse",
"||",
"false",
"!==",
"$",
"value",
")",
")",
"{",
"$",
"ex",
"=",
"new",
"... | Validates the type of the value.
@param mixed $value
@throws InvalidTypeException | [
"Validates",
"the",
"type",
"of",
"the",
"value",
"."
] | d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7 | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/Config/Definition/ArrayNode.php#L264-L279 |
192,859 | ekyna/Resource | Dispatcher/ResourceEventDispatcherTrait.php | ResourceEventDispatcherTrait.getResourceEventName | public function getResourceEventName(ResourceInterface $resource, $suffix)
{
if (null !== $configuration = $this->registry->findConfiguration($resource, false)) {
return sprintf('%s.%s', $configuration->getResourceId(), $suffix);
}
// TODO throw exception ?
return null;... | php | public function getResourceEventName(ResourceInterface $resource, $suffix)
{
if (null !== $configuration = $this->registry->findConfiguration($resource, false)) {
return sprintf('%s.%s', $configuration->getResourceId(), $suffix);
}
// TODO throw exception ?
return null;... | [
"public",
"function",
"getResourceEventName",
"(",
"ResourceInterface",
"$",
"resource",
",",
"$",
"suffix",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"configuration",
"=",
"$",
"this",
"->",
"registry",
"->",
"findConfiguration",
"(",
"$",
"resource",
",",
"... | Returns the resource event name.
@param ResourceInterface $resource
@param string $suffix
@return string|null | [
"Returns",
"the",
"resource",
"event",
"name",
"."
] | 96ee3d28e02bd9513705408e3bb7f88a76e52f56 | https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Dispatcher/ResourceEventDispatcherTrait.php#L92-L101 |
192,860 | ptlis/grep-db | src/Metadata/MySQL/ServerMetadata.php | ServerMetadata.getDatabaseMetadata | public function getDatabaseMetadata(string $databaseName): DatabaseMetadata
{
if (!array_key_exists($databaseName, $this->databaseMetadataList)) {
throw new \RuntimeException('Server "' . $this->host . '" doesn\'t contain database "' . $databaseName . '"');
}
return $this->datab... | php | public function getDatabaseMetadata(string $databaseName): DatabaseMetadata
{
if (!array_key_exists($databaseName, $this->databaseMetadataList)) {
throw new \RuntimeException('Server "' . $this->host . '" doesn\'t contain database "' . $databaseName . '"');
}
return $this->datab... | [
"public",
"function",
"getDatabaseMetadata",
"(",
"string",
"$",
"databaseName",
")",
":",
"DatabaseMetadata",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"databaseName",
",",
"$",
"this",
"->",
"databaseMetadataList",
")",
")",
"{",
"throw",
"new",
"\\... | Returns database metadata for the specified database. | [
"Returns",
"database",
"metadata",
"for",
"the",
"specified",
"database",
"."
] | 7abff68982d426690d0515ccd7adc7a2e3d72a3f | https://github.com/ptlis/grep-db/blob/7abff68982d426690d0515ccd7adc7a2e3d72a3f/src/Metadata/MySQL/ServerMetadata.php#L56-L63 |
192,861 | ytake/ConsoleKernel | src/Command.php | Command.configure | public function configure()
{
$this->setName($this->command);
$this->setDescription($this->description);
$this->arguments();
} | php | public function configure()
{
$this->setName($this->command);
$this->setDescription($this->description);
$this->arguments();
} | [
"public",
"function",
"configure",
"(",
")",
"{",
"$",
"this",
"->",
"setName",
"(",
"$",
"this",
"->",
"command",
")",
";",
"$",
"this",
"->",
"setDescription",
"(",
"$",
"this",
"->",
"description",
")",
";",
"$",
"this",
"->",
"arguments",
"(",
")... | command interface configure
@return void | [
"command",
"interface",
"configure"
] | 605e6421f968c744c3ffaa07cba3ade1a7a6e623 | https://github.com/ytake/ConsoleKernel/blob/605e6421f968c744c3ffaa07cba3ade1a7a6e623/src/Command.php#L55-L60 |
192,862 | rzajac/phptools | src/Date/DateTime.php | DateTime.toMySQLDate | public function toMySQLDate($withTime = true)
{
if ($this->isHollow()) {
return $withTime ? '0000-00-00 00:00:00' : '0000-00-00';
}
$format = $withTime ? 'Y-m-d H:i:s' : 'Y-m-d';
return $this->format($format);
} | php | public function toMySQLDate($withTime = true)
{
if ($this->isHollow()) {
return $withTime ? '0000-00-00 00:00:00' : '0000-00-00';
}
$format = $withTime ? 'Y-m-d H:i:s' : 'Y-m-d';
return $this->format($format);
} | [
"public",
"function",
"toMySQLDate",
"(",
"$",
"withTime",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isHollow",
"(",
")",
")",
"{",
"return",
"$",
"withTime",
"?",
"'0000-00-00 00:00:00'",
":",
"'0000-00-00'",
";",
"}",
"$",
"format",
"=",
... | Returns date in MySQL format.
NOTE: It returns 0000-00-00 00:00:00 for hollow dates
@param bool $withTime
@return string | [
"Returns",
"date",
"in",
"MySQL",
"format",
"."
] | 3cbece7645942d244603c14ba897d8a676ee3088 | https://github.com/rzajac/phptools/blob/3cbece7645942d244603c14ba897d8a676ee3088/src/Date/DateTime.php#L238-L247 |
192,863 | rzajac/phptools | src/Date/DateTime.php | DateTime.addMonths | public function addMonths($delta)
{
$interval = new DateInterval('P'.abs($delta).'M');
if ($delta > 0) {
$this->add($interval);
} elseif ($delta < 0) {
$this->sub($interval);
}
return $this;
} | php | public function addMonths($delta)
{
$interval = new DateInterval('P'.abs($delta).'M');
if ($delta > 0) {
$this->add($interval);
} elseif ($delta < 0) {
$this->sub($interval);
}
return $this;
} | [
"public",
"function",
"addMonths",
"(",
"$",
"delta",
")",
"{",
"$",
"interval",
"=",
"new",
"DateInterval",
"(",
"'P'",
".",
"abs",
"(",
"$",
"delta",
")",
".",
"'M'",
")",
";",
"if",
"(",
"$",
"delta",
">",
"0",
")",
"{",
"$",
"this",
"->",
"... | Go x months before or ahead.
@param int $delta The number of months to add or subtract
@return static | [
"Go",
"x",
"months",
"before",
"or",
"ahead",
"."
] | 3cbece7645942d244603c14ba897d8a676ee3088 | https://github.com/rzajac/phptools/blob/3cbece7645942d244603c14ba897d8a676ee3088/src/Date/DateTime.php#L386-L397 |
192,864 | rzajac/phptools | src/Date/DateTime.php | DateTime.getCurrentYear | public static function getCurrentYear($inUTC = false, $format = self::YEAR_FORMAT_LONG)
{
$tz = $inUTC ? 'UTC' : null;
return (int) static::now($tz)->format($format);
} | php | public static function getCurrentYear($inUTC = false, $format = self::YEAR_FORMAT_LONG)
{
$tz = $inUTC ? 'UTC' : null;
return (int) static::now($tz)->format($format);
} | [
"public",
"static",
"function",
"getCurrentYear",
"(",
"$",
"inUTC",
"=",
"false",
",",
"$",
"format",
"=",
"self",
"::",
"YEAR_FORMAT_LONG",
")",
"{",
"$",
"tz",
"=",
"$",
"inUTC",
"?",
"'UTC'",
":",
"null",
";",
"return",
"(",
"int",
")",
"static",
... | Get current year.
@param bool $inUTC
@param string $format
@return int | [
"Get",
"current",
"year",
"."
] | 3cbece7645942d244603c14ba897d8a676ee3088 | https://github.com/rzajac/phptools/blob/3cbece7645942d244603c14ba897d8a676ee3088/src/Date/DateTime.php#L420-L425 |
192,865 | rzajac/phptools | src/Date/DateTime.php | DateTime.getCurrentMonth | public static function getCurrentMonth($inUTC = false)
{
$tz = $inUTC ? 'UTC' : null;
return (int) static::now($tz)->format('n');
} | php | public static function getCurrentMonth($inUTC = false)
{
$tz = $inUTC ? 'UTC' : null;
return (int) static::now($tz)->format('n');
} | [
"public",
"static",
"function",
"getCurrentMonth",
"(",
"$",
"inUTC",
"=",
"false",
")",
"{",
"$",
"tz",
"=",
"$",
"inUTC",
"?",
"'UTC'",
":",
"null",
";",
"return",
"(",
"int",
")",
"static",
"::",
"now",
"(",
"$",
"tz",
")",
"->",
"format",
"(",
... | Get current month.
@param bool $inUTC
@return int | [
"Get",
"current",
"month",
"."
] | 3cbece7645942d244603c14ba897d8a676ee3088 | https://github.com/rzajac/phptools/blob/3cbece7645942d244603c14ba897d8a676ee3088/src/Date/DateTime.php#L434-L439 |
192,866 | rzajac/phptools | src/Date/DateTime.php | DateTime.getCurrentHour | public static function getCurrentHour($inUTC = false)
{
$tz = $inUTC ? 'UTC' : null;
return (int) static::now($tz)->format('G');
} | php | public static function getCurrentHour($inUTC = false)
{
$tz = $inUTC ? 'UTC' : null;
return (int) static::now($tz)->format('G');
} | [
"public",
"static",
"function",
"getCurrentHour",
"(",
"$",
"inUTC",
"=",
"false",
")",
"{",
"$",
"tz",
"=",
"$",
"inUTC",
"?",
"'UTC'",
":",
"null",
";",
"return",
"(",
"int",
")",
"static",
"::",
"now",
"(",
"$",
"tz",
")",
"->",
"format",
"(",
... | Get current hour.
@param bool $inUTC
@return int | [
"Get",
"current",
"hour",
"."
] | 3cbece7645942d244603c14ba897d8a676ee3088 | https://github.com/rzajac/phptools/blob/3cbece7645942d244603c14ba897d8a676ee3088/src/Date/DateTime.php#L448-L453 |
192,867 | rzajac/phptools | src/Date/DateTime.php | DateTime.getCurrentMinutes | public static function getCurrentMinutes($inUTC = false)
{
$tz = $inUTC ? 'UTC' : null;
return (int) static::now($tz)->format('i');
} | php | public static function getCurrentMinutes($inUTC = false)
{
$tz = $inUTC ? 'UTC' : null;
return (int) static::now($tz)->format('i');
} | [
"public",
"static",
"function",
"getCurrentMinutes",
"(",
"$",
"inUTC",
"=",
"false",
")",
"{",
"$",
"tz",
"=",
"$",
"inUTC",
"?",
"'UTC'",
":",
"null",
";",
"return",
"(",
"int",
")",
"static",
"::",
"now",
"(",
"$",
"tz",
")",
"->",
"format",
"("... | Get current minutes.
@param bool $inUTC
@return int | [
"Get",
"current",
"minutes",
"."
] | 3cbece7645942d244603c14ba897d8a676ee3088 | https://github.com/rzajac/phptools/blob/3cbece7645942d244603c14ba897d8a676ee3088/src/Date/DateTime.php#L462-L467 |
192,868 | rzajac/phptools | src/Date/DateTime.php | DateTime.targetSerialize | public function targetSerialize($target = self::SER_DEFAULT, $params = null)
{
return $this->format($this->format);
} | php | public function targetSerialize($target = self::SER_DEFAULT, $params = null)
{
return $this->format($this->format);
} | [
"public",
"function",
"targetSerialize",
"(",
"$",
"target",
"=",
"self",
"::",
"SER_DEFAULT",
",",
"$",
"params",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"format",
"(",
"$",
"this",
"->",
"format",
")",
";",
"}"
] | Serialize object for given target.
@param string $target The serialization target (one of the TSer constants)
@param mixed $params The additional parameters that serializer might need
@throws \Exception
@return \stdClass|string|array|NULL | [
"Serialize",
"object",
"for",
"given",
"target",
"."
] | 3cbece7645942d244603c14ba897d8a676ee3088 | https://github.com/rzajac/phptools/blob/3cbece7645942d244603c14ba897d8a676ee3088/src/Date/DateTime.php#L517-L520 |
192,869 | Dhii/stringable-helper-base | src/StringableReplaceCapableTrait.php | StringableReplaceCapableTrait._stringableReplace | public function _stringableReplace($search, $replace, $subject)
{
$search = $this->_normalizeString($search);
$replace = $this->_normalizeString($replace);
$subject = $this->_normalizeString($subject);
return str_replace($search, $replace, $subject);
} | php | public function _stringableReplace($search, $replace, $subject)
{
$search = $this->_normalizeString($search);
$replace = $this->_normalizeString($replace);
$subject = $this->_normalizeString($subject);
return str_replace($search, $replace, $subject);
} | [
"public",
"function",
"_stringableReplace",
"(",
"$",
"search",
",",
"$",
"replace",
",",
"$",
"subject",
")",
"{",
"$",
"search",
"=",
"$",
"this",
"->",
"_normalizeString",
"(",
"$",
"search",
")",
";",
"$",
"replace",
"=",
"$",
"this",
"->",
"_norma... | Replaces occurrences of needle in haystack.
@since [*next-version*]
@see str_replace()
@param string|Stringable $search The string to look for.
@param string|Stringable $replace The string to replace with.
@param string|Stringable $subject The string look in.
@throw InvalidArgumentException If the needle, replaceme... | [
"Replaces",
"occurrences",
"of",
"needle",
"in",
"haystack",
"."
] | 904254409800710665135a751659b59d140a2b40 | https://github.com/Dhii/stringable-helper-base/blob/904254409800710665135a751659b59d140a2b40/src/StringableReplaceCapableTrait.php#L30-L37 |
192,870 | the-eater/odango.php | src/NyaaUser.php | NyaaUser.construct | static function construct($name, $id, $aliases = [])
{
$user = new NyaaUser();
$user->name = $name;
$user->id = $id;
$user->aliases = $aliases;
return $user;
} | php | static function construct($name, $id, $aliases = [])
{
$user = new NyaaUser();
$user->name = $name;
$user->id = $id;
$user->aliases = $aliases;
return $user;
} | [
"static",
"function",
"construct",
"(",
"$",
"name",
",",
"$",
"id",
",",
"$",
"aliases",
"=",
"[",
"]",
")",
"{",
"$",
"user",
"=",
"new",
"NyaaUser",
"(",
")",
";",
"$",
"user",
"->",
"name",
"=",
"$",
"name",
";",
"$",
"user",
"->",
"id",
... | Constructs a new NyaaUser
@param string $name The name this NyaaUser works under
@param int $id The id of the user
@param array $aliases Array with aliases this NyaaUser works under
@return NyaaUser | [
"Constructs",
"a",
"new",
"NyaaUser"
] | 6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f | https://github.com/the-eater/odango.php/blob/6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f/src/NyaaUser.php#L18-L26 |
192,871 | the-eater/odango.php | src/NyaaUser.php | NyaaUser.getKnown | static function getKnown()
{
return [
NyaaUser::construct('HorribleSubs', 64513),
NyaaUser::construct('Commie', 76430),
NyaaUser::construct('Cthuko', 227226, ['Cthune']),
NyaaUser::construct('DeadFish', 169660),
NyaaUser::construct('Coalgirls', 62260)
];
} | php | static function getKnown()
{
return [
NyaaUser::construct('HorribleSubs', 64513),
NyaaUser::construct('Commie', 76430),
NyaaUser::construct('Cthuko', 227226, ['Cthune']),
NyaaUser::construct('DeadFish', 169660),
NyaaUser::construct('Coalgirls', 62260)
];
} | [
"static",
"function",
"getKnown",
"(",
")",
"{",
"return",
"[",
"NyaaUser",
"::",
"construct",
"(",
"'HorribleSubs'",
",",
"64513",
")",
",",
"NyaaUser",
"::",
"construct",
"(",
"'Commie'",
",",
"76430",
")",
",",
"NyaaUser",
"::",
"construct",
"(",
"'Cthu... | Gets a list of known NyaaUsers
@return NyaaUser[] | [
"Gets",
"a",
"list",
"of",
"known",
"NyaaUsers"
] | 6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f | https://github.com/the-eater/odango.php/blob/6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f/src/NyaaUser.php#L32-L41 |
192,872 | wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/CondFilterer.php | CondFilterer.inArray | public function inArray()
{
$needle = $this->getParameter('value');
$haystack = $this->getParameter('array');
if($haystack instanceof Meta){
$haystack = $haystack->getMetaValue();
}
if(is_string($haystack))
$haystack = StringUtils::smartExplode($hays... | php | public function inArray()
{
$needle = $this->getParameter('value');
$haystack = $this->getParameter('array');
if($haystack instanceof Meta){
$haystack = $haystack->getMetaValue();
}
if(is_string($haystack))
$haystack = StringUtils::smartExplode($hays... | [
"public",
"function",
"inArray",
"(",
")",
"{",
"$",
"needle",
"=",
"$",
"this",
"->",
"getParameter",
"(",
"'value'",
")",
";",
"$",
"haystack",
"=",
"$",
"this",
"->",
"getParameter",
"(",
"'array'",
")",
";",
"if",
"(",
"$",
"haystack",
"instanceof"... | Returns true if 'value' is found in array 'array'
Expected Params:
value string The item to search for in the array
array array The array to search
@return boolean true if value is in array | [
"Returns",
"true",
"if",
"value",
"is",
"found",
"in",
"array",
"array"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/CondFilterer.php#L43-L56 |
192,873 | wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/CondFilterer.php | CondFilterer.isItTimeYet | public function isItTimeYet()
{
$now = $this->DateFactory->newLocalDate();
$today = strtolower($now->format("D"));
$days = $this->getParameter('days'); //sun,mon,tue,wed,thu,fri,sat
$date = $this->getParameter('date'); //Y-m-d
$startTime = $this->getParam... | php | public function isItTimeYet()
{
$now = $this->DateFactory->newLocalDate();
$today = strtolower($now->format("D"));
$days = $this->getParameter('days'); //sun,mon,tue,wed,thu,fri,sat
$date = $this->getParameter('date'); //Y-m-d
$startTime = $this->getParam... | [
"public",
"function",
"isItTimeYet",
"(",
")",
"{",
"$",
"now",
"=",
"$",
"this",
"->",
"DateFactory",
"->",
"newLocalDate",
"(",
")",
";",
"$",
"today",
"=",
"strtolower",
"(",
"$",
"now",
"->",
"format",
"(",
"\"D\"",
")",
")",
";",
"$",
"days",
... | Returns true if now is within the specified date criteria; false otherwise.
The server timezone is used for all dates.
Expected Params:
days string A comma-separated list of lowercase 3-character day abbreviations; today must match at least one of these days; optional
date string A string in the format of Y-... | [
"Returns",
"true",
"if",
"now",
"is",
"within",
"the",
"specified",
"date",
"criteria",
";",
"false",
"otherwise",
".",
"The",
"server",
"timezone",
"is",
"used",
"for",
"all",
"dates",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/CondFilterer.php#L70-L106 |
192,874 | field-interactive/cito-bundle | Cito/Pagelist.php | Pagelist.applySorting | public static function applySorting($pagelist, $sortOrder = null, $sortBy = null)
{
// sort order
if (isset($sortOrder)) {
switch ($sortOrder) {
case 'asc':
$sortOrder = 1;
break;
case 'desc':
$s... | php | public static function applySorting($pagelist, $sortOrder = null, $sortBy = null)
{
// sort order
if (isset($sortOrder)) {
switch ($sortOrder) {
case 'asc':
$sortOrder = 1;
break;
case 'desc':
$s... | [
"public",
"static",
"function",
"applySorting",
"(",
"$",
"pagelist",
",",
"$",
"sortOrder",
"=",
"null",
",",
"$",
"sortBy",
"=",
"null",
")",
"{",
"// sort order",
"if",
"(",
"isset",
"(",
"$",
"sortOrder",
")",
")",
"{",
"switch",
"(",
"$",
"sortOrd... | Sorting method.
@param array $pagelist Pagelist array
@param string $sortOrder Sort order
@param string $sortBy Sort key
@return array $pagelist | [
"Sorting",
"method",
"."
] | 41cab570f960d964916e278c616720b17de258c1 | https://github.com/field-interactive/cito-bundle/blob/41cab570f960d964916e278c616720b17de258c1/Cito/Pagelist.php#L29-L92 |
192,875 | field-interactive/cito-bundle | Cito/Pagelist.php | Pagelist.applyFilter | public static function applyFilter($pageList, $filterFunction = null)
{
if (isset($filterFunction)) {
$pageList = array_filter($pageList, $filterFunction);
}
return $pageList;
} | php | public static function applyFilter($pageList, $filterFunction = null)
{
if (isset($filterFunction)) {
$pageList = array_filter($pageList, $filterFunction);
}
return $pageList;
} | [
"public",
"static",
"function",
"applyFilter",
"(",
"$",
"pageList",
",",
"$",
"filterFunction",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"filterFunction",
")",
")",
"{",
"$",
"pageList",
"=",
"array_filter",
"(",
"$",
"pageList",
",",
"$",
... | Filter method.
@param array $pagelist Pagelist array
@param $filterFunction Callback function
@return array $pagelist | [
"Filter",
"method",
"."
] | 41cab570f960d964916e278c616720b17de258c1 | https://github.com/field-interactive/cito-bundle/blob/41cab570f960d964916e278c616720b17de258c1/Cito/Pagelist.php#L102-L109 |
192,876 | field-interactive/cito-bundle | Cito/Pagelist.php | Pagelist.applyLimit | public static function applyLimit($pageList, $limit = null)
{
if (isset($limit)) {
$pageList = array_slice($pageList, 0, $limit);
}
return $pageList;
} | php | public static function applyLimit($pageList, $limit = null)
{
if (isset($limit)) {
$pageList = array_slice($pageList, 0, $limit);
}
return $pageList;
} | [
"public",
"static",
"function",
"applyLimit",
"(",
"$",
"pageList",
",",
"$",
"limit",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"limit",
")",
")",
"{",
"$",
"pageList",
"=",
"array_slice",
"(",
"$",
"pageList",
",",
"0",
",",
"$",
"limi... | Limit method.
@param string $pagelist Pagelist array
@param int $limit Limit entries
@return array $pagelist | [
"Limit",
"method",
"."
] | 41cab570f960d964916e278c616720b17de258c1 | https://github.com/field-interactive/cito-bundle/blob/41cab570f960d964916e278c616720b17de258c1/Cito/Pagelist.php#L119-L126 |
192,877 | field-interactive/cito-bundle | Cito/Pagelist.php | Pagelist.dir | public static function dir(\Twig_Environment $environment, $dir, $current, $sortOrder = null, $sortBy = 'link', $filter = null, $limit = null, $userAgentEnabled = false)
{
$pagelist = [];
// create new instance
$iterator = new \RecursiveIteratorIterator(
new \RecursiveDirectoryI... | php | public static function dir(\Twig_Environment $environment, $dir, $current, $sortOrder = null, $sortBy = 'link', $filter = null, $limit = null, $userAgentEnabled = false)
{
$pagelist = [];
// create new instance
$iterator = new \RecursiveIteratorIterator(
new \RecursiveDirectoryI... | [
"public",
"static",
"function",
"dir",
"(",
"\\",
"Twig_Environment",
"$",
"environment",
",",
"$",
"dir",
",",
"$",
"current",
",",
"$",
"sortOrder",
"=",
"null",
",",
"$",
"sortBy",
"=",
"'link'",
",",
"$",
"filter",
"=",
"null",
",",
"$",
"limit",
... | Static helper method for directory listings.
@param \Twig_Environment $environment
@param string $dir Path to list
@param string $current
@param string $sortOrder
@param string $sortBy
@param string $filter
@param int $limit
@return ArrayIte... | [
"Static",
"helper",
"method",
"for",
"directory",
"listings",
"."
] | 41cab570f960d964916e278c616720b17de258c1 | https://github.com/field-interactive/cito-bundle/blob/41cab570f960d964916e278c616720b17de258c1/Cito/Pagelist.php#L145-L175 |
192,878 | field-interactive/cito-bundle | Cito/Pagelist.php | Pagelist.files | public static function files(\Twig_Environment $environment, $files, $current, $sortOrder = null, $sortBy = null, $filter = null, $userAgentEnabled = false)
{
$pagelist = [];
foreach ($files as $file) {
if (!strpos($file, $current)) {
$relativePath = Page::generateRelativ... | php | public static function files(\Twig_Environment $environment, $files, $current, $sortOrder = null, $sortBy = null, $filter = null, $userAgentEnabled = false)
{
$pagelist = [];
foreach ($files as $file) {
if (!strpos($file, $current)) {
$relativePath = Page::generateRelativ... | [
"public",
"static",
"function",
"files",
"(",
"\\",
"Twig_Environment",
"$",
"environment",
",",
"$",
"files",
",",
"$",
"current",
",",
"$",
"sortOrder",
"=",
"null",
",",
"$",
"sortBy",
"=",
"null",
",",
"$",
"filter",
"=",
"null",
",",
"$",
"userAge... | Static helper method for file listings.
@param \Twig_Environment $environment
@param array $files Files to list
@param $current
@param null $sortOrder
@param string $sortBy
@param null $filter
@return ArrayIterator
@throws \Twig_Error_Loader
@throws \Twig_Error_Runtime
@throws \Twig_Error_Synta... | [
"Static",
"helper",
"method",
"for",
"file",
"listings",
"."
] | 41cab570f960d964916e278c616720b17de258c1 | https://github.com/field-interactive/cito-bundle/blob/41cab570f960d964916e278c616720b17de258c1/Cito/Pagelist.php#L193-L213 |
192,879 | EdwinDayot/shorty-framework | src/Framework/Routing/Router.php | Router.build | public function build()
{
$uri = $this->trimTrailingSlashes($this->request->getUri()->getPath());
$method = mb_strtoupper($this->request->getMethod());
foreach ($this->routes[$method] as $routeUri => $action) {
$arguments = $this->match($uri, $routeUri);
if (!is_nul... | php | public function build()
{
$uri = $this->trimTrailingSlashes($this->request->getUri()->getPath());
$method = mb_strtoupper($this->request->getMethod());
foreach ($this->routes[$method] as $routeUri => $action) {
$arguments = $this->match($uri, $routeUri);
if (!is_nul... | [
"public",
"function",
"build",
"(",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"trimTrailingSlashes",
"(",
"$",
"this",
"->",
"request",
"->",
"getUri",
"(",
")",
"->",
"getPath",
"(",
")",
")",
";",
"$",
"method",
"=",
"mb_strtoupper",
"(",
"$",
... | Handle the route.
@throws \Shorty\Framework\Routing\Exceptions\HTTPException
@return bool | [
"Handle",
"the",
"route",
"."
] | e03c991ea86aedbd87674d1ee2f9041b55b5e578 | https://github.com/EdwinDayot/shorty-framework/blob/e03c991ea86aedbd87674d1ee2f9041b55b5e578/src/Framework/Routing/Router.php#L68-L82 |
192,880 | EdwinDayot/shorty-framework | src/Framework/Routing/Router.php | Router.triggerAction | private function triggerAction($action): Response
{
if (is_callable($action)) {
return $this->returnResponse(
$this->container->call($action)
);
} elseif (is_array($action)) {
return $this->returnResponse(
$this->container->call(
... | php | private function triggerAction($action): Response
{
if (is_callable($action)) {
return $this->returnResponse(
$this->container->call($action)
);
} elseif (is_array($action)) {
return $this->returnResponse(
$this->container->call(
... | [
"private",
"function",
"triggerAction",
"(",
"$",
"action",
")",
":",
"Response",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"action",
")",
")",
"{",
"return",
"$",
"this",
"->",
"returnResponse",
"(",
"$",
"this",
"->",
"container",
"->",
"call",
"(",
"... | Triggers an action.
@param $action
@throws \Shorty\Framework\Routing\Exceptions\HTTPException
@return \GuzzleHttp\Psr7\Response | [
"Triggers",
"an",
"action",
"."
] | e03c991ea86aedbd87674d1ee2f9041b55b5e578 | https://github.com/EdwinDayot/shorty-framework/blob/e03c991ea86aedbd87674d1ee2f9041b55b5e578/src/Framework/Routing/Router.php#L149-L168 |
192,881 | EdwinDayot/shorty-framework | src/Framework/Routing/Router.php | Router.returnResponse | private function returnResponse($result): Response
{
if ($result instanceof Response) {
return $result;
}
if (is_array($result)) {
$result = json_encode($result);
}
return new Response(200, [], $result);
} | php | private function returnResponse($result): Response
{
if ($result instanceof Response) {
return $result;
}
if (is_array($result)) {
$result = json_encode($result);
}
return new Response(200, [], $result);
} | [
"private",
"function",
"returnResponse",
"(",
"$",
"result",
")",
":",
"Response",
"{",
"if",
"(",
"$",
"result",
"instanceof",
"Response",
")",
"{",
"return",
"$",
"result",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",
"result",
")",
")",
"{",
"$",
"r... | Returns a Response object.
@param mixed $result
@return \GuzzleHttp\Psr7\Response|string | [
"Returns",
"a",
"Response",
"object",
"."
] | e03c991ea86aedbd87674d1ee2f9041b55b5e578 | https://github.com/EdwinDayot/shorty-framework/blob/e03c991ea86aedbd87674d1ee2f9041b55b5e578/src/Framework/Routing/Router.php#L177-L188 |
192,882 | EdwinDayot/shorty-framework | src/Framework/Routing/Router.php | Router.match | private function match(string $uri, string $routeUri): ?array
{
if ($uri === $routeUri) {
return [];
}
return $this->getArguments($uri, $routeUri);
} | php | private function match(string $uri, string $routeUri): ?array
{
if ($uri === $routeUri) {
return [];
}
return $this->getArguments($uri, $routeUri);
} | [
"private",
"function",
"match",
"(",
"string",
"$",
"uri",
",",
"string",
"$",
"routeUri",
")",
":",
"?",
"array",
"{",
"if",
"(",
"$",
"uri",
"===",
"$",
"routeUri",
")",
"{",
"return",
"[",
"]",
";",
"}",
"return",
"$",
"this",
"->",
"getArgument... | Matches the URI and route.
@param string $uri
@param string $routeUri
@return array|null | [
"Matches",
"the",
"URI",
"and",
"route",
"."
] | e03c991ea86aedbd87674d1ee2f9041b55b5e578 | https://github.com/EdwinDayot/shorty-framework/blob/e03c991ea86aedbd87674d1ee2f9041b55b5e578/src/Framework/Routing/Router.php#L198-L205 |
192,883 | EdwinDayot/shorty-framework | src/Framework/Routing/Router.php | Router.constructAction | private function constructAction($action, array $arguments = []): bool
{
if (is_callable($action)) {
$this->pendingAction = $action;
return true;
} elseif (is_string($action)) {
$actionParts = explode('@', $action);
$controllerName = 'App\\Http\\Cont... | php | private function constructAction($action, array $arguments = []): bool
{
if (is_callable($action)) {
$this->pendingAction = $action;
return true;
} elseif (is_string($action)) {
$actionParts = explode('@', $action);
$controllerName = 'App\\Http\\Cont... | [
"private",
"function",
"constructAction",
"(",
"$",
"action",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
")",
":",
"bool",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"action",
")",
")",
"{",
"$",
"this",
"->",
"pendingAction",
"=",
"$",
"action",
"... | Construct action before running it.
@param $action
@param array $arguments
@throws \Shorty\Framework\Routing\Exceptions\HTTPException
@return bool | [
"Construct",
"action",
"before",
"running",
"it",
"."
] | e03c991ea86aedbd87674d1ee2f9041b55b5e578 | https://github.com/EdwinDayot/shorty-framework/blob/e03c991ea86aedbd87674d1ee2f9041b55b5e578/src/Framework/Routing/Router.php#L217-L249 |
192,884 | EdwinDayot/shorty-framework | src/Framework/Routing/Router.php | Router.matchUri | private function matchUri(string $regex, string $uri): ?array
{
if (preg_match_all('/' . $regex . '/', $uri, $uriMatches)) {
$uriMatches = array_filter($uriMatches, function ($key) {
if (is_string($key)) {
return true;
}
return... | php | private function matchUri(string $regex, string $uri): ?array
{
if (preg_match_all('/' . $regex . '/', $uri, $uriMatches)) {
$uriMatches = array_filter($uriMatches, function ($key) {
if (is_string($key)) {
return true;
}
return... | [
"private",
"function",
"matchUri",
"(",
"string",
"$",
"regex",
",",
"string",
"$",
"uri",
")",
":",
"?",
"array",
"{",
"if",
"(",
"preg_match_all",
"(",
"'/'",
".",
"$",
"regex",
".",
"'/'",
",",
"$",
"uri",
",",
"$",
"uriMatches",
")",
")",
"{",
... | Matches the URI.
@param string $regex
@param string $uri
@return array|null | [
"Matches",
"the",
"URI",
"."
] | e03c991ea86aedbd87674d1ee2f9041b55b5e578 | https://github.com/EdwinDayot/shorty-framework/blob/e03c991ea86aedbd87674d1ee2f9041b55b5e578/src/Framework/Routing/Router.php#L258-L277 |
192,885 | EdwinDayot/shorty-framework | src/Framework/Routing/Router.php | Router.getArguments | private function getArguments(string $uri, string $routeUri): ?array
{
if (preg_match_all('/({[a-z]+:)/i', $routeUri, $matches)) {
$regex = str_replace('/', '\/',
str_replace('}', ')',
preg_replace('/{([a-z]+):/i', '(?<$1>', $routeUri)
)
... | php | private function getArguments(string $uri, string $routeUri): ?array
{
if (preg_match_all('/({[a-z]+:)/i', $routeUri, $matches)) {
$regex = str_replace('/', '\/',
str_replace('}', ')',
preg_replace('/{([a-z]+):/i', '(?<$1>', $routeUri)
)
... | [
"private",
"function",
"getArguments",
"(",
"string",
"$",
"uri",
",",
"string",
"$",
"routeUri",
")",
":",
"?",
"array",
"{",
"if",
"(",
"preg_match_all",
"(",
"'/({[a-z]+:)/i'",
",",
"$",
"routeUri",
",",
"$",
"matches",
")",
")",
"{",
"$",
"regex",
... | Get the arguments for the requested URI.
@param string $uri
@param string $routeUri
@return array|null | [
"Get",
"the",
"arguments",
"for",
"the",
"requested",
"URI",
"."
] | e03c991ea86aedbd87674d1ee2f9041b55b5e578 | https://github.com/EdwinDayot/shorty-framework/blob/e03c991ea86aedbd87674d1ee2f9041b55b5e578/src/Framework/Routing/Router.php#L286-L299 |
192,886 | modulusphp/http | Middleware/CheckForMaintenanceMode.php | CheckForMaintenanceMode.inExceptArray | protected function inExceptArray($request)
{
foreach ($this->except as $except) {
if ($request->is($except)) {
return true;
}
}
return false;
} | php | protected function inExceptArray($request)
{
foreach ($this->except as $except) {
if ($request->is($except)) {
return true;
}
}
return false;
} | [
"protected",
"function",
"inExceptArray",
"(",
"$",
"request",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"except",
"as",
"$",
"except",
")",
"{",
"if",
"(",
"$",
"request",
"->",
"is",
"(",
"$",
"except",
")",
")",
"{",
"return",
"true",
";",
"}... | Determine if the request has a URI that should be accessible in maintenance mode.
@param \Modulus\Http\Request $request
@return bool | [
"Determine",
"if",
"the",
"request",
"has",
"a",
"URI",
"that",
"should",
"be",
"accessible",
"in",
"maintenance",
"mode",
"."
] | fc5c0f2b582a04de1685578d3fb790686a0a240c | https://github.com/modulusphp/http/blob/fc5c0f2b582a04de1685578d3fb790686a0a240c/Middleware/CheckForMaintenanceMode.php#L65-L74 |
192,887 | FuzeWorks/Core | src/FuzeWorks/TemplateEngine/SmartyEngine.php | SmartyEngine.loadSmarty | private function loadSmarty()
{
if (is_null($this->smartyInstance)) {
$this->smartyInstance = new Smarty();
// Then prepare all variables
$this->smartyInstance->setCompileDir(Core::$tempDir . DS . 'Smarty' . DS . 'Compile');
$this->smartyInstance->setCacheDir... | php | private function loadSmarty()
{
if (is_null($this->smartyInstance)) {
$this->smartyInstance = new Smarty();
// Then prepare all variables
$this->smartyInstance->setCompileDir(Core::$tempDir . DS . 'Smarty' . DS . 'Compile');
$this->smartyInstance->setCacheDir... | [
"private",
"function",
"loadSmarty",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"smartyInstance",
")",
")",
"{",
"$",
"this",
"->",
"smartyInstance",
"=",
"new",
"Smarty",
"(",
")",
";",
"// Then prepare all variables",
"$",
"this",
"->",... | Loads a Smarty instance if it is not already loaded. | [
"Loads",
"a",
"Smarty",
"instance",
"if",
"it",
"is",
"not",
"already",
"loaded",
"."
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/FuzeWorks/TemplateEngine/SmartyEngine.php#L95-L104 |
192,888 | SlaxWeb/Router | src/Dispatcher.php | Dispatcher.enableSegMatch | public function enableSegMatch(
string $namespace,
array $params = [],
string $prepend = "",
string $defaultMethod = "index"
): Dispatcher {
$this->segBasedMatch = [
"enabled" => true,
"uriPrepend" => $prepend,
"controller" =>... | php | public function enableSegMatch(
string $namespace,
array $params = [],
string $prepend = "",
string $defaultMethod = "index"
): Dispatcher {
$this->segBasedMatch = [
"enabled" => true,
"uriPrepend" => $prepend,
"controller" =>... | [
"public",
"function",
"enableSegMatch",
"(",
"string",
"$",
"namespace",
",",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"string",
"$",
"prepend",
"=",
"\"\"",
",",
"string",
"$",
"defaultMethod",
"=",
"\"index\"",
")",
":",
"Dispatcher",
"{",
"$",
"thi... | Enable segment Based URI Matching
Enables the segment based URI matching, sets the Controller namespace, and
the default method to call if the second segment is not found in the URI.
Default method has the default value of string("index").
@param string $namespace Controller namespace
@param array $params Controller ... | [
"Enable",
"segment",
"Based",
"URI",
"Matching"
] | b4a25655710638c71787a8498d267a663ef2e819 | https://github.com/SlaxWeb/Router/blob/b4a25655710638c71787a8498d267a663ef2e819/src/Dispatcher.php#L171-L187 |
192,889 | SlaxWeb/Router | src/Dispatcher.php | Dispatcher.findRoute | protected function findRoute(int $method, string $uri)
{
$route = null;
// if URI is empty and a default route is set, use it instead
if ($uri !== ""
|| ($route = $this->routes->defaultRoute()) === null
) {
return $this->checkContainer($method, $uri);
... | php | protected function findRoute(int $method, string $uri)
{
$route = null;
// if URI is empty and a default route is set, use it instead
if ($uri !== ""
|| ($route = $this->routes->defaultRoute()) === null
) {
return $this->checkContainer($method, $uri);
... | [
"protected",
"function",
"findRoute",
"(",
"int",
"$",
"method",
",",
"string",
"$",
"uri",
")",
"{",
"$",
"route",
"=",
"null",
";",
"// if URI is empty and a default route is set, use it instead",
"if",
"(",
"$",
"uri",
"!==",
"\"\"",
"||",
"(",
"$",
"route"... | Find matching Route
Try and obtain the route that bests fits the request and return it. If no
such route is found, and no 404 route exists, nor is one returned from a
'routeNotFound' hook execution, null is returned.
@param int $method Request Method
@param string $uri Request Uri
@return \SlaxWeb\Router\Route|null | [
"Find",
"matching",
"Route"
] | b4a25655710638c71787a8498d267a663ef2e819 | https://github.com/SlaxWeb/Router/blob/b4a25655710638c71787a8498d267a663ef2e819/src/Dispatcher.php#L200-L210 |
192,890 | SlaxWeb/Router | src/Dispatcher.php | Dispatcher.checkContainer | protected function checkContainer(int $method, string $uri)
{
while (($route = $this->routes->next()) !== false) {
if (($route->method & $method) !== $method) {
continue;
}
if (preg_match_all($this->posix2Pcre($route->uri), $uri, $matches) === 0) {
... | php | protected function checkContainer(int $method, string $uri)
{
while (($route = $this->routes->next()) !== false) {
if (($route->method & $method) !== $method) {
continue;
}
if (preg_match_all($this->posix2Pcre($route->uri), $uri, $matches) === 0) {
... | [
"protected",
"function",
"checkContainer",
"(",
"int",
"$",
"method",
",",
"string",
"$",
"uri",
")",
"{",
"while",
"(",
"(",
"$",
"route",
"=",
"$",
"this",
"->",
"routes",
"->",
"next",
"(",
")",
")",
"!==",
"false",
")",
"{",
"if",
"(",
"(",
"... | Check Routes Container
Iterates the routes container and tries to match the request to a Route in
the container. Returns the matching Route object if found, or null otherwise.
@param int $method Request Method
@param string $uri Request Uri
@return \SlaxWeb\Router\Route|null | [
"Check",
"Routes",
"Container"
] | b4a25655710638c71787a8498d267a663ef2e819 | https://github.com/SlaxWeb/Router/blob/b4a25655710638c71787a8498d267a663ef2e819/src/Dispatcher.php#L222-L241 |
192,891 | SlaxWeb/Router | src/Dispatcher.php | Dispatcher.handleNoMatch | protected function handleNoMatch()
{
$result = $this->hooks->exec("router.dispatcher.routeNotFound");
// check if hook call produced a valid Route object
if ($result instanceof Route) {
$this->logger->info("No Route found, hook call produced valid Route object, using it instead."... | php | protected function handleNoMatch()
{
$result = $this->hooks->exec("router.dispatcher.routeNotFound");
// check if hook call produced a valid Route object
if ($result instanceof Route) {
$this->logger->info("No Route found, hook call produced valid Route object, using it instead."... | [
"protected",
"function",
"handleNoMatch",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"hooks",
"->",
"exec",
"(",
"\"router.dispatcher.routeNotFound\"",
")",
";",
"// check if hook call produced a valid Route object",
"if",
"(",
"$",
"result",
"instanceof",
... | Handle No Matching Route Found
Execute the Route Not Found Hook definition with the help of the Hook component
and return a valid Route object if it is found in the Hook execution return
data. If no valid route is returned by the hook, try to obtain the 404 route
from the Route Container object and return it.
@return... | [
"Handle",
"No",
"Matching",
"Route",
"Found"
] | b4a25655710638c71787a8498d267a663ef2e819 | https://github.com/SlaxWeb/Router/blob/b4a25655710638c71787a8498d267a663ef2e819/src/Dispatcher.php#L253-L269 |
192,892 | SlaxWeb/Router | src/Dispatcher.php | Dispatcher.posix2Pcre | protected function posix2Pcre(
string $regex,
array $names = ["params", "named"]
): string {
$counters = [];
foreach ($names as $type) {
$regex = preg_replace_callback(
"~\[:{$type}:\]~",
function() use (&$counters, $type) {
... | php | protected function posix2Pcre(
string $regex,
array $names = ["params", "named"]
): string {
$counters = [];
foreach ($names as $type) {
$regex = preg_replace_callback(
"~\[:{$type}:\]~",
function() use (&$counters, $type) {
... | [
"protected",
"function",
"posix2Pcre",
"(",
"string",
"$",
"regex",
",",
"array",
"$",
"names",
"=",
"[",
"\"params\"",
",",
"\"named\"",
"]",
")",
":",
"string",
"{",
"$",
"counters",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"names",
"as",
"$",
"typ... | POSIX named class to PCRE capturing group
Replace the special POSIX named classes with normal named capturing
groups.
@param string $regex Raw regexp string
@param array $names POSIX class names array, default: ["params", "named"]
@return string Replaced regexp string | [
"POSIX",
"named",
"class",
"to",
"PCRE",
"capturing",
"group"
] | b4a25655710638c71787a8498d267a663ef2e819 | https://github.com/SlaxWeb/Router/blob/b4a25655710638c71787a8498d267a663ef2e819/src/Dispatcher.php#L367-L388 |
192,893 | SlaxWeb/Router | src/Dispatcher.php | Dispatcher.addParams | protected function addParams(array $matches)
{
$params = [];
foreach ($matches as $key => $value) {
$value = $value[0];
if (strpos($key, "params") === 0) {
$params["parameters"] = array_merge(
$params["parameters"] ?? [],
... | php | protected function addParams(array $matches)
{
$params = [];
foreach ($matches as $key => $value) {
$value = $value[0];
if (strpos($key, "params") === 0) {
$params["parameters"] = array_merge(
$params["parameters"] ?? [],
... | [
"protected",
"function",
"addParams",
"(",
"array",
"$",
"matches",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"matches",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"$",
"value",
"[",
"0",
"]",
";",
... | Add additional parameters
Prepares the found matches from the URI and injects them into the
'addQueryParams' property.
@param array $matches Regex matches
@return void | [
"Add",
"additional",
"parameters"
] | b4a25655710638c71787a8498d267a663ef2e819 | https://github.com/SlaxWeb/Router/blob/b4a25655710638c71787a8498d267a663ef2e819/src/Dispatcher.php#L399-L428 |
192,894 | Retentio/Boomgo | src/Boomgo/Parser/AnnotationParser.php | AnnotationParser.parse | public function parse($filepath)
{
$metadata = array();
$reflectedClass = $this->getReflection($filepath);
$metadata['class'] = $reflectedClass->getName();
$propertiesMetadata = $this->processPropertiesParsing($reflectedClass);
$metadata = array_merge($metadata, $properties... | php | public function parse($filepath)
{
$metadata = array();
$reflectedClass = $this->getReflection($filepath);
$metadata['class'] = $reflectedClass->getName();
$propertiesMetadata = $this->processPropertiesParsing($reflectedClass);
$metadata = array_merge($metadata, $properties... | [
"public",
"function",
"parse",
"(",
"$",
"filepath",
")",
"{",
"$",
"metadata",
"=",
"array",
"(",
")",
";",
"$",
"reflectedClass",
"=",
"$",
"this",
"->",
"getReflection",
"(",
"$",
"filepath",
")",
";",
"$",
"metadata",
"[",
"'class'",
"]",
"=",
"$... | ParserInterface implementation
Extract className and metadata properties
@param string $filepath
@see ParserInterface::parse()
@return array | [
"ParserInterface",
"implementation",
"Extract",
"className",
"and",
"metadata",
"properties"
] | 95cc53777425dd76cd0034046fa4f9e72c04d73a | https://github.com/Retentio/Boomgo/blob/95cc53777425dd76cd0034046fa4f9e72c04d73a/src/Boomgo/Parser/AnnotationParser.php#L133-L144 |
192,895 | Retentio/Boomgo | src/Boomgo/Parser/AnnotationParser.php | AnnotationParser.getReflection | protected function getReflection($filepath)
{
// Regexp instead of tokenizer because of the bad perf @link > https://gist.github.com/1886076
if (!preg_match('#^namespace\s+(.+?);.*class\s+(\w+).+;$#sm', file_get_contents($filepath), $captured)) {
throw new \RuntimeException('Unable to fi... | php | protected function getReflection($filepath)
{
// Regexp instead of tokenizer because of the bad perf @link > https://gist.github.com/1886076
if (!preg_match('#^namespace\s+(.+?);.*class\s+(\w+).+;$#sm', file_get_contents($filepath), $captured)) {
throw new \RuntimeException('Unable to fi... | [
"protected",
"function",
"getReflection",
"(",
"$",
"filepath",
")",
"{",
"// Regexp instead of tokenizer because of the bad perf @link > https://gist.github.com/1886076",
"if",
"(",
"!",
"preg_match",
"(",
"'#^namespace\\s+(.+?);.*class\\s+(\\w+).+;$#sm'",
",",
"file_get_contents",
... | Extract the fully qualified namespace and return a ReflectionClass object
@param string $filepath Path to the file to parse
@return ReflectionClass | [
"Extract",
"the",
"fully",
"qualified",
"namespace",
"and",
"return",
"a",
"ReflectionClass",
"object"
] | 95cc53777425dd76cd0034046fa4f9e72c04d73a | https://github.com/Retentio/Boomgo/blob/95cc53777425dd76cd0034046fa4f9e72c04d73a/src/Boomgo/Parser/AnnotationParser.php#L153-L170 |
192,896 | Retentio/Boomgo | src/Boomgo/Parser/AnnotationParser.php | AnnotationParser.processPropertiesParsing | protected function processPropertiesParsing(\ReflectionClass $reflectedClass)
{
$metadata = array();
$reflectedProperties = $reflectedClass->getProperties();
foreach ($reflectedProperties as $reflectedProperty) {
if ($this->isBoomgoProperty($reflectedProperty)) {
... | php | protected function processPropertiesParsing(\ReflectionClass $reflectedClass)
{
$metadata = array();
$reflectedProperties = $reflectedClass->getProperties();
foreach ($reflectedProperties as $reflectedProperty) {
if ($this->isBoomgoProperty($reflectedProperty)) {
... | [
"protected",
"function",
"processPropertiesParsing",
"(",
"\\",
"ReflectionClass",
"$",
"reflectedClass",
")",
"{",
"$",
"metadata",
"=",
"array",
"(",
")",
";",
"$",
"reflectedProperties",
"=",
"$",
"reflectedClass",
"->",
"getProperties",
"(",
")",
";",
"forea... | Parse class properties for metadata extraction if valid contains valid annotation local tag
@param ReflectionClass $reflectedClass The document reflected object to parse
@return array An array filled with Definition instance | [
"Parse",
"class",
"properties",
"for",
"metadata",
"extraction",
"if",
"valid",
"contains",
"valid",
"annotation",
"local",
"tag"
] | 95cc53777425dd76cd0034046fa4f9e72c04d73a | https://github.com/Retentio/Boomgo/blob/95cc53777425dd76cd0034046fa4f9e72c04d73a/src/Boomgo/Parser/AnnotationParser.php#L179-L193 |
192,897 | Retentio/Boomgo | src/Boomgo/Parser/AnnotationParser.php | AnnotationParser.isBoomgoProperty | private function isBoomgoProperty(\ReflectionProperty $property)
{
$propertyName = $property->getName();
$className = $property->getDeclaringClass()->getName();
$annotationTag = substr_count($property->getDocComment(), $this->getLocalAnnotation());
if (0 < $annotationTag) {
... | php | private function isBoomgoProperty(\ReflectionProperty $property)
{
$propertyName = $property->getName();
$className = $property->getDeclaringClass()->getName();
$annotationTag = substr_count($property->getDocComment(), $this->getLocalAnnotation());
if (0 < $annotationTag) {
... | [
"private",
"function",
"isBoomgoProperty",
"(",
"\\",
"ReflectionProperty",
"$",
"property",
")",
"{",
"$",
"propertyName",
"=",
"$",
"property",
"->",
"getName",
"(",
")",
";",
"$",
"className",
"=",
"$",
"property",
"->",
"getDeclaringClass",
"(",
")",
"->... | Check if an object property has to be processed by Boomgo
@param ReflectionProperty $property the property to check
@throws RuntimeException If annotation is malformed
@return Boolean True if the property should be stored | [
"Check",
"if",
"an",
"object",
"property",
"has",
"to",
"be",
"processed",
"by",
"Boomgo"
] | 95cc53777425dd76cd0034046fa4f9e72c04d73a | https://github.com/Retentio/Boomgo/blob/95cc53777425dd76cd0034046fa4f9e72c04d73a/src/Boomgo/Parser/AnnotationParser.php#L204-L219 |
192,898 | Retentio/Boomgo | src/Boomgo/Parser/AnnotationParser.php | AnnotationParser.parseMetadataProperty | private function parseMetadataProperty(\ReflectionProperty $property)
{
$metadata = array();
$tag = '@var';
$docComment = $property->getDocComment();
$occurence = (int) substr_count($docComment, $tag);
if (1 < $occurence) {
throw new \RuntimeException(sprintf('"@... | php | private function parseMetadataProperty(\ReflectionProperty $property)
{
$metadata = array();
$tag = '@var';
$docComment = $property->getDocComment();
$occurence = (int) substr_count($docComment, $tag);
if (1 < $occurence) {
throw new \RuntimeException(sprintf('"@... | [
"private",
"function",
"parseMetadataProperty",
"(",
"\\",
"ReflectionProperty",
"$",
"property",
")",
"{",
"$",
"metadata",
"=",
"array",
"(",
")",
";",
"$",
"tag",
"=",
"'@var'",
";",
"$",
"docComment",
"=",
"$",
"property",
"->",
"getDocComment",
"(",
"... | Parse Boomgo metadata
Extract metadata from the optional var tag
@param \ReflectionProperty $property
@return array | [
"Parse",
"Boomgo",
"metadata"
] | 95cc53777425dd76cd0034046fa4f9e72c04d73a | https://github.com/Retentio/Boomgo/blob/95cc53777425dd76cd0034046fa4f9e72c04d73a/src/Boomgo/Parser/AnnotationParser.php#L230-L257 |
192,899 | ekyna/SettingBundle | Manager/SettingsManager.php | SettingsManager.getParameters | private function getParameters($namespace)
{
$parameters = [];
/** @var Parameter $parameter */
foreach ($this->parameterRepository->findBy(['namespace' => $namespace]) as $parameter) {
$parameters[$parameter->getName()] = $parameter->getValue();
}
return $param... | php | private function getParameters($namespace)
{
$parameters = [];
/** @var Parameter $parameter */
foreach ($this->parameterRepository->findBy(['namespace' => $namespace]) as $parameter) {
$parameters[$parameter->getName()] = $parameter->getValue();
}
return $param... | [
"private",
"function",
"getParameters",
"(",
"$",
"namespace",
")",
"{",
"$",
"parameters",
"=",
"[",
"]",
";",
"/** @var Parameter $parameter */",
"foreach",
"(",
"$",
"this",
"->",
"parameterRepository",
"->",
"findBy",
"(",
"[",
"'namespace'",
"=>",
"$",
"n... | Load parameter from database.
@param string $namespace
@return array | [
"Load",
"parameter",
"from",
"database",
"."
] | df58f83eb3a01ef56cd76ea73639322c581e75c1 | https://github.com/ekyna/SettingBundle/blob/df58f83eb3a01ef56cd76ea73639322c581e75c1/Manager/SettingsManager.php#L253-L263 |
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.