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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
226,100
|
jagilpe/encryption-bundle
|
Service/EncryptionService.php
|
EncryptionService.getUserRelatedEntities
|
private function getUserRelatedEntities($user)
{
$relatedEntities =array();
$reflectionClass = ClassUtils::newReflectionObject($user);
if ($reflectionClass->hasMethod('getMainProfile')) {
$userProfile = $user->getMainProfile();
$relatedEntities = $userProfile ? array($userProfile) : array();
}
return $relatedEntities;
}
|
php
|
private function getUserRelatedEntities($user)
{
$relatedEntities =array();
$reflectionClass = ClassUtils::newReflectionObject($user);
if ($reflectionClass->hasMethod('getMainProfile')) {
$userProfile = $user->getMainProfile();
$relatedEntities = $userProfile ? array($userProfile) : array();
}
return $relatedEntities;
}
|
[
"private",
"function",
"getUserRelatedEntities",
"(",
"$",
"user",
")",
"{",
"$",
"relatedEntities",
"=",
"array",
"(",
")",
";",
"$",
"reflectionClass",
"=",
"ClassUtils",
"::",
"newReflectionObject",
"(",
"$",
"user",
")",
";",
"if",
"(",
"$",
"reflectionClass",
"->",
"hasMethod",
"(",
"'getMainProfile'",
")",
")",
"{",
"$",
"userProfile",
"=",
"$",
"user",
"->",
"getMainProfile",
"(",
")",
";",
"$",
"relatedEntities",
"=",
"$",
"userProfile",
"?",
"array",
"(",
"$",
"userProfile",
")",
":",
"array",
"(",
")",
";",
"}",
"return",
"$",
"relatedEntities",
";",
"}"
] |
Returns the entities that are related with the user entity and can be persisted
in the same moment as the user entity. For this entities the user id is not set
in the moment they are persisted and therefore not saved with the key
@TODO Remove depencency from Polavis Viva code
@param mixed $user
@return array
|
[
"Returns",
"the",
"entities",
"that",
"are",
"related",
"with",
"the",
"user",
"entity",
"and",
"can",
"be",
"persisted",
"in",
"the",
"same",
"moment",
"as",
"the",
"user",
"entity",
".",
"For",
"this",
"entities",
"the",
"user",
"id",
"is",
"not",
"set",
"in",
"the",
"moment",
"they",
"are",
"persisted",
"and",
"therefore",
"not",
"saved",
"with",
"the",
"key"
] |
1e1ba13a3cc646b36e3407822f2e8339c5671f47
|
https://github.com/jagilpe/encryption-bundle/blob/1e1ba13a3cc646b36e3407822f2e8339c5671f47/Service/EncryptionService.php#L821-L833
|
226,101
|
jagilpe/encryption-bundle
|
Service/EncryptionService.php
|
EncryptionService.hasEncryptionFieldsDoctrineMetadata
|
private function hasEncryptionFieldsDoctrineMetadata(DoctrineClassMetadata $classMetadata)
{
$return = false;
if (ClassMetadataInfo::INHERITANCE_TYPE_JOINED === $classMetadata->inheritanceType
|| ClassMetadataInfo::INHERITANCE_TYPE_SINGLE_TABLE === $classMetadata->inheritanceType) {
$rootEntity = $classMetadata->rootEntityName;
if ($rootEntity !== $classMetadata->getName()) {
$rootEntityEncryptionMetadata = $this->getEncryptionMetadataFor($rootEntity);
return $rootEntityEncryptionMetadata && $rootEntityEncryptionMetadata->encryptionEnabled;
}
}
return $return;
}
|
php
|
private function hasEncryptionFieldsDoctrineMetadata(DoctrineClassMetadata $classMetadata)
{
$return = false;
if (ClassMetadataInfo::INHERITANCE_TYPE_JOINED === $classMetadata->inheritanceType
|| ClassMetadataInfo::INHERITANCE_TYPE_SINGLE_TABLE === $classMetadata->inheritanceType) {
$rootEntity = $classMetadata->rootEntityName;
if ($rootEntity !== $classMetadata->getName()) {
$rootEntityEncryptionMetadata = $this->getEncryptionMetadataFor($rootEntity);
return $rootEntityEncryptionMetadata && $rootEntityEncryptionMetadata->encryptionEnabled;
}
}
return $return;
}
|
[
"private",
"function",
"hasEncryptionFieldsDoctrineMetadata",
"(",
"DoctrineClassMetadata",
"$",
"classMetadata",
")",
"{",
"$",
"return",
"=",
"false",
";",
"if",
"(",
"ClassMetadataInfo",
"::",
"INHERITANCE_TYPE_JOINED",
"===",
"$",
"classMetadata",
"->",
"inheritanceType",
"||",
"ClassMetadataInfo",
"::",
"INHERITANCE_TYPE_SINGLE_TABLE",
"===",
"$",
"classMetadata",
"->",
"inheritanceType",
")",
"{",
"$",
"rootEntity",
"=",
"$",
"classMetadata",
"->",
"rootEntityName",
";",
"if",
"(",
"$",
"rootEntity",
"!==",
"$",
"classMetadata",
"->",
"getName",
"(",
")",
")",
"{",
"$",
"rootEntityEncryptionMetadata",
"=",
"$",
"this",
"->",
"getEncryptionMetadataFor",
"(",
"$",
"rootEntity",
")",
";",
"return",
"$",
"rootEntityEncryptionMetadata",
"&&",
"$",
"rootEntityEncryptionMetadata",
"->",
"encryptionEnabled",
";",
"}",
"}",
"return",
"$",
"return",
";",
"}"
] |
Checks if the required fields metadata were inserted in some other class of the hierachy.
@param DoctrineClassMetadata $classMetadata
@return bool
|
[
"Checks",
"if",
"the",
"required",
"fields",
"metadata",
"were",
"inserted",
"in",
"some",
"other",
"class",
"of",
"the",
"hierachy",
"."
] |
1e1ba13a3cc646b36e3407822f2e8339c5671f47
|
https://github.com/jagilpe/encryption-bundle/blob/1e1ba13a3cc646b36e3407822f2e8339c5671f47/Service/EncryptionService.php#L853-L866
|
226,102
|
gjerokrsteski/pimf-framework
|
core/Pimf/Util/Uuid.php
|
Uuid.getNodeId
|
private static function getNodeId()
{
if (self::$hostIp !== null) {
return ip2long(self::$hostIp);
}
self::$hostIp = '127.0.0.1';
if (self::$hostName !== null) {
self::$hostIp = crc32(self::$hostName);
}
if (true === function_exists('php_uname')) {
self::$hostName = php_uname('n');
self::$hostIp = gethostbyname(self::$hostName);
}
if (true === function_exists('gethostname')) {
self::$hostName = gethostname();
self::$hostIp = gethostbyname(self::$hostName);
}
return ip2long(self::$hostIp);
}
|
php
|
private static function getNodeId()
{
if (self::$hostIp !== null) {
return ip2long(self::$hostIp);
}
self::$hostIp = '127.0.0.1';
if (self::$hostName !== null) {
self::$hostIp = crc32(self::$hostName);
}
if (true === function_exists('php_uname')) {
self::$hostName = php_uname('n');
self::$hostIp = gethostbyname(self::$hostName);
}
if (true === function_exists('gethostname')) {
self::$hostName = gethostname();
self::$hostIp = gethostbyname(self::$hostName);
}
return ip2long(self::$hostIp);
}
|
[
"private",
"static",
"function",
"getNodeId",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"hostIp",
"!==",
"null",
")",
"{",
"return",
"ip2long",
"(",
"self",
"::",
"$",
"hostIp",
")",
";",
"}",
"self",
"::",
"$",
"hostIp",
"=",
"'127.0.0.1'",
";",
"if",
"(",
"self",
"::",
"$",
"hostName",
"!==",
"null",
")",
"{",
"self",
"::",
"$",
"hostIp",
"=",
"crc32",
"(",
"self",
"::",
"$",
"hostName",
")",
";",
"}",
"if",
"(",
"true",
"===",
"function_exists",
"(",
"'php_uname'",
")",
")",
"{",
"self",
"::",
"$",
"hostName",
"=",
"php_uname",
"(",
"'n'",
")",
";",
"self",
"::",
"$",
"hostIp",
"=",
"gethostbyname",
"(",
"self",
"::",
"$",
"hostName",
")",
";",
"}",
"if",
"(",
"true",
"===",
"function_exists",
"(",
"'gethostname'",
")",
")",
"{",
"self",
"::",
"$",
"hostName",
"=",
"gethostname",
"(",
")",
";",
"self",
"::",
"$",
"hostIp",
"=",
"gethostbyname",
"(",
"self",
"::",
"$",
"hostName",
")",
";",
"}",
"return",
"ip2long",
"(",
"self",
"::",
"$",
"hostIp",
")",
";",
"}"
] |
Returns a 32-bit integer that identifies this host.
The node identifier needs to be unique among nodes
in a cluster for a given application in order to
avoid collisions between generated identifiers.
@return integer
|
[
"Returns",
"a",
"32",
"-",
"bit",
"integer",
"that",
"identifies",
"this",
"host",
"."
] |
859aa7c8bb727b556c5e32224842af3cff33f18b
|
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Util/Uuid.php#L58-L81
|
226,103
|
gjerokrsteski/pimf-framework
|
core/Pimf/Util/Uuid.php
|
Uuid.generate
|
public static function generate()
{
if (self::$node === null) {
self::$node = self::getNodeId();
}
if (self::$pid === null) {
self::$pid = self::getLockId();
}
list($time_mid, $time_lo) = explode(' ', microtime());
$time_low = (int)$time_lo;
$time_mid = (int)substr($time_mid, 2);
$time_and_version = mt_rand(0, 0xfff);
// version 4 UUID
$time_and_version |= 0x4000;
$clock_seq_low = mt_rand(0, 0xff);
// type is pseudo-random
$clock_seq_high = mt_rand(0, 0x3f);
$clock_seq_high |= 0x80;
$node_low = self::$pid;
$node = self::$node;
return sprintf(
'%08x-%04x-%04x-%02x%02x-%04x%08x', $time_low, $time_mid & 0xffff, $time_and_version, $clock_seq_high,
$clock_seq_low, $node_low,
$node
);
}
|
php
|
public static function generate()
{
if (self::$node === null) {
self::$node = self::getNodeId();
}
if (self::$pid === null) {
self::$pid = self::getLockId();
}
list($time_mid, $time_lo) = explode(' ', microtime());
$time_low = (int)$time_lo;
$time_mid = (int)substr($time_mid, 2);
$time_and_version = mt_rand(0, 0xfff);
// version 4 UUID
$time_and_version |= 0x4000;
$clock_seq_low = mt_rand(0, 0xff);
// type is pseudo-random
$clock_seq_high = mt_rand(0, 0x3f);
$clock_seq_high |= 0x80;
$node_low = self::$pid;
$node = self::$node;
return sprintf(
'%08x-%04x-%04x-%02x%02x-%04x%08x', $time_low, $time_mid & 0xffff, $time_and_version, $clock_seq_high,
$clock_seq_low, $node_low,
$node
);
}
|
[
"public",
"static",
"function",
"generate",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"node",
"===",
"null",
")",
"{",
"self",
"::",
"$",
"node",
"=",
"self",
"::",
"getNodeId",
"(",
")",
";",
"}",
"if",
"(",
"self",
"::",
"$",
"pid",
"===",
"null",
")",
"{",
"self",
"::",
"$",
"pid",
"=",
"self",
"::",
"getLockId",
"(",
")",
";",
"}",
"list",
"(",
"$",
"time_mid",
",",
"$",
"time_lo",
")",
"=",
"explode",
"(",
"' '",
",",
"microtime",
"(",
")",
")",
";",
"$",
"time_low",
"=",
"(",
"int",
")",
"$",
"time_lo",
";",
"$",
"time_mid",
"=",
"(",
"int",
")",
"substr",
"(",
"$",
"time_mid",
",",
"2",
")",
";",
"$",
"time_and_version",
"=",
"mt_rand",
"(",
"0",
",",
"0xfff",
")",
";",
"// version 4 UUID",
"$",
"time_and_version",
"|=",
"0x4000",
";",
"$",
"clock_seq_low",
"=",
"mt_rand",
"(",
"0",
",",
"0xff",
")",
";",
"// type is pseudo-random",
"$",
"clock_seq_high",
"=",
"mt_rand",
"(",
"0",
",",
"0x3f",
")",
";",
"$",
"clock_seq_high",
"|=",
"0x80",
";",
"$",
"node_low",
"=",
"self",
"::",
"$",
"pid",
";",
"$",
"node",
"=",
"self",
"::",
"$",
"node",
";",
"return",
"sprintf",
"(",
"'%08x-%04x-%04x-%02x%02x-%04x%08x'",
",",
"$",
"time_low",
",",
"$",
"time_mid",
"&",
"0xffff",
",",
"$",
"time_and_version",
",",
"$",
"clock_seq_high",
",",
"$",
"clock_seq_low",
",",
"$",
"node_low",
",",
"$",
"node",
")",
";",
"}"
] |
Generate an RFC 4122 UUID.
This is pseudo-random UUID influenced by the system clock, IP
address and process ID.
The intended use is to generate an identifier that can uniquely
identify user generated posts, comments etc. made to a website.
This generation process should be sufficient to avoid collisions
between nodes in a cluster, and between apache children on the
same host.
@return string
|
[
"Generate",
"an",
"RFC",
"4122",
"UUID",
"."
] |
859aa7c8bb727b556c5e32224842af3cff33f18b
|
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Util/Uuid.php#L112-L146
|
226,104
|
sdboyer/gliph
|
src/Gliph/Graph/AdjacencyList.php
|
AdjacencyList.getTraversableSplos
|
protected function getTraversableSplos(\SplObjectStorage $splos) {
if ($this->walking->contains($splos)) {
return clone $splos;
}
else {
$this->walking->attach($splos);
return $splos;
}
}
|
php
|
protected function getTraversableSplos(\SplObjectStorage $splos) {
if ($this->walking->contains($splos)) {
return clone $splos;
}
else {
$this->walking->attach($splos);
return $splos;
}
}
|
[
"protected",
"function",
"getTraversableSplos",
"(",
"\\",
"SplObjectStorage",
"$",
"splos",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"walking",
"->",
"contains",
"(",
"$",
"splos",
")",
")",
"{",
"return",
"clone",
"$",
"splos",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"walking",
"->",
"attach",
"(",
"$",
"splos",
")",
";",
"return",
"$",
"splos",
";",
"}",
"}"
] |
Helper function to ensure SPLOS traversal pointer is not overridden.
This would otherwise occur if nested calls are made that traverse the
same SPLOS. This keeps track of which SPLOSes are currently being
traversed, and if it's in use, it returns a clone.
It is incumbent on the calling code to release the semaphore directly
by calling $this->walking->detach($splos) when the traversal in
question is complete. (This is very important!)
@param \SplObjectStorage $splos
The SPLOS to traverse.
@return \SplObjectStorage
A SPLOS that is safe for traversal; may or may not be a clone of the
original.
|
[
"Helper",
"function",
"to",
"ensure",
"SPLOS",
"traversal",
"pointer",
"is",
"not",
"overridden",
"."
] |
5ec6314b2b211053f6bae989b95446ccf6e8ded0
|
https://github.com/sdboyer/gliph/blob/5ec6314b2b211053f6bae989b95446ccf6e8ded0/src/Gliph/Graph/AdjacencyList.php#L119-L127
|
226,105
|
Techworker/ssml
|
src/Element/Audio.php
|
Audio.factory
|
public static function factory(string $src): Audio
{
$audio = new Audio();
$audio->src = $src;
return $audio;
}
|
php
|
public static function factory(string $src): Audio
{
$audio = new Audio();
$audio->src = $src;
return $audio;
}
|
[
"public",
"static",
"function",
"factory",
"(",
"string",
"$",
"src",
")",
":",
"Audio",
"{",
"$",
"audio",
"=",
"new",
"Audio",
"(",
")",
";",
"$",
"audio",
"->",
"src",
"=",
"$",
"src",
";",
"return",
"$",
"audio",
";",
"}"
] |
Creates an audio element with the given src as attribute.
@param string $src
@return Audio
|
[
"Creates",
"an",
"audio",
"element",
"with",
"the",
"given",
"src",
"as",
"attribute",
"."
] |
cafb979b777480baf7a01b5db2bf7c2cff837805
|
https://github.com/Techworker/ssml/blob/cafb979b777480baf7a01b5db2bf7c2cff837805/src/Element/Audio.php#L37-L42
|
226,106
|
gjerokrsteski/pimf-framework
|
core/Pimf/Cli/Std.php
|
Std.read
|
public function read($prompt, $validation = "/.*/")
{
$value = '';
while (true) {
$this->view("Please enter a " . $prompt . ":");
$value = $this->value();
if ($this->valid($validation, $value)) {
break;
}
$this->view("[ Value format for " . $prompt . " is invalid! ]");
}
return $value;
}
|
php
|
public function read($prompt, $validation = "/.*/")
{
$value = '';
while (true) {
$this->view("Please enter a " . $prompt . ":");
$value = $this->value();
if ($this->valid($validation, $value)) {
break;
}
$this->view("[ Value format for " . $prompt . " is invalid! ]");
}
return $value;
}
|
[
"public",
"function",
"read",
"(",
"$",
"prompt",
",",
"$",
"validation",
"=",
"\"/.*/\"",
")",
"{",
"$",
"value",
"=",
"''",
";",
"while",
"(",
"true",
")",
"{",
"$",
"this",
"->",
"view",
"(",
"\"Please enter a \"",
".",
"$",
"prompt",
".",
"\":\"",
")",
";",
"$",
"value",
"=",
"$",
"this",
"->",
"value",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"valid",
"(",
"$",
"validation",
",",
"$",
"value",
")",
")",
"{",
"break",
";",
"}",
"$",
"this",
"->",
"view",
"(",
"\"[ Value format for \"",
".",
"$",
"prompt",
".",
"\" is invalid! ]\"",
")",
";",
"}",
"return",
"$",
"value",
";",
"}"
] |
Allow direct access to the corresponding input stream of the PHP process.
@param string $prompt
@param string $validation A regex pattern
<code>
Have a look at the examples for $validation:
Regular Expression | Will match...
-------------------------------------------------------------
.* | Not empty
foo | The string "foo"
^foo | "foo" at the start of a string
foo$ | "foo" at the end of a string
^foo$ | "foo" when it is alone on a string
[abc] | a, b, or c
[a-z] | Any lowercase letter
[^A-Z] | Any character that is not a uppercase letter
(gif|jpg) | Matches either "gif" or "jpeg"
[a-z]+ | One or more lowercase letters
[0-9\.\-] | Аny number, dot, or minus sign
</code>
@return string
|
[
"Allow",
"direct",
"access",
"to",
"the",
"corresponding",
"input",
"stream",
"of",
"the",
"PHP",
"process",
"."
] |
859aa7c8bb727b556c5e32224842af3cff33f18b
|
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Cli/Std.php#L73-L91
|
226,107
|
progsmile/request-validator
|
src/Validator.php
|
Validator.make
|
public static function make(array $data, array $rules, array $userMessages = [])
{
self::$validatorFacade = new ValidatorFacade($userMessages);
$data = self::prepareData($data);
$rules = self::prepareRules($rules);
foreach ($rules as $fieldName => $fieldRules) {
$fieldName = trim($fieldName);
$fieldRules = trim($fieldRules);
if (!$fieldRules) {
//no rules
continue;
}
$groupedRules = explode('|', $fieldRules);
foreach ($groupedRules as $concreteRule) {
$ruleNameParam = explode(':', $concreteRule);
$ruleName = $ruleNameParam[0];
//for date/time validators
if (count($ruleNameParam) >= 2) {
$ruleValue = implode(':', array_slice($ruleNameParam, 1));
//for other params
} else {
$ruleValue = isset($ruleNameParam[1]) ? $ruleNameParam[1] : '';
}
self::$config[BaseRule::CONFIG_DATA] = $data;
self::$config[BaseRule::CONFIG_FIELD_RULES] = $fieldRules;
$ruleInstance = RulesFactory::createRule($ruleName, self::$config, [
$fieldName, // The field name
isset($data[$fieldName]) ? $data[$fieldName] : '', // The provided value
$ruleValue, // The rule's value
]);
if (!$ruleInstance->isValid()) {
self::$validatorFacade->chooseErrorMessage($ruleInstance);
}
}
}
return self::$validatorFacade;
}
|
php
|
public static function make(array $data, array $rules, array $userMessages = [])
{
self::$validatorFacade = new ValidatorFacade($userMessages);
$data = self::prepareData($data);
$rules = self::prepareRules($rules);
foreach ($rules as $fieldName => $fieldRules) {
$fieldName = trim($fieldName);
$fieldRules = trim($fieldRules);
if (!$fieldRules) {
//no rules
continue;
}
$groupedRules = explode('|', $fieldRules);
foreach ($groupedRules as $concreteRule) {
$ruleNameParam = explode(':', $concreteRule);
$ruleName = $ruleNameParam[0];
//for date/time validators
if (count($ruleNameParam) >= 2) {
$ruleValue = implode(':', array_slice($ruleNameParam, 1));
//for other params
} else {
$ruleValue = isset($ruleNameParam[1]) ? $ruleNameParam[1] : '';
}
self::$config[BaseRule::CONFIG_DATA] = $data;
self::$config[BaseRule::CONFIG_FIELD_RULES] = $fieldRules;
$ruleInstance = RulesFactory::createRule($ruleName, self::$config, [
$fieldName, // The field name
isset($data[$fieldName]) ? $data[$fieldName] : '', // The provided value
$ruleValue, // The rule's value
]);
if (!$ruleInstance->isValid()) {
self::$validatorFacade->chooseErrorMessage($ruleInstance);
}
}
}
return self::$validatorFacade;
}
|
[
"public",
"static",
"function",
"make",
"(",
"array",
"$",
"data",
",",
"array",
"$",
"rules",
",",
"array",
"$",
"userMessages",
"=",
"[",
"]",
")",
"{",
"self",
"::",
"$",
"validatorFacade",
"=",
"new",
"ValidatorFacade",
"(",
"$",
"userMessages",
")",
";",
"$",
"data",
"=",
"self",
"::",
"prepareData",
"(",
"$",
"data",
")",
";",
"$",
"rules",
"=",
"self",
"::",
"prepareRules",
"(",
"$",
"rules",
")",
";",
"foreach",
"(",
"$",
"rules",
"as",
"$",
"fieldName",
"=>",
"$",
"fieldRules",
")",
"{",
"$",
"fieldName",
"=",
"trim",
"(",
"$",
"fieldName",
")",
";",
"$",
"fieldRules",
"=",
"trim",
"(",
"$",
"fieldRules",
")",
";",
"if",
"(",
"!",
"$",
"fieldRules",
")",
"{",
"//no rules",
"continue",
";",
"}",
"$",
"groupedRules",
"=",
"explode",
"(",
"'|'",
",",
"$",
"fieldRules",
")",
";",
"foreach",
"(",
"$",
"groupedRules",
"as",
"$",
"concreteRule",
")",
"{",
"$",
"ruleNameParam",
"=",
"explode",
"(",
"':'",
",",
"$",
"concreteRule",
")",
";",
"$",
"ruleName",
"=",
"$",
"ruleNameParam",
"[",
"0",
"]",
";",
"//for date/time validators",
"if",
"(",
"count",
"(",
"$",
"ruleNameParam",
")",
">=",
"2",
")",
"{",
"$",
"ruleValue",
"=",
"implode",
"(",
"':'",
",",
"array_slice",
"(",
"$",
"ruleNameParam",
",",
"1",
")",
")",
";",
"//for other params",
"}",
"else",
"{",
"$",
"ruleValue",
"=",
"isset",
"(",
"$",
"ruleNameParam",
"[",
"1",
"]",
")",
"?",
"$",
"ruleNameParam",
"[",
"1",
"]",
":",
"''",
";",
"}",
"self",
"::",
"$",
"config",
"[",
"BaseRule",
"::",
"CONFIG_DATA",
"]",
"=",
"$",
"data",
";",
"self",
"::",
"$",
"config",
"[",
"BaseRule",
"::",
"CONFIG_FIELD_RULES",
"]",
"=",
"$",
"fieldRules",
";",
"$",
"ruleInstance",
"=",
"RulesFactory",
"::",
"createRule",
"(",
"$",
"ruleName",
",",
"self",
"::",
"$",
"config",
",",
"[",
"$",
"fieldName",
",",
"// The field name",
"isset",
"(",
"$",
"data",
"[",
"$",
"fieldName",
"]",
")",
"?",
"$",
"data",
"[",
"$",
"fieldName",
"]",
":",
"''",
",",
"// The provided value",
"$",
"ruleValue",
",",
"// The rule's value",
"]",
")",
";",
"if",
"(",
"!",
"$",
"ruleInstance",
"->",
"isValid",
"(",
")",
")",
"{",
"self",
"::",
"$",
"validatorFacade",
"->",
"chooseErrorMessage",
"(",
"$",
"ruleInstance",
")",
";",
"}",
"}",
"}",
"return",
"self",
"::",
"$",
"validatorFacade",
";",
"}"
] |
Make validation.
@param array $data user request data
@param array $rules validation rules
@param array $userMessages custom error messages
@return ValidatorFacade
|
[
"Make",
"validation",
"."
] |
f211abd1a8e7c67030401f8c4896d926da7dafef
|
https://github.com/progsmile/request-validator/blob/f211abd1a8e7c67030401f8c4896d926da7dafef/src/Validator.php#L30-L77
|
226,108
|
progsmile/request-validator
|
src/Validator.php
|
Validator.prepareData
|
private static function prepareData(array $data)
{
$newData = [];
foreach ($data as $paramName => $paramValue) {
if (is_array($paramValue)) {
foreach ($paramValue as $newKey => $newValue) {
$newData[trim($paramName).'['.trim($newKey).']'] = trim($newValue);
}
} else {
$newData[trim($paramName)] = trim($paramValue);
}
}
return $newData;
}
|
php
|
private static function prepareData(array $data)
{
$newData = [];
foreach ($data as $paramName => $paramValue) {
if (is_array($paramValue)) {
foreach ($paramValue as $newKey => $newValue) {
$newData[trim($paramName).'['.trim($newKey).']'] = trim($newValue);
}
} else {
$newData[trim($paramName)] = trim($paramValue);
}
}
return $newData;
}
|
[
"private",
"static",
"function",
"prepareData",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"newData",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"paramName",
"=>",
"$",
"paramValue",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"paramValue",
")",
")",
"{",
"foreach",
"(",
"$",
"paramValue",
"as",
"$",
"newKey",
"=>",
"$",
"newValue",
")",
"{",
"$",
"newData",
"[",
"trim",
"(",
"$",
"paramName",
")",
".",
"'['",
".",
"trim",
"(",
"$",
"newKey",
")",
".",
"']'",
"]",
"=",
"trim",
"(",
"$",
"newValue",
")",
";",
"}",
"}",
"else",
"{",
"$",
"newData",
"[",
"trim",
"(",
"$",
"paramName",
")",
"]",
"=",
"trim",
"(",
"$",
"paramValue",
")",
";",
"}",
"}",
"return",
"$",
"newData",
";",
"}"
] |
Prepare user data for validator.
@param array $data
@return array
|
[
"Prepare",
"user",
"data",
"for",
"validator",
"."
] |
f211abd1a8e7c67030401f8c4896d926da7dafef
|
https://github.com/progsmile/request-validator/blob/f211abd1a8e7c67030401f8c4896d926da7dafef/src/Validator.php#L86-L101
|
226,109
|
progsmile/request-validator
|
src/Validator.php
|
Validator.prepareRules
|
private static function prepareRules(array $rules)
{
$mergedRules = [];
foreach ($rules as $ruleFields => $ruleConditions) {
//if set of fields like 'firstname, lastname...'
if (strpos($ruleFields, ',') !== false) {
foreach (explode(',', $ruleFields) as $fieldName) {
$fieldName = trim($fieldName);
if (!isset($mergedRules[$fieldName])) {
$mergedRules[$fieldName] = $ruleConditions;
} else {
$mergedRules[$fieldName] .= '|'.$ruleConditions;
}
}
} else {
if (!isset($mergedRules[$ruleFields])) {
$mergedRules[$ruleFields] = $ruleConditions;
} else {
$mergedRules[$ruleFields] .= '|'.$ruleConditions;
}
}
}
$finalRules = [];
//remove duplicated rules, like 'required|alpha|required'
foreach ($mergedRules as $newRule => $rule) {
$finalRules[$newRule] = implode('|', array_unique(explode('|', $rule)));
}
return $finalRules;
}
|
php
|
private static function prepareRules(array $rules)
{
$mergedRules = [];
foreach ($rules as $ruleFields => $ruleConditions) {
//if set of fields like 'firstname, lastname...'
if (strpos($ruleFields, ',') !== false) {
foreach (explode(',', $ruleFields) as $fieldName) {
$fieldName = trim($fieldName);
if (!isset($mergedRules[$fieldName])) {
$mergedRules[$fieldName] = $ruleConditions;
} else {
$mergedRules[$fieldName] .= '|'.$ruleConditions;
}
}
} else {
if (!isset($mergedRules[$ruleFields])) {
$mergedRules[$ruleFields] = $ruleConditions;
} else {
$mergedRules[$ruleFields] .= '|'.$ruleConditions;
}
}
}
$finalRules = [];
//remove duplicated rules, like 'required|alpha|required'
foreach ($mergedRules as $newRule => $rule) {
$finalRules[$newRule] = implode('|', array_unique(explode('|', $rule)));
}
return $finalRules;
}
|
[
"private",
"static",
"function",
"prepareRules",
"(",
"array",
"$",
"rules",
")",
"{",
"$",
"mergedRules",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"rules",
"as",
"$",
"ruleFields",
"=>",
"$",
"ruleConditions",
")",
"{",
"//if set of fields like 'firstname, lastname...'",
"if",
"(",
"strpos",
"(",
"$",
"ruleFields",
",",
"','",
")",
"!==",
"false",
")",
"{",
"foreach",
"(",
"explode",
"(",
"','",
",",
"$",
"ruleFields",
")",
"as",
"$",
"fieldName",
")",
"{",
"$",
"fieldName",
"=",
"trim",
"(",
"$",
"fieldName",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"mergedRules",
"[",
"$",
"fieldName",
"]",
")",
")",
"{",
"$",
"mergedRules",
"[",
"$",
"fieldName",
"]",
"=",
"$",
"ruleConditions",
";",
"}",
"else",
"{",
"$",
"mergedRules",
"[",
"$",
"fieldName",
"]",
".=",
"'|'",
".",
"$",
"ruleConditions",
";",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"mergedRules",
"[",
"$",
"ruleFields",
"]",
")",
")",
"{",
"$",
"mergedRules",
"[",
"$",
"ruleFields",
"]",
"=",
"$",
"ruleConditions",
";",
"}",
"else",
"{",
"$",
"mergedRules",
"[",
"$",
"ruleFields",
"]",
".=",
"'|'",
".",
"$",
"ruleConditions",
";",
"}",
"}",
"}",
"$",
"finalRules",
"=",
"[",
"]",
";",
"//remove duplicated rules, like 'required|alpha|required'",
"foreach",
"(",
"$",
"mergedRules",
"as",
"$",
"newRule",
"=>",
"$",
"rule",
")",
"{",
"$",
"finalRules",
"[",
"$",
"newRule",
"]",
"=",
"implode",
"(",
"'|'",
",",
"array_unique",
"(",
"explode",
"(",
"'|'",
",",
"$",
"rule",
")",
")",
")",
";",
"}",
"return",
"$",
"finalRules",
";",
"}"
] |
Merges all field's rules into one
if you have elegant implementation, you are welcome.
@param array $rules
@return array
|
[
"Merges",
"all",
"field",
"s",
"rules",
"into",
"one",
"if",
"you",
"have",
"elegant",
"implementation",
"you",
"are",
"welcome",
"."
] |
f211abd1a8e7c67030401f8c4896d926da7dafef
|
https://github.com/progsmile/request-validator/blob/f211abd1a8e7c67030401f8c4896d926da7dafef/src/Validator.php#L111-L145
|
226,110
|
gjerokrsteski/pimf-framework
|
core/Pimf/Url.php
|
Url.base
|
public static function base()
{
if (isset(static::$base)) {
return static::$base;
}
$url = Config::get('app.url');
if ($url !== '') {
$base = $url;
} else {
$base = self::$url;
}
return static::$base = $base;
}
|
php
|
public static function base()
{
if (isset(static::$base)) {
return static::$base;
}
$url = Config::get('app.url');
if ($url !== '') {
$base = $url;
} else {
$base = self::$url;
}
return static::$base = $base;
}
|
[
"public",
"static",
"function",
"base",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"base",
")",
")",
"{",
"return",
"static",
"::",
"$",
"base",
";",
"}",
"$",
"url",
"=",
"Config",
"::",
"get",
"(",
"'app.url'",
")",
";",
"if",
"(",
"$",
"url",
"!==",
"''",
")",
"{",
"$",
"base",
"=",
"$",
"url",
";",
"}",
"else",
"{",
"$",
"base",
"=",
"self",
"::",
"$",
"url",
";",
"}",
"return",
"static",
"::",
"$",
"base",
"=",
"$",
"base",
";",
"}"
] |
Get the base URL of the application.
@return string
|
[
"Get",
"the",
"base",
"URL",
"of",
"the",
"application",
"."
] |
859aa7c8bb727b556c5e32224842af3cff33f18b
|
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Url.php#L96-L111
|
226,111
|
gjerokrsteski/pimf-framework
|
core/Pimf/Url.php
|
Url.to
|
public static function to($url = '', $https = null, $asset = false)
{
$url = trim($url, '/');
if (static::valid($url)) {
return $url;
}
$root = self::format($https, $asset);
return rtrim($root, '/') . '/' . ltrim($url, '/');
}
|
php
|
public static function to($url = '', $https = null, $asset = false)
{
$url = trim($url, '/');
if (static::valid($url)) {
return $url;
}
$root = self::format($https, $asset);
return rtrim($root, '/') . '/' . ltrim($url, '/');
}
|
[
"public",
"static",
"function",
"to",
"(",
"$",
"url",
"=",
"''",
",",
"$",
"https",
"=",
"null",
",",
"$",
"asset",
"=",
"false",
")",
"{",
"$",
"url",
"=",
"trim",
"(",
"$",
"url",
",",
"'/'",
")",
";",
"if",
"(",
"static",
"::",
"valid",
"(",
"$",
"url",
")",
")",
"{",
"return",
"$",
"url",
";",
"}",
"$",
"root",
"=",
"self",
"::",
"format",
"(",
"$",
"https",
",",
"$",
"asset",
")",
";",
"return",
"rtrim",
"(",
"$",
"root",
",",
"'/'",
")",
".",
"'/'",
".",
"ltrim",
"(",
"$",
"url",
",",
"'/'",
")",
";",
"}"
] |
Generate an application URL.
@param string $url
@param null|bool $https
@param bool $asset
@return string
|
[
"Generate",
"an",
"application",
"URL",
"."
] |
859aa7c8bb727b556c5e32224842af3cff33f18b
|
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Url.php#L122-L133
|
226,112
|
gjerokrsteski/pimf-framework
|
core/Pimf/Url.php
|
Url.format
|
private static function format($https = null, $asset = false)
{
$root = static::base();
if (!$asset) {
$root .= '/' . Config::get('app.index');
}
// Unless $https is specified we set https for all secure links.
if (is_null($https)) {
$https = self::$isHttps;
}
// disable SSL on all framework generated links to make it more
// convenient to work with the site while developing locally.
if ($https && Config::get('ssl')) {
return preg_replace('~http://~', 'https://', $root, 1);
}
return preg_replace('~https://~', 'http://', $root, 1);
}
|
php
|
private static function format($https = null, $asset = false)
{
$root = static::base();
if (!$asset) {
$root .= '/' . Config::get('app.index');
}
// Unless $https is specified we set https for all secure links.
if (is_null($https)) {
$https = self::$isHttps;
}
// disable SSL on all framework generated links to make it more
// convenient to work with the site while developing locally.
if ($https && Config::get('ssl')) {
return preg_replace('~http://~', 'https://', $root, 1);
}
return preg_replace('~https://~', 'http://', $root, 1);
}
|
[
"private",
"static",
"function",
"format",
"(",
"$",
"https",
"=",
"null",
",",
"$",
"asset",
"=",
"false",
")",
"{",
"$",
"root",
"=",
"static",
"::",
"base",
"(",
")",
";",
"if",
"(",
"!",
"$",
"asset",
")",
"{",
"$",
"root",
".=",
"'/'",
".",
"Config",
"::",
"get",
"(",
"'app.index'",
")",
";",
"}",
"// Unless $https is specified we set https for all secure links.",
"if",
"(",
"is_null",
"(",
"$",
"https",
")",
")",
"{",
"$",
"https",
"=",
"self",
"::",
"$",
"isHttps",
";",
"}",
"// disable SSL on all framework generated links to make it more",
"// convenient to work with the site while developing locally.",
"if",
"(",
"$",
"https",
"&&",
"Config",
"::",
"get",
"(",
"'ssl'",
")",
")",
"{",
"return",
"preg_replace",
"(",
"'~http://~'",
",",
"'https://'",
",",
"$",
"root",
",",
"1",
")",
";",
"}",
"return",
"preg_replace",
"(",
"'~https://~'",
",",
"'http://'",
",",
"$",
"root",
",",
"1",
")",
";",
"}"
] |
Computes the URl method
@param null|bool $https
@param bool $asset
@return string
|
[
"Computes",
"the",
"URl",
"method"
] |
859aa7c8bb727b556c5e32224842af3cff33f18b
|
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Url.php#L143-L163
|
226,113
|
gjerokrsteski/pimf-framework
|
core/Pimf/Url.php
|
Url.toAsset
|
public static function toAsset($url, $https = null)
{
if (static::valid($url) || static::valid('http:' . $url)) {
return $url;
}
$app = Config::get('app');
$root = ($app['asset_url'] != '') ? $app['asset_url'] : false;
// shoot us through a different server or third-party content delivery network.
if ($root) {
return rtrim($root, '/') . '/' . ltrim($url, '/');
}
$url = static::to($url, $https, true);
// we do not need to come through the front controller.
if ($app['index'] !== '') {
$url = str_replace($app['index'] . '/', '', $url);
}
return $url;
}
|
php
|
public static function toAsset($url, $https = null)
{
if (static::valid($url) || static::valid('http:' . $url)) {
return $url;
}
$app = Config::get('app');
$root = ($app['asset_url'] != '') ? $app['asset_url'] : false;
// shoot us through a different server or third-party content delivery network.
if ($root) {
return rtrim($root, '/') . '/' . ltrim($url, '/');
}
$url = static::to($url, $https, true);
// we do not need to come through the front controller.
if ($app['index'] !== '') {
$url = str_replace($app['index'] . '/', '', $url);
}
return $url;
}
|
[
"public",
"static",
"function",
"toAsset",
"(",
"$",
"url",
",",
"$",
"https",
"=",
"null",
")",
"{",
"if",
"(",
"static",
"::",
"valid",
"(",
"$",
"url",
")",
"||",
"static",
"::",
"valid",
"(",
"'http:'",
".",
"$",
"url",
")",
")",
"{",
"return",
"$",
"url",
";",
"}",
"$",
"app",
"=",
"Config",
"::",
"get",
"(",
"'app'",
")",
";",
"$",
"root",
"=",
"(",
"$",
"app",
"[",
"'asset_url'",
"]",
"!=",
"''",
")",
"?",
"$",
"app",
"[",
"'asset_url'",
"]",
":",
"false",
";",
"// shoot us through a different server or third-party content delivery network.",
"if",
"(",
"$",
"root",
")",
"{",
"return",
"rtrim",
"(",
"$",
"root",
",",
"'/'",
")",
".",
"'/'",
".",
"ltrim",
"(",
"$",
"url",
",",
"'/'",
")",
";",
"}",
"$",
"url",
"=",
"static",
"::",
"to",
"(",
"$",
"url",
",",
"$",
"https",
",",
"true",
")",
";",
"// we do not need to come through the front controller.",
"if",
"(",
"$",
"app",
"[",
"'index'",
"]",
"!==",
"''",
")",
"{",
"$",
"url",
"=",
"str_replace",
"(",
"$",
"app",
"[",
"'index'",
"]",
".",
"'/'",
",",
"''",
",",
"$",
"url",
")",
";",
"}",
"return",
"$",
"url",
";",
"}"
] |
Generate an application URL to an asset.
@param string $url
@param bool $https
@return string
|
[
"Generate",
"an",
"application",
"URL",
"to",
"an",
"asset",
"."
] |
859aa7c8bb727b556c5e32224842af3cff33f18b
|
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Url.php#L185-L207
|
226,114
|
gjerokrsteski/pimf-framework
|
core/Pimf/Url.php
|
Url.valid
|
public static function valid($url)
{
if (Str::startsWith($url, '//')) {
return true;
}
return filter_var($url, FILTER_VALIDATE_URL) !== false;
}
|
php
|
public static function valid($url)
{
if (Str::startsWith($url, '//')) {
return true;
}
return filter_var($url, FILTER_VALIDATE_URL) !== false;
}
|
[
"public",
"static",
"function",
"valid",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"Str",
"::",
"startsWith",
"(",
"$",
"url",
",",
"'//'",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"filter_var",
"(",
"$",
"url",
",",
"FILTER_VALIDATE_URL",
")",
"!==",
"false",
";",
"}"
] |
Determine if the given URL is valid.
@param string $url
@return bool
|
[
"Determine",
"if",
"the",
"given",
"URL",
"is",
"valid",
"."
] |
859aa7c8bb727b556c5e32224842af3cff33f18b
|
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Url.php#L216-L223
|
226,115
|
gjerokrsteski/pimf-framework
|
core/Pimf/Session/Storages/Storage.php
|
Storage.id
|
public function id()
{
// just return any string since the Cookie storage has no idea.
if ($this instanceof \Pimf\Session\Storages\Cookie) {
return Character::random(40);
}
// we'll find an random ID here.
do {
$session = $this->load($key = Character::random(40));
} while ($session !== null);
return $key;
}
|
php
|
public function id()
{
// just return any string since the Cookie storage has no idea.
if ($this instanceof \Pimf\Session\Storages\Cookie) {
return Character::random(40);
}
// we'll find an random ID here.
do {
$session = $this->load($key = Character::random(40));
} while ($session !== null);
return $key;
}
|
[
"public",
"function",
"id",
"(",
")",
"{",
"// just return any string since the Cookie storage has no idea.",
"if",
"(",
"$",
"this",
"instanceof",
"\\",
"Pimf",
"\\",
"Session",
"\\",
"Storages",
"\\",
"Cookie",
")",
"{",
"return",
"Character",
"::",
"random",
"(",
"40",
")",
";",
"}",
"// we'll find an random ID here.",
"do",
"{",
"$",
"session",
"=",
"$",
"this",
"->",
"load",
"(",
"$",
"key",
"=",
"Character",
"::",
"random",
"(",
"40",
")",
")",
";",
"}",
"while",
"(",
"$",
"session",
"!==",
"null",
")",
";",
"return",
"$",
"key",
";",
"}"
] |
Get a new session ID that isn't assigned to any current session.
@return string
|
[
"Get",
"a",
"new",
"session",
"ID",
"that",
"isn",
"t",
"assigned",
"to",
"any",
"current",
"session",
"."
] |
859aa7c8bb727b556c5e32224842af3cff33f18b
|
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Session/Storages/Storage.php#L64-L77
|
226,116
|
gamegos/php-code-sniffer
|
src/Gamegos/CodeSniffer/Helpers/RulesetHelper.php
|
RulesetHelper.updateRuleProperty
|
protected function updateRuleProperty($rule, $key, $value)
{
if (preg_match('/^[^.]+(\.[^.]+){3}$/', $rule)) {
$this->current[$rule][$key] = $value;
$this->commit();
} else {
throw new InvalidArgumentException('Invalid rule name!');
}
}
|
php
|
protected function updateRuleProperty($rule, $key, $value)
{
if (preg_match('/^[^.]+(\.[^.]+){3}$/', $rule)) {
$this->current[$rule][$key] = $value;
$this->commit();
} else {
throw new InvalidArgumentException('Invalid rule name!');
}
}
|
[
"protected",
"function",
"updateRuleProperty",
"(",
"$",
"rule",
",",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^[^.]+(\\.[^.]+){3}$/'",
",",
"$",
"rule",
")",
")",
"{",
"$",
"this",
"->",
"current",
"[",
"$",
"rule",
"]",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"$",
"this",
"->",
"commit",
"(",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Invalid rule name!'",
")",
";",
"}",
"}"
] |
Update a property of a rule.
@param string $rule
@param string $key
@param mixed $value
@throws \InvalidArgumentException
|
[
"Update",
"a",
"property",
"of",
"a",
"rule",
"."
] |
7e5939b66a55bb70eb66830b596b28e6bf3d1368
|
https://github.com/gamegos/php-code-sniffer/blob/7e5939b66a55bb70eb66830b596b28e6bf3d1368/src/Gamegos/CodeSniffer/Helpers/RulesetHelper.php#L110-L118
|
226,117
|
gamegos/php-code-sniffer
|
src/Gamegos/CodeSniffer/Helpers/RulesetHelper.php
|
RulesetHelper.updateSniffProperty
|
protected function updateSniffProperty($sniff, $key, $value)
{
if (preg_match('/^[^.]+(\.[^.]+){2}$/', $sniff)) {
$this->current[$sniff]['properties'][$key] = $value;
$this->commit();
} else {
throw new InvalidArgumentException('Invalid sniff name!');
}
}
|
php
|
protected function updateSniffProperty($sniff, $key, $value)
{
if (preg_match('/^[^.]+(\.[^.]+){2}$/', $sniff)) {
$this->current[$sniff]['properties'][$key] = $value;
$this->commit();
} else {
throw new InvalidArgumentException('Invalid sniff name!');
}
}
|
[
"protected",
"function",
"updateSniffProperty",
"(",
"$",
"sniff",
",",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^[^.]+(\\.[^.]+){2}$/'",
",",
"$",
"sniff",
")",
")",
"{",
"$",
"this",
"->",
"current",
"[",
"$",
"sniff",
"]",
"[",
"'properties'",
"]",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"$",
"this",
"->",
"commit",
"(",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Invalid sniff name!'",
")",
";",
"}",
"}"
] |
Update a property of a sniff.
@param string $sniff
@param string $key
@param mixed $value
@throws \InvalidArgumentException
|
[
"Update",
"a",
"property",
"of",
"a",
"sniff",
"."
] |
7e5939b66a55bb70eb66830b596b28e6bf3d1368
|
https://github.com/gamegos/php-code-sniffer/blob/7e5939b66a55bb70eb66830b596b28e6bf3d1368/src/Gamegos/CodeSniffer/Helpers/RulesetHelper.php#L127-L135
|
226,118
|
eosnewmedia/JSON-API-Common
|
src/Model/Resource/JsonResource.php
|
JsonResource.duplicate
|
public function duplicate(string $id = null): ResourceInterface
{
$resource = new self($this->type(), $id ?? $this->id(), $this->attributes()->all());
$resource->metaInformation()->mergeCollection($this->metaInformation());
foreach ($this->relationships()->all() as $relationship) {
$resource->relationships()->set($relationship->duplicate());
}
foreach ($this->links()->all() as $link) {
$resource->links()->set($link->duplicate());
}
return $resource;
}
|
php
|
public function duplicate(string $id = null): ResourceInterface
{
$resource = new self($this->type(), $id ?? $this->id(), $this->attributes()->all());
$resource->metaInformation()->mergeCollection($this->metaInformation());
foreach ($this->relationships()->all() as $relationship) {
$resource->relationships()->set($relationship->duplicate());
}
foreach ($this->links()->all() as $link) {
$resource->links()->set($link->duplicate());
}
return $resource;
}
|
[
"public",
"function",
"duplicate",
"(",
"string",
"$",
"id",
"=",
"null",
")",
":",
"ResourceInterface",
"{",
"$",
"resource",
"=",
"new",
"self",
"(",
"$",
"this",
"->",
"type",
"(",
")",
",",
"$",
"id",
"??",
"$",
"this",
"->",
"id",
"(",
")",
",",
"$",
"this",
"->",
"attributes",
"(",
")",
"->",
"all",
"(",
")",
")",
";",
"$",
"resource",
"->",
"metaInformation",
"(",
")",
"->",
"mergeCollection",
"(",
"$",
"this",
"->",
"metaInformation",
"(",
")",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"relationships",
"(",
")",
"->",
"all",
"(",
")",
"as",
"$",
"relationship",
")",
"{",
"$",
"resource",
"->",
"relationships",
"(",
")",
"->",
"set",
"(",
"$",
"relationship",
"->",
"duplicate",
"(",
")",
")",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"links",
"(",
")",
"->",
"all",
"(",
")",
"as",
"$",
"link",
")",
"{",
"$",
"resource",
"->",
"links",
"(",
")",
"->",
"set",
"(",
"$",
"link",
"->",
"duplicate",
"(",
")",
")",
";",
"}",
"return",
"$",
"resource",
";",
"}"
] |
Creates a new resource containing all data from the current one.
If set, the new request will have the given id.
@param string $id
@return ResourceInterface
@throws \InvalidArgumentException
|
[
"Creates",
"a",
"new",
"resource",
"containing",
"all",
"data",
"from",
"the",
"current",
"one",
".",
"If",
"set",
"the",
"new",
"request",
"will",
"have",
"the",
"given",
"id",
"."
] |
d868eb4d76bf75518f1bb72a70e5abf78fcae476
|
https://github.com/eosnewmedia/JSON-API-Common/blob/d868eb4d76bf75518f1bb72a70e5abf78fcae476/src/Model/Resource/JsonResource.php#L130-L145
|
226,119
|
vinkla/laravel-backup
|
src/BackupServiceProvider.php
|
BackupServiceProvider.registerExecutor
|
protected function registerExecutor()
{
$this->app->singleton('backup.executor', function (Container $app) {
$logger = $app['log'];
return new Executor($logger);
});
$this->app->alias('backup.executor', Executor::class);
}
|
php
|
protected function registerExecutor()
{
$this->app->singleton('backup.executor', function (Container $app) {
$logger = $app['log'];
return new Executor($logger);
});
$this->app->alias('backup.executor', Executor::class);
}
|
[
"protected",
"function",
"registerExecutor",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'backup.executor'",
",",
"function",
"(",
"Container",
"$",
"app",
")",
"{",
"$",
"logger",
"=",
"$",
"app",
"[",
"'log'",
"]",
";",
"return",
"new",
"Executor",
"(",
"$",
"logger",
")",
";",
"}",
")",
";",
"$",
"this",
"->",
"app",
"->",
"alias",
"(",
"'backup.executor'",
",",
"Executor",
"::",
"class",
")",
";",
"}"
] |
Register the executor class.
@return void
|
[
"Register",
"the",
"executor",
"class",
"."
] |
d3662b6509a39bce9cd75cc3e65b4ea01be46b26
|
https://github.com/vinkla/laravel-backup/blob/d3662b6509a39bce9cd75cc3e65b4ea01be46b26/src/BackupServiceProvider.php#L79-L88
|
226,120
|
vinkla/laravel-backup
|
src/BackupServiceProvider.php
|
BackupServiceProvider.registerProfileBuilder
|
protected function registerProfileBuilder()
{
$this->app->singleton('backup.builder', function (Container $app) {
$config = $app['config']['backup'];
$factory = new ProfileBuilderFactory($app);
return $factory->make($config);
});
$this->app->alias('backup.builder', ProfileBuilder::class);
}
|
php
|
protected function registerProfileBuilder()
{
$this->app->singleton('backup.builder', function (Container $app) {
$config = $app['config']['backup'];
$factory = new ProfileBuilderFactory($app);
return $factory->make($config);
});
$this->app->alias('backup.builder', ProfileBuilder::class);
}
|
[
"protected",
"function",
"registerProfileBuilder",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'backup.builder'",
",",
"function",
"(",
"Container",
"$",
"app",
")",
"{",
"$",
"config",
"=",
"$",
"app",
"[",
"'config'",
"]",
"[",
"'backup'",
"]",
";",
"$",
"factory",
"=",
"new",
"ProfileBuilderFactory",
"(",
"$",
"app",
")",
";",
"return",
"$",
"factory",
"->",
"make",
"(",
"$",
"config",
")",
";",
"}",
")",
";",
"$",
"this",
"->",
"app",
"->",
"alias",
"(",
"'backup.builder'",
",",
"ProfileBuilder",
"::",
"class",
")",
";",
"}"
] |
Register the profile builder class.
@return void
|
[
"Register",
"the",
"profile",
"builder",
"class",
"."
] |
d3662b6509a39bce9cd75cc3e65b4ea01be46b26
|
https://github.com/vinkla/laravel-backup/blob/d3662b6509a39bce9cd75cc3e65b4ea01be46b26/src/BackupServiceProvider.php#L95-L106
|
226,121
|
vinkla/laravel-backup
|
src/BackupServiceProvider.php
|
BackupServiceProvider.registerProfileRegistry
|
protected function registerProfileRegistry()
{
$this->app->singleton('backup.registry', function (Container $app) {
$config = $app['config']['backup'];
$builder = $app['backup.builder'];
$factory = new ProfileRegistryFactory($builder);
return $factory->make($config);
});
$this->app->alias('backup.registry', ProfileRegistry::class);
}
|
php
|
protected function registerProfileRegistry()
{
$this->app->singleton('backup.registry', function (Container $app) {
$config = $app['config']['backup'];
$builder = $app['backup.builder'];
$factory = new ProfileRegistryFactory($builder);
return $factory->make($config);
});
$this->app->alias('backup.registry', ProfileRegistry::class);
}
|
[
"protected",
"function",
"registerProfileRegistry",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'backup.registry'",
",",
"function",
"(",
"Container",
"$",
"app",
")",
"{",
"$",
"config",
"=",
"$",
"app",
"[",
"'config'",
"]",
"[",
"'backup'",
"]",
";",
"$",
"builder",
"=",
"$",
"app",
"[",
"'backup.builder'",
"]",
";",
"$",
"factory",
"=",
"new",
"ProfileRegistryFactory",
"(",
"$",
"builder",
")",
";",
"return",
"$",
"factory",
"->",
"make",
"(",
"$",
"config",
")",
";",
"}",
")",
";",
"$",
"this",
"->",
"app",
"->",
"alias",
"(",
"'backup.registry'",
",",
"ProfileRegistry",
"::",
"class",
")",
";",
"}"
] |
Register the profile registry class.
@return void
|
[
"Register",
"the",
"profile",
"registry",
"class",
"."
] |
d3662b6509a39bce9cd75cc3e65b4ea01be46b26
|
https://github.com/vinkla/laravel-backup/blob/d3662b6509a39bce9cd75cc3e65b4ea01be46b26/src/BackupServiceProvider.php#L113-L125
|
226,122
|
vinkla/laravel-backup
|
src/BackupServiceProvider.php
|
BackupServiceProvider.registerMysqlDumpSource
|
protected function registerMysqlDumpSource()
{
$this->app->bind(MysqlDumpSource::class, function (Container $app) {
$config = $app['config'];
return new MysqlDumpSource($config);
});
}
|
php
|
protected function registerMysqlDumpSource()
{
$this->app->bind(MysqlDumpSource::class, function (Container $app) {
$config = $app['config'];
return new MysqlDumpSource($config);
});
}
|
[
"protected",
"function",
"registerMysqlDumpSource",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"bind",
"(",
"MysqlDumpSource",
"::",
"class",
",",
"function",
"(",
"Container",
"$",
"app",
")",
"{",
"$",
"config",
"=",
"$",
"app",
"[",
"'config'",
"]",
";",
"return",
"new",
"MysqlDumpSource",
"(",
"$",
"config",
")",
";",
"}",
")",
";",
"}"
] |
Register the database source class.
@return void
|
[
"Register",
"the",
"database",
"source",
"class",
"."
] |
d3662b6509a39bce9cd75cc3e65b4ea01be46b26
|
https://github.com/vinkla/laravel-backup/blob/d3662b6509a39bce9cd75cc3e65b4ea01be46b26/src/BackupServiceProvider.php#L132-L139
|
226,123
|
vinkla/laravel-backup
|
src/BackupServiceProvider.php
|
BackupServiceProvider.registerBackup
|
protected function registerBackup()
{
$this->app->singleton('backup', function (Container $app) {
$config = $app['config'];
$registry = $app['backup.registry'];
$executor = $app['backup.executor'];
return new Backup($config, $registry, $executor);
});
$this->app->alias('backup', Backup::class);
}
|
php
|
protected function registerBackup()
{
$this->app->singleton('backup', function (Container $app) {
$config = $app['config'];
$registry = $app['backup.registry'];
$executor = $app['backup.executor'];
return new Backup($config, $registry, $executor);
});
$this->app->alias('backup', Backup::class);
}
|
[
"protected",
"function",
"registerBackup",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'backup'",
",",
"function",
"(",
"Container",
"$",
"app",
")",
"{",
"$",
"config",
"=",
"$",
"app",
"[",
"'config'",
"]",
";",
"$",
"registry",
"=",
"$",
"app",
"[",
"'backup.registry'",
"]",
";",
"$",
"executor",
"=",
"$",
"app",
"[",
"'backup.executor'",
"]",
";",
"return",
"new",
"Backup",
"(",
"$",
"config",
",",
"$",
"registry",
",",
"$",
"executor",
")",
";",
"}",
")",
";",
"$",
"this",
"->",
"app",
"->",
"alias",
"(",
"'backup'",
",",
"Backup",
"::",
"class",
")",
";",
"}"
] |
Register the backup class.
@return void
|
[
"Register",
"the",
"backup",
"class",
"."
] |
d3662b6509a39bce9cd75cc3e65b4ea01be46b26
|
https://github.com/vinkla/laravel-backup/blob/d3662b6509a39bce9cd75cc3e65b4ea01be46b26/src/BackupServiceProvider.php#L146-L157
|
226,124
|
frictionlessdata/datapackage-php
|
src/Registry.php
|
Registry.getResourceValidationProfile
|
public static function getResourceValidationProfile($descriptor)
{
$descriptor = Utils::objectify($descriptor);
if (isset($descriptor->profile) && $descriptor->profile != 'default') {
return $descriptor->profile;
} else {
return 'data-resource';
}
}
|
php
|
public static function getResourceValidationProfile($descriptor)
{
$descriptor = Utils::objectify($descriptor);
if (isset($descriptor->profile) && $descriptor->profile != 'default') {
return $descriptor->profile;
} else {
return 'data-resource';
}
}
|
[
"public",
"static",
"function",
"getResourceValidationProfile",
"(",
"$",
"descriptor",
")",
"{",
"$",
"descriptor",
"=",
"Utils",
"::",
"objectify",
"(",
"$",
"descriptor",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"descriptor",
"->",
"profile",
")",
"&&",
"$",
"descriptor",
"->",
"profile",
"!=",
"'default'",
")",
"{",
"return",
"$",
"descriptor",
"->",
"profile",
";",
"}",
"else",
"{",
"return",
"'data-resource'",
";",
"}",
"}"
] |
get the profile which should be used for validation from the given resource descriptor.
|
[
"get",
"the",
"profile",
"which",
"should",
"be",
"used",
"for",
"validation",
"from",
"the",
"given",
"resource",
"descriptor",
"."
] |
e745c21c1e9b11734964909275cfb4688004f07a
|
https://github.com/frictionlessdata/datapackage-php/blob/e745c21c1e9b11734964909275cfb4688004f07a/src/Registry.php#L13-L21
|
226,125
|
frictionlessdata/datapackage-php
|
src/Registry.php
|
Registry.getJsonSchemaFile
|
public static function getJsonSchemaFile($profile)
{
foreach (static::getAllSchemas() as $schema) {
if ($schema->id != 'registry' && $schema->id == $profile) {
if (isset($schema->schema_path)) {
return realpath(dirname(__FILE__)).'/Validators/schemas/'.$schema->schema_path;
} else {
return $schema->schema_filename;
}
}
}
return false;
}
|
php
|
public static function getJsonSchemaFile($profile)
{
foreach (static::getAllSchemas() as $schema) {
if ($schema->id != 'registry' && $schema->id == $profile) {
if (isset($schema->schema_path)) {
return realpath(dirname(__FILE__)).'/Validators/schemas/'.$schema->schema_path;
} else {
return $schema->schema_filename;
}
}
}
return false;
}
|
[
"public",
"static",
"function",
"getJsonSchemaFile",
"(",
"$",
"profile",
")",
"{",
"foreach",
"(",
"static",
"::",
"getAllSchemas",
"(",
")",
"as",
"$",
"schema",
")",
"{",
"if",
"(",
"$",
"schema",
"->",
"id",
"!=",
"'registry'",
"&&",
"$",
"schema",
"->",
"id",
"==",
"$",
"profile",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"schema",
"->",
"schema_path",
")",
")",
"{",
"return",
"realpath",
"(",
"dirname",
"(",
"__FILE__",
")",
")",
".",
"'/Validators/schemas/'",
".",
"$",
"schema",
"->",
"schema_path",
";",
"}",
"else",
"{",
"return",
"$",
"schema",
"->",
"schema_filename",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] |
given a normalized profile - get the corresponding schema file for known schema in the registry
returns false in case of unknown schema
works the same for both datapackage schema and resource schemas.
|
[
"given",
"a",
"normalized",
"profile",
"-",
"get",
"the",
"corresponding",
"schema",
"file",
"for",
"known",
"schema",
"in",
"the",
"registry",
"returns",
"false",
"in",
"case",
"of",
"unknown",
"schema",
"works",
"the",
"same",
"for",
"both",
"datapackage",
"schema",
"and",
"resource",
"schemas",
"."
] |
e745c21c1e9b11734964909275cfb4688004f07a
|
https://github.com/frictionlessdata/datapackage-php/blob/e745c21c1e9b11734964909275cfb4688004f07a/src/Registry.php#L41-L54
|
226,126
|
frictionlessdata/datapackage-php
|
src/Registry.php
|
Registry.getAllSchemas
|
public static function getAllSchemas()
{
// registry schema
$registrySchemaFilename = dirname(__FILE__).'/Validators/schemas/registry.json';
$registry = [
(object) [
'id' => 'registry',
'schema' => 'https://specs.frictionlessdata.io/schemas/registry.json',
'schema_path' => 'registry.json',
],
];
// schemas from the registry (currently contains only the datapackage scheams)
$schemaIds = [];
if (file_exists($registrySchemaFilename)) {
foreach (json_decode(file_get_contents($registrySchemaFilename)) as $schema) {
$schemaIds[] = $schema->id;
$registry[] = $schema;
}
// resource schemas - currently not in the registry
foreach (['data-resource', 'tabular-data-resource'] as $id) {
if (!in_array($id, $schemaIds)) {
$registry[] = (object) [
'id' => $id,
'schema' => "https://specs.frictionlessdata.io/schemas/{$id}.json",
'schema_path' => "{$id}.json",
];
}
}
}
// custom registered schemas
foreach (static::$registeredSchemas as $profile => $schema) {
$registry[] = (object) [
'id' => $profile,
'schema_filename' => $schema['filename'],
];
}
return $registry;
}
|
php
|
public static function getAllSchemas()
{
// registry schema
$registrySchemaFilename = dirname(__FILE__).'/Validators/schemas/registry.json';
$registry = [
(object) [
'id' => 'registry',
'schema' => 'https://specs.frictionlessdata.io/schemas/registry.json',
'schema_path' => 'registry.json',
],
];
// schemas from the registry (currently contains only the datapackage scheams)
$schemaIds = [];
if (file_exists($registrySchemaFilename)) {
foreach (json_decode(file_get_contents($registrySchemaFilename)) as $schema) {
$schemaIds[] = $schema->id;
$registry[] = $schema;
}
// resource schemas - currently not in the registry
foreach (['data-resource', 'tabular-data-resource'] as $id) {
if (!in_array($id, $schemaIds)) {
$registry[] = (object) [
'id' => $id,
'schema' => "https://specs.frictionlessdata.io/schemas/{$id}.json",
'schema_path' => "{$id}.json",
];
}
}
}
// custom registered schemas
foreach (static::$registeredSchemas as $profile => $schema) {
$registry[] = (object) [
'id' => $profile,
'schema_filename' => $schema['filename'],
];
}
return $registry;
}
|
[
"public",
"static",
"function",
"getAllSchemas",
"(",
")",
"{",
"// registry schema",
"$",
"registrySchemaFilename",
"=",
"dirname",
"(",
"__FILE__",
")",
".",
"'/Validators/schemas/registry.json'",
";",
"$",
"registry",
"=",
"[",
"(",
"object",
")",
"[",
"'id'",
"=>",
"'registry'",
",",
"'schema'",
"=>",
"'https://specs.frictionlessdata.io/schemas/registry.json'",
",",
"'schema_path'",
"=>",
"'registry.json'",
",",
"]",
",",
"]",
";",
"// schemas from the registry (currently contains only the datapackage scheams)",
"$",
"schemaIds",
"=",
"[",
"]",
";",
"if",
"(",
"file_exists",
"(",
"$",
"registrySchemaFilename",
")",
")",
"{",
"foreach",
"(",
"json_decode",
"(",
"file_get_contents",
"(",
"$",
"registrySchemaFilename",
")",
")",
"as",
"$",
"schema",
")",
"{",
"$",
"schemaIds",
"[",
"]",
"=",
"$",
"schema",
"->",
"id",
";",
"$",
"registry",
"[",
"]",
"=",
"$",
"schema",
";",
"}",
"// resource schemas - currently not in the registry",
"foreach",
"(",
"[",
"'data-resource'",
",",
"'tabular-data-resource'",
"]",
"as",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"id",
",",
"$",
"schemaIds",
")",
")",
"{",
"$",
"registry",
"[",
"]",
"=",
"(",
"object",
")",
"[",
"'id'",
"=>",
"$",
"id",
",",
"'schema'",
"=>",
"\"https://specs.frictionlessdata.io/schemas/{$id}.json\"",
",",
"'schema_path'",
"=>",
"\"{$id}.json\"",
",",
"]",
";",
"}",
"}",
"}",
"// custom registered schemas",
"foreach",
"(",
"static",
"::",
"$",
"registeredSchemas",
"as",
"$",
"profile",
"=>",
"$",
"schema",
")",
"{",
"$",
"registry",
"[",
"]",
"=",
"(",
"object",
")",
"[",
"'id'",
"=>",
"$",
"profile",
",",
"'schema_filename'",
"=>",
"$",
"schema",
"[",
"'filename'",
"]",
",",
"]",
";",
"}",
"return",
"$",
"registry",
";",
"}"
] |
returns array of all known schemas in the registry.
|
[
"returns",
"array",
"of",
"all",
"known",
"schemas",
"in",
"the",
"registry",
"."
] |
e745c21c1e9b11734964909275cfb4688004f07a
|
https://github.com/frictionlessdata/datapackage-php/blob/e745c21c1e9b11734964909275cfb4688004f07a/src/Registry.php#L69-L107
|
226,127
|
frictionlessdata/datapackage-php
|
src/Resources/BaseResource.php
|
BaseResource.rewind
|
public function rewind()
{
$this->dataStreams = null;
$this->currentDataStream = 0;
foreach ($this->dataStreams() as $dataStream) {
$dataStream->rewind();
}
}
|
php
|
public function rewind()
{
$this->dataStreams = null;
$this->currentDataStream = 0;
foreach ($this->dataStreams() as $dataStream) {
$dataStream->rewind();
}
}
|
[
"public",
"function",
"rewind",
"(",
")",
"{",
"$",
"this",
"->",
"dataStreams",
"=",
"null",
";",
"$",
"this",
"->",
"currentDataStream",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"dataStreams",
"(",
")",
"as",
"$",
"dataStream",
")",
"{",
"$",
"dataStream",
"->",
"rewind",
"(",
")",
";",
"}",
"}"
] |
standard iterator functions - to iterate over the data sources
|
[
"standard",
"iterator",
"functions",
"-",
"to",
"iterate",
"over",
"the",
"data",
"sources"
] |
e745c21c1e9b11734964909275cfb4688004f07a
|
https://github.com/frictionlessdata/datapackage-php/blob/e745c21c1e9b11734964909275cfb4688004f07a/src/Resources/BaseResource.php#L127-L134
|
226,128
|
frictionlessdata/datapackage-php
|
src/Resources/BaseResource.php
|
BaseResource.normalizeDataSource
|
public static function normalizeDataSource($dataSource, $basePath = null)
{
if (!empty($basePath) && !Utils::isHttpSource($dataSource)) {
// TODO: support JSON pointers
$absPath = $basePath.DIRECTORY_SEPARATOR.$dataSource;
if (file_exists($absPath)) {
$dataSource = $absPath;
}
}
return $dataSource;
}
|
php
|
public static function normalizeDataSource($dataSource, $basePath = null)
{
if (!empty($basePath) && !Utils::isHttpSource($dataSource)) {
// TODO: support JSON pointers
$absPath = $basePath.DIRECTORY_SEPARATOR.$dataSource;
if (file_exists($absPath)) {
$dataSource = $absPath;
}
}
return $dataSource;
}
|
[
"public",
"static",
"function",
"normalizeDataSource",
"(",
"$",
"dataSource",
",",
"$",
"basePath",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"basePath",
")",
"&&",
"!",
"Utils",
"::",
"isHttpSource",
"(",
"$",
"dataSource",
")",
")",
"{",
"// TODO: support JSON pointers",
"$",
"absPath",
"=",
"$",
"basePath",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"dataSource",
";",
"if",
"(",
"file_exists",
"(",
"$",
"absPath",
")",
")",
"{",
"$",
"dataSource",
"=",
"$",
"absPath",
";",
"}",
"}",
"return",
"$",
"dataSource",
";",
"}"
] |
allows extending classes to add custom sources
used by unit tests to add a mock http source.
@param string $dataSource
@param string $basePath
@return string
|
[
"allows",
"extending",
"classes",
"to",
"add",
"custom",
"sources",
"used",
"by",
"unit",
"tests",
"to",
"add",
"a",
"mock",
"http",
"source",
"."
] |
e745c21c1e9b11734964909275cfb4688004f07a
|
https://github.com/frictionlessdata/datapackage-php/blob/e745c21c1e9b11734964909275cfb4688004f07a/src/Resources/BaseResource.php#L217-L228
|
226,129
|
frictionlessdata/datapackage-php
|
src/Validators/BaseValidator.php
|
BaseValidator.getValidationSchemaUrl
|
protected function getValidationSchemaUrl()
{
$profile = $this->getValidationProfile();
if ($filename = $this->getJsonSchemaFileFromRegistry($profile)) {
// known profile id in the registry
return $this->convertValidationSchemaFilenameToUrl($filename);
} elseif (Utils::isHttpSource($profile)) {
// url
return $profile;
} elseif (file_exists($filename = $this->basePath.DIRECTORY_SEPARATOR.$profile)) {
// relative path - prefixed with basePath
return $this->convertValidationSchemaFilenameToUrl($filename);
} else {
// absolute path (or relative to current working directory)
return $this->convertValidationSchemaFilenameToUrl($profile);
}
}
|
php
|
protected function getValidationSchemaUrl()
{
$profile = $this->getValidationProfile();
if ($filename = $this->getJsonSchemaFileFromRegistry($profile)) {
// known profile id in the registry
return $this->convertValidationSchemaFilenameToUrl($filename);
} elseif (Utils::isHttpSource($profile)) {
// url
return $profile;
} elseif (file_exists($filename = $this->basePath.DIRECTORY_SEPARATOR.$profile)) {
// relative path - prefixed with basePath
return $this->convertValidationSchemaFilenameToUrl($filename);
} else {
// absolute path (or relative to current working directory)
return $this->convertValidationSchemaFilenameToUrl($profile);
}
}
|
[
"protected",
"function",
"getValidationSchemaUrl",
"(",
")",
"{",
"$",
"profile",
"=",
"$",
"this",
"->",
"getValidationProfile",
"(",
")",
";",
"if",
"(",
"$",
"filename",
"=",
"$",
"this",
"->",
"getJsonSchemaFileFromRegistry",
"(",
"$",
"profile",
")",
")",
"{",
"// known profile id in the registry",
"return",
"$",
"this",
"->",
"convertValidationSchemaFilenameToUrl",
"(",
"$",
"filename",
")",
";",
"}",
"elseif",
"(",
"Utils",
"::",
"isHttpSource",
"(",
"$",
"profile",
")",
")",
"{",
"// url",
"return",
"$",
"profile",
";",
"}",
"elseif",
"(",
"file_exists",
"(",
"$",
"filename",
"=",
"$",
"this",
"->",
"basePath",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"profile",
")",
")",
"{",
"// relative path - prefixed with basePath",
"return",
"$",
"this",
"->",
"convertValidationSchemaFilenameToUrl",
"(",
"$",
"filename",
")",
";",
"}",
"else",
"{",
"// absolute path (or relative to current working directory)",
"return",
"$",
"this",
"->",
"convertValidationSchemaFilenameToUrl",
"(",
"$",
"profile",
")",
";",
"}",
"}"
] |
get the url which the schema for validation can be fetched from.
@return string
|
[
"get",
"the",
"url",
"which",
"the",
"schema",
"for",
"validation",
"can",
"be",
"fetched",
"from",
"."
] |
e745c21c1e9b11734964909275cfb4688004f07a
|
https://github.com/frictionlessdata/datapackage-php/blob/e745c21c1e9b11734964909275cfb4688004f07a/src/Validators/BaseValidator.php#L67-L83
|
226,130
|
frictionlessdata/datapackage-php
|
src/Validators/BaseValidator.php
|
BaseValidator.addError
|
protected function addError($code, $extraDetails = null)
{
// modified from parent function to support changing the error class
$errorClass = $this->getSchemaValidationErrorClass();
$this->errors[] = new $errorClass($code, $extraDetails);
}
|
php
|
protected function addError($code, $extraDetails = null)
{
// modified from parent function to support changing the error class
$errorClass = $this->getSchemaValidationErrorClass();
$this->errors[] = new $errorClass($code, $extraDetails);
}
|
[
"protected",
"function",
"addError",
"(",
"$",
"code",
",",
"$",
"extraDetails",
"=",
"null",
")",
"{",
"// modified from parent function to support changing the error class",
"$",
"errorClass",
"=",
"$",
"this",
"->",
"getSchemaValidationErrorClass",
"(",
")",
";",
"$",
"this",
"->",
"errors",
"[",
"]",
"=",
"new",
"$",
"errorClass",
"(",
"$",
"code",
",",
"$",
"extraDetails",
")",
";",
"}"
] |
Add an error to the validator object - errors are aggregated and returned by validate function.
@param int $code
@param null|mixed $extraDetails
|
[
"Add",
"an",
"error",
"to",
"the",
"validator",
"object",
"-",
"errors",
"are",
"aggregated",
"and",
"returned",
"by",
"validate",
"function",
"."
] |
e745c21c1e9b11734964909275cfb4688004f07a
|
https://github.com/frictionlessdata/datapackage-php/blob/e745c21c1e9b11734964909275cfb4688004f07a/src/Validators/BaseValidator.php#L146-L151
|
226,131
|
Techworker/ssml
|
src/BaseElement.php
|
BaseElement.root
|
public function root() : ContainerElement
{
// no need to check anything else, we are at the top
if ($this instanceof Speak) {
return $this;
}
// loop until we find an element that has no parent
$currentParent = $this->parent;
while ($currentParent->parent !== null) {
$currentParent = $currentParent->parent;
}
return $currentParent;
}
|
php
|
public function root() : ContainerElement
{
// no need to check anything else, we are at the top
if ($this instanceof Speak) {
return $this;
}
// loop until we find an element that has no parent
$currentParent = $this->parent;
while ($currentParent->parent !== null) {
$currentParent = $currentParent->parent;
}
return $currentParent;
}
|
[
"public",
"function",
"root",
"(",
")",
":",
"ContainerElement",
"{",
"// no need to check anything else, we are at the top",
"if",
"(",
"$",
"this",
"instanceof",
"Speak",
")",
"{",
"return",
"$",
"this",
";",
"}",
"// loop until we find an element that has no parent",
"$",
"currentParent",
"=",
"$",
"this",
"->",
"parent",
";",
"while",
"(",
"$",
"currentParent",
"->",
"parent",
"!==",
"null",
")",
"{",
"$",
"currentParent",
"=",
"$",
"currentParent",
"->",
"parent",
";",
"}",
"return",
"$",
"currentParent",
";",
"}"
] |
Gets the topmost root element of the current ssml-tree.
@return ContainerElement
|
[
"Gets",
"the",
"topmost",
"root",
"element",
"of",
"the",
"current",
"ssml",
"-",
"tree",
"."
] |
cafb979b777480baf7a01b5db2bf7c2cff837805
|
https://github.com/Techworker/ssml/blob/cafb979b777480baf7a01b5db2bf7c2cff837805/src/BaseElement.php#L43-L57
|
226,132
|
Techworker/ssml
|
src/BaseElement.php
|
BaseElement.attr
|
public function attr(string $name, string $value = null)
{
if ($value === null) {
if (isset($this->customAttributes[$name])) {
return $this->customAttributes[$name];
}
throw new SsmlException('Unknown attribute ' . $name . ' in class ' . get_class($this));
}
$this->customAttributes[$name] = $value;
return $this;
}
|
php
|
public function attr(string $name, string $value = null)
{
if ($value === null) {
if (isset($this->customAttributes[$name])) {
return $this->customAttributes[$name];
}
throw new SsmlException('Unknown attribute ' . $name . ' in class ' . get_class($this));
}
$this->customAttributes[$name] = $value;
return $this;
}
|
[
"public",
"function",
"attr",
"(",
"string",
"$",
"name",
",",
"string",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"customAttributes",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"customAttributes",
"[",
"$",
"name",
"]",
";",
"}",
"throw",
"new",
"SsmlException",
"(",
"'Unknown attribute '",
".",
"$",
"name",
".",
"' in class '",
".",
"get_class",
"(",
"$",
"this",
")",
")",
";",
"}",
"$",
"this",
"->",
"customAttributes",
"[",
"$",
"name",
"]",
"=",
"$",
"value",
";",
"return",
"$",
"this",
";",
"}"
] |
Adds an unmanaged custom attribute to the element or gets an attribute either from the list
of custom attributes.
@param string $name The name of the attribute.
@param string $value The value of the attribute.
@throws SsmlException
@return static
|
[
"Adds",
"an",
"unmanaged",
"custom",
"attribute",
"to",
"the",
"element",
"or",
"gets",
"an",
"attribute",
"either",
"from",
"the",
"list",
"of",
"custom",
"attributes",
"."
] |
cafb979b777480baf7a01b5db2bf7c2cff837805
|
https://github.com/Techworker/ssml/blob/cafb979b777480baf7a01b5db2bf7c2cff837805/src/BaseElement.php#L68-L80
|
226,133
|
Techworker/ssml
|
src/BaseElement.php
|
BaseElement.customAttributesToDOM
|
protected function customAttributesToDOM(\DOMElement $element) : void
{
foreach ($this->customAttributes as $key => $value) {
$element->setAttribute($key, $value);
}
}
|
php
|
protected function customAttributesToDOM(\DOMElement $element) : void
{
foreach ($this->customAttributes as $key => $value) {
$element->setAttribute($key, $value);
}
}
|
[
"protected",
"function",
"customAttributesToDOM",
"(",
"\\",
"DOMElement",
"$",
"element",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"this",
"->",
"customAttributes",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"element",
"->",
"setAttribute",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"}",
"}"
] |
Sets the custom attributes in the given \DomElement instance.
@param \DOMElement $element
|
[
"Sets",
"the",
"custom",
"attributes",
"in",
"the",
"given",
"\\",
"DomElement",
"instance",
"."
] |
cafb979b777480baf7a01b5db2bf7c2cff837805
|
https://github.com/Techworker/ssml/blob/cafb979b777480baf7a01b5db2bf7c2cff837805/src/BaseElement.php#L97-L102
|
226,134
|
vinkla/laravel-backup
|
src/ProfileBuilderFactory.php
|
ProfileBuilderFactory.make
|
public function make(array $config): ProfileBuilder
{
$config = $this->getConfig($config);
return $this->getProfileBuilder($config);
}
|
php
|
public function make(array $config): ProfileBuilder
{
$config = $this->getConfig($config);
return $this->getProfileBuilder($config);
}
|
[
"public",
"function",
"make",
"(",
"array",
"$",
"config",
")",
":",
"ProfileBuilder",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"getConfig",
"(",
"$",
"config",
")",
";",
"return",
"$",
"this",
"->",
"getProfileBuilder",
"(",
"$",
"config",
")",
";",
"}"
] |
Make the profile builder.
@param array $config
@return \Zenstruck\Backup\ProfileBuilder
|
[
"Make",
"the",
"profile",
"builder",
"."
] |
d3662b6509a39bce9cd75cc3e65b4ea01be46b26
|
https://github.com/vinkla/laravel-backup/blob/d3662b6509a39bce9cd75cc3e65b4ea01be46b26/src/ProfileBuilderFactory.php#L53-L58
|
226,135
|
vinkla/laravel-backup
|
src/ProfileBuilderFactory.php
|
ProfileBuilderFactory.getProfileBuilder
|
protected function getProfileBuilder(array $config): ProfileBuilder
{
return new ProfileBuilder(
$this->bootstrap(array_get($config, 'processors')),
$this->bootstrap(array_get($config, 'namers')),
$this->bootstrap(array_get($config, 'sources')),
$this->bootstrap(array_get($config, 'destinations'))
);
}
|
php
|
protected function getProfileBuilder(array $config): ProfileBuilder
{
return new ProfileBuilder(
$this->bootstrap(array_get($config, 'processors')),
$this->bootstrap(array_get($config, 'namers')),
$this->bootstrap(array_get($config, 'sources')),
$this->bootstrap(array_get($config, 'destinations'))
);
}
|
[
"protected",
"function",
"getProfileBuilder",
"(",
"array",
"$",
"config",
")",
":",
"ProfileBuilder",
"{",
"return",
"new",
"ProfileBuilder",
"(",
"$",
"this",
"->",
"bootstrap",
"(",
"array_get",
"(",
"$",
"config",
",",
"'processors'",
")",
")",
",",
"$",
"this",
"->",
"bootstrap",
"(",
"array_get",
"(",
"$",
"config",
",",
"'namers'",
")",
")",
",",
"$",
"this",
"->",
"bootstrap",
"(",
"array_get",
"(",
"$",
"config",
",",
"'sources'",
")",
")",
",",
"$",
"this",
"->",
"bootstrap",
"(",
"array_get",
"(",
"$",
"config",
",",
"'destinations'",
")",
")",
")",
";",
"}"
] |
Get the profile builder.
@param array $config
@return \Zenstruck\Backup\ProfileBuilder
|
[
"Get",
"the",
"profile",
"builder",
"."
] |
d3662b6509a39bce9cd75cc3e65b4ea01be46b26
|
https://github.com/vinkla/laravel-backup/blob/d3662b6509a39bce9cd75cc3e65b4ea01be46b26/src/ProfileBuilderFactory.php#L89-L97
|
226,136
|
sop/gcm
|
lib/GCM/GHASH.php
|
GHASH.compute
|
public function compute(string $X): string
{
$len = strlen($X);
if (0 != $len % 16) {
throw new \UnexpectedValueException(
"Input string must be a multiple of 128 bits.");
}
$Y = GCM::ZB_128;
// number of 128-bit blocks
$m = $len >> 4;
for ($i = 0; $i < $m; ++$i) {
$xi = substr($X, $i << 4, 16);
$Y = $this->_mult($Y ^ $xi, $this->_subkey);
}
return $Y;
}
|
php
|
public function compute(string $X): string
{
$len = strlen($X);
if (0 != $len % 16) {
throw new \UnexpectedValueException(
"Input string must be a multiple of 128 bits.");
}
$Y = GCM::ZB_128;
// number of 128-bit blocks
$m = $len >> 4;
for ($i = 0; $i < $m; ++$i) {
$xi = substr($X, $i << 4, 16);
$Y = $this->_mult($Y ^ $xi, $this->_subkey);
}
return $Y;
}
|
[
"public",
"function",
"compute",
"(",
"string",
"$",
"X",
")",
":",
"string",
"{",
"$",
"len",
"=",
"strlen",
"(",
"$",
"X",
")",
";",
"if",
"(",
"0",
"!=",
"$",
"len",
"%",
"16",
")",
"{",
"throw",
"new",
"\\",
"UnexpectedValueException",
"(",
"\"Input string must be a multiple of 128 bits.\"",
")",
";",
"}",
"$",
"Y",
"=",
"GCM",
"::",
"ZB_128",
";",
"// number of 128-bit blocks",
"$",
"m",
"=",
"$",
"len",
">>",
"4",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"m",
";",
"++",
"$",
"i",
")",
"{",
"$",
"xi",
"=",
"substr",
"(",
"$",
"X",
",",
"$",
"i",
"<<",
"4",
",",
"16",
")",
";",
"$",
"Y",
"=",
"$",
"this",
"->",
"_mult",
"(",
"$",
"Y",
"^",
"$",
"xi",
",",
"$",
"this",
"->",
"_subkey",
")",
";",
"}",
"return",
"$",
"Y",
";",
"}"
] |
Compute hash.
@param string $X Input string
@return string Hash
|
[
"Compute",
"hash",
"."
] |
ef5f63ca0fb1af4c5d2a319858746b9ffd12a216
|
https://github.com/sop/gcm/blob/ef5f63ca0fb1af4c5d2a319858746b9ffd12a216/lib/GCM/GHASH.php#L49-L64
|
226,137
|
sop/gcm
|
lib/GCM/GHASH.php
|
GHASH._mult
|
private function _mult(string $X, string $Y): string
{
$x = GCM::strToGMP($X);
$Z = GCM::strToGMP(GCM::ZB_128);
$V = GCM::strToGMP($Y);
$R = GCM::strToGMP(self::R);
for ($i = 0; $i < 128; ++$i) {
// if bit at X[i] is set
if (gmp_testbit($x, 127 - $i)) {
$Z ^= $V;
}
// if LSB(Vi) = 0
if (!gmp_testbit($V, 0)) {
$V >>= 1;
} else {
$V = ($V >> 1) ^ $R;
}
}
return GCM::gmpToStr($Z, 16);
}
|
php
|
private function _mult(string $X, string $Y): string
{
$x = GCM::strToGMP($X);
$Z = GCM::strToGMP(GCM::ZB_128);
$V = GCM::strToGMP($Y);
$R = GCM::strToGMP(self::R);
for ($i = 0; $i < 128; ++$i) {
// if bit at X[i] is set
if (gmp_testbit($x, 127 - $i)) {
$Z ^= $V;
}
// if LSB(Vi) = 0
if (!gmp_testbit($V, 0)) {
$V >>= 1;
} else {
$V = ($V >> 1) ^ $R;
}
}
return GCM::gmpToStr($Z, 16);
}
|
[
"private",
"function",
"_mult",
"(",
"string",
"$",
"X",
",",
"string",
"$",
"Y",
")",
":",
"string",
"{",
"$",
"x",
"=",
"GCM",
"::",
"strToGMP",
"(",
"$",
"X",
")",
";",
"$",
"Z",
"=",
"GCM",
"::",
"strToGMP",
"(",
"GCM",
"::",
"ZB_128",
")",
";",
"$",
"V",
"=",
"GCM",
"::",
"strToGMP",
"(",
"$",
"Y",
")",
";",
"$",
"R",
"=",
"GCM",
"::",
"strToGMP",
"(",
"self",
"::",
"R",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"128",
";",
"++",
"$",
"i",
")",
"{",
"// if bit at X[i] is set",
"if",
"(",
"gmp_testbit",
"(",
"$",
"x",
",",
"127",
"-",
"$",
"i",
")",
")",
"{",
"$",
"Z",
"^=",
"$",
"V",
";",
"}",
"// if LSB(Vi) = 0",
"if",
"(",
"!",
"gmp_testbit",
"(",
"$",
"V",
",",
"0",
")",
")",
"{",
"$",
"V",
">>=",
"1",
";",
"}",
"else",
"{",
"$",
"V",
"=",
"(",
"$",
"V",
">>",
"1",
")",
"^",
"$",
"R",
";",
"}",
"}",
"return",
"GCM",
"::",
"gmpToStr",
"(",
"$",
"Z",
",",
"16",
")",
";",
"}"
] |
Apply block multiplication operation.
See NIST SP-800-38D, chapter 6.3 for the details.
@param string $X
@param string $Y
@return string
|
[
"Apply",
"block",
"multiplication",
"operation",
"."
] |
ef5f63ca0fb1af4c5d2a319858746b9ffd12a216
|
https://github.com/sop/gcm/blob/ef5f63ca0fb1af4c5d2a319858746b9ffd12a216/lib/GCM/GHASH.php#L86-L105
|
226,138
|
gjerokrsteski/pimf-framework
|
core/Pimf/Util/Character/Clean.php
|
Clean.xss
|
public static function xss($string, $charset = 'ISO-8859-1')
{
$sanitize = new Sanitize();
$string = $sanitize::removeNullCharacters($string);
$string = $sanitize::validateStandardCharacterEntities($string);
$string = $sanitize::validateUTF16TwoByteEncoding($string);
$string = $sanitize::strangeThingsAreSubmitted($string);
$string = $sanitize::convertCharacterEntitiesToASCII($string, $charset);
$string = $sanitize::convertAllTabsToSpaces($string);
$string = $sanitize::makesPhpTagsSafe($string);
$string = $sanitize::compactAnyExplodedWords($string);
$string = $sanitize::removeDisallowedJavaScriptInLinksOrImgTags($string);
$string = $sanitize::removeJavaScriptEventHandlers($string);
$string = $sanitize::healNaughtyHTMLElements($string);
$string = $sanitize::healNaughtyScriptingElements($string);
$string = $sanitize::removeJavaScriptHardRedirects($string);
return $string;
}
|
php
|
public static function xss($string, $charset = 'ISO-8859-1')
{
$sanitize = new Sanitize();
$string = $sanitize::removeNullCharacters($string);
$string = $sanitize::validateStandardCharacterEntities($string);
$string = $sanitize::validateUTF16TwoByteEncoding($string);
$string = $sanitize::strangeThingsAreSubmitted($string);
$string = $sanitize::convertCharacterEntitiesToASCII($string, $charset);
$string = $sanitize::convertAllTabsToSpaces($string);
$string = $sanitize::makesPhpTagsSafe($string);
$string = $sanitize::compactAnyExplodedWords($string);
$string = $sanitize::removeDisallowedJavaScriptInLinksOrImgTags($string);
$string = $sanitize::removeJavaScriptEventHandlers($string);
$string = $sanitize::healNaughtyHTMLElements($string);
$string = $sanitize::healNaughtyScriptingElements($string);
$string = $sanitize::removeJavaScriptHardRedirects($string);
return $string;
}
|
[
"public",
"static",
"function",
"xss",
"(",
"$",
"string",
",",
"$",
"charset",
"=",
"'ISO-8859-1'",
")",
"{",
"$",
"sanitize",
"=",
"new",
"Sanitize",
"(",
")",
";",
"$",
"string",
"=",
"$",
"sanitize",
"::",
"removeNullCharacters",
"(",
"$",
"string",
")",
";",
"$",
"string",
"=",
"$",
"sanitize",
"::",
"validateStandardCharacterEntities",
"(",
"$",
"string",
")",
";",
"$",
"string",
"=",
"$",
"sanitize",
"::",
"validateUTF16TwoByteEncoding",
"(",
"$",
"string",
")",
";",
"$",
"string",
"=",
"$",
"sanitize",
"::",
"strangeThingsAreSubmitted",
"(",
"$",
"string",
")",
";",
"$",
"string",
"=",
"$",
"sanitize",
"::",
"convertCharacterEntitiesToASCII",
"(",
"$",
"string",
",",
"$",
"charset",
")",
";",
"$",
"string",
"=",
"$",
"sanitize",
"::",
"convertAllTabsToSpaces",
"(",
"$",
"string",
")",
";",
"$",
"string",
"=",
"$",
"sanitize",
"::",
"makesPhpTagsSafe",
"(",
"$",
"string",
")",
";",
"$",
"string",
"=",
"$",
"sanitize",
"::",
"compactAnyExplodedWords",
"(",
"$",
"string",
")",
";",
"$",
"string",
"=",
"$",
"sanitize",
"::",
"removeDisallowedJavaScriptInLinksOrImgTags",
"(",
"$",
"string",
")",
";",
"$",
"string",
"=",
"$",
"sanitize",
"::",
"removeJavaScriptEventHandlers",
"(",
"$",
"string",
")",
";",
"$",
"string",
"=",
"$",
"sanitize",
"::",
"healNaughtyHTMLElements",
"(",
"$",
"string",
")",
";",
"$",
"string",
"=",
"$",
"sanitize",
"::",
"healNaughtyScriptingElements",
"(",
"$",
"string",
")",
";",
"$",
"string",
"=",
"$",
"sanitize",
"::",
"removeJavaScriptHardRedirects",
"(",
"$",
"string",
")",
";",
"return",
"$",
"string",
";",
"}"
] |
Cleans against XSS.
@param string $string String to check
@param string $charset Character set (default ISO-8859-1)
@return string $value Sanitized string
|
[
"Cleans",
"against",
"XSS",
"."
] |
859aa7c8bb727b556c5e32224842af3cff33f18b
|
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Util/Character/Clean.php#L38-L57
|
226,139
|
jagilpe/encryption-bundle
|
Entity/Traits/PerUserEncryptableEntityTrait.php
|
PerUserEncryptableEntityTrait.getOwnerUser
|
public function getOwnerUser()
{
$reflection = ClassUtils::newReflectionObject($this);
if ($reflection->hasMethod('getUser')) {
return $this->getUser();
}
elseif ($reflection->hasMethod('getUserProfile')) {
return $this->getUserProfile() ? $this->getUserProfile()->getUser() : null;
}
return null;
}
|
php
|
public function getOwnerUser()
{
$reflection = ClassUtils::newReflectionObject($this);
if ($reflection->hasMethod('getUser')) {
return $this->getUser();
}
elseif ($reflection->hasMethod('getUserProfile')) {
return $this->getUserProfile() ? $this->getUserProfile()->getUser() : null;
}
return null;
}
|
[
"public",
"function",
"getOwnerUser",
"(",
")",
"{",
"$",
"reflection",
"=",
"ClassUtils",
"::",
"newReflectionObject",
"(",
"$",
"this",
")",
";",
"if",
"(",
"$",
"reflection",
"->",
"hasMethod",
"(",
"'getUser'",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getUser",
"(",
")",
";",
"}",
"elseif",
"(",
"$",
"reflection",
"->",
"hasMethod",
"(",
"'getUserProfile'",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getUserProfile",
"(",
")",
"?",
"$",
"this",
"->",
"getUserProfile",
"(",
")",
"->",
"getUser",
"(",
")",
":",
"null",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns the owner of this entity
@return PKEncryptionEnabledUserInterface
|
[
"Returns",
"the",
"owner",
"of",
"this",
"entity"
] |
1e1ba13a3cc646b36e3407822f2e8339c5671f47
|
https://github.com/jagilpe/encryption-bundle/blob/1e1ba13a3cc646b36e3407822f2e8339c5671f47/Entity/Traits/PerUserEncryptableEntityTrait.php#L78-L90
|
226,140
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Text.php
|
Text.SendText
|
public function SendText(Request\SendText $SendText = null)
{
$uri = $this->getUri('/text', array());
return $this->post($uri, $SendText);
}
|
php
|
public function SendText(Request\SendText $SendText = null)
{
$uri = $this->getUri('/text', array());
return $this->post($uri, $SendText);
}
|
[
"public",
"function",
"SendText",
"(",
"Request",
"\\",
"SendText",
"$",
"SendText",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/text'",
",",
"array",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"post",
"(",
"$",
"uri",
",",
"$",
"SendText",
")",
";",
"}"
] |
Send text message and return broadcastId
Sending a text message requires at least a toNumber and a message. SendText
starts a text campaign and returns the broadcastId if campaign is successful
started. This returned broadcastId can be passed to QueryTexts to get state of
text messages in campaign and get list of individual textId for use in GetText
calls. The broadcastId can also be passed to GetBroadcastStats to get
information about the text campaign, such as BilledAmount, Duration, State,
etc... The industry standard is for text messages to be limited to 160
characters or less. If the message is over 160 characters then a
BigMessageStrategy should be selected in the TextBroadcastConfig.
@api
@param Request\SendText $SendText = null
|
[
"Send",
"text",
"message",
"and",
"return",
"broadcastId"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Text.php#L29-L34
|
226,141
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Text.php
|
Text.QueryTexts
|
public function QueryTexts(Request\QueryTexts $QueryTexts = null)
{
$uri = $this->getUri('/text', array());
return $this->get($uri, $QueryTexts);
}
|
php
|
public function QueryTexts(Request\QueryTexts $QueryTexts = null)
{
$uri = $this->getUri('/text', array());
return $this->get($uri, $QueryTexts);
}
|
[
"public",
"function",
"QueryTexts",
"(",
"Request",
"\\",
"QueryTexts",
"$",
"QueryTexts",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/text'",
",",
"array",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"get",
"(",
"$",
"uri",
",",
"$",
"QueryTexts",
")",
";",
"}"
] |
List sent and received text messages
Query for text messages using standard ActionQuery which filters on batchId,
broadcastId, toNumber, etc... Returns a list of text messages and all associated
info. See GetText to return just a single text action by id.
@api
@param Request\QueryTexts $QueryTexts = null
|
[
"List",
"sent",
"and",
"received",
"text",
"messages"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Text.php#L46-L51
|
226,142
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Text.php
|
Text.CreateAutoReply
|
public function CreateAutoReply(Request\CreateAutoReply $CreateAutoReply = null)
{
$uri = $this->getUri('/text/auto-reply', array());
return $this->post($uri, $CreateAutoReply);
}
|
php
|
public function CreateAutoReply(Request\CreateAutoReply $CreateAutoReply = null)
{
$uri = $this->getUri('/text/auto-reply', array());
return $this->post($uri, $CreateAutoReply);
}
|
[
"public",
"function",
"CreateAutoReply",
"(",
"Request",
"\\",
"CreateAutoReply",
"$",
"CreateAutoReply",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/text/auto-reply'",
",",
"array",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"post",
"(",
"$",
"uri",
",",
"$",
"CreateAutoReply",
")",
";",
"}"
] |
Configures a new auto-reply
Create and configure new autoreply message for existing Did Auto-Replys are text
message replys sent to a customer when a customer replys to a text message from
a campaign. A keyword will need to have been purchased before an Auto-Reply can
be created.
@api
@param Request\CreateAutoReply $CreateAutoReply = null
|
[
"Configures",
"a",
"new",
"auto",
"-",
"reply"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Text.php#L83-L88
|
226,143
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Text.php
|
Text.QueryAutoReplies
|
public function QueryAutoReplies(Request\QueryAutoReplies $QueryAutoReplies = null)
{
$uri = $this->getUri('/text/auto-reply', array());
return $this->get($uri, $QueryAutoReplies);
}
|
php
|
public function QueryAutoReplies(Request\QueryAutoReplies $QueryAutoReplies = null)
{
$uri = $this->getUri('/text/auto-reply', array());
return $this->get($uri, $QueryAutoReplies);
}
|
[
"public",
"function",
"QueryAutoReplies",
"(",
"Request",
"\\",
"QueryAutoReplies",
"$",
"QueryAutoReplies",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/text/auto-reply'",
",",
"array",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"get",
"(",
"$",
"uri",
",",
"$",
"QueryAutoReplies",
")",
";",
"}"
] |
Lists configured auto-replies
Query for autoreplies using optional number
@api
@param Request\QueryAutoReplies $QueryAutoReplies = null
|
[
"Lists",
"configured",
"auto",
"-",
"replies"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Text.php#L98-L103
|
226,144
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Call.php
|
Call.SendCall
|
public function SendCall(Request\SendCall $SendCall = null)
{
$uri = $this->getUri('/call', array());
return $this->post($uri, $SendCall);
}
|
php
|
public function SendCall(Request\SendCall $SendCall = null)
{
$uri = $this->getUri('/call', array());
return $this->post($uri, $SendCall);
}
|
[
"public",
"function",
"SendCall",
"(",
"Request",
"\\",
"SendCall",
"$",
"SendCall",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/call'",
",",
"array",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"post",
"(",
"$",
"uri",
",",
"$",
"SendCall",
")",
";",
"}"
] |
Creates a call broadcast, adds numbers to it, and sends it immediately
Start sending calls using VoiceBroadcastConfig or by setting up an IVR using
IvrBroadcastConfig. Sending a call requires at least a ToNumber and sound id or
an IVR. The returned broadcastId can be passed to QueryCalls to get state of
call actions in campaign and get list of individual callIds for use in GetCall
request. The broadcastId can also be passed to GetBroadcastStats to get
information about the call campaign, such as BilledAmount, Duration, State,
etc...
@api
@param Request\SendCall $SendCall = null
|
[
"Creates",
"a",
"call",
"broadcast",
"adds",
"numbers",
"to",
"it",
"and",
"sends",
"it",
"immediately"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Call.php#L27-L32
|
226,145
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Call.php
|
Call.QueryCalls
|
public function QueryCalls(Request\QueryCalls $QueryCalls = null)
{
$uri = $this->getUri('/call', array());
return $this->get($uri, $QueryCalls);
}
|
php
|
public function QueryCalls(Request\QueryCalls $QueryCalls = null)
{
$uri = $this->getUri('/call', array());
return $this->get($uri, $QueryCalls);
}
|
[
"public",
"function",
"QueryCalls",
"(",
"Request",
"\\",
"QueryCalls",
"$",
"QueryCalls",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/call'",
",",
"array",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"get",
"(",
"$",
"uri",
",",
"$",
"QueryCalls",
")",
";",
"}"
] |
Lists inbound and outbound calls
Query for calls using standard ActionQuery which filters on batchId,
broadcastId, toNumber, etc... Returns a list of calls and all associated info.
See GetCall to return just a single call action by id.
@api
@param Request\QueryCalls $QueryCalls = null
|
[
"Lists",
"inbound",
"and",
"outbound",
"calls"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Call.php#L44-L49
|
226,146
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Call.php
|
Call.CreateSound
|
public function CreateSound(Request\CreateSound $CreateSound = null)
{
$uri = $this->getUri('/call/sound', array());
return $this->post($uri, $CreateSound);
}
|
php
|
public function CreateSound(Request\CreateSound $CreateSound = null)
{
$uri = $this->getUri('/call/sound', array());
return $this->post($uri, $CreateSound);
}
|
[
"public",
"function",
"CreateSound",
"(",
"Request",
"\\",
"CreateSound",
"$",
"CreateSound",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/call/sound'",
",",
"array",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"post",
"(",
"$",
"uri",
",",
"$",
"CreateSound",
")",
";",
"}"
] |
Creates a new CallFire-hosted sound for use in calls.
There are two ways to create a sound: (1) uploading a pre-recorded WAV or MP3,
or (2) initiating a call to record a sound over the phone. Duplicate uploads
are not allowed. If a duplicate sound data are provided, a new sound is not
created. Instead, the ID of the previous sound is returned. Recording a sound
over the phone works by first creating a sound asset using the RecordingCall
option, then call the ToNumber to record live voice as sound. If sound is
created using RecordingCall then need to wait for sound to be active by calling
GetSoundMeta until Status = 'ACTIVE'. Use the returned soundId in a subsequent
SendCall request.
@api
@param Request\CreateSound $CreateSound = null
|
[
"Creates",
"a",
"new",
"CallFire",
"-",
"hosted",
"sound",
"for",
"use",
"in",
"calls",
"."
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Call.php#L86-L91
|
226,147
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Call.php
|
Call.QuerySoundMeta
|
public function QuerySoundMeta(Request\QuerySoundMeta $QuerySoundMeta = null)
{
$uri = $this->getUri('/call/sound', array());
return $this->get($uri, $QuerySoundMeta);
}
|
php
|
public function QuerySoundMeta(Request\QuerySoundMeta $QuerySoundMeta = null)
{
$uri = $this->getUri('/call/sound', array());
return $this->get($uri, $QuerySoundMeta);
}
|
[
"public",
"function",
"QuerySoundMeta",
"(",
"Request",
"\\",
"QuerySoundMeta",
"$",
"QuerySoundMeta",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/call/sound'",
",",
"array",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"get",
"(",
"$",
"uri",
",",
"$",
"QuerySoundMeta",
")",
";",
"}"
] |
Lists sounds available for use in calls.
Return list of sound meta info that includes id, status, name, length, etc...
This operation only returns meta info, not the actual sound data. The raw binary
sound data can be obtained from the GetSoundData.
@api
@param Request\QuerySoundMeta $QuerySoundMeta = null
|
[
"Lists",
"sounds",
"available",
"for",
"use",
"in",
"calls",
"."
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Call.php#L103-L108
|
226,148
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Call.php
|
Call.SendVerificationCodeToCallerId
|
public function SendVerificationCodeToCallerId(Request\SendVerificationCodeToCallerId $SendVerificationCodeToCallerId = null)
{
$uri = $this->getUri('/call/callerid/send-verification', array());
return $this->post($uri, $SendVerificationCodeToCallerId);
}
|
php
|
public function SendVerificationCodeToCallerId(Request\SendVerificationCodeToCallerId $SendVerificationCodeToCallerId = null)
{
$uri = $this->getUri('/call/callerid/send-verification', array());
return $this->post($uri, $SendVerificationCodeToCallerId);
}
|
[
"public",
"function",
"SendVerificationCodeToCallerId",
"(",
"Request",
"\\",
"SendVerificationCodeToCallerId",
"$",
"SendVerificationCodeToCallerId",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/call/callerid/send-verification'",
",",
"array",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"post",
"(",
"$",
"uri",
",",
"$",
"SendVerificationCodeToCallerId",
")",
";",
"}"
] |
Sends call to callerId number and voice verification code
Creating broadcasts requires a verified callerId (FromNumber) as one of the
mandatory parameters. This api method along with VerifyCallerIdRequest can be
used to verify a callerId that can be used in subsequent create broadcast
requests.
@api
@param Request\SendVerificationCodeToCallerId $SendVerificationCodeToCallerId =
null
|
[
"Sends",
"call",
"to",
"callerId",
"number",
"and",
"voice",
"verification",
"code"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Call.php#L139-L144
|
226,149
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Call.php
|
Call.VerifyCallerId
|
public function VerifyCallerId(Request\VerifyCallerId $VerifyCallerId = null)
{
$uri = $this->getUri('/call/callerid/verify', array());
return $this->post($uri, $VerifyCallerId);
}
|
php
|
public function VerifyCallerId(Request\VerifyCallerId $VerifyCallerId = null)
{
$uri = $this->getUri('/call/callerid/verify', array());
return $this->post($uri, $VerifyCallerId);
}
|
[
"public",
"function",
"VerifyCallerId",
"(",
"Request",
"\\",
"VerifyCallerId",
"$",
"VerifyCallerId",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/call/callerid/verify'",
",",
"array",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"post",
"(",
"$",
"uri",
",",
"$",
"VerifyCallerId",
")",
";",
"}"
] |
Verify callerId by including verification code
Verifying a callerId is a two step process. First a verification code must be
sent to callerId SendVerificationCodeToCallerId. Then the verificationCode sent
to callerId must be entered here to mark callerId as verified.
@api
@param Request\VerifyCallerId $VerifyCallerId = null
|
[
"Verify",
"callerId",
"by",
"including",
"verification",
"code"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Call.php#L156-L161
|
226,150
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Call.php
|
Call.GetCallerIds
|
public function GetCallerIds(Request\GetCallerIds $GetCallerIds = null)
{
$uri = $this->getUri('/call/callerid', array());
return $this->get($uri, $GetCallerIds);
}
|
php
|
public function GetCallerIds(Request\GetCallerIds $GetCallerIds = null)
{
$uri = $this->getUri('/call/callerid', array());
return $this->get($uri, $GetCallerIds);
}
|
[
"public",
"function",
"GetCallerIds",
"(",
"Request",
"\\",
"GetCallerIds",
"$",
"GetCallerIds",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/call/callerid'",
",",
"array",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"get",
"(",
"$",
"uri",
",",
"$",
"GetCallerIds",
")",
";",
"}"
] |
Return list of verified callerIds
Creating broadcasts requires verified callerId as FromNumber. This method
returns the list of callerId numbers that have been verified and can be used to
create broadcasts. See SendVerificationCodeToCallerId and VerifyCallerIdRequest
for instructions on how to verify a callerId.
@api
@param Request\GetCallerIds $GetCallerIds = null
|
[
"Return",
"list",
"of",
"verified",
"callerIds"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Call.php#L174-L179
|
226,151
|
infomaniac-amf/php
|
lib/AMF/Serializer.php
|
Serializer.getObjectClassname
|
private function getObjectClassname($object)
{
if (!is_object($object)) {
return null;
}
if (!$this->isClassMappingEnabled()) {
return '';
}
if(is_callable($this->getClassmappingCallback())) {
$className = call_user_func_array($this->getClassmappingCallback(), [$object]);
} else {
$className = get_class($object);
}
return $className == 'stdClass' ? '' : $className;
}
|
php
|
private function getObjectClassname($object)
{
if (!is_object($object)) {
return null;
}
if (!$this->isClassMappingEnabled()) {
return '';
}
if(is_callable($this->getClassmappingCallback())) {
$className = call_user_func_array($this->getClassmappingCallback(), [$object]);
} else {
$className = get_class($object);
}
return $className == 'stdClass' ? '' : $className;
}
|
[
"private",
"function",
"getObjectClassname",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"object",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"isClassMappingEnabled",
"(",
")",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"is_callable",
"(",
"$",
"this",
"->",
"getClassmappingCallback",
"(",
")",
")",
")",
"{",
"$",
"className",
"=",
"call_user_func_array",
"(",
"$",
"this",
"->",
"getClassmappingCallback",
"(",
")",
",",
"[",
"$",
"object",
"]",
")",
";",
"}",
"else",
"{",
"$",
"className",
"=",
"get_class",
"(",
"$",
"object",
")",
";",
"}",
"return",
"$",
"className",
"==",
"'stdClass'",
"?",
"''",
":",
"$",
"className",
";",
"}"
] |
Get the fully-qualified classname for a given typed object
@param $object
@return null|string
|
[
"Get",
"the",
"fully",
"-",
"qualified",
"classname",
"for",
"a",
"given",
"typed",
"object"
] |
1b71c125352ec562f473cd51958a03f786aa7ac9
|
https://github.com/infomaniac-amf/php/blob/1b71c125352ec562f473cd51958a03f786aa7ac9/lib/AMF/Serializer.php#L234-L251
|
226,152
|
gjerokrsteski/pimf-framework
|
core/Pimf/Cookie.php
|
Cookie.forever
|
public static function forever($name, $value, $path = '/', $domain = null, $secure = false)
{
return static::put($name, $value, static::FOREVER, $path, $domain, $secure);
}
|
php
|
public static function forever($name, $value, $path = '/', $domain = null, $secure = false)
{
return static::put($name, $value, static::FOREVER, $path, $domain, $secure);
}
|
[
"public",
"static",
"function",
"forever",
"(",
"$",
"name",
",",
"$",
"value",
",",
"$",
"path",
"=",
"'/'",
",",
"$",
"domain",
"=",
"null",
",",
"$",
"secure",
"=",
"false",
")",
"{",
"return",
"static",
"::",
"put",
"(",
"$",
"name",
",",
"$",
"value",
",",
"static",
"::",
"FOREVER",
",",
"$",
"path",
",",
"$",
"domain",
",",
"$",
"secure",
")",
";",
"}"
] |
Set a "permanent" cookie. The cookie will last for one year.
@param $name
@param $value
@param string $path
@param null $domain
@param bool $secure
@return bool
|
[
"Set",
"a",
"permanent",
"cookie",
".",
"The",
"cookie",
"will",
"last",
"for",
"one",
"year",
"."
] |
859aa7c8bb727b556c5e32224842af3cff33f18b
|
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Cookie.php#L128-L131
|
226,153
|
gjerokrsteski/pimf-framework
|
core/Pimf/Cookie.php
|
Cookie.parse
|
protected static function parse($value)
{
$segments = explode('+', $value);
// check if the cookie is invalid.
if (!(count($segments) >= 2)) {
return null;
}
$value = implode('+', array_slice($segments, 1));
// check the SHA-1 hash from the cookie.
if ($segments[0] == static::hash($value)) {
return $value;
}
return null;
}
|
php
|
protected static function parse($value)
{
$segments = explode('+', $value);
// check if the cookie is invalid.
if (!(count($segments) >= 2)) {
return null;
}
$value = implode('+', array_slice($segments, 1));
// check the SHA-1 hash from the cookie.
if ($segments[0] == static::hash($value)) {
return $value;
}
return null;
}
|
[
"protected",
"static",
"function",
"parse",
"(",
"$",
"value",
")",
"{",
"$",
"segments",
"=",
"explode",
"(",
"'+'",
",",
"$",
"value",
")",
";",
"// check if the cookie is invalid.",
"if",
"(",
"!",
"(",
"count",
"(",
"$",
"segments",
")",
">=",
"2",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"value",
"=",
"implode",
"(",
"'+'",
",",
"array_slice",
"(",
"$",
"segments",
",",
"1",
")",
")",
";",
"// check the SHA-1 hash from the cookie.",
"if",
"(",
"$",
"segments",
"[",
"0",
"]",
"==",
"static",
"::",
"hash",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"value",
";",
"}",
"return",
"null",
";",
"}"
] |
Parse a hash fingerprinted cookie value.
@param string $value
@return string
|
[
"Parse",
"a",
"hash",
"fingerprinted",
"cookie",
"value",
"."
] |
859aa7c8bb727b556c5e32224842af3cff33f18b
|
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Cookie.php#L167-L184
|
226,154
|
gjerokrsteski/pimf-framework
|
core/Pimf/Cookie.php
|
Cookie.send
|
public static function send()
{
foreach (static::$jar as $cookie) {
setcookie($cookie['name'], $cookie['value'], $cookie['expiration'], $cookie['path'], $cookie['domain'],
$cookie['secure'], true);
}
}
|
php
|
public static function send()
{
foreach (static::$jar as $cookie) {
setcookie($cookie['name'], $cookie['value'], $cookie['expiration'], $cookie['path'], $cookie['domain'],
$cookie['secure'], true);
}
}
|
[
"public",
"static",
"function",
"send",
"(",
")",
"{",
"foreach",
"(",
"static",
"::",
"$",
"jar",
"as",
"$",
"cookie",
")",
"{",
"setcookie",
"(",
"$",
"cookie",
"[",
"'name'",
"]",
",",
"$",
"cookie",
"[",
"'value'",
"]",
",",
"$",
"cookie",
"[",
"'expiration'",
"]",
",",
"$",
"cookie",
"[",
"'path'",
"]",
",",
"$",
"cookie",
"[",
"'domain'",
"]",
",",
"$",
"cookie",
"[",
"'secure'",
"]",
",",
"true",
")",
";",
"}",
"}"
] |
Send along with the rest of the HTTP headers.
|
[
"Send",
"along",
"with",
"the",
"rest",
"of",
"the",
"HTTP",
"headers",
"."
] |
859aa7c8bb727b556c5e32224842af3cff33f18b
|
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Cookie.php#L189-L195
|
226,155
|
adamgoose/laravel-annotations
|
src/Adamgoose/Routing/Annotations/Scanner.php
|
Scanner.addEndpoint
|
protected function addEndpoint(EndpointCollection $endpoints, ReflectionClass $class,
$method, array $annotations)
{
$endpoints->push($endpoint = new MethodEndpoint([
'reflection' => $class, 'method' => $method, 'uses' => $class->name.'@'.$method
]));
foreach ($annotations as $annotation)
$annotation->modify($endpoint, $class->getMethod($method));
}
|
php
|
protected function addEndpoint(EndpointCollection $endpoints, ReflectionClass $class,
$method, array $annotations)
{
$endpoints->push($endpoint = new MethodEndpoint([
'reflection' => $class, 'method' => $method, 'uses' => $class->name.'@'.$method
]));
foreach ($annotations as $annotation)
$annotation->modify($endpoint, $class->getMethod($method));
}
|
[
"protected",
"function",
"addEndpoint",
"(",
"EndpointCollection",
"$",
"endpoints",
",",
"ReflectionClass",
"$",
"class",
",",
"$",
"method",
",",
"array",
"$",
"annotations",
")",
"{",
"$",
"endpoints",
"->",
"push",
"(",
"$",
"endpoint",
"=",
"new",
"MethodEndpoint",
"(",
"[",
"'reflection'",
"=>",
"$",
"class",
",",
"'method'",
"=>",
"$",
"method",
",",
"'uses'",
"=>",
"$",
"class",
"->",
"name",
".",
"'@'",
".",
"$",
"method",
"]",
")",
")",
";",
"foreach",
"(",
"$",
"annotations",
"as",
"$",
"annotation",
")",
"$",
"annotation",
"->",
"modify",
"(",
"$",
"endpoint",
",",
"$",
"class",
"->",
"getMethod",
"(",
"$",
"method",
")",
")",
";",
"}"
] |
Create a new endpoint in the collection.
@param \Adamgoose\Routing\Annotations\EndpointCollection $endpoints
@param \ReflectionClass $class
@param string $method
@param array $annotations
@return void
|
[
"Create",
"a",
"new",
"endpoint",
"in",
"the",
"collection",
"."
] |
0a8445508d5d3aeb08e42d0bb357373b522da28e
|
https://github.com/adamgoose/laravel-annotations/blob/0a8445508d5d3aeb08e42d0bb357373b522da28e/src/Adamgoose/Routing/Annotations/Scanner.php#L110-L119
|
226,156
|
mlanin/laravel-setup-wizard
|
src/Commands/Steps/DotEnv.php
|
DotEnv.prepare
|
public function prepare()
{
$result = [];
$file = $this->envFileToUseForDefaults();
\Lanin\Laravel\SetupWizard\Support\DotEnv::load($this->envFilePath(), $file);
foreach (\Lanin\Laravel\SetupWizard\Support\DotEnv::$variables as $name => $default)
{
$options = $this->getVariableOptions($name);
$result[$name] = $this->{'run' . $options['type']}($name, $options, $default);
}
return $result;
}
|
php
|
public function prepare()
{
$result = [];
$file = $this->envFileToUseForDefaults();
\Lanin\Laravel\SetupWizard\Support\DotEnv::load($this->envFilePath(), $file);
foreach (\Lanin\Laravel\SetupWizard\Support\DotEnv::$variables as $name => $default)
{
$options = $this->getVariableOptions($name);
$result[$name] = $this->{'run' . $options['type']}($name, $options, $default);
}
return $result;
}
|
[
"public",
"function",
"prepare",
"(",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"file",
"=",
"$",
"this",
"->",
"envFileToUseForDefaults",
"(",
")",
";",
"\\",
"Lanin",
"\\",
"Laravel",
"\\",
"SetupWizard",
"\\",
"Support",
"\\",
"DotEnv",
"::",
"load",
"(",
"$",
"this",
"->",
"envFilePath",
"(",
")",
",",
"$",
"file",
")",
";",
"foreach",
"(",
"\\",
"Lanin",
"\\",
"Laravel",
"\\",
"SetupWizard",
"\\",
"Support",
"\\",
"DotEnv",
"::",
"$",
"variables",
"as",
"$",
"name",
"=>",
"$",
"default",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"getVariableOptions",
"(",
"$",
"name",
")",
";",
"$",
"result",
"[",
"$",
"name",
"]",
"=",
"$",
"this",
"->",
"{",
"'run'",
".",
"$",
"options",
"[",
"'type'",
"]",
"}",
"(",
"$",
"name",
",",
"$",
"options",
",",
"$",
"default",
")",
";",
"}",
"return",
"$",
"result",
";",
"}"
] |
Proceed step.
@return array
|
[
"Proceed",
"step",
"."
] |
b2614612f92861af434e70b0fe070f6167a71e33
|
https://github.com/mlanin/laravel-setup-wizard/blob/b2614612f92861af434e70b0fe070f6167a71e33/src/Commands/Steps/DotEnv.php#L58-L74
|
226,157
|
mlanin/laravel-setup-wizard
|
src/Commands/Steps/DotEnv.php
|
DotEnv.envFileToUseForDefaults
|
protected function envFileToUseForDefaults()
{
$file = config('setup.dot_env.default_file');
if ($this->envFileExist() &&
$this->command->confirm('Existing .env file was found. Use it for defaults?', true)
)
{
$file = '.env';
}
return $file;
}
|
php
|
protected function envFileToUseForDefaults()
{
$file = config('setup.dot_env.default_file');
if ($this->envFileExist() &&
$this->command->confirm('Existing .env file was found. Use it for defaults?', true)
)
{
$file = '.env';
}
return $file;
}
|
[
"protected",
"function",
"envFileToUseForDefaults",
"(",
")",
"{",
"$",
"file",
"=",
"config",
"(",
"'setup.dot_env.default_file'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"envFileExist",
"(",
")",
"&&",
"$",
"this",
"->",
"command",
"->",
"confirm",
"(",
"'Existing .env file was found. Use it for defaults?'",
",",
"true",
")",
")",
"{",
"$",
"file",
"=",
"'.env'",
";",
"}",
"return",
"$",
"file",
";",
"}"
] |
Chooses what env file to use.
@return string
|
[
"Chooses",
"what",
"env",
"file",
"to",
"use",
"."
] |
b2614612f92861af434e70b0fe070f6167a71e33
|
https://github.com/mlanin/laravel-setup-wizard/blob/b2614612f92861af434e70b0fe070f6167a71e33/src/Commands/Steps/DotEnv.php#L97-L109
|
226,158
|
mlanin/laravel-setup-wizard
|
src/Commands/Steps/DotEnv.php
|
DotEnv.runInput
|
protected function runInput($name, array $options, $default = null)
{
return $this->command->ask($this->generatePrompt($name, $options['prompt']), $default);
}
|
php
|
protected function runInput($name, array $options, $default = null)
{
return $this->command->ask($this->generatePrompt($name, $options['prompt']), $default);
}
|
[
"protected",
"function",
"runInput",
"(",
"$",
"name",
",",
"array",
"$",
"options",
",",
"$",
"default",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"command",
"->",
"ask",
"(",
"$",
"this",
"->",
"generatePrompt",
"(",
"$",
"name",
",",
"$",
"options",
"[",
"'prompt'",
"]",
")",
",",
"$",
"default",
")",
";",
"}"
] |
Run input prompt.
@param string $name
@param array $options
@param string|null $default
@return string
|
[
"Run",
"input",
"prompt",
"."
] |
b2614612f92861af434e70b0fe070f6167a71e33
|
https://github.com/mlanin/laravel-setup-wizard/blob/b2614612f92861af434e70b0fe070f6167a71e33/src/Commands/Steps/DotEnv.php#L119-L122
|
226,159
|
mlanin/laravel-setup-wizard
|
src/Commands/Steps/DotEnv.php
|
DotEnv.runSelect
|
protected function runSelect($name, array $options, $default = null)
{
return $this->command->choice(
$this->generatePrompt($name, $options['prompt']),
$options['options'],
array_search($default, $options['options'])
);
}
|
php
|
protected function runSelect($name, array $options, $default = null)
{
return $this->command->choice(
$this->generatePrompt($name, $options['prompt']),
$options['options'],
array_search($default, $options['options'])
);
}
|
[
"protected",
"function",
"runSelect",
"(",
"$",
"name",
",",
"array",
"$",
"options",
",",
"$",
"default",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"command",
"->",
"choice",
"(",
"$",
"this",
"->",
"generatePrompt",
"(",
"$",
"name",
",",
"$",
"options",
"[",
"'prompt'",
"]",
")",
",",
"$",
"options",
"[",
"'options'",
"]",
",",
"array_search",
"(",
"$",
"default",
",",
"$",
"options",
"[",
"'options'",
"]",
")",
")",
";",
"}"
] |
Run select prompt.
@param string $name
@param array $options
@param string|null $default
@return string
|
[
"Run",
"select",
"prompt",
"."
] |
b2614612f92861af434e70b0fe070f6167a71e33
|
https://github.com/mlanin/laravel-setup-wizard/blob/b2614612f92861af434e70b0fe070f6167a71e33/src/Commands/Steps/DotEnv.php#L132-L139
|
226,160
|
mlanin/laravel-setup-wizard
|
src/Commands/Steps/DotEnv.php
|
DotEnv.runRandom
|
protected function runRandom($name, array $options, $default = 'SomeRandomString')
{
$value = $this->command->ask($this->generatePrompt($name, $options['prompt']), $default);
if ($value === 'SomeRandomString')
{
$value = $this->getRandomKey(config('app.cipher'));
}
return $value;
}
|
php
|
protected function runRandom($name, array $options, $default = 'SomeRandomString')
{
$value = $this->command->ask($this->generatePrompt($name, $options['prompt']), $default);
if ($value === 'SomeRandomString')
{
$value = $this->getRandomKey(config('app.cipher'));
}
return $value;
}
|
[
"protected",
"function",
"runRandom",
"(",
"$",
"name",
",",
"array",
"$",
"options",
",",
"$",
"default",
"=",
"'SomeRandomString'",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"command",
"->",
"ask",
"(",
"$",
"this",
"->",
"generatePrompt",
"(",
"$",
"name",
",",
"$",
"options",
"[",
"'prompt'",
"]",
")",
",",
"$",
"default",
")",
";",
"if",
"(",
"$",
"value",
"===",
"'SomeRandomString'",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"getRandomKey",
"(",
"config",
"(",
"'app.cipher'",
")",
")",
";",
"}",
"return",
"$",
"value",
";",
"}"
] |
Run random prompt.
@param string $name
@param array $options
@param string $default
@return string
|
[
"Run",
"random",
"prompt",
"."
] |
b2614612f92861af434e70b0fe070f6167a71e33
|
https://github.com/mlanin/laravel-setup-wizard/blob/b2614612f92861af434e70b0fe070f6167a71e33/src/Commands/Steps/DotEnv.php#L149-L159
|
226,161
|
mlanin/laravel-setup-wizard
|
src/Commands/Steps/DotEnv.php
|
DotEnv.saveFile
|
protected function saveFile($results)
{
$file = fopen($this->envFilePath('.env'), 'w+');
foreach ($results as $variable => $value)
{
fwrite($file, $variable . '=' . $value . PHP_EOL);
}
return fclose($file);
}
|
php
|
protected function saveFile($results)
{
$file = fopen($this->envFilePath('.env'), 'w+');
foreach ($results as $variable => $value)
{
fwrite($file, $variable . '=' . $value . PHP_EOL);
}
return fclose($file);
}
|
[
"protected",
"function",
"saveFile",
"(",
"$",
"results",
")",
"{",
"$",
"file",
"=",
"fopen",
"(",
"$",
"this",
"->",
"envFilePath",
"(",
"'.env'",
")",
",",
"'w+'",
")",
";",
"foreach",
"(",
"$",
"results",
"as",
"$",
"variable",
"=>",
"$",
"value",
")",
"{",
"fwrite",
"(",
"$",
"file",
",",
"$",
"variable",
".",
"'='",
".",
"$",
"value",
".",
"PHP_EOL",
")",
";",
"}",
"return",
"fclose",
"(",
"$",
"file",
")",
";",
"}"
] |
Save .env file.
@param $results
@return bool
|
[
"Save",
".",
"env",
"file",
"."
] |
b2614612f92861af434e70b0fe070f6167a71e33
|
https://github.com/mlanin/laravel-setup-wizard/blob/b2614612f92861af434e70b0fe070f6167a71e33/src/Commands/Steps/DotEnv.php#L243-L252
|
226,162
|
ceeram/blame
|
src/Event/LoggedInUserListener.php
|
LoggedInUserListener.beforeSave
|
public function beforeSave(Event $event, EntityInterface $entity, ArrayObject $options) {
if (empty($options['loggedInUser'])) {
$options['loggedInUser'] = $this->_Auth->user('id');
}
}
|
php
|
public function beforeSave(Event $event, EntityInterface $entity, ArrayObject $options) {
if (empty($options['loggedInUser'])) {
$options['loggedInUser'] = $this->_Auth->user('id');
}
}
|
[
"public",
"function",
"beforeSave",
"(",
"Event",
"$",
"event",
",",
"EntityInterface",
"$",
"entity",
",",
"ArrayObject",
"$",
"options",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"options",
"[",
"'loggedInUser'",
"]",
")",
")",
"{",
"$",
"options",
"[",
"'loggedInUser'",
"]",
"=",
"$",
"this",
"->",
"_Auth",
"->",
"user",
"(",
"'id'",
")",
";",
"}",
"}"
] |
Before save listener.
@param \Cake\Event\Event $event The beforeSave event that was fired
@param \Cake\Datasource\EntityInterface $entity The entity that is going to be saved
@param \ArrayObject $options the options passed to the save method
@return void
|
[
"Before",
"save",
"listener",
"."
] |
550bdd7ae91dc11704eb4acc1b34f92ba2642cb3
|
https://github.com/ceeram/blame/blob/550bdd7ae91dc11704eb4acc1b34f92ba2642cb3/src/Event/LoggedInUserListener.php#L52-L56
|
226,163
|
mlanin/laravel-setup-wizard
|
src/Support/DotEnv.php
|
DotEnv.setEnvironmentVariable
|
public static function setEnvironmentVariable($name, $value = null)
{
list($name, $value) = static::normaliseEnvironmentVariable($name, $value);
static::$variables[$name] = $value;
}
|
php
|
public static function setEnvironmentVariable($name, $value = null)
{
list($name, $value) = static::normaliseEnvironmentVariable($name, $value);
static::$variables[$name] = $value;
}
|
[
"public",
"static",
"function",
"setEnvironmentVariable",
"(",
"$",
"name",
",",
"$",
"value",
"=",
"null",
")",
"{",
"list",
"(",
"$",
"name",
",",
"$",
"value",
")",
"=",
"static",
"::",
"normaliseEnvironmentVariable",
"(",
"$",
"name",
",",
"$",
"value",
")",
";",
"static",
"::",
"$",
"variables",
"[",
"$",
"name",
"]",
"=",
"$",
"value",
";",
"}"
] |
Overwrite to save variables to array.
@param string $name
@param string|null $value
@return void
|
[
"Overwrite",
"to",
"save",
"variables",
"to",
"array",
"."
] |
b2614612f92861af434e70b0fe070f6167a71e33
|
https://github.com/mlanin/laravel-setup-wizard/blob/b2614612f92861af434e70b0fe070f6167a71e33/src/Support/DotEnv.php#L18-L23
|
226,164
|
Lenius/economic-php-client
|
Economic/API/Request.php
|
Request.get
|
public function get($path, $query = [])
{
// Add query parameters to $path?
if (!empty($query)) {
if (strpos($path, '?') === false) {
$path .= '?'.http_build_query($query, '', '&');
} else {
$path .= ini_get('arg_separator.output').http_build_query($query, '', '&');
}
}
// Start the request and return the response
return $this->execute('GET', $path);
}
|
php
|
public function get($path, $query = [])
{
// Add query parameters to $path?
if (!empty($query)) {
if (strpos($path, '?') === false) {
$path .= '?'.http_build_query($query, '', '&');
} else {
$path .= ini_get('arg_separator.output').http_build_query($query, '', '&');
}
}
// Start the request and return the response
return $this->execute('GET', $path);
}
|
[
"public",
"function",
"get",
"(",
"$",
"path",
",",
"$",
"query",
"=",
"[",
"]",
")",
"{",
"// Add query parameters to $path?",
"if",
"(",
"!",
"empty",
"(",
"$",
"query",
")",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"path",
",",
"'?'",
")",
"===",
"false",
")",
"{",
"$",
"path",
".=",
"'?'",
".",
"http_build_query",
"(",
"$",
"query",
",",
"''",
",",
"'&'",
")",
";",
"}",
"else",
"{",
"$",
"path",
".=",
"ini_get",
"(",
"'arg_separator.output'",
")",
".",
"http_build_query",
"(",
"$",
"query",
",",
"''",
",",
"'&'",
")",
";",
"}",
"}",
"// Start the request and return the response",
"return",
"$",
"this",
"->",
"execute",
"(",
"'GET'",
",",
"$",
"path",
")",
";",
"}"
] |
GET function.
Performs an API GET request
@param string $path
@param array $query
@throws Exception
@return Response
|
[
"GET",
"function",
"."
] |
201c94e55cc6662a2cd05d1c485bdd823c79ab1b
|
https://github.com/Lenius/economic-php-client/blob/201c94e55cc6662a2cd05d1c485bdd823c79ab1b/Economic/API/Request.php#L39-L52
|
226,165
|
sop/gcm
|
lib/GCM/Cipher/AES/AESCipher.php
|
AESCipher.fromKeyLength
|
public static function fromKeyLength(int $len): self
{
$bits = $len << 3;
if (!array_key_exists($bits, self::MAP_KEYSIZE_TO_CLS)) {
throw new \UnexpectedValueException(
"No AES implementation for $bits-bit key size.");
}
$cls = self::MAP_KEYSIZE_TO_CLS[$bits];
return new $cls();
}
|
php
|
public static function fromKeyLength(int $len): self
{
$bits = $len << 3;
if (!array_key_exists($bits, self::MAP_KEYSIZE_TO_CLS)) {
throw new \UnexpectedValueException(
"No AES implementation for $bits-bit key size.");
}
$cls = self::MAP_KEYSIZE_TO_CLS[$bits];
return new $cls();
}
|
[
"public",
"static",
"function",
"fromKeyLength",
"(",
"int",
"$",
"len",
")",
":",
"self",
"{",
"$",
"bits",
"=",
"$",
"len",
"<<",
"3",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"bits",
",",
"self",
"::",
"MAP_KEYSIZE_TO_CLS",
")",
")",
"{",
"throw",
"new",
"\\",
"UnexpectedValueException",
"(",
"\"No AES implementation for $bits-bit key size.\"",
")",
";",
"}",
"$",
"cls",
"=",
"self",
"::",
"MAP_KEYSIZE_TO_CLS",
"[",
"$",
"bits",
"]",
";",
"return",
"new",
"$",
"cls",
"(",
")",
";",
"}"
] |
Get AES cipher instance by key length.
@param int $len Key length in bytes
@throws \UnexpectedValueException
@return self
|
[
"Get",
"AES",
"cipher",
"instance",
"by",
"key",
"length",
"."
] |
ef5f63ca0fb1af4c5d2a319858746b9ffd12a216
|
https://github.com/sop/gcm/blob/ef5f63ca0fb1af4c5d2a319858746b9ffd12a216/lib/GCM/Cipher/AES/AESCipher.php#L50-L59
|
226,166
|
gamegos/php-code-sniffer
|
src/Gamegos/Sniffs/Commenting/DocCommentSniff.php
|
DocCommentSniff.getCommentMethod
|
protected function getCommentMethod(PHP_CodeSniffer_File $phpcsFile, $commentEnd)
{
$tokens = $phpcsFile->getTokens();
$next = $phpcsFile->findNext(array(T_WHITESPACE), $commentEnd + 1, null, true);
if (in_array($tokens[$next]['code'], \PHP_CodeSniffer_Tokens::$methodPrefixes)) {
return $phpcsFile->findNext(array(T_FUNCTION), $next, $phpcsFile->findEndOfStatement($next));
}
return false;
}
|
php
|
protected function getCommentMethod(PHP_CodeSniffer_File $phpcsFile, $commentEnd)
{
$tokens = $phpcsFile->getTokens();
$next = $phpcsFile->findNext(array(T_WHITESPACE), $commentEnd + 1, null, true);
if (in_array($tokens[$next]['code'], \PHP_CodeSniffer_Tokens::$methodPrefixes)) {
return $phpcsFile->findNext(array(T_FUNCTION), $next, $phpcsFile->findEndOfStatement($next));
}
return false;
}
|
[
"protected",
"function",
"getCommentMethod",
"(",
"PHP_CodeSniffer_File",
"$",
"phpcsFile",
",",
"$",
"commentEnd",
")",
"{",
"$",
"tokens",
"=",
"$",
"phpcsFile",
"->",
"getTokens",
"(",
")",
";",
"$",
"next",
"=",
"$",
"phpcsFile",
"->",
"findNext",
"(",
"array",
"(",
"T_WHITESPACE",
")",
",",
"$",
"commentEnd",
"+",
"1",
",",
"null",
",",
"true",
")",
";",
"if",
"(",
"in_array",
"(",
"$",
"tokens",
"[",
"$",
"next",
"]",
"[",
"'code'",
"]",
",",
"\\",
"PHP_CodeSniffer_Tokens",
"::",
"$",
"methodPrefixes",
")",
")",
"{",
"return",
"$",
"phpcsFile",
"->",
"findNext",
"(",
"array",
"(",
"T_FUNCTION",
")",
",",
"$",
"next",
",",
"$",
"phpcsFile",
"->",
"findEndOfStatement",
"(",
"$",
"next",
")",
")",
";",
"}",
"return",
"false",
";",
"}"
] |
Get the method token if current token is a method comment.
Returns false if no method found for the comment.
@param \PHP_CodeSniffer_File $phpcsFile
@param int $commentEnd
@return int|bool
@author Safak Ozpinar <safak@gamegos.com>
|
[
"Get",
"the",
"method",
"token",
"if",
"current",
"token",
"is",
"a",
"method",
"comment",
".",
"Returns",
"false",
"if",
"no",
"method",
"found",
"for",
"the",
"comment",
"."
] |
7e5939b66a55bb70eb66830b596b28e6bf3d1368
|
https://github.com/gamegos/php-code-sniffer/blob/7e5939b66a55bb70eb66830b596b28e6bf3d1368/src/Gamegos/Sniffs/Commenting/DocCommentSniff.php#L169-L177
|
226,167
|
lexik/ws-colissimo
|
src/WSColissimo/WSColiPosteLetterService/Util/ServiceAvailability.php
|
ServiceAvailability.curlCheck
|
protected function curlCheck()
{
$ch = curl_init($this->endPoint);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
$responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$responseBody = $this->cleanUp($data);
curl_close($ch);
if ($responseCode === 200 && $responseBody === '[OK]') {
return true;
}
return false;
}
|
php
|
protected function curlCheck()
{
$ch = curl_init($this->endPoint);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
$responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$responseBody = $this->cleanUp($data);
curl_close($ch);
if ($responseCode === 200 && $responseBody === '[OK]') {
return true;
}
return false;
}
|
[
"protected",
"function",
"curlCheck",
"(",
")",
"{",
"$",
"ch",
"=",
"curl_init",
"(",
"$",
"this",
"->",
"endPoint",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_HEADER",
",",
"0",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_RETURNTRANSFER",
",",
"1",
")",
";",
"$",
"data",
"=",
"curl_exec",
"(",
"$",
"ch",
")",
";",
"$",
"responseCode",
"=",
"curl_getinfo",
"(",
"$",
"ch",
",",
"CURLINFO_HTTP_CODE",
")",
";",
"$",
"responseBody",
"=",
"$",
"this",
"->",
"cleanUp",
"(",
"$",
"data",
")",
";",
"curl_close",
"(",
"$",
"ch",
")",
";",
"if",
"(",
"$",
"responseCode",
"===",
"200",
"&&",
"$",
"responseBody",
"===",
"'[OK]'",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Check service availability using curl
@return boolean
|
[
"Check",
"service",
"availability",
"using",
"curl"
] |
df4ba30b05afed8e49d509c36592d4aa7797c259
|
https://github.com/lexik/ws-colissimo/blob/df4ba30b05afed8e49d509c36592d4aa7797c259/src/WSColissimo/WSColiPosteLetterService/Util/ServiceAvailability.php#L46-L65
|
226,168
|
lexik/ws-colissimo
|
src/WSColissimo/WSColiPosteLetterService/Util/ServiceAvailability.php
|
ServiceAvailability.fileGetContentsCheck
|
protected function fileGetContentsCheck()
{
$contents = file_get_contents($this->endPoint);
$contents = $this->cleanUp($contents);
if ($contents === '[OK]') {
return true;
}
return false;
}
|
php
|
protected function fileGetContentsCheck()
{
$contents = file_get_contents($this->endPoint);
$contents = $this->cleanUp($contents);
if ($contents === '[OK]') {
return true;
}
return false;
}
|
[
"protected",
"function",
"fileGetContentsCheck",
"(",
")",
"{",
"$",
"contents",
"=",
"file_get_contents",
"(",
"$",
"this",
"->",
"endPoint",
")",
";",
"$",
"contents",
"=",
"$",
"this",
"->",
"cleanUp",
"(",
"$",
"contents",
")",
";",
"if",
"(",
"$",
"contents",
"===",
"'[OK]'",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Check service availability using file_get_contents
@return boolean
|
[
"Check",
"service",
"availability",
"using",
"file_get_contents"
] |
df4ba30b05afed8e49d509c36592d4aa7797c259
|
https://github.com/lexik/ws-colissimo/blob/df4ba30b05afed8e49d509c36592d4aa7797c259/src/WSColissimo/WSColiPosteLetterService/Util/ServiceAvailability.php#L72-L82
|
226,169
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Ccc.php
|
Ccc.CreateCccCampaign
|
public function CreateCccCampaign(Request\CreateCccCampaign $CreateCccCampaign = null)
{
$uri = $this->getUri('/ccc', array());
return $this->post($uri, $CreateCccCampaign);
}
|
php
|
public function CreateCccCampaign(Request\CreateCccCampaign $CreateCccCampaign = null)
{
$uri = $this->getUri('/ccc', array());
return $this->post($uri, $CreateCccCampaign);
}
|
[
"public",
"function",
"CreateCccCampaign",
"(",
"Request",
"\\",
"CreateCccCampaign",
"$",
"CreateCccCampaign",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/ccc'",
",",
"array",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"post",
"(",
"$",
"uri",
",",
"$",
"CreateCccCampaign",
")",
";",
"}"
] |
Create CCC Campaign
Create ccc campaign. Returns id of newly created ccc campaign.
@api
@param Request\CreateCccCampaign $CreateCccCampaign = null
|
[
"Create",
"CCC",
"Campaign"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Ccc.php#L36-L41
|
226,170
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Ccc.php
|
Ccc.QueryCccCampaigns
|
public function QueryCccCampaigns(Request\QueryCccCampaigns $QueryCccCampaigns = null)
{
$uri = $this->getUri('/ccc', array());
return $this->get($uri, $QueryCccCampaigns);
}
|
php
|
public function QueryCccCampaigns(Request\QueryCccCampaigns $QueryCccCampaigns = null)
{
$uri = $this->getUri('/ccc', array());
return $this->get($uri, $QueryCccCampaigns);
}
|
[
"public",
"function",
"QueryCccCampaigns",
"(",
"Request",
"\\",
"QueryCccCampaigns",
"$",
"QueryCccCampaigns",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/ccc'",
",",
"array",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"get",
"(",
"$",
"uri",
",",
"$",
"QueryCccCampaigns",
")",
";",
"}"
] |
Query CCC Campaigns
Query for existing ccc campaigns using optional filters such as name, status,
labels, etc... Returns a list of ccc campaigns and all associated info. See
GetCccCampaign to return just a single ccc campaign by id.
@api
@param Request\QueryCccCampaigns $QueryCccCampaigns = null
|
[
"Query",
"CCC",
"Campaigns"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Ccc.php#L53-L58
|
226,171
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Ccc.php
|
Ccc.ControlCccCampaign
|
public function ControlCccCampaign($Id, Request\ControlCccCampaign $ControlCccCampaign)
{
$uri = $this->getUri('/ccc/%s/control', array($Id));
return $this->put($uri, $ControlCccCampaign);
}
|
php
|
public function ControlCccCampaign($Id, Request\ControlCccCampaign $ControlCccCampaign)
{
$uri = $this->getUri('/ccc/%s/control', array($Id));
return $this->put($uri, $ControlCccCampaign);
}
|
[
"public",
"function",
"ControlCccCampaign",
"(",
"$",
"Id",
",",
"Request",
"\\",
"ControlCccCampaign",
"$",
"ControlCccCampaign",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/ccc/%s/control'",
",",
"array",
"(",
"$",
"Id",
")",
")",
";",
"return",
"$",
"this",
"->",
"put",
"(",
"$",
"uri",
",",
"$",
"ControlCccCampaign",
")",
";",
"}"
] |
Starts, Stops or Archives a CCC Campaign
Apply command START, STOP, or ARCHIVE to ccc campaign. Also can change the max
active count of campaign.
@api
@param int $Id Unique ID of resource
@param Request\ControlCccCampaign $ControlCccCampaign
|
[
"Starts",
"Stops",
"or",
"Archives",
"a",
"CCC",
"Campaign"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Ccc.php#L104-L109
|
226,172
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Ccc.php
|
Ccc.QueryAgents
|
public function QueryAgents(Request\QueryAgents $QueryAgents = null)
{
$uri = $this->getUri('/ccc/agent', array());
return $this->get($uri, $QueryAgents);
}
|
php
|
public function QueryAgents(Request\QueryAgents $QueryAgents = null)
{
$uri = $this->getUri('/ccc/agent', array());
return $this->get($uri, $QueryAgents);
}
|
[
"public",
"function",
"QueryAgents",
"(",
"Request",
"\\",
"QueryAgents",
"$",
"QueryAgents",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/ccc/agent'",
",",
"array",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"get",
"(",
"$",
"uri",
",",
"$",
"QueryAgents",
")",
";",
"}"
] |
Lists existing Agents
Query for existing Agents using optional filters such as campaignId, name,
etc... Returns a list of Agents and all associated info. See GetAgent to return
just a single Agent by id.
@api
@param Request\QueryAgents $QueryAgents = null
|
[
"Lists",
"existing",
"Agents"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Ccc.php#L151-L156
|
226,173
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Ccc.php
|
Ccc.QueryAgentGroups
|
public function QueryAgentGroups(Request\QueryAgentGroups $QueryAgentGroups = null)
{
$uri = $this->getUri('/ccc/agent-group', array());
return $this->get($uri, $QueryAgentGroups);
}
|
php
|
public function QueryAgentGroups(Request\QueryAgentGroups $QueryAgentGroups = null)
{
$uri = $this->getUri('/ccc/agent-group', array());
return $this->get($uri, $QueryAgentGroups);
}
|
[
"public",
"function",
"QueryAgentGroups",
"(",
"Request",
"\\",
"QueryAgentGroups",
"$",
"QueryAgentGroups",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/ccc/agent-group'",
",",
"array",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"get",
"(",
"$",
"uri",
",",
"$",
"QueryAgentGroups",
")",
";",
"}"
] |
Lists existing AgentGroups
Query for existing agent groups using optional filters such as campaignId, name,
etc... Returns a list of AgentGroups and all associated info. See GetAgentGroup
to return just a single AgentGroup by id.
@api
@param Request\QueryAgentGroups $QueryAgentGroups = null
|
[
"Lists",
"existing",
"AgentGroups"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Ccc.php#L184-L189
|
226,174
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Ccc.php
|
Ccc.CreateAgentGroup
|
public function CreateAgentGroup(Request\CreateAgentGroup $CreateAgentGroup = null)
{
$uri = $this->getUri('/ccc/agent-group', array());
return $this->post($uri, $CreateAgentGroup);
}
|
php
|
public function CreateAgentGroup(Request\CreateAgentGroup $CreateAgentGroup = null)
{
$uri = $this->getUri('/ccc/agent-group', array());
return $this->post($uri, $CreateAgentGroup);
}
|
[
"public",
"function",
"CreateAgentGroup",
"(",
"Request",
"\\",
"CreateAgentGroup",
"$",
"CreateAgentGroup",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/ccc/agent-group'",
",",
"array",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"post",
"(",
"$",
"uri",
",",
"$",
"CreateAgentGroup",
")",
";",
"}"
] |
Create CCC AgentGroup
Create agent group using either list of agent ids or list of agent emails but
not both.
@api
@param Request\CreateAgentGroup $CreateAgentGroup = null
|
[
"Create",
"CCC",
"AgentGroup"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Ccc.php#L200-L205
|
226,175
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Ccc.php
|
Ccc.QueryAgentSessions
|
public function QueryAgentSessions(Request\QueryAgentSessions $QueryAgentSessions = null)
{
$uri = $this->getUri('/ccc/agent-session', array());
return $this->get($uri, $QueryAgentSessions);
}
|
php
|
public function QueryAgentSessions(Request\QueryAgentSessions $QueryAgentSessions = null)
{
$uri = $this->getUri('/ccc/agent-session', array());
return $this->get($uri, $QueryAgentSessions);
}
|
[
"public",
"function",
"QueryAgentSessions",
"(",
"Request",
"\\",
"QueryAgentSessions",
"$",
"QueryAgentSessions",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/ccc/agent-session'",
",",
"array",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"get",
"(",
"$",
"uri",
",",
"$",
"QueryAgentSessions",
")",
";",
"}"
] |
Lists existing AgentSessions
Query for existing agent sessions using optional filters such as CampaignId,
AgentEmail, etc... Returns a list of agent sessions and all associated info. See
GetAgentSession to return just a single agent session by id.
@api
@param Request\QueryAgentSessions $QueryAgentSessions = null
|
[
"Lists",
"existing",
"AgentSessions"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Ccc.php#L248-L253
|
226,176
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Ccc.php
|
Ccc.SendAgentInvites
|
public function SendAgentInvites($CampaignId, Request\SendAgentInvites $SendAgentInvites)
{
$uri = $this->getUri('/ccc/%s/agent-invite', array($CampaignId));
return $this->post($uri, $SendAgentInvites);
}
|
php
|
public function SendAgentInvites($CampaignId, Request\SendAgentInvites $SendAgentInvites)
{
$uri = $this->getUri('/ccc/%s/agent-invite', array($CampaignId));
return $this->post($uri, $SendAgentInvites);
}
|
[
"public",
"function",
"SendAgentInvites",
"(",
"$",
"CampaignId",
",",
"Request",
"\\",
"SendAgentInvites",
"$",
"SendAgentInvites",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/ccc/%s/agent-invite'",
",",
"array",
"(",
"$",
"CampaignId",
")",
")",
";",
"return",
"$",
"this",
"->",
"post",
"(",
"$",
"uri",
",",
"$",
"SendAgentInvites",
")",
";",
"}"
] |
Send CCC AgentInvite
Send ccc agent invite email which includes a link inside email for agent to
register with campaign.
@api
@param int $CampaignId CCC Campaign to invite agents to
@param Request\SendAgentInvites $SendAgentInvites
|
[
"Send",
"CCC",
"AgentInvite"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Ccc.php#L265-L270
|
226,177
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Ccc.php
|
Ccc.GetAgentInviteUri
|
public function GetAgentInviteUri($CampaignId, Request\GetAgentInviteUri $GetAgentInviteUri)
{
$uri = $this->getUri('/ccc/%s/agent-invite-uri', array($CampaignId));
return $this->get($uri, $GetAgentInviteUri);
}
|
php
|
public function GetAgentInviteUri($CampaignId, Request\GetAgentInviteUri $GetAgentInviteUri)
{
$uri = $this->getUri('/ccc/%s/agent-invite-uri', array($CampaignId));
return $this->get($uri, $GetAgentInviteUri);
}
|
[
"public",
"function",
"GetAgentInviteUri",
"(",
"$",
"CampaignId",
",",
"Request",
"\\",
"GetAgentInviteUri",
"$",
"GetAgentInviteUri",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/ccc/%s/agent-invite-uri'",
",",
"array",
"(",
"$",
"CampaignId",
")",
")",
";",
"return",
"$",
"this",
"->",
"get",
"(",
"$",
"uri",
",",
"$",
"GetAgentInviteUri",
")",
";",
"}"
] |
Get CCC AgentInvite URI
Return campaign registration link that agents can use to register for a
campaign. (ex:
https://www.callfire.com/ui/register/agent/c1ca1280-64c8-11e4-8fe5-00136e4efdeb)
@api
@param int $CampaignId CCC Campaign to invite agents to
@param Request\GetAgentInviteUri $GetAgentInviteUri
|
[
"Get",
"CCC",
"AgentInvite",
"URI"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Ccc.php#L283-L288
|
226,178
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Ccc.php
|
Ccc.GetCccCampaignStats
|
public function GetCccCampaignStats($CampaignId, Request\GetCccCampaignStats $GetCccCampaignStats = null)
{
$uri = $this->getUri('/ccc/%s/stats', array($CampaignId));
return $this->get($uri, $GetCccCampaignStats);
}
|
php
|
public function GetCccCampaignStats($CampaignId, Request\GetCccCampaignStats $GetCccCampaignStats = null)
{
$uri = $this->getUri('/ccc/%s/stats', array($CampaignId));
return $this->get($uri, $GetCccCampaignStats);
}
|
[
"public",
"function",
"GetCccCampaignStats",
"(",
"$",
"CampaignId",
",",
"Request",
"\\",
"GetCccCampaignStats",
"$",
"GetCccCampaignStats",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/ccc/%s/stats'",
",",
"array",
"(",
"$",
"CampaignId",
")",
")",
";",
"return",
"$",
"this",
"->",
"get",
"(",
"$",
"uri",
",",
"$",
"GetCccCampaignStats",
")",
";",
"}"
] |
Get CCC Campaign statistics by campaign id
Return campaign stats that includes call counts and billing amounts.
@api
@param Request\GetCccCampaignStats $GetCccCampaignStats = null
@param int $CampaignId
|
[
"Get",
"CCC",
"Campaign",
"statistics",
"by",
"campaign",
"id"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Ccc.php#L299-L304
|
226,179
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Ccc.php
|
Ccc.UpdateCccCampaign
|
public function UpdateCccCampaign($Id, Request\UpdateCccCampaign $UpdateCccCampaign = null)
{
$uri = $this->getUri('/ccc/%s', array($Id));
return $this->put($uri, $UpdateCccCampaign);
}
|
php
|
public function UpdateCccCampaign($Id, Request\UpdateCccCampaign $UpdateCccCampaign = null)
{
$uri = $this->getUri('/ccc/%s', array($Id));
return $this->put($uri, $UpdateCccCampaign);
}
|
[
"public",
"function",
"UpdateCccCampaign",
"(",
"$",
"Id",
",",
"Request",
"\\",
"UpdateCccCampaign",
"$",
"UpdateCccCampaign",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/ccc/%s'",
",",
"array",
"(",
"$",
"Id",
")",
")",
";",
"return",
"$",
"this",
"->",
"put",
"(",
"$",
"uri",
",",
"$",
"UpdateCccCampaign",
")",
";",
"}"
] |
Updates an existing CCC Campaigns configuration
Update existing campaign's configuration such as time zone restrictions or retry
logic. Currently all fields from config are updated so the 'Message' field needs
to be populated just like in CreateCccCampaign operation. Use unique ID to
specify campaign. Need to provide dummy 'Name' field Campaign even though the
field will not be overwritten.
@api
@param Request\UpdateCccCampaign $UpdateCccCampaign = null
@param int $Id
|
[
"Updates",
"an",
"existing",
"CCC",
"Campaigns",
"configuration"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Ccc.php#L319-L324
|
226,180
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Ccc.php
|
Ccc.AddAgents
|
public function AddAgents($CampaignId, Request\AddAgents $AddAgents = null)
{
$uri = $this->getUri('/ccc/%s/agent', array($CampaignId));
return $this->post($uri, $AddAgents);
}
|
php
|
public function AddAgents($CampaignId, Request\AddAgents $AddAgents = null)
{
$uri = $this->getUri('/ccc/%s/agent', array($CampaignId));
return $this->post($uri, $AddAgents);
}
|
[
"public",
"function",
"AddAgents",
"(",
"$",
"CampaignId",
",",
"Request",
"\\",
"AddAgents",
"$",
"AddAgents",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/ccc/%s/agent'",
",",
"array",
"(",
"$",
"CampaignId",
")",
")",
";",
"return",
"$",
"this",
"->",
"post",
"(",
"$",
"uri",
",",
"$",
"AddAgents",
")",
";",
"}"
] |
Add Agents to Campaign
Add agents identified by id or email to existing ccc campaign.
@api
@param Request\AddAgents $AddAgents = null
@param int $CampaignId
|
[
"Add",
"Agents",
"to",
"Campaign"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Ccc.php#L335-L340
|
226,181
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Ccc.php
|
Ccc.GetAgents
|
public function GetAgents($CampaignId, Request\GetAgents $GetAgents = null)
{
$uri = $this->getUri('/ccc/%s/agent', array($CampaignId));
return $this->get($uri, $GetAgents);
}
|
php
|
public function GetAgents($CampaignId, Request\GetAgents $GetAgents = null)
{
$uri = $this->getUri('/ccc/%s/agent', array($CampaignId));
return $this->get($uri, $GetAgents);
}
|
[
"public",
"function",
"GetAgents",
"(",
"$",
"CampaignId",
",",
"Request",
"\\",
"GetAgents",
"$",
"GetAgents",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/ccc/%s/agent'",
",",
"array",
"(",
"$",
"CampaignId",
")",
")",
";",
"return",
"$",
"this",
"->",
"get",
"(",
"$",
"uri",
",",
"$",
"GetAgents",
")",
";",
"}"
] |
Get Agents attached with Campaign
Get list of agents attached to ccc campaign.
@api
@param Request\GetAgents $GetAgents = null
@param int $CampaignId
|
[
"Get",
"Agents",
"attached",
"with",
"Campaign"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Ccc.php#L351-L356
|
226,182
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Ccc.php
|
Ccc.RemoveAgent
|
public function RemoveAgent($CampaignId, $Id, Request\RemoveAgent $RemoveAgent = null)
{
$uri = $this->getUri('/ccc/%s/agent/%s', array($CampaignId, $Id));
return $this->delete($uri, $RemoveAgent);
}
|
php
|
public function RemoveAgent($CampaignId, $Id, Request\RemoveAgent $RemoveAgent = null)
{
$uri = $this->getUri('/ccc/%s/agent/%s', array($CampaignId, $Id));
return $this->delete($uri, $RemoveAgent);
}
|
[
"public",
"function",
"RemoveAgent",
"(",
"$",
"CampaignId",
",",
"$",
"Id",
",",
"Request",
"\\",
"RemoveAgent",
"$",
"RemoveAgent",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/ccc/%s/agent/%s'",
",",
"array",
"(",
"$",
"CampaignId",
",",
"$",
"Id",
")",
")",
";",
"return",
"$",
"this",
"->",
"delete",
"(",
"$",
"uri",
",",
"$",
"RemoveAgent",
")",
";",
"}"
] |
Remove Agents from CCC Campaign
Remove individual agent identified by id from ccc campaign identified by
campaign id.
@api
@param Request\RemoveAgent $RemoveAgent = null
@param int $CampaignId
@param int $Id
|
[
"Remove",
"Agents",
"from",
"CCC",
"Campaign"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Ccc.php#L369-L374
|
226,183
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Ccc.php
|
Ccc.UpdateAgentGroup
|
public function UpdateAgentGroup($Id, Request\UpdateAgentGroup $UpdateAgentGroup = null)
{
$uri = $this->getUri('/ccc/agent-group/%s', array($Id));
return $this->put($uri, $UpdateAgentGroup);
}
|
php
|
public function UpdateAgentGroup($Id, Request\UpdateAgentGroup $UpdateAgentGroup = null)
{
$uri = $this->getUri('/ccc/agent-group/%s', array($Id));
return $this->put($uri, $UpdateAgentGroup);
}
|
[
"public",
"function",
"UpdateAgentGroup",
"(",
"$",
"Id",
",",
"Request",
"\\",
"UpdateAgentGroup",
"$",
"UpdateAgentGroup",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/ccc/agent-group/%s'",
",",
"array",
"(",
"$",
"Id",
")",
")",
";",
"return",
"$",
"this",
"->",
"put",
"(",
"$",
"uri",
",",
"$",
"UpdateAgentGroup",
")",
";",
"}"
] |
Updates an existing CCC AgentGroup
Update existing agent group identified by id. Change name, etc...
@api
@param Request\UpdateAgentGroup $UpdateAgentGroup = null
@param int $Id
|
[
"Updates",
"an",
"existing",
"CCC",
"AgentGroup"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Ccc.php#L385-L390
|
226,184
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Ccc.php
|
Ccc.AddAgentGroups
|
public function AddAgentGroups($CampaignId, Request\AddAgentGroups $AddAgentGroups = null)
{
$uri = $this->getUri('/ccc/%s/agent-group', array($CampaignId));
return $this->post($uri, $AddAgentGroups);
}
|
php
|
public function AddAgentGroups($CampaignId, Request\AddAgentGroups $AddAgentGroups = null)
{
$uri = $this->getUri('/ccc/%s/agent-group', array($CampaignId));
return $this->post($uri, $AddAgentGroups);
}
|
[
"public",
"function",
"AddAgentGroups",
"(",
"$",
"CampaignId",
",",
"Request",
"\\",
"AddAgentGroups",
"$",
"AddAgentGroups",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/ccc/%s/agent-group'",
",",
"array",
"(",
"$",
"CampaignId",
")",
")",
";",
"return",
"$",
"this",
"->",
"post",
"(",
"$",
"uri",
",",
"$",
"AddAgentGroups",
")",
";",
"}"
] |
Add AgentGroups to Campaign
Add agent groups identified by ids to campaign.
@api
@param Request\AddAgentGroups $AddAgentGroups = null
@param int $CampaignId
|
[
"Add",
"AgentGroups",
"to",
"Campaign"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Ccc.php#L401-L406
|
226,185
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Ccc.php
|
Ccc.GetAgentGroups
|
public function GetAgentGroups($CampaignId, Request\GetAgentGroups $GetAgentGroups = null)
{
$uri = $this->getUri('/ccc/%s/agent-group', array($CampaignId));
return $this->get($uri, $GetAgentGroups);
}
|
php
|
public function GetAgentGroups($CampaignId, Request\GetAgentGroups $GetAgentGroups = null)
{
$uri = $this->getUri('/ccc/%s/agent-group', array($CampaignId));
return $this->get($uri, $GetAgentGroups);
}
|
[
"public",
"function",
"GetAgentGroups",
"(",
"$",
"CampaignId",
",",
"Request",
"\\",
"GetAgentGroups",
"$",
"GetAgentGroups",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/ccc/%s/agent-group'",
",",
"array",
"(",
"$",
"CampaignId",
")",
")",
";",
"return",
"$",
"this",
"->",
"get",
"(",
"$",
"uri",
",",
"$",
"GetAgentGroups",
")",
";",
"}"
] |
Get all AgentGroups attached to Campaign
Returns a list of agent groups attached to campaign.
@api
@param Request\GetAgentGroups $GetAgentGroups = null
@param int $CampaignId
|
[
"Get",
"all",
"AgentGroups",
"attached",
"to",
"Campaign"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Ccc.php#L417-L422
|
226,186
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Api/Rest/Client/Ccc.php
|
Ccc.RemoveAgentGroup
|
public function RemoveAgentGroup($CampaignId, $Id, Request\RemoveAgentGroup $RemoveAgentGroup = null)
{
$uri = $this->getUri('/ccc/%s/agent-group/%s', array($CampaignId, $Id));
return $this->delete($uri, $RemoveAgentGroup);
}
|
php
|
public function RemoveAgentGroup($CampaignId, $Id, Request\RemoveAgentGroup $RemoveAgentGroup = null)
{
$uri = $this->getUri('/ccc/%s/agent-group/%s', array($CampaignId, $Id));
return $this->delete($uri, $RemoveAgentGroup);
}
|
[
"public",
"function",
"RemoveAgentGroup",
"(",
"$",
"CampaignId",
",",
"$",
"Id",
",",
"Request",
"\\",
"RemoveAgentGroup",
"$",
"RemoveAgentGroup",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'/ccc/%s/agent-group/%s'",
",",
"array",
"(",
"$",
"CampaignId",
",",
"$",
"Id",
")",
")",
";",
"return",
"$",
"this",
"->",
"delete",
"(",
"$",
"uri",
",",
"$",
"RemoveAgentGroup",
")",
";",
"}"
] |
Remove AgentGroup from Campaign
Remove agent group identified by id from campaign. If id points to non-existent
agent group then ServiceFault or 404 error will be thrown.
@api
@param Request\RemoveAgentGroup $RemoveAgentGroup = null
@param int $CampaignId
@param int $Id
|
[
"Remove",
"AgentGroup",
"from",
"Campaign"
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Api/Rest/Client/Ccc.php#L435-L440
|
226,187
|
thephpleague/openid-connect-claims
|
src/ClaimsSet.php
|
ClaimsSet.setFormattedAddress
|
public function setFormattedAddress($formattedAddress)
{
if (array_key_exists('address', $this->attributes) === false) {
$this->attributes['address'] = [];
}
$this->attributes['address']['formatted'] = (string) $formattedAddress;
}
|
php
|
public function setFormattedAddress($formattedAddress)
{
if (array_key_exists('address', $this->attributes) === false) {
$this->attributes['address'] = [];
}
$this->attributes['address']['formatted'] = (string) $formattedAddress;
}
|
[
"public",
"function",
"setFormattedAddress",
"(",
"$",
"formattedAddress",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'address'",
",",
"$",
"this",
"->",
"attributes",
")",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"attributes",
"[",
"'address'",
"]",
"=",
"[",
"]",
";",
"}",
"$",
"this",
"->",
"attributes",
"[",
"'address'",
"]",
"[",
"'formatted'",
"]",
"=",
"(",
"string",
")",
"$",
"formattedAddress",
";",
"}"
] |
Set the user's address as a formatted string
@param string|null $formattedAddress Full mailing address, formatted for display or use on a mailing list.
This field MAY contain multiple lines, separated by newlines. Newlines
can be represented either as a carriage return/line feed pair ("\r\n")
or as a single line feed character ("\n").
|
[
"Set",
"the",
"user",
"s",
"address",
"as",
"a",
"formatted",
"string"
] |
94c25fafdb36d1ee462dc1e74f95709943c1d363
|
https://github.com/thephpleague/openid-connect-claims/blob/94c25fafdb36d1ee462dc1e74f95709943c1d363/src/ClaimsSet.php#L225-L232
|
226,188
|
thephpleague/openid-connect-claims
|
src/ClaimsSet.php
|
ClaimsSet.setClaim
|
public function setClaim($claim, $value)
{
if (in_array(
$claim,
[
'sub',
'name',
'given_name',
'middle_name',
'family_name',
'nickname',
'preferred_username',
'profile',
'picture',
'website',
'email',
'email_verified',
'gender',
'birthdate',
'zoneinfo',
'locale',
'phone_number',
'phone_number_verified',
'address',
]
)) {
throw new \InvalidArgumentException(
sprintf(
'Please use the relevant method to set the `%s` claim',
$claim
)
);
}
$this->attributes[$claim] = $value;
}
|
php
|
public function setClaim($claim, $value)
{
if (in_array(
$claim,
[
'sub',
'name',
'given_name',
'middle_name',
'family_name',
'nickname',
'preferred_username',
'profile',
'picture',
'website',
'email',
'email_verified',
'gender',
'birthdate',
'zoneinfo',
'locale',
'phone_number',
'phone_number_verified',
'address',
]
)) {
throw new \InvalidArgumentException(
sprintf(
'Please use the relevant method to set the `%s` claim',
$claim
)
);
}
$this->attributes[$claim] = $value;
}
|
[
"public",
"function",
"setClaim",
"(",
"$",
"claim",
",",
"$",
"value",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"claim",
",",
"[",
"'sub'",
",",
"'name'",
",",
"'given_name'",
",",
"'middle_name'",
",",
"'family_name'",
",",
"'nickname'",
",",
"'preferred_username'",
",",
"'profile'",
",",
"'picture'",
",",
"'website'",
",",
"'email'",
",",
"'email_verified'",
",",
"'gender'",
",",
"'birthdate'",
",",
"'zoneinfo'",
",",
"'locale'",
",",
"'phone_number'",
",",
"'phone_number_verified'",
",",
"'address'",
",",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Please use the relevant method to set the `%s` claim'",
",",
"$",
"claim",
")",
")",
";",
"}",
"$",
"this",
"->",
"attributes",
"[",
"$",
"claim",
"]",
"=",
"$",
"value",
";",
"}"
] |
Set a claim
@param string $claim
@param mixed $value
|
[
"Set",
"a",
"claim"
] |
94c25fafdb36d1ee462dc1e74f95709943c1d363
|
https://github.com/thephpleague/openid-connect-claims/blob/94c25fafdb36d1ee462dc1e74f95709943c1d363/src/ClaimsSet.php#L286-L321
|
226,189
|
eosnewmedia/JSON-API-Common
|
src/Model/Resource/Link/Link.php
|
Link.duplicate
|
public function duplicate(string $name = null): LinkInterface
{
$link = new self($name ?? $this->name(), $this->href());
$link->metaInformation()->mergeCollection($this->metaInformation());
return $link;
}
|
php
|
public function duplicate(string $name = null): LinkInterface
{
$link = new self($name ?? $this->name(), $this->href());
$link->metaInformation()->mergeCollection($this->metaInformation());
return $link;
}
|
[
"public",
"function",
"duplicate",
"(",
"string",
"$",
"name",
"=",
"null",
")",
":",
"LinkInterface",
"{",
"$",
"link",
"=",
"new",
"self",
"(",
"$",
"name",
"??",
"$",
"this",
"->",
"name",
"(",
")",
",",
"$",
"this",
"->",
"href",
"(",
")",
")",
";",
"$",
"link",
"->",
"metaInformation",
"(",
")",
"->",
"mergeCollection",
"(",
"$",
"this",
"->",
"metaInformation",
"(",
")",
")",
";",
"return",
"$",
"link",
";",
"}"
] |
Creates a new link containing all data from the current one.
If set, the new link will have the given name.
@param string|null $name
@return LinkInterface
@throws \InvalidArgumentException
|
[
"Creates",
"a",
"new",
"link",
"containing",
"all",
"data",
"from",
"the",
"current",
"one",
".",
"If",
"set",
"the",
"new",
"link",
"will",
"have",
"the",
"given",
"name",
"."
] |
d868eb4d76bf75518f1bb72a70e5abf78fcae476
|
https://github.com/eosnewmedia/JSON-API-Common/blob/d868eb4d76bf75518f1bb72a70e5abf78fcae476/src/Model/Resource/Link/Link.php#L80-L86
|
226,190
|
CallFire/CallFire-PHP-SDK
|
src/CallFire/Generator/Rest.php
|
Rest.generateClasses
|
public function generateClasses($requestNamespace = null, $responseNamespace = null, $structureNamespace = null)
{
$classGenerator = $this->getClassGenerator();
if ($constructorGenerator = $this->getConstructorGenerator()) {
$classGenerator->addMethodFromGenerator($constructorGenerator);
}
if ($requestNamespace) {
$classGenerator->addUse($requestNamespace, self::REQUEST_NAMESPACE_ALIAS);
}
if ($responseNamespace) {
$classGenerator->addUse($responseNamespace, self::RESPONSE_NAMESPACE_ALIAS);
}
if ($structureNamespace) {
$classGenerator->addUse($structureNamespace, self::STRUCTURE_NAMESPACE_ALIAS);
}
foreach ($this->getServices() as $service) {
$serviceGenerator = new Rest\Service;
$serviceGenerator->setClassGenerator(clone $classGenerator);
$serviceGenerator->setDescription($service);
$serviceGenerator->generate();
$this->transformService($serviceGenerator);
$this->addClass($serviceGenerator);
}
return $this->getClasses();
}
|
php
|
public function generateClasses($requestNamespace = null, $responseNamespace = null, $structureNamespace = null)
{
$classGenerator = $this->getClassGenerator();
if ($constructorGenerator = $this->getConstructorGenerator()) {
$classGenerator->addMethodFromGenerator($constructorGenerator);
}
if ($requestNamespace) {
$classGenerator->addUse($requestNamespace, self::REQUEST_NAMESPACE_ALIAS);
}
if ($responseNamespace) {
$classGenerator->addUse($responseNamespace, self::RESPONSE_NAMESPACE_ALIAS);
}
if ($structureNamespace) {
$classGenerator->addUse($structureNamespace, self::STRUCTURE_NAMESPACE_ALIAS);
}
foreach ($this->getServices() as $service) {
$serviceGenerator = new Rest\Service;
$serviceGenerator->setClassGenerator(clone $classGenerator);
$serviceGenerator->setDescription($service);
$serviceGenerator->generate();
$this->transformService($serviceGenerator);
$this->addClass($serviceGenerator);
}
return $this->getClasses();
}
|
[
"public",
"function",
"generateClasses",
"(",
"$",
"requestNamespace",
"=",
"null",
",",
"$",
"responseNamespace",
"=",
"null",
",",
"$",
"structureNamespace",
"=",
"null",
")",
"{",
"$",
"classGenerator",
"=",
"$",
"this",
"->",
"getClassGenerator",
"(",
")",
";",
"if",
"(",
"$",
"constructorGenerator",
"=",
"$",
"this",
"->",
"getConstructorGenerator",
"(",
")",
")",
"{",
"$",
"classGenerator",
"->",
"addMethodFromGenerator",
"(",
"$",
"constructorGenerator",
")",
";",
"}",
"if",
"(",
"$",
"requestNamespace",
")",
"{",
"$",
"classGenerator",
"->",
"addUse",
"(",
"$",
"requestNamespace",
",",
"self",
"::",
"REQUEST_NAMESPACE_ALIAS",
")",
";",
"}",
"if",
"(",
"$",
"responseNamespace",
")",
"{",
"$",
"classGenerator",
"->",
"addUse",
"(",
"$",
"responseNamespace",
",",
"self",
"::",
"RESPONSE_NAMESPACE_ALIAS",
")",
";",
"}",
"if",
"(",
"$",
"structureNamespace",
")",
"{",
"$",
"classGenerator",
"->",
"addUse",
"(",
"$",
"structureNamespace",
",",
"self",
"::",
"STRUCTURE_NAMESPACE_ALIAS",
")",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"getServices",
"(",
")",
"as",
"$",
"service",
")",
"{",
"$",
"serviceGenerator",
"=",
"new",
"Rest",
"\\",
"Service",
";",
"$",
"serviceGenerator",
"->",
"setClassGenerator",
"(",
"clone",
"$",
"classGenerator",
")",
";",
"$",
"serviceGenerator",
"->",
"setDescription",
"(",
"$",
"service",
")",
";",
"$",
"serviceGenerator",
"->",
"generate",
"(",
")",
";",
"$",
"this",
"->",
"transformService",
"(",
"$",
"serviceGenerator",
")",
";",
"$",
"this",
"->",
"addClass",
"(",
"$",
"serviceGenerator",
")",
";",
"}",
"return",
"$",
"this",
"->",
"getClasses",
"(",
")",
";",
"}"
] |
Populate the API class generators from the available
API data.
@param string $requestNamespace = null
@param string $responseNamespace = null
@param string $structureNamespace = null
@return array
|
[
"Populate",
"the",
"API",
"class",
"generators",
"from",
"the",
"available",
"API",
"data",
"."
] |
7d6d3e1c59d4116e4fadaf57851a2fa127a13f65
|
https://github.com/CallFire/CallFire-PHP-SDK/blob/7d6d3e1c59d4116e4fadaf57851a2fa127a13f65/src/CallFire/Generator/Rest.php#L67-L95
|
226,191
|
gjerokrsteski/pimf-framework
|
core/Pimf/Controller/Core.php
|
Core.initCliAction
|
public function initCliAction()
{
clearstatcache();
$app = 'app/' . Config::get('app.name') . '/';
$assets = array(
BASE_PATH . $app . '_session/',
BASE_PATH . $app . '_cache/',
BASE_PATH . $app . '_database/',
BASE_PATH . $app . '_templates/',
);
echo 'Check app assets' . PHP_EOL;
foreach ($assets as $asset) {
if (!is_dir($asset)) {
echo "[ Please create '$asset' directory! ]" . PHP_EOL;
}
if (!is_writable($asset)) {
echo "[ Please make '$asset' writable! ]" . PHP_EOL;
}
}
echo 'Secure root directory' . PHP_EOL;
chmod(BASE_PATH, 0755);
echo 'Secure .htaccess' . PHP_EOL;
chmod(BASE_PATH . '.htaccess', 0644);
echo 'Secure index.php' . PHP_EOL;
chmod(BASE_PATH . 'index.php', 0644);
echo 'Secure autoload.core.php' . PHP_EOL;
chmod(BASE_PATH . 'pimf-framework/autoload.core.php', 0644);
echo 'Create logging files' . PHP_EOL;
$directory = Config::get('bootstrap.local_temp_directory');
$handle = fopen($file = $directory . 'pimf-logs.txt', "at+");
fclose($handle);
chmod($file, 0777);
$handle = fopen($file = $directory . 'pimf-warnings.txt', "at+");
fclose($handle);
chmod($file, 0777);
$handle = fopen($file = $directory . 'pimf-errors.txt', "at+");
fclose($handle);
chmod($file, 0777);
clearstatcache();
}
|
php
|
public function initCliAction()
{
clearstatcache();
$app = 'app/' . Config::get('app.name') . '/';
$assets = array(
BASE_PATH . $app . '_session/',
BASE_PATH . $app . '_cache/',
BASE_PATH . $app . '_database/',
BASE_PATH . $app . '_templates/',
);
echo 'Check app assets' . PHP_EOL;
foreach ($assets as $asset) {
if (!is_dir($asset)) {
echo "[ Please create '$asset' directory! ]" . PHP_EOL;
}
if (!is_writable($asset)) {
echo "[ Please make '$asset' writable! ]" . PHP_EOL;
}
}
echo 'Secure root directory' . PHP_EOL;
chmod(BASE_PATH, 0755);
echo 'Secure .htaccess' . PHP_EOL;
chmod(BASE_PATH . '.htaccess', 0644);
echo 'Secure index.php' . PHP_EOL;
chmod(BASE_PATH . 'index.php', 0644);
echo 'Secure autoload.core.php' . PHP_EOL;
chmod(BASE_PATH . 'pimf-framework/autoload.core.php', 0644);
echo 'Create logging files' . PHP_EOL;
$directory = Config::get('bootstrap.local_temp_directory');
$handle = fopen($file = $directory . 'pimf-logs.txt', "at+");
fclose($handle);
chmod($file, 0777);
$handle = fopen($file = $directory . 'pimf-warnings.txt', "at+");
fclose($handle);
chmod($file, 0777);
$handle = fopen($file = $directory . 'pimf-errors.txt', "at+");
fclose($handle);
chmod($file, 0777);
clearstatcache();
}
|
[
"public",
"function",
"initCliAction",
"(",
")",
"{",
"clearstatcache",
"(",
")",
";",
"$",
"app",
"=",
"'app/'",
".",
"Config",
"::",
"get",
"(",
"'app.name'",
")",
".",
"'/'",
";",
"$",
"assets",
"=",
"array",
"(",
"BASE_PATH",
".",
"$",
"app",
".",
"'_session/'",
",",
"BASE_PATH",
".",
"$",
"app",
".",
"'_cache/'",
",",
"BASE_PATH",
".",
"$",
"app",
".",
"'_database/'",
",",
"BASE_PATH",
".",
"$",
"app",
".",
"'_templates/'",
",",
")",
";",
"echo",
"'Check app assets'",
".",
"PHP_EOL",
";",
"foreach",
"(",
"$",
"assets",
"as",
"$",
"asset",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"asset",
")",
")",
"{",
"echo",
"\"[ Please create '$asset' directory! ]\"",
".",
"PHP_EOL",
";",
"}",
"if",
"(",
"!",
"is_writable",
"(",
"$",
"asset",
")",
")",
"{",
"echo",
"\"[ Please make '$asset' writable! ]\"",
".",
"PHP_EOL",
";",
"}",
"}",
"echo",
"'Secure root directory'",
".",
"PHP_EOL",
";",
"chmod",
"(",
"BASE_PATH",
",",
"0755",
")",
";",
"echo",
"'Secure .htaccess'",
".",
"PHP_EOL",
";",
"chmod",
"(",
"BASE_PATH",
".",
"'.htaccess'",
",",
"0644",
")",
";",
"echo",
"'Secure index.php'",
".",
"PHP_EOL",
";",
"chmod",
"(",
"BASE_PATH",
".",
"'index.php'",
",",
"0644",
")",
";",
"echo",
"'Secure autoload.core.php'",
".",
"PHP_EOL",
";",
"chmod",
"(",
"BASE_PATH",
".",
"'pimf-framework/autoload.core.php'",
",",
"0644",
")",
";",
"echo",
"'Create logging files'",
".",
"PHP_EOL",
";",
"$",
"directory",
"=",
"Config",
"::",
"get",
"(",
"'bootstrap.local_temp_directory'",
")",
";",
"$",
"handle",
"=",
"fopen",
"(",
"$",
"file",
"=",
"$",
"directory",
".",
"'pimf-logs.txt'",
",",
"\"at+\"",
")",
";",
"fclose",
"(",
"$",
"handle",
")",
";",
"chmod",
"(",
"$",
"file",
",",
"0777",
")",
";",
"$",
"handle",
"=",
"fopen",
"(",
"$",
"file",
"=",
"$",
"directory",
".",
"'pimf-warnings.txt'",
",",
"\"at+\"",
")",
";",
"fclose",
"(",
"$",
"handle",
")",
";",
"chmod",
"(",
"$",
"file",
",",
"0777",
")",
";",
"$",
"handle",
"=",
"fopen",
"(",
"$",
"file",
"=",
"$",
"directory",
".",
"'pimf-errors.txt'",
",",
"\"at+\"",
")",
";",
"fclose",
"(",
"$",
"handle",
")",
";",
"chmod",
"(",
"$",
"file",
",",
"0777",
")",
";",
"clearstatcache",
"(",
")",
";",
"}"
] |
Checks the applications architecture and creates some security and safety measures.
|
[
"Checks",
"the",
"applications",
"architecture",
"and",
"creates",
"some",
"security",
"and",
"safety",
"measures",
"."
] |
859aa7c8bb727b556c5e32224842af3cff33f18b
|
https://github.com/gjerokrsteski/pimf-framework/blob/859aa7c8bb727b556c5e32224842af3cff33f18b/core/Pimf/Controller/Core.php#L31-L84
|
226,192
|
lexik/ws-colissimo
|
src/WSColissimo/WSColiPosteLetterService/ClientBuilder.php
|
ClientBuilder.build
|
public function build()
{
$soapClientFactory = new SoapClientFactory();
$soapClient = $soapClientFactory->create($this->wsdl);
return new Client($soapClient);
}
|
php
|
public function build()
{
$soapClientFactory = new SoapClientFactory();
$soapClient = $soapClientFactory->create($this->wsdl);
return new Client($soapClient);
}
|
[
"public",
"function",
"build",
"(",
")",
"{",
"$",
"soapClientFactory",
"=",
"new",
"SoapClientFactory",
"(",
")",
";",
"$",
"soapClient",
"=",
"$",
"soapClientFactory",
"->",
"create",
"(",
"$",
"this",
"->",
"wsdl",
")",
";",
"return",
"new",
"Client",
"(",
"$",
"soapClient",
")",
";",
"}"
] |
Build the WSColiPosteLetterService SOAP client
@return Client
|
[
"Build",
"the",
"WSColiPosteLetterService",
"SOAP",
"client"
] |
df4ba30b05afed8e49d509c36592d4aa7797c259
|
https://github.com/lexik/ws-colissimo/blob/df4ba30b05afed8e49d509c36592d4aa7797c259/src/WSColissimo/WSColiPosteLetterService/ClientBuilder.php#L27-L33
|
226,193
|
Lenius/economic-php-client
|
Economic/API/Client.php
|
Client.create
|
public function create()
{
// @codeCoverageIgnoreStart
if (!empty($this->ch)) {
curl_close($this->ch);
}
// @codeCoverageIgnoreEnd
// Instantiate cURL object
$this->ch = curl_init();
// Apply authentication headers
$this->authenticate();
}
|
php
|
public function create()
{
// @codeCoverageIgnoreStart
if (!empty($this->ch)) {
curl_close($this->ch);
}
// @codeCoverageIgnoreEnd
// Instantiate cURL object
$this->ch = curl_init();
// Apply authentication headers
$this->authenticate();
}
|
[
"public",
"function",
"create",
"(",
")",
"{",
"// @codeCoverageIgnoreStart",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"ch",
")",
")",
"{",
"curl_close",
"(",
"$",
"this",
"->",
"ch",
")",
";",
"}",
"// @codeCoverageIgnoreEnd",
"// Instantiate cURL object",
"$",
"this",
"->",
"ch",
"=",
"curl_init",
"(",
")",
";",
"// Apply authentication headers",
"$",
"this",
"->",
"authenticate",
"(",
")",
";",
"}"
] |
Create function.
Create cURL connection with authentication
|
[
"Create",
"function",
"."
] |
201c94e55cc6662a2cd05d1c485bdd823c79ab1b
|
https://github.com/Lenius/economic-php-client/blob/201c94e55cc6662a2cd05d1c485bdd823c79ab1b/Economic/API/Client.php#L71-L84
|
226,194
|
crip-laravel/filesys
|
src/Services/BlobMetadata.php
|
BlobMetadata.init
|
public function init($path)
{
$this->storage = app()->make('filesystem');
$this->path = $path;
if ($this->exists()) {
list($this->dir, $this->name) = FileSystem::splitNameFromPath($path);
$this->lastModified = $this->storage->lastModified($path);
$metadata = $this->storage->getMetaData($path);
if (!is_array($metadata)) {
return $this;
}
$this->path = $metadata['path'];
$this->size = array_key_exists('size', $metadata) ?
$metadata['size'] : 0;
$this->type = $metadata['type'];
if ($this->isFile()) {
list($this->name, $this->extension) = $this->splitNameAndExtension($this->name);
try {
$this->mimeType = $this->storage->mimeType($this->path);
} catch (\Exception $ex) {
$this->mimeType = self::guessMimeType($this->extension, $this->isFile());
}
}
}
return $this;
}
|
php
|
public function init($path)
{
$this->storage = app()->make('filesystem');
$this->path = $path;
if ($this->exists()) {
list($this->dir, $this->name) = FileSystem::splitNameFromPath($path);
$this->lastModified = $this->storage->lastModified($path);
$metadata = $this->storage->getMetaData($path);
if (!is_array($metadata)) {
return $this;
}
$this->path = $metadata['path'];
$this->size = array_key_exists('size', $metadata) ?
$metadata['size'] : 0;
$this->type = $metadata['type'];
if ($this->isFile()) {
list($this->name, $this->extension) = $this->splitNameAndExtension($this->name);
try {
$this->mimeType = $this->storage->mimeType($this->path);
} catch (\Exception $ex) {
$this->mimeType = self::guessMimeType($this->extension, $this->isFile());
}
}
}
return $this;
}
|
[
"public",
"function",
"init",
"(",
"$",
"path",
")",
"{",
"$",
"this",
"->",
"storage",
"=",
"app",
"(",
")",
"->",
"make",
"(",
"'filesystem'",
")",
";",
"$",
"this",
"->",
"path",
"=",
"$",
"path",
";",
"if",
"(",
"$",
"this",
"->",
"exists",
"(",
")",
")",
"{",
"list",
"(",
"$",
"this",
"->",
"dir",
",",
"$",
"this",
"->",
"name",
")",
"=",
"FileSystem",
"::",
"splitNameFromPath",
"(",
"$",
"path",
")",
";",
"$",
"this",
"->",
"lastModified",
"=",
"$",
"this",
"->",
"storage",
"->",
"lastModified",
"(",
"$",
"path",
")",
";",
"$",
"metadata",
"=",
"$",
"this",
"->",
"storage",
"->",
"getMetaData",
"(",
"$",
"path",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"metadata",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"$",
"this",
"->",
"path",
"=",
"$",
"metadata",
"[",
"'path'",
"]",
";",
"$",
"this",
"->",
"size",
"=",
"array_key_exists",
"(",
"'size'",
",",
"$",
"metadata",
")",
"?",
"$",
"metadata",
"[",
"'size'",
"]",
":",
"0",
";",
"$",
"this",
"->",
"type",
"=",
"$",
"metadata",
"[",
"'type'",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"isFile",
"(",
")",
")",
"{",
"list",
"(",
"$",
"this",
"->",
"name",
",",
"$",
"this",
"->",
"extension",
")",
"=",
"$",
"this",
"->",
"splitNameAndExtension",
"(",
"$",
"this",
"->",
"name",
")",
";",
"try",
"{",
"$",
"this",
"->",
"mimeType",
"=",
"$",
"this",
"->",
"storage",
"->",
"mimeType",
"(",
"$",
"this",
"->",
"path",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"ex",
")",
"{",
"$",
"this",
"->",
"mimeType",
"=",
"self",
"::",
"guessMimeType",
"(",
"$",
"this",
"->",
"extension",
",",
"$",
"this",
"->",
"isFile",
"(",
")",
")",
";",
"}",
"}",
"}",
"return",
"$",
"this",
";",
"}"
] |
BlobMetadata initializer.
@param $path
@return BlobMetadata $this
|
[
"BlobMetadata",
"initializer",
"."
] |
43c66929a5a16772dbb3bae4b5188bdc10b6f9ec
|
https://github.com/crip-laravel/filesys/blob/43c66929a5a16772dbb3bae4b5188bdc10b6f9ec/src/Services/BlobMetadata.php#L34-L68
|
226,195
|
crip-laravel/filesys
|
src/Services/BlobMetadata.php
|
BlobMetadata.debugInfo
|
public function debugInfo()
{
return [
'exists' => $this->exists(),
'isFile' => $this->isFile(),
'isImage' => $this->isImage(),
'path' => $this->path,
'lastModified' => $this->lastModified,
'name' => $this->name,
'dir' => $this->dir,
'mimeType' => $this->mimeType,
'extension' => $this->extension,
'size' => $this->size,
'type' => $this->type,
'getFullName' => $this->getFullName()
];
}
|
php
|
public function debugInfo()
{
return [
'exists' => $this->exists(),
'isFile' => $this->isFile(),
'isImage' => $this->isImage(),
'path' => $this->path,
'lastModified' => $this->lastModified,
'name' => $this->name,
'dir' => $this->dir,
'mimeType' => $this->mimeType,
'extension' => $this->extension,
'size' => $this->size,
'type' => $this->type,
'getFullName' => $this->getFullName()
];
}
|
[
"public",
"function",
"debugInfo",
"(",
")",
"{",
"return",
"[",
"'exists'",
"=>",
"$",
"this",
"->",
"exists",
"(",
")",
",",
"'isFile'",
"=>",
"$",
"this",
"->",
"isFile",
"(",
")",
",",
"'isImage'",
"=>",
"$",
"this",
"->",
"isImage",
"(",
")",
",",
"'path'",
"=>",
"$",
"this",
"->",
"path",
",",
"'lastModified'",
"=>",
"$",
"this",
"->",
"lastModified",
",",
"'name'",
"=>",
"$",
"this",
"->",
"name",
",",
"'dir'",
"=>",
"$",
"this",
"->",
"dir",
",",
"'mimeType'",
"=>",
"$",
"this",
"->",
"mimeType",
",",
"'extension'",
"=>",
"$",
"this",
"->",
"extension",
",",
"'size'",
"=>",
"$",
"this",
"->",
"size",
",",
"'type'",
"=>",
"$",
"this",
"->",
"type",
",",
"'getFullName'",
"=>",
"$",
"this",
"->",
"getFullName",
"(",
")",
"]",
";",
"}"
] |
Get debug info of current metadata file.
@return array
|
[
"Get",
"debug",
"info",
"of",
"current",
"metadata",
"file",
"."
] |
43c66929a5a16772dbb3bae4b5188bdc10b6f9ec
|
https://github.com/crip-laravel/filesys/blob/43c66929a5a16772dbb3bae4b5188bdc10b6f9ec/src/Services/BlobMetadata.php#L74-L90
|
226,196
|
crip-laravel/filesys
|
src/Services/BlobMetadata.php
|
BlobMetadata.guessMimeType
|
public static function guessMimeType($extension = '', $isFile = true)
{
if ($isFile) {
$map = config('cripfilesys.mime.map');
return isset($map[$extension]) ?
$map[$extension] : 'text/plain';
}
return 'dir';
}
|
php
|
public static function guessMimeType($extension = '', $isFile = true)
{
if ($isFile) {
$map = config('cripfilesys.mime.map');
return isset($map[$extension]) ?
$map[$extension] : 'text/plain';
}
return 'dir';
}
|
[
"public",
"static",
"function",
"guessMimeType",
"(",
"$",
"extension",
"=",
"''",
",",
"$",
"isFile",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"isFile",
")",
"{",
"$",
"map",
"=",
"config",
"(",
"'cripfilesys.mime.map'",
")",
";",
"return",
"isset",
"(",
"$",
"map",
"[",
"$",
"extension",
"]",
")",
"?",
"$",
"map",
"[",
"$",
"extension",
"]",
":",
"'text/plain'",
";",
"}",
"return",
"'dir'",
";",
"}"
] |
Try guess mime type from path
@param string $extension
@param bool $isFile
@return string
|
[
"Try",
"guess",
"mime",
"type",
"from",
"path"
] |
43c66929a5a16772dbb3bae4b5188bdc10b6f9ec
|
https://github.com/crip-laravel/filesys/blob/43c66929a5a16772dbb3bae4b5188bdc10b6f9ec/src/Services/BlobMetadata.php#L229-L238
|
226,197
|
Techworker/ssml
|
src/Specification/Alexa.php
|
Alexa.getAllowedElements
|
protected function getAllowedElements() : array
{
return [
Speak::class,
Audio::class,
Break_::class,
Paragraph::class,
Phoneme::class,
Sentence::class,
SayAs::class,
Word::class,
Text::class
];
}
|
php
|
protected function getAllowedElements() : array
{
return [
Speak::class,
Audio::class,
Break_::class,
Paragraph::class,
Phoneme::class,
Sentence::class,
SayAs::class,
Word::class,
Text::class
];
}
|
[
"protected",
"function",
"getAllowedElements",
"(",
")",
":",
"array",
"{",
"return",
"[",
"Speak",
"::",
"class",
",",
"Audio",
"::",
"class",
",",
"Break_",
"::",
"class",
",",
"Paragraph",
"::",
"class",
",",
"Phoneme",
"::",
"class",
",",
"Sentence",
"::",
"class",
",",
"SayAs",
"::",
"class",
",",
"Word",
"::",
"class",
",",
"Text",
"::",
"class",
"]",
";",
"}"
] |
Gets the allowed elements.
@return array
|
[
"Gets",
"the",
"allowed",
"elements",
"."
] |
cafb979b777480baf7a01b5db2bf7c2cff837805
|
https://github.com/Techworker/ssml/blob/cafb979b777480baf7a01b5db2bf7c2cff837805/src/Specification/Alexa.php#L47-L60
|
226,198
|
Techworker/ssml
|
src/Specification/Alexa.php
|
Alexa.validateElement
|
protected function validateElement(BaseElement $element) : void
{
if ($element instanceof Break_) {
$this->validateBreak($element);
} elseif ($element instanceof Phoneme) {
$this->validatePhoneme($element);
} elseif ($element instanceof SayAs) {
$this->validateSayAs($element);
} elseif ($element instanceof Word) {
$this->validateWord($element);
}
}
|
php
|
protected function validateElement(BaseElement $element) : void
{
if ($element instanceof Break_) {
$this->validateBreak($element);
} elseif ($element instanceof Phoneme) {
$this->validatePhoneme($element);
} elseif ($element instanceof SayAs) {
$this->validateSayAs($element);
} elseif ($element instanceof Word) {
$this->validateWord($element);
}
}
|
[
"protected",
"function",
"validateElement",
"(",
"BaseElement",
"$",
"element",
")",
":",
"void",
"{",
"if",
"(",
"$",
"element",
"instanceof",
"Break_",
")",
"{",
"$",
"this",
"->",
"validateBreak",
"(",
"$",
"element",
")",
";",
"}",
"elseif",
"(",
"$",
"element",
"instanceof",
"Phoneme",
")",
"{",
"$",
"this",
"->",
"validatePhoneme",
"(",
"$",
"element",
")",
";",
"}",
"elseif",
"(",
"$",
"element",
"instanceof",
"SayAs",
")",
"{",
"$",
"this",
"->",
"validateSayAs",
"(",
"$",
"element",
")",
";",
"}",
"elseif",
"(",
"$",
"element",
"instanceof",
"Word",
")",
"{",
"$",
"this",
"->",
"validateWord",
"(",
"$",
"element",
")",
";",
"}",
"}"
] |
Calls validation methods based on the givene element.
@param BaseElement $element
@return void
|
[
"Calls",
"validation",
"methods",
"based",
"on",
"the",
"givene",
"element",
"."
] |
cafb979b777480baf7a01b5db2bf7c2cff837805
|
https://github.com/Techworker/ssml/blob/cafb979b777480baf7a01b5db2bf7c2cff837805/src/Specification/Alexa.php#L68-L79
|
226,199
|
Techworker/ssml
|
src/Specification/Alexa.php
|
Alexa.validateBreak
|
protected function validateBreak(Break_ $break)
{
$strength = $break->strength;
if ($strength !== null && !in_array($strength, self::BREAK_STRENGTHS, true)) {
throw new InvalidAttributeValueException(
$break, 'strength', $strength, self::BREAK_STRENGTHS, 'alexa'
);
}
$time = $break->time;
if ($time !== null && preg_match('/^\d+m*s+$/', $time) === 0) {
throw new InvalidAttributeValueException(
$break, 'time', $time, '\d[m*s+]', 'alexa'
);
}
}
|
php
|
protected function validateBreak(Break_ $break)
{
$strength = $break->strength;
if ($strength !== null && !in_array($strength, self::BREAK_STRENGTHS, true)) {
throw new InvalidAttributeValueException(
$break, 'strength', $strength, self::BREAK_STRENGTHS, 'alexa'
);
}
$time = $break->time;
if ($time !== null && preg_match('/^\d+m*s+$/', $time) === 0) {
throw new InvalidAttributeValueException(
$break, 'time', $time, '\d[m*s+]', 'alexa'
);
}
}
|
[
"protected",
"function",
"validateBreak",
"(",
"Break_",
"$",
"break",
")",
"{",
"$",
"strength",
"=",
"$",
"break",
"->",
"strength",
";",
"if",
"(",
"$",
"strength",
"!==",
"null",
"&&",
"!",
"in_array",
"(",
"$",
"strength",
",",
"self",
"::",
"BREAK_STRENGTHS",
",",
"true",
")",
")",
"{",
"throw",
"new",
"InvalidAttributeValueException",
"(",
"$",
"break",
",",
"'strength'",
",",
"$",
"strength",
",",
"self",
"::",
"BREAK_STRENGTHS",
",",
"'alexa'",
")",
";",
"}",
"$",
"time",
"=",
"$",
"break",
"->",
"time",
";",
"if",
"(",
"$",
"time",
"!==",
"null",
"&&",
"preg_match",
"(",
"'/^\\d+m*s+$/'",
",",
"$",
"time",
")",
"===",
"0",
")",
"{",
"throw",
"new",
"InvalidAttributeValueException",
"(",
"$",
"break",
",",
"'time'",
",",
"$",
"time",
",",
"'\\d[m*s+]'",
",",
"'alexa'",
")",
";",
"}",
"}"
] |
Validates a Break_ element.
@param Break_ $break
@throws InvalidAttributeValueException
|
[
"Validates",
"a",
"Break_",
"element",
"."
] |
cafb979b777480baf7a01b5db2bf7c2cff837805
|
https://github.com/Techworker/ssml/blob/cafb979b777480baf7a01b5db2bf7c2cff837805/src/Specification/Alexa.php#L87-L102
|
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.