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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
231,800 | praxisnetau/silverware | src/Extensions/Model/TokenMappingExtension.php | TokenMappingExtension.getTokenMappings | public function getTokenMappings()
{
// Create Mappings Array:
$mappings = [];
// Define Mappings Array:
if (is_array($this->owner->config()->token_mappings)) {
foreach ($this->owner->config()->token_mappings as $name => $spec) {
if (!is_array($spec)) {
$spec = ['property' => $spec];
}
$mappings[$name] = $spec;
}
}
// Answer Mappings Array:
return $mappings;
} | php | public function getTokenMappings()
{
// Create Mappings Array:
$mappings = [];
// Define Mappings Array:
if (is_array($this->owner->config()->token_mappings)) {
foreach ($this->owner->config()->token_mappings as $name => $spec) {
if (!is_array($spec)) {
$spec = ['property' => $spec];
}
$mappings[$name] = $spec;
}
}
// Answer Mappings Array:
return $mappings;
} | [
"public",
"function",
"getTokenMappings",
"(",
")",
"{",
"// Create Mappings Array:",
"$",
"mappings",
"=",
"[",
"]",
";",
"// Define Mappings Array:",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"owner",
"->",
"config",
"(",
")",
"->",
"token_mappings",
")... | Answers the token mappings for the extended object.
@return array | [
"Answers",
"the",
"token",
"mappings",
"for",
"the",
"extended",
"object",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/TokenMappingExtension.php#L39-L64 |
231,801 | praxisnetau/silverware | src/Extensions/Model/TokenMappingExtension.php | TokenMappingExtension.replaceTokens | public function replaceTokens($text, $tokens = [])
{
// Obtain Token Mappings:
$mappings = $this->getTokenMappings();
// Iterate Token Mappings:
foreach ($mappings as $name => $spec) {
// Ignore Custom Mappings:
if (isset($spec['custom']) && $spec['custom']) {
continue;
}
// Check Property Defined:
if (!isset($spec['property'])) {
throw new Exception(sprintf('Property is undefined for token mapping "%s"', $name));
}
// Obtain Value for Token:
$value = isset($tokens[$name]) ? $tokens[$name] : $this->getPropertyValue($spec['property']);
// Perform Token Replacement:
$text = str_ireplace("{{$name}}", $value, $text);
}
// Answer Processed Text:
return $text;
} | php | public function replaceTokens($text, $tokens = [])
{
// Obtain Token Mappings:
$mappings = $this->getTokenMappings();
// Iterate Token Mappings:
foreach ($mappings as $name => $spec) {
// Ignore Custom Mappings:
if (isset($spec['custom']) && $spec['custom']) {
continue;
}
// Check Property Defined:
if (!isset($spec['property'])) {
throw new Exception(sprintf('Property is undefined for token mapping "%s"', $name));
}
// Obtain Value for Token:
$value = isset($tokens[$name]) ? $tokens[$name] : $this->getPropertyValue($spec['property']);
// Perform Token Replacement:
$text = str_ireplace("{{$name}}", $value, $text);
}
// Answer Processed Text:
return $text;
} | [
"public",
"function",
"replaceTokens",
"(",
"$",
"text",
",",
"$",
"tokens",
"=",
"[",
"]",
")",
"{",
"// Obtain Token Mappings:",
"$",
"mappings",
"=",
"$",
"this",
"->",
"getTokenMappings",
"(",
")",
";",
"// Iterate Token Mappings:",
"foreach",
"(",
"$",
... | Replaces tokens found within the given text with their mapped value.
@param string $text Text with tokens to replace.
@param array $tokens Array of tokens mapped to values (optional).
@throws Exception
@return string | [
"Replaces",
"tokens",
"found",
"within",
"the",
"given",
"text",
"with",
"their",
"mapped",
"value",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/TokenMappingExtension.php#L76-L111 |
231,802 | kuzzleio/sdk-php | src/Collection.php | Collection.search | public function search(array $filters, array $options = [])
{
$data = [
'body' => $filters
];
$response = $this->kuzzle->query(
$this->buildQueryArgs('document', 'search'),
$this->kuzzle->addHeaders($data, $this->headers),
$options
);
$response['result']['hits'] = array_map(function ($document) {
return new Document($this, $document['_id'], $document['_source'], $document['_meta']);
}, $response['result']['hits']);
if (array_key_exists('_scroll_id', $response['result'])) {
$options['scrollId'] = $response['result']['_scroll_id'];
}
return new SearchResult(
$this,
$response['result']['total'],
$response['result']['hits'],
array_key_exists('aggregations', $response['result']) ? $response['result']['aggregations'] : [],
$options,
$filters,
array_key_exists('previous', $options) ? $options['previous'] : null
);
} | php | public function search(array $filters, array $options = [])
{
$data = [
'body' => $filters
];
$response = $this->kuzzle->query(
$this->buildQueryArgs('document', 'search'),
$this->kuzzle->addHeaders($data, $this->headers),
$options
);
$response['result']['hits'] = array_map(function ($document) {
return new Document($this, $document['_id'], $document['_source'], $document['_meta']);
}, $response['result']['hits']);
if (array_key_exists('_scroll_id', $response['result'])) {
$options['scrollId'] = $response['result']['_scroll_id'];
}
return new SearchResult(
$this,
$response['result']['total'],
$response['result']['hits'],
array_key_exists('aggregations', $response['result']) ? $response['result']['aggregations'] : [],
$options,
$filters,
array_key_exists('previous', $options) ? $options['previous'] : null
);
} | [
"public",
"function",
"search",
"(",
"array",
"$",
"filters",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"[",
"'body'",
"=>",
"$",
"filters",
"]",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"kuzzle",
"->",
"query",
... | Executes an advanced search on the data collection.
@param array $filters Filters in ElasticSearch Query DSL format
@param array $options Optional parameters
@return SearchResult | [
"Executes",
"an",
"advanced",
"search",
"on",
"the",
"data",
"collection",
"."
] | b1e76cafaa9c7cc08d619c838c6208489e94565b | https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Collection.php#L57-L87 |
231,803 | kuzzleio/sdk-php | src/Collection.php | Collection.scroll | public function scroll($scrollId, array $options = [], array $filters = [])
{
$options['httpParams'] = [':scrollId' => $scrollId];
$data = [];
if (!$scrollId) {
throw new \Exception('Collection.scroll: scrollId is required');
}
$response = $this->kuzzle->query(
$this->kuzzle->buildQueryArgs('document', 'scroll'),
$data,
$options
);
$response['result']['hits'] = array_map(function ($document) {
return new Document($this, $document['_id'], $document['_source'], $document['_meta']);
}, $response['result']['hits']);
if (array_key_exists('_scroll_id', $response['result'])) {
$options['scrollId'] = $response['result']['_scroll_id'];
}
return new SearchResult(
$this,
$response['result']['total'],
$response['result']['hits'],
array_key_exists('aggregations', $response['result']) ? $response['result']['aggregations'] : [],
$options,
$filters,
array_key_exists('previous', $options) ? $options['previous'] : null
);
} | php | public function scroll($scrollId, array $options = [], array $filters = [])
{
$options['httpParams'] = [':scrollId' => $scrollId];
$data = [];
if (!$scrollId) {
throw new \Exception('Collection.scroll: scrollId is required');
}
$response = $this->kuzzle->query(
$this->kuzzle->buildQueryArgs('document', 'scroll'),
$data,
$options
);
$response['result']['hits'] = array_map(function ($document) {
return new Document($this, $document['_id'], $document['_source'], $document['_meta']);
}, $response['result']['hits']);
if (array_key_exists('_scroll_id', $response['result'])) {
$options['scrollId'] = $response['result']['_scroll_id'];
}
return new SearchResult(
$this,
$response['result']['total'],
$response['result']['hits'],
array_key_exists('aggregations', $response['result']) ? $response['result']['aggregations'] : [],
$options,
$filters,
array_key_exists('previous', $options) ? $options['previous'] : null
);
} | [
"public",
"function",
"scroll",
"(",
"$",
"scrollId",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"array",
"$",
"filters",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"[",
"'httpParams'",
"]",
"=",
"[",
"':scrollId'",
"=>",
"$",
"scrollId",
"]",
... | Retrieves next result of a search with scroll query.
@param string $scrollId
@param array $options (optional) arguments
@param array $filters (optional) original filters
@return SearchResult
@throws \Exception | [
"Retrieves",
"next",
"result",
"of",
"a",
"search",
"with",
"scroll",
"query",
"."
] | b1e76cafaa9c7cc08d619c838c6208489e94565b | https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Collection.php#L98-L132 |
231,804 | kuzzleio/sdk-php | src/Collection.php | Collection.count | public function count(array $filters, array $options = [])
{
$data = [
'body' => $filters
];
$response = $this->kuzzle->query(
$this->buildQueryArgs('document', 'count'),
$this->kuzzle->addHeaders($data, $this->headers),
$options
);
return $response['result']['count'];
} | php | public function count(array $filters, array $options = [])
{
$data = [
'body' => $filters
];
$response = $this->kuzzle->query(
$this->buildQueryArgs('document', 'count'),
$this->kuzzle->addHeaders($data, $this->headers),
$options
);
return $response['result']['count'];
} | [
"public",
"function",
"count",
"(",
"array",
"$",
"filters",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"[",
"'body'",
"=>",
"$",
"filters",
"]",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"kuzzle",
"->",
"query",
... | Returns the number of documents matching the provided set of filters.
@param array $filters Filters in ElasticSearch Query DSL format
@param array $options Optional parameters
@return integer the matched documents count | [
"Returns",
"the",
"number",
"of",
"documents",
"matching",
"the",
"provided",
"set",
"of",
"filters",
"."
] | b1e76cafaa9c7cc08d619c838c6208489e94565b | https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Collection.php#L142-L155 |
231,805 | kuzzleio/sdk-php | src/Collection.php | Collection.create | public function create(array $mapping = [], array $options = [])
{
$data = [
'body' => $mapping
];
$response = $this->kuzzle->query(
$this->buildQueryArgs('collection', 'create'),
$this->kuzzle->addHeaders($data, $this->headers),
$options
);
return $response['result']['acknowledged'];
} | php | public function create(array $mapping = [], array $options = [])
{
$data = [
'body' => $mapping
];
$response = $this->kuzzle->query(
$this->buildQueryArgs('collection', 'create'),
$this->kuzzle->addHeaders($data, $this->headers),
$options
);
return $response['result']['acknowledged'];
} | [
"public",
"function",
"create",
"(",
"array",
"$",
"mapping",
"=",
"[",
"]",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"[",
"'body'",
"=>",
"$",
"mapping",
"]",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"kuzzle"... | Create a new empty data collection. An optional mapping
object can be provided
@param array $mapping Optional collection mapping description
@param array $options Optional parameters
@return boolean | [
"Create",
"a",
"new",
"empty",
"data",
"collection",
".",
"An",
"optional",
"mapping",
"object",
"can",
"be",
"provided"
] | b1e76cafaa9c7cc08d619c838c6208489e94565b | https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Collection.php#L165-L178 |
231,806 | kuzzleio/sdk-php | src/Collection.php | Collection.deleteDocument | public function deleteDocument($filters, array $options = [])
{
$data = [];
if (is_string($filters)) {
$data['_id'] = $filters;
$action = 'delete';
} else {
$data['body'] = ['query' => (object)$filters];
$action = 'deleteByQuery';
}
$response = $this->kuzzle->query(
$this->buildQueryArgs('document', $action),
$this->kuzzle->addHeaders($data, $this->headers),
$options
);
return $action === 'delete' ? $response['result']['_id'] : $response['result']['ids'];
} | php | public function deleteDocument($filters, array $options = [])
{
$data = [];
if (is_string($filters)) {
$data['_id'] = $filters;
$action = 'delete';
} else {
$data['body'] = ['query' => (object)$filters];
$action = 'deleteByQuery';
}
$response = $this->kuzzle->query(
$this->buildQueryArgs('document', $action),
$this->kuzzle->addHeaders($data, $this->headers),
$options
);
return $action === 'delete' ? $response['result']['_id'] : $response['result']['ids'];
} | [
"public",
"function",
"deleteDocument",
"(",
"$",
"filters",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"if",
"(",
"is_string",
"(",
"$",
"filters",
")",
")",
"{",
"$",
"data",
"[",
"'_id'",
"]",
"=",
... | Delete either a stored document, or all stored documents matching search filters.
@param array|string $filters Unique document identifier OR Filters in ElasticSearch Query DSL format
@param array $options Optional parameters
@return integer|integer[] | [
"Delete",
"either",
"a",
"stored",
"document",
"or",
"all",
"stored",
"documents",
"matching",
"search",
"filters",
"."
] | b1e76cafaa9c7cc08d619c838c6208489e94565b | https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Collection.php#L243-L262 |
231,807 | kuzzleio/sdk-php | src/Collection.php | Collection.documentExists | public function documentExists($documentId, array $options = [])
{
$data = [
'_id' => $documentId
];
$response = $this->kuzzle->query(
$this->buildQueryArgs('document', 'exists'),
$this->kuzzle->addHeaders($data, $this->headers),
$options
);
return $response['result'];
} | php | public function documentExists($documentId, array $options = [])
{
$data = [
'_id' => $documentId
];
$response = $this->kuzzle->query(
$this->buildQueryArgs('document', 'exists'),
$this->kuzzle->addHeaders($data, $this->headers),
$options
);
return $response['result'];
} | [
"public",
"function",
"documentExists",
"(",
"$",
"documentId",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"[",
"'_id'",
"=>",
"$",
"documentId",
"]",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"kuzzle",
"->",
"query"... | Returns a boolean indicating whether or not a document with provided ID exists.
@param string $documentId
@param array $options
@return boolean | [
"Returns",
"a",
"boolean",
"indicating",
"whether",
"or",
"not",
"a",
"document",
"with",
"provided",
"ID",
"exists",
"."
] | b1e76cafaa9c7cc08d619c838c6208489e94565b | https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Collection.php#L306-L319 |
231,808 | kuzzleio/sdk-php | src/Collection.php | Collection.getSpecifications | public function getSpecifications(array $options = [])
{
$data = [
'index' => $this->index,
'collection' => $this->collection
];
$response = $this->kuzzle->query(
$this->buildQueryArgs('collection', 'getSpecifications'),
$this->kuzzle->addHeaders($data, $this->headers),
$options
);
return $response['result'];
} | php | public function getSpecifications(array $options = [])
{
$data = [
'index' => $this->index,
'collection' => $this->collection
];
$response = $this->kuzzle->query(
$this->buildQueryArgs('collection', 'getSpecifications'),
$this->kuzzle->addHeaders($data, $this->headers),
$options
);
return $response['result'];
} | [
"public",
"function",
"getSpecifications",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"[",
"'index'",
"=>",
"$",
"this",
"->",
"index",
",",
"'collection'",
"=>",
"$",
"this",
"->",
"collection",
"]",
";",
"$",
"response",... | Retrieves the current specifications of this collection
@param array $options Optional parameters
@return mixed | [
"Retrieves",
"the",
"current",
"specifications",
"of",
"this",
"collection"
] | b1e76cafaa9c7cc08d619c838c6208489e94565b | https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Collection.php#L364-L378 |
231,809 | kuzzleio/sdk-php | src/Collection.php | Collection.mCreateDocument | public function mCreateDocument($documents, array $options = [])
{
if (!is_array($documents)) {
throw new InvalidArgumentException('Collection.mCreateDocument: documents parameter format is invalid (should be an array of documents)');
}
$documents = array_map(function ($document) {
return $document instanceof Document ? $document->serialize() : $document;
}, $documents);
$data = ['body' => ['documents' => $documents]];
$response = $this->kuzzle->query(
$this->buildQueryArgs('document', 'mCreate'),
$this->kuzzle->addHeaders($data, $this->headers),
$options
);
return $response['result'];
} | php | public function mCreateDocument($documents, array $options = [])
{
if (!is_array($documents)) {
throw new InvalidArgumentException('Collection.mCreateDocument: documents parameter format is invalid (should be an array of documents)');
}
$documents = array_map(function ($document) {
return $document instanceof Document ? $document->serialize() : $document;
}, $documents);
$data = ['body' => ['documents' => $documents]];
$response = $this->kuzzle->query(
$this->buildQueryArgs('document', 'mCreate'),
$this->kuzzle->addHeaders($data, $this->headers),
$options
);
return $response['result'];
} | [
"public",
"function",
"mCreateDocument",
"(",
"$",
"documents",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"documents",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Collection.mCreateDocu... | Create the provided documents
@param array $documents Array of documents to create
@param array $options Optional parameters
@return mixed | [
"Create",
"the",
"provided",
"documents"
] | b1e76cafaa9c7cc08d619c838c6208489e94565b | https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Collection.php#L387-L406 |
231,810 | kuzzleio/sdk-php | src/Collection.php | Collection.mDeleteDocument | public function mDeleteDocument($documentIds, array $options = [])
{
if (!is_array($documentIds)) {
throw new InvalidArgumentException('Collection.mDeleteDocument: documents parameter format is invalid (should be an array of document IDs)');
}
$data = ['body' => ['ids' => $documentIds]];
$response = $this->kuzzle->query(
$this->buildQueryArgs('document', 'mDelete'),
$this->kuzzle->addHeaders($data, $this->headers),
$options
);
return $response['result'];
} | php | public function mDeleteDocument($documentIds, array $options = [])
{
if (!is_array($documentIds)) {
throw new InvalidArgumentException('Collection.mDeleteDocument: documents parameter format is invalid (should be an array of document IDs)');
}
$data = ['body' => ['ids' => $documentIds]];
$response = $this->kuzzle->query(
$this->buildQueryArgs('document', 'mDelete'),
$this->kuzzle->addHeaders($data, $this->headers),
$options
);
return $response['result'];
} | [
"public",
"function",
"mDeleteDocument",
"(",
"$",
"documentIds",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"documentIds",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Collection.mDelete... | Delete specific documents according to given IDs
@param array $documentIds IDs of the documents to delete
@param array $options Optional parameters
@return mixed | [
"Delete",
"specific",
"documents",
"according",
"to",
"given",
"IDs"
] | b1e76cafaa9c7cc08d619c838c6208489e94565b | https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Collection.php#L443-L458 |
231,811 | kuzzleio/sdk-php | src/Collection.php | Collection.replaceDocument | public function replaceDocument($documentId, array $content, array $options = [])
{
$data = [
'_id' => $documentId,
'body' => $content
];
$response = $this->kuzzle->query(
$this->buildQueryArgs('document', 'createOrReplace'),
$this->kuzzle->addHeaders($data, $this->headers),
$options
);
$content = $response['result']['_source'];
$content['_version'] = $response['result']['_version'];
$meta = $response['result']['_meta'];
return new Document($this, $response['result']['_id'], $content, $meta);
} | php | public function replaceDocument($documentId, array $content, array $options = [])
{
$data = [
'_id' => $documentId,
'body' => $content
];
$response = $this->kuzzle->query(
$this->buildQueryArgs('document', 'createOrReplace'),
$this->kuzzle->addHeaders($data, $this->headers),
$options
);
$content = $response['result']['_source'];
$content['_version'] = $response['result']['_version'];
$meta = $response['result']['_meta'];
return new Document($this, $response['result']['_id'], $content, $meta);
} | [
"public",
"function",
"replaceDocument",
"(",
"$",
"documentId",
",",
"array",
"$",
"content",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"[",
"'_id'",
"=>",
"$",
"documentId",
",",
"'body'",
"=>",
"$",
"content",
"]",
"... | Replace an existing document with a new one.
@param string $documentId Unique document identifier
@param array $content Content of the document to create
@param array $options Optional parameters
@return Document | [
"Replace",
"an",
"existing",
"document",
"with",
"a",
"new",
"one",
"."
] | b1e76cafaa9c7cc08d619c838c6208489e94565b | https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Collection.php#L573-L591 |
231,812 | kuzzleio/sdk-php | src/Collection.php | Collection.scrollSpecifications | public function scrollSpecifications($scrollId, array $options = [])
{
if (!$scrollId) {
throw new \Exception('Collection.scrollSpecifications: scrollId is required');
}
$options['httpParams'] = [':scrollId' => $scrollId];
$data = [];
$response = $this->kuzzle->query(
$this->kuzzle->buildQueryArgs('collection', 'scrollSpecifications'),
$data,
$options
);
return $response['result'];
} | php | public function scrollSpecifications($scrollId, array $options = [])
{
if (!$scrollId) {
throw new \Exception('Collection.scrollSpecifications: scrollId is required');
}
$options['httpParams'] = [':scrollId' => $scrollId];
$data = [];
$response = $this->kuzzle->query(
$this->kuzzle->buildQueryArgs('collection', 'scrollSpecifications'),
$data,
$options
);
return $response['result'];
} | [
"public",
"function",
"scrollSpecifications",
"(",
"$",
"scrollId",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"scrollId",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Collection.scrollSpecifications: scrollId is required'... | Scrolls through specifications using the provided scrollId
@param string $scrollId
@param array $options Optional parameters
@return mixed
@throws \Exception | [
"Scrolls",
"through",
"specifications",
"using",
"the",
"provided",
"scrollId"
] | b1e76cafaa9c7cc08d619c838c6208489e94565b | https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Collection.php#L601-L618 |
231,813 | kuzzleio/sdk-php | src/Collection.php | Collection.setHeaders | public function setHeaders(array $headers, $replace = false)
{
if ($replace) {
$this->headers = $headers;
} else {
foreach ($headers as $key => $value) {
$this->headers[$key] = $value;
}
}
return $this;
} | php | public function setHeaders(array $headers, $replace = false)
{
if ($replace) {
$this->headers = $headers;
} else {
foreach ($headers as $key => $value) {
$this->headers[$key] = $value;
}
}
return $this;
} | [
"public",
"function",
"setHeaders",
"(",
"array",
"$",
"headers",
",",
"$",
"replace",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"replace",
")",
"{",
"$",
"this",
"->",
"headers",
"=",
"$",
"headers",
";",
"}",
"else",
"{",
"foreach",
"(",
"$",
"head... | This is a helper function returning itself, allowing to easily set headers while chaining calls.
@param array $headers New content
@param bool $replace true: replace the current content with the provided data, false: merge it
@return Collection | [
"This",
"is",
"a",
"helper",
"function",
"returning",
"itself",
"allowing",
"to",
"easily",
"set",
"headers",
"while",
"chaining",
"calls",
"."
] | b1e76cafaa9c7cc08d619c838c6208489e94565b | https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Collection.php#L649-L660 |
231,814 | kuzzleio/sdk-php | src/Collection.php | Collection.truncate | public function truncate(array $options = [])
{
$response = $this->kuzzle->query(
$this->buildQueryArgs('collection', 'truncate'),
$this->kuzzle->addHeaders([], $this->headers),
$options
);
return $response['result']['ids'];
} | php | public function truncate(array $options = [])
{
$response = $this->kuzzle->query(
$this->buildQueryArgs('collection', 'truncate'),
$this->kuzzle->addHeaders([], $this->headers),
$options
);
return $response['result']['ids'];
} | [
"public",
"function",
"truncate",
"(",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"kuzzle",
"->",
"query",
"(",
"$",
"this",
"->",
"buildQueryArgs",
"(",
"'collection'",
",",
"'truncate'",
")",
",",
"$",
... | Truncate the data collection,
removing all stored documents but keeping all associated mappings.
@param array $options Optional parameters
@return array ids of deleted documents | [
"Truncate",
"the",
"data",
"collection",
"removing",
"all",
"stored",
"documents",
"but",
"keeping",
"all",
"associated",
"mappings",
"."
] | b1e76cafaa9c7cc08d619c838c6208489e94565b | https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Collection.php#L669-L678 |
231,815 | kuzzleio/sdk-php | src/Collection.php | Collection.updateSpecifications | public function updateSpecifications($specifications, array $options = [])
{
$data = [
'body' => [
$this->index => [
$this->collection => $specifications
]
]
];
$response = $this->kuzzle->query(
$this->buildQueryArgs('collection', 'updateSpecifications'),
$this->kuzzle->addHeaders($data, $this->headers),
$options
);
return $response['result'];
} | php | public function updateSpecifications($specifications, array $options = [])
{
$data = [
'body' => [
$this->index => [
$this->collection => $specifications
]
]
];
$response = $this->kuzzle->query(
$this->buildQueryArgs('collection', 'updateSpecifications'),
$this->kuzzle->addHeaders($data, $this->headers),
$options
);
return $response['result'];
} | [
"public",
"function",
"updateSpecifications",
"(",
"$",
"specifications",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"[",
"'body'",
"=>",
"[",
"$",
"this",
"->",
"index",
"=>",
"[",
"$",
"this",
"->",
"collection",
"=>",
... | Updates the current specifications of this collection
@param array $specifications Specifications content
@param array $options Optional parameters
@return mixed | [
"Updates",
"the",
"current",
"specifications",
"of",
"this",
"collection"
] | b1e76cafaa9c7cc08d619c838c6208489e94565b | https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Collection.php#L723-L740 |
231,816 | praxisnetau/silverware | src/Sections/LayoutSection.php | LayoutSection.getPageLayout | public function getPageLayout()
{
if ($page = $this->getCurrentPage(Page::class)) {
return $page->getPageLayout();
}
return Page::create()->getPageLayout();
} | php | public function getPageLayout()
{
if ($page = $this->getCurrentPage(Page::class)) {
return $page->getPageLayout();
}
return Page::create()->getPageLayout();
} | [
"public",
"function",
"getPageLayout",
"(",
")",
"{",
"if",
"(",
"$",
"page",
"=",
"$",
"this",
"->",
"getCurrentPage",
"(",
"Page",
"::",
"class",
")",
")",
"{",
"return",
"$",
"page",
"->",
"getPageLayout",
"(",
")",
";",
"}",
"return",
"Page",
"::... | Answers the layout for the current page.
@return Layout | [
"Answers",
"the",
"layout",
"for",
"the",
"current",
"page",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Sections/LayoutSection.php#L133-L140 |
231,817 | praxisnetau/silverware | src/ORM/MultiClassObject.php | MultiClassObject.getClassNameOptions | protected function getClassNameOptions()
{
$hidden = [];
$classes = [];
foreach ($this->dbObject('ClassName')->enumValues() as $class) {
if ($class == self::class || !in_array($class, ClassInfo::subclassesFor($this))) {
continue;
}
if ($hide = Config::inst()->get($class, 'hide_ancestor')) {
$hidden[$hide] = true;
}
if (!$class::singleton()->canCreate()) {
continue;
}
$classes[$class] = $class::singleton()->i18n_singular_name();
}
foreach ($hidden as $class => $hide) {
unset($classes[$class]);
}
return $classes;
} | php | protected function getClassNameOptions()
{
$hidden = [];
$classes = [];
foreach ($this->dbObject('ClassName')->enumValues() as $class) {
if ($class == self::class || !in_array($class, ClassInfo::subclassesFor($this))) {
continue;
}
if ($hide = Config::inst()->get($class, 'hide_ancestor')) {
$hidden[$hide] = true;
}
if (!$class::singleton()->canCreate()) {
continue;
}
$classes[$class] = $class::singleton()->i18n_singular_name();
}
foreach ($hidden as $class => $hide) {
unset($classes[$class]);
}
return $classes;
} | [
"protected",
"function",
"getClassNameOptions",
"(",
")",
"{",
"$",
"hidden",
"=",
"[",
"]",
";",
"$",
"classes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"dbObject",
"(",
"'ClassName'",
")",
"->",
"enumValues",
"(",
")",
"as",
"$",
"cl... | Answers an array of options for the class name field.
@return array | [
"Answers",
"an",
"array",
"of",
"options",
"for",
"the",
"class",
"name",
"field",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/ORM/MultiClassObject.php#L189-L217 |
231,818 | praxisnetau/silverware | src/Grid/Framework.php | Framework.getStyle | public function getStyle($name, $subname = null)
{
$name = strtolower($name);
$subname = strtolower($subname);
if (strpos($name, '.') !== false && !$subname) {
list($name, $subname) = explode('.', $name);
}
if (($mappings = $this->getStyleMappings()) && isset($mappings[$name])) {
if (!$subname) {
$subname = $name;
}
if (is_array($mappings[$name])) {
return isset($mappings[$name][$subname]) ? $mappings[$name][$subname] : null;
} else {
return $mappings[$name];
}
}
return $name;
} | php | public function getStyle($name, $subname = null)
{
$name = strtolower($name);
$subname = strtolower($subname);
if (strpos($name, '.') !== false && !$subname) {
list($name, $subname) = explode('.', $name);
}
if (($mappings = $this->getStyleMappings()) && isset($mappings[$name])) {
if (!$subname) {
$subname = $name;
}
if (is_array($mappings[$name])) {
return isset($mappings[$name][$subname]) ? $mappings[$name][$subname] : null;
} else {
return $mappings[$name];
}
}
return $name;
} | [
"public",
"function",
"getStyle",
"(",
"$",
"name",
",",
"$",
"subname",
"=",
"null",
")",
"{",
"$",
"name",
"=",
"strtolower",
"(",
"$",
"name",
")",
";",
"$",
"subname",
"=",
"strtolower",
"(",
"$",
"subname",
")",
";",
"if",
"(",
"strpos",
"(",
... | Answers the style mapped to the given name.
@param string $name Name of style.
@param string $subname Subname of style (optional).
@return string | [
"Answers",
"the",
"style",
"mapped",
"to",
"the",
"given",
"name",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Grid/Framework.php#L110-L134 |
231,819 | praxisnetau/silverware | src/Grid/Framework.php | Framework.getStyles | public function getStyles($names = [])
{
$styles = [];
foreach ($names as $name) {
$styles[] = $this->getStyle($name);
}
return array_filter($styles);
} | php | public function getStyles($names = [])
{
$styles = [];
foreach ($names as $name) {
$styles[] = $this->getStyle($name);
}
return array_filter($styles);
} | [
"public",
"function",
"getStyles",
"(",
"$",
"names",
"=",
"[",
"]",
")",
"{",
"$",
"styles",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"names",
"as",
"$",
"name",
")",
"{",
"$",
"styles",
"[",
"]",
"=",
"$",
"this",
"->",
"getStyle",
"(",
"$",
... | Answers the styles mapped to the given names.
@param array $names Names of styles.
@return array | [
"Answers",
"the",
"styles",
"mapped",
"to",
"the",
"given",
"names",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Grid/Framework.php#L143-L152 |
231,820 | praxisnetau/silverware | src/Grid/Framework.php | Framework.getBreakpoint | public function getBreakpoint($viewport)
{
$viewport = strtolower($viewport);
if (($breakpoints = $this->getBreakpoints()) && isset($breakpoints[$viewport])) {
return $breakpoints[$viewport];
}
} | php | public function getBreakpoint($viewport)
{
$viewport = strtolower($viewport);
if (($breakpoints = $this->getBreakpoints()) && isset($breakpoints[$viewport])) {
return $breakpoints[$viewport];
}
} | [
"public",
"function",
"getBreakpoint",
"(",
"$",
"viewport",
")",
"{",
"$",
"viewport",
"=",
"strtolower",
"(",
"$",
"viewport",
")",
";",
"if",
"(",
"(",
"$",
"breakpoints",
"=",
"$",
"this",
"->",
"getBreakpoints",
"(",
")",
")",
"&&",
"isset",
"(",
... | Answers the breakpoint for the specified viewport.
@param string $viewport
@return string | [
"Answers",
"the",
"breakpoint",
"for",
"the",
"specified",
"viewport",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Grid/Framework.php#L161-L168 |
231,821 | praxisnetau/silverware | src/Grid/Framework.php | Framework.getColumnSizeOptions | public function getColumnSizeOptions($max = null)
{
return ArrayLib::valuekey(range(1, $max ? $max : $this->getNumberOfColumns()));
} | php | public function getColumnSizeOptions($max = null)
{
return ArrayLib::valuekey(range(1, $max ? $max : $this->getNumberOfColumns()));
} | [
"public",
"function",
"getColumnSizeOptions",
"(",
"$",
"max",
"=",
"null",
")",
"{",
"return",
"ArrayLib",
"::",
"valuekey",
"(",
"range",
"(",
"1",
",",
"$",
"max",
"?",
"$",
"max",
":",
"$",
"this",
"->",
"getNumberOfColumns",
"(",
")",
")",
")",
... | Answers an array of numeric options for column size fields.
@param integer $max Maximum number of columns (optional, defaults to number of columns from config).
@return array | [
"Answers",
"an",
"array",
"of",
"numeric",
"options",
"for",
"column",
"size",
"fields",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Grid/Framework.php#L207-L210 |
231,822 | praxisnetau/silverware | src/Dev/FixtureFactory.php | FixtureFactory.createObject | public function createObject($name, $identifier, $data = null, $filter = [])
{
// Create Object:
$object = $this->getBlueprintOrDefault($name)->createObject($identifier, $data, $this->fixtures, $filter);
// Answer Object:
return $object;
} | php | public function createObject($name, $identifier, $data = null, $filter = [])
{
// Create Object:
$object = $this->getBlueprintOrDefault($name)->createObject($identifier, $data, $this->fixtures, $filter);
// Answer Object:
return $object;
} | [
"public",
"function",
"createObject",
"(",
"$",
"name",
",",
"$",
"identifier",
",",
"$",
"data",
"=",
"null",
",",
"$",
"filter",
"=",
"[",
"]",
")",
"{",
"// Create Object:",
"$",
"object",
"=",
"$",
"this",
"->",
"getBlueprintOrDefault",
"(",
"$",
"... | Writes the fixture into the database using data objects.
@param string $name Class name (subclass of DataObject).
@param string $identifier Unique identifier for this fixture type.
@param array $data Optional map of properties which overrides the default data.
@param array $filter Optional map of properties to use as a filter.
@return DataObject | [
"Writes",
"the",
"fixture",
"into",
"the",
"database",
"using",
"data",
"objects",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureFactory.php#L55-L64 |
231,823 | praxisnetau/silverware | src/Dev/FixtureFactory.php | FixtureFactory.getBlueprintOrDefault | public function getBlueprintOrDefault($name)
{
if (!$this->getBlueprint($name)) {
$this->blueprints[$name] = $this->getDefaultBlueprint($name);
}
return $this->blueprints[$name]->setFactory($this);
} | php | public function getBlueprintOrDefault($name)
{
if (!$this->getBlueprint($name)) {
$this->blueprints[$name] = $this->getDefaultBlueprint($name);
}
return $this->blueprints[$name]->setFactory($this);
} | [
"public",
"function",
"getBlueprintOrDefault",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"getBlueprint",
"(",
"$",
"name",
")",
")",
"{",
"$",
"this",
"->",
"blueprints",
"[",
"$",
"name",
"]",
"=",
"$",
"this",
"->",
"getDefault... | Answers either an existing blueprint or a new instance of the default blueprint for the specified class.
@param string $name Class name (subclass of DataObject).
@return FixtureBlueprint | [
"Answers",
"either",
"an",
"existing",
"blueprint",
"or",
"a",
"new",
"instance",
"of",
"the",
"default",
"blueprint",
"for",
"the",
"specified",
"class",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureFactory.php#L73-L80 |
231,824 | praxisnetau/silverware | src/Dev/FixtureFactory.php | FixtureFactory.addFixture | public function addFixture($object, $identifier)
{
if (!isset($this->fixtures[get_class($object)])) {
$this->fixtures[get_class($object)] = [];
}
$this->fixtures[get_class($object)][$identifier] = $object->ID;
} | php | public function addFixture($object, $identifier)
{
if (!isset($this->fixtures[get_class($object)])) {
$this->fixtures[get_class($object)] = [];
}
$this->fixtures[get_class($object)][$identifier] = $object->ID;
} | [
"public",
"function",
"addFixture",
"(",
"$",
"object",
",",
"$",
"identifier",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"fixtures",
"[",
"get_class",
"(",
"$",
"object",
")",
"]",
")",
")",
"{",
"$",
"this",
"->",
"fixtures",
"["... | Adds the identifier and ID of the given object to the fixtures map.
@param DataObject $object
@param string $identifier
@return void | [
"Adds",
"the",
"identifier",
"and",
"ID",
"of",
"the",
"given",
"object",
"to",
"the",
"fixtures",
"map",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/FixtureFactory.php#L102-L109 |
231,825 | Josantonius/PHP-Database | src/Database.php | Database.getConnection | public static function getConnection(
$id,
$provider = null,
$host = null,
$user = null,
$name = null,
$password = null,
$settings = null
) {
if (isset(self::$conn[self::$id = $id])) {
return self::$conn[$id];
}
return self::$conn[$id] = new self(
$provider,
$host,
$user,
$name,
$password,
$settings
);
} | php | public static function getConnection(
$id,
$provider = null,
$host = null,
$user = null,
$name = null,
$password = null,
$settings = null
) {
if (isset(self::$conn[self::$id = $id])) {
return self::$conn[$id];
}
return self::$conn[$id] = new self(
$provider,
$host,
$user,
$name,
$password,
$settings
);
} | [
"public",
"static",
"function",
"getConnection",
"(",
"$",
"id",
",",
"$",
"provider",
"=",
"null",
",",
"$",
"host",
"=",
"null",
",",
"$",
"user",
"=",
"null",
",",
"$",
"name",
"=",
"null",
",",
"$",
"password",
"=",
"null",
",",
"$",
"settings"... | Get connection.
Create a new if it doesn't exist or another provider is used.
@param string $id → identifying name for the database
@param string $provider → name of provider class
@param string $host → database host
@param string $user → database user
@param string $name → database name
@param string $password → database password
@param array $settings → database options
@param string $settings['port'] → database port
@param string $settings['charset'] → database charset
@return object → object with the connection | [
"Get",
"connection",
"."
] | 8f68e1d49bde6071fed92f8d162a86bb78867975 | https://github.com/Josantonius/PHP-Database/blob/8f68e1d49bde6071fed92f8d162a86bb78867975/src/Database.php#L160-L181 |
231,826 | Josantonius/PHP-Database | src/Database.php | Database.query | public function query($query, $statements = null, $result = 'obj')
{
$this->settings['type'] = trim(explode(' ', $query)[0]);
$this->query = $query;
$this->settings['result'] = $result;
$this->settings['statements'] = $statements;
$types = '|SELECT|INSERT|UPDATE|DELETE|CREATE|TRUNCATE|DROP|';
if (! strpos($types, $this->settings['type'])) {
throw new DBException(
'Unknown query type:' . $this->settings['type']
);
}
$this->implement();
return $this->getResponse();
} | php | public function query($query, $statements = null, $result = 'obj')
{
$this->settings['type'] = trim(explode(' ', $query)[0]);
$this->query = $query;
$this->settings['result'] = $result;
$this->settings['statements'] = $statements;
$types = '|SELECT|INSERT|UPDATE|DELETE|CREATE|TRUNCATE|DROP|';
if (! strpos($types, $this->settings['type'])) {
throw new DBException(
'Unknown query type:' . $this->settings['type']
);
}
$this->implement();
return $this->getResponse();
} | [
"public",
"function",
"query",
"(",
"$",
"query",
",",
"$",
"statements",
"=",
"null",
",",
"$",
"result",
"=",
"'obj'",
")",
"{",
"$",
"this",
"->",
"settings",
"[",
"'type'",
"]",
"=",
"trim",
"(",
"explode",
"(",
"' '",
",",
"$",
"query",
")",
... | Process query and prepare it for the provider.
@param string $query → query
@param array $statements → null by default or array for statements
@param string $result → 'obj' → result as object
→ 'array_num' → result as numeric array
→ 'array_assoc' → result as associative array
→ 'rows' → affected rows number
→ 'id' → last insert id
@throws DBException → invalid query type
@return mixed → result as object, array, int... | [
"Process",
"query",
"and",
"prepare",
"it",
"for",
"the",
"provider",
"."
] | 8f68e1d49bde6071fed92f8d162a86bb78867975 | https://github.com/Josantonius/PHP-Database/blob/8f68e1d49bde6071fed92f8d162a86bb78867975/src/Database.php#L199-L219 |
231,827 | Josantonius/PHP-Database | src/Database.php | Database.where | public function where($clauses, $statements = null)
{
$this->settings['where'] = $clauses;
if (is_array($this->settings['statements'])) {
$this->settings['statements'] = array_merge(
$this->settings['statements'],
$statements
);
} else {
$this->settings['statements'] = $statements;
}
return $this;
} | php | public function where($clauses, $statements = null)
{
$this->settings['where'] = $clauses;
if (is_array($this->settings['statements'])) {
$this->settings['statements'] = array_merge(
$this->settings['statements'],
$statements
);
} else {
$this->settings['statements'] = $statements;
}
return $this;
} | [
"public",
"function",
"where",
"(",
"$",
"clauses",
",",
"$",
"statements",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"settings",
"[",
"'where'",
"]",
"=",
"$",
"clauses",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"settings",
"[",
"'stateme... | Where clauses.
@param mixed $clauses → column name and value
@param array $statements → null by default or array for statements
@return object | [
"Where",
"clauses",
"."
] | 8f68e1d49bde6071fed92f8d162a86bb78867975 | https://github.com/Josantonius/PHP-Database/blob/8f68e1d49bde6071fed92f8d162a86bb78867975/src/Database.php#L482-L496 |
231,828 | Josantonius/PHP-Database | src/Database.php | Database.execute | public function execute($result = 'obj')
{
$this->settings['result'] = $result;
$type = strtolower($this->settings['type']);
switch ($this->settings['type']) {
case 'SELECT':
$params = [
$this->settings['columns'],
$this->settings['table'],
$this->settings['where'],
$this->settings['order'],
$this->settings['limit'],
$this->settings['statements'],
$this->settings['result'],
];
break;
case 'INSERT':
$params = [
$this->settings['table'],
$this->settings['data'],
$this->settings['statements'],
];
break;
case 'UPDATE':
$params = [
$this->settings['table'],
$this->settings['data'],
$this->settings['statements'],
$this->settings['where'],
];
break;
case 'REPLACE':
$params = [
$this->settings['table'],
$this->settings['data'],
$this->settings['statements'],
];
break;
case 'DELETE':
$params = [
$this->settings['table'],
$this->settings['statements'],
$this->settings['where'],
];
break;
case 'CREATE':
$params = [
$this->settings['table'],
$this->settings['data'],
$this->settings['foreing'],
$this->settings['reference'],
$this->settings['on'],
$this->settings['actions'],
$this->settings['engine'],
$this->settings['charset'],
];
break;
case 'TRUNCATE':
$params = [
$this->settings['table'],
];
break;
case 'DROP':
$params = [
$this->settings['table'],
];
break;
}
$provider = [$this->provider, $type];
$this->response = call_user_func_array($provider, $params);
$this->reset();
return $this->getResponse();
} | php | public function execute($result = 'obj')
{
$this->settings['result'] = $result;
$type = strtolower($this->settings['type']);
switch ($this->settings['type']) {
case 'SELECT':
$params = [
$this->settings['columns'],
$this->settings['table'],
$this->settings['where'],
$this->settings['order'],
$this->settings['limit'],
$this->settings['statements'],
$this->settings['result'],
];
break;
case 'INSERT':
$params = [
$this->settings['table'],
$this->settings['data'],
$this->settings['statements'],
];
break;
case 'UPDATE':
$params = [
$this->settings['table'],
$this->settings['data'],
$this->settings['statements'],
$this->settings['where'],
];
break;
case 'REPLACE':
$params = [
$this->settings['table'],
$this->settings['data'],
$this->settings['statements'],
];
break;
case 'DELETE':
$params = [
$this->settings['table'],
$this->settings['statements'],
$this->settings['where'],
];
break;
case 'CREATE':
$params = [
$this->settings['table'],
$this->settings['data'],
$this->settings['foreing'],
$this->settings['reference'],
$this->settings['on'],
$this->settings['actions'],
$this->settings['engine'],
$this->settings['charset'],
];
break;
case 'TRUNCATE':
$params = [
$this->settings['table'],
];
break;
case 'DROP':
$params = [
$this->settings['table'],
];
break;
}
$provider = [$this->provider, $type];
$this->response = call_user_func_array($provider, $params);
$this->reset();
return $this->getResponse();
} | [
"public",
"function",
"execute",
"(",
"$",
"result",
"=",
"'obj'",
")",
"{",
"$",
"this",
"->",
"settings",
"[",
"'result'",
"]",
"=",
"$",
"result",
";",
"$",
"type",
"=",
"strtolower",
"(",
"$",
"this",
"->",
"settings",
"[",
"'type'",
"]",
")",
... | Execute query.
@param string $result → 'obj' → result as object
→ 'array_num' → result as numeric array
→ 'array_assoc' → result as associative array
→ 'rows' → affected rows number
→ 'id' → last insert id
@return int → number of lines updated or 0 if not updated | [
"Execute",
"query",
"."
] | 8f68e1d49bde6071fed92f8d162a86bb78867975 | https://github.com/Josantonius/PHP-Database/blob/8f68e1d49bde6071fed92f8d162a86bb78867975/src/Database.php#L537-L615 |
231,829 | Josantonius/PHP-Database | src/Database.php | Database.implementPrepareStatements | private function implementPrepareStatements()
{
$this->response = $this->provider->statements(
$this->query,
$this->settings['statements']
);
} | php | private function implementPrepareStatements()
{
$this->response = $this->provider->statements(
$this->query,
$this->settings['statements']
);
} | [
"private",
"function",
"implementPrepareStatements",
"(",
")",
"{",
"$",
"this",
"->",
"response",
"=",
"$",
"this",
"->",
"provider",
"->",
"statements",
"(",
"$",
"this",
"->",
"query",
",",
"$",
"this",
"->",
"settings",
"[",
"'statements'",
"]",
")",
... | Run query with prepared statements. | [
"Run",
"query",
"with",
"prepared",
"statements",
"."
] | 8f68e1d49bde6071fed92f8d162a86bb78867975 | https://github.com/Josantonius/PHP-Database/blob/8f68e1d49bde6071fed92f8d162a86bb78867975/src/Database.php#L634-L640 |
231,830 | Josantonius/PHP-Database | src/Database.php | Database.implementQuery | private function implementQuery()
{
$this->response = $this->provider->query(
$this->query,
$this->settings['type']
);
} | php | private function implementQuery()
{
$this->response = $this->provider->query(
$this->query,
$this->settings['type']
);
} | [
"private",
"function",
"implementQuery",
"(",
")",
"{",
"$",
"this",
"->",
"response",
"=",
"$",
"this",
"->",
"provider",
"->",
"query",
"(",
"$",
"this",
"->",
"query",
",",
"$",
"this",
"->",
"settings",
"[",
"'type'",
"]",
")",
";",
"}"
] | Run query without prepared statements. | [
"Run",
"query",
"without",
"prepared",
"statements",
"."
] | 8f68e1d49bde6071fed92f8d162a86bb78867975 | https://github.com/Josantonius/PHP-Database/blob/8f68e1d49bde6071fed92f8d162a86bb78867975/src/Database.php#L645-L651 |
231,831 | Josantonius/PHP-Database | src/Database.php | Database.getResponse | private function getResponse()
{
$this->lastInsertId = $this->provider->lastInsertId();
$this->rowCount = $this->provider->rowCount($this->response);
if (is_null($this->response)) {
throw new DBException(
'Error executing the query ' . $this->provider->getError()
);
}
return $this->fetchResponse();
} | php | private function getResponse()
{
$this->lastInsertId = $this->provider->lastInsertId();
$this->rowCount = $this->provider->rowCount($this->response);
if (is_null($this->response)) {
throw new DBException(
'Error executing the query ' . $this->provider->getError()
);
}
return $this->fetchResponse();
} | [
"private",
"function",
"getResponse",
"(",
")",
"{",
"$",
"this",
"->",
"lastInsertId",
"=",
"$",
"this",
"->",
"provider",
"->",
"lastInsertId",
"(",
")",
";",
"$",
"this",
"->",
"rowCount",
"=",
"$",
"this",
"->",
"provider",
"->",
"rowCount",
"(",
"... | Get response after executing the query.
@throws DBException → error executing query
@return mixed → result as object, array, int... | [
"Get",
"response",
"after",
"executing",
"the",
"query",
"."
] | 8f68e1d49bde6071fed92f8d162a86bb78867975 | https://github.com/Josantonius/PHP-Database/blob/8f68e1d49bde6071fed92f8d162a86bb78867975/src/Database.php#L660-L673 |
231,832 | Josantonius/PHP-Database | src/Database.php | Database.reset | private function reset()
{
$this->settings['columns'] = null;
$this->settings['table'] = null;
$this->settings['where'] = null;
$this->settings['order'] = null;
$this->settings['limit'] = null;
$this->settings['statements'] = null;
$this->settings['foreing'] = null;
$this->settings['reference'] = null;
$this->settings['on'] = null;
$this->settings['actions'] = null;
$this->settings['engine'] = null;
$this->settings['charset'] = null;
} | php | private function reset()
{
$this->settings['columns'] = null;
$this->settings['table'] = null;
$this->settings['where'] = null;
$this->settings['order'] = null;
$this->settings['limit'] = null;
$this->settings['statements'] = null;
$this->settings['foreing'] = null;
$this->settings['reference'] = null;
$this->settings['on'] = null;
$this->settings['actions'] = null;
$this->settings['engine'] = null;
$this->settings['charset'] = null;
} | [
"private",
"function",
"reset",
"(",
")",
"{",
"$",
"this",
"->",
"settings",
"[",
"'columns'",
"]",
"=",
"null",
";",
"$",
"this",
"->",
"settings",
"[",
"'table'",
"]",
"=",
"null",
";",
"$",
"this",
"->",
"settings",
"[",
"'where'",
"]",
"=",
"n... | Reset query parameters. | [
"Reset",
"query",
"parameters",
"."
] | 8f68e1d49bde6071fed92f8d162a86bb78867975 | https://github.com/Josantonius/PHP-Database/blob/8f68e1d49bde6071fed92f8d162a86bb78867975/src/Database.php#L708-L722 |
231,833 | evercode1/view-maker | src/WritesViewFiles.php | WritesViewFiles.makeViewDirectory | private function makeViewDirectory()
{
if (file_exists(base_path($this->folderPath)))
{
$this->error($this->theModel. ' folder already exists!');
die();
}
mkdir(base_path($this->folderPath));
return $this;
} | php | private function makeViewDirectory()
{
if (file_exists(base_path($this->folderPath)))
{
$this->error($this->theModel. ' folder already exists!');
die();
}
mkdir(base_path($this->folderPath));
return $this;
} | [
"private",
"function",
"makeViewDirectory",
"(",
")",
"{",
"if",
"(",
"file_exists",
"(",
"base_path",
"(",
"$",
"this",
"->",
"folderPath",
")",
")",
")",
"{",
"$",
"this",
"->",
"error",
"(",
"$",
"this",
"->",
"theModel",
".",
"' folder already exists!'... | make view directory | [
"make",
"view",
"directory"
] | 033705485894d1eb5d2f3151e679d45bb2ad0bfc | https://github.com/evercode1/view-maker/blob/033705485894d1eb5d2f3151e679d45bb2ad0bfc/src/WritesViewFiles.php#L10-L26 |
231,834 | evercode1/view-maker | src/WritesViewFiles.php | WritesViewFiles.makeViewFiles | private function makeViewFiles($templateType)
{
switch($templateType){
case 'plain' :
return $this->makeFiles('plain');
break;
case 'basic' :
return $this->makeFiles('basic');
break;
case 'dt' :
return $this->makeFiles('dt');
break;
case 'vue' :
return $this->makeFiles('vue');
break;
default:
$this->error($templateType . ' is not a valid type');
die();
}
} | php | private function makeViewFiles($templateType)
{
switch($templateType){
case 'plain' :
return $this->makeFiles('plain');
break;
case 'basic' :
return $this->makeFiles('basic');
break;
case 'dt' :
return $this->makeFiles('dt');
break;
case 'vue' :
return $this->makeFiles('vue');
break;
default:
$this->error($templateType . ' is not a valid type');
die();
}
} | [
"private",
"function",
"makeViewFiles",
"(",
"$",
"templateType",
")",
"{",
"switch",
"(",
"$",
"templateType",
")",
"{",
"case",
"'plain'",
":",
"return",
"$",
"this",
"->",
"makeFiles",
"(",
"'plain'",
")",
";",
"break",
";",
"case",
"'basic'",
":",
"r... | make view files based on type, plain, basic or dt | [
"make",
"view",
"files",
"based",
"on",
"type",
"plain",
"basic",
"or",
"dt"
] | 033705485894d1eb5d2f3151e679d45bb2ad0bfc | https://github.com/evercode1/view-maker/blob/033705485894d1eb5d2f3151e679d45bb2ad0bfc/src/WritesViewFiles.php#L31-L69 |
231,835 | praxisnetau/silverware | src/View/GridAware.php | GridAware.styles | public function styles()
{
// Obtain Arguments:
$args = func_get_args();
// Array Argument Passed?
if (is_array($args[0])) {
// Obtain Styles:
$styles = $this->grid()->getStyles($args[0]);
// Answer as Array or String? (2nd param is true)
return (isset($args[1]) && $args[1]) ? ViewTools::singleton()->array2att($styles) : $styles;
}
// Answer Styles Array:
return $this->grid()->getStyles($args);
} | php | public function styles()
{
// Obtain Arguments:
$args = func_get_args();
// Array Argument Passed?
if (is_array($args[0])) {
// Obtain Styles:
$styles = $this->grid()->getStyles($args[0]);
// Answer as Array or String? (2nd param is true)
return (isset($args[1]) && $args[1]) ? ViewTools::singleton()->array2att($styles) : $styles;
}
// Answer Styles Array:
return $this->grid()->getStyles($args);
} | [
"public",
"function",
"styles",
"(",
")",
"{",
"// Obtain Arguments:",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"// Array Argument Passed?",
"if",
"(",
"is_array",
"(",
"$",
"args",
"[",
"0",
"]",
")",
")",
"{",
"// Obtain Styles:",
"$",
"styles",
... | Answers the styles mapped to the given names from the grid framework.
@return array|string | [
"Answers",
"the",
"styles",
"mapped",
"to",
"the",
"given",
"names",
"from",
"the",
"grid",
"framework",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/View/GridAware.php#L62-L85 |
231,836 | i-am-tom/schemer | src/Validator/ValidatorAbstract.php | ValidatorAbstract.pipe | protected function pipe(callable $validator) : ValidatorAbstract
{
$that = clone $this; // Immutability!
array_push($that->restrictions, $validator);
return $that;
} | php | protected function pipe(callable $validator) : ValidatorAbstract
{
$that = clone $this; // Immutability!
array_push($that->restrictions, $validator);
return $that;
} | [
"protected",
"function",
"pipe",
"(",
"callable",
"$",
"validator",
")",
":",
"ValidatorAbstract",
"{",
"$",
"that",
"=",
"clone",
"$",
"this",
";",
"// Immutability!",
"array_push",
"(",
"$",
"that",
"->",
"restrictions",
",",
"$",
"validator",
")",
";",
... | Add another validator to the restrictions.
@param callable $validator The validator to add.
@return Schemer\Validator\ValidatorAbstract | [
"Add",
"another",
"validator",
"to",
"the",
"restrictions",
"."
] | aa4ff458eae636ca61ada07d05859e27d3b4584d | https://github.com/i-am-tom/schemer/blob/aa4ff458eae636ca61ada07d05859e27d3b4584d/src/Validator/ValidatorAbstract.php#L23-L29 |
231,837 | i-am-tom/schemer | src/Validator/ValidatorAbstract.php | ValidatorAbstract.predicate | protected static function predicate(
callable $predicate,
string $error
) : callable {
return function ($value) use ($predicate, $error) : Result {
return $predicate($value)
? Result::success()
: Result::failure($error);
};
} | php | protected static function predicate(
callable $predicate,
string $error
) : callable {
return function ($value) use ($predicate, $error) : Result {
return $predicate($value)
? Result::success()
: Result::failure($error);
};
} | [
"protected",
"static",
"function",
"predicate",
"(",
"callable",
"$",
"predicate",
",",
"string",
"$",
"error",
")",
":",
"callable",
"{",
"return",
"function",
"(",
"$",
"value",
")",
"use",
"(",
"$",
"predicate",
",",
"$",
"error",
")",
":",
"Result",
... | Create a restriction from a boolean predicate.
@param callable $predicate True/false-yielding function.
@param string $error The failure error to use.
@return callable A restriction to pipe. | [
"Create",
"a",
"restriction",
"from",
"a",
"boolean",
"predicate",
"."
] | aa4ff458eae636ca61ada07d05859e27d3b4584d | https://github.com/i-am-tom/schemer/blob/aa4ff458eae636ca61ada07d05859e27d3b4584d/src/Validator/ValidatorAbstract.php#L37-L46 |
231,838 | i-am-tom/schemer | src/Validator/ValidatorAbstract.php | ValidatorAbstract.should | public function should(
callable $validator,
string $error = 'unsatisfied predicate'
) : ValidatorAbstract {
return $this->pipe(self::predicate($validator, $error));
} | php | public function should(
callable $validator,
string $error = 'unsatisfied predicate'
) : ValidatorAbstract {
return $this->pipe(self::predicate($validator, $error));
} | [
"public",
"function",
"should",
"(",
"callable",
"$",
"validator",
",",
"string",
"$",
"error",
"=",
"'unsatisfied predicate'",
")",
":",
"ValidatorAbstract",
"{",
"return",
"$",
"this",
"->",
"pipe",
"(",
"self",
"::",
"predicate",
"(",
"$",
"validator",
",... | The value will be checked against a custom predicate.
@param callable $predicate The predicate.
@param string $error A custom error.
@return ValidatorAbstract | [
"The",
"value",
"will",
"be",
"checked",
"against",
"a",
"custom",
"predicate",
"."
] | aa4ff458eae636ca61ada07d05859e27d3b4584d | https://github.com/i-am-tom/schemer/blob/aa4ff458eae636ca61ada07d05859e27d3b4584d/src/Validator/ValidatorAbstract.php#L71-L76 |
231,839 | i-am-tom/schemer | src/Validator/ValidatorAbstract.php | ValidatorAbstract.validate | public function validate($value) : Result
{
return array_reduce(
$this->restrictions,
function ($result, $restriction) use ($value) : Result {
if ($result->isFatal()) {
return $result;
}
return $result->concat($restriction($value));
},
Result::success()
);
} | php | public function validate($value) : Result
{
return array_reduce(
$this->restrictions,
function ($result, $restriction) use ($value) : Result {
if ($result->isFatal()) {
return $result;
}
return $result->concat($restriction($value));
},
Result::success()
);
} | [
"public",
"function",
"validate",
"(",
"$",
"value",
")",
":",
"Result",
"{",
"return",
"array_reduce",
"(",
"$",
"this",
"->",
"restrictions",
",",
"function",
"(",
"$",
"result",
",",
"$",
"restriction",
")",
"use",
"(",
"$",
"value",
")",
":",
"Resu... | Execute the validation functions.
@param $value The value to validate.
@return Schemer\Result The validation result. | [
"Execute",
"the",
"validation",
"functions",
"."
] | aa4ff458eae636ca61ada07d05859e27d3b4584d | https://github.com/i-am-tom/schemer/blob/aa4ff458eae636ca61ada07d05859e27d3b4584d/src/Validator/ValidatorAbstract.php#L96-L109 |
231,840 | kuzzleio/sdk-php | src/Security/User.php | User.getProfiles | public function getProfiles()
{
if (!array_key_exists('profileIds', $this->content)) {
return [];
}
$profiles = [];
foreach ($this->content['profileIds'] as $profileId) {
$profiles[] = $this->security->fetchProfile($profileId);
}
return $profiles;
} | php | public function getProfiles()
{
if (!array_key_exists('profileIds', $this->content)) {
return [];
}
$profiles = [];
foreach ($this->content['profileIds'] as $profileId) {
$profiles[] = $this->security->fetchProfile($profileId);
}
return $profiles;
} | [
"public",
"function",
"getProfiles",
"(",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'profileIds'",
",",
"$",
"this",
"->",
"content",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"profiles",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"... | Returns this user associated profiles.
@return Profile[] | [
"Returns",
"this",
"user",
"associated",
"profiles",
"."
] | b1e76cafaa9c7cc08d619c838c6208489e94565b | https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Security/User.php#L46-L59 |
231,841 | kuzzleio/sdk-php | src/Security/User.php | User.setProfiles | public function setProfiles($profiles)
{
$profileIds = [];
foreach ($profiles as $profile) {
$profileIds[] = $this->extractProfileId($profile);
}
$this->content['profileIds'] = $profileIds;
return $this;
} | php | public function setProfiles($profiles)
{
$profileIds = [];
foreach ($profiles as $profile) {
$profileIds[] = $this->extractProfileId($profile);
}
$this->content['profileIds'] = $profileIds;
return $this;
} | [
"public",
"function",
"setProfiles",
"(",
"$",
"profiles",
")",
"{",
"$",
"profileIds",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"profiles",
"as",
"$",
"profile",
")",
"{",
"$",
"profileIds",
"[",
"]",
"=",
"$",
"this",
"->",
"extractProfileId",
"(",
... | Replaces the profiles associated to this user.
@param string[]|Profile[] $profiles Unique ids or Kuzzle\Security\Profile instances corresponding to the new associated profiles
@return $this | [
"Replaces",
"the",
"profiles",
"associated",
"to",
"this",
"user",
"."
] | b1e76cafaa9c7cc08d619c838c6208489e94565b | https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Security/User.php#L80-L91 |
231,842 | kuzzleio/sdk-php | src/Security/User.php | User.addProfile | public function addProfile($profile)
{
if (!array_key_exists('profileIds', $this->content)) {
$this->content['profileIds'] = [];
}
$this->content['profileIds'][] = $this->extractProfileId($profile);
return $this;
} | php | public function addProfile($profile)
{
if (!array_key_exists('profileIds', $this->content)) {
$this->content['profileIds'] = [];
}
$this->content['profileIds'][] = $this->extractProfileId($profile);
return $this;
} | [
"public",
"function",
"addProfile",
"(",
"$",
"profile",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'profileIds'",
",",
"$",
"this",
"->",
"content",
")",
")",
"{",
"$",
"this",
"->",
"content",
"[",
"'profileIds'",
"]",
"=",
"[",
"]",
";",
... | Add a profile to this user.
@param string|Profile $profile Unique id or Kuzzle\Security\Profile instances corresponding to the new associated profile
@return $this | [
"Add",
"a",
"profile",
"to",
"this",
"user",
"."
] | b1e76cafaa9c7cc08d619c838c6208489e94565b | https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Security/User.php#L99-L108 |
231,843 | wallstreetio/ontraport | src/Clients/CurlClient.php | CurlClient.request | public function request($method, $uri, array $data = array())
{
$path = $this->path() . '/' . trim($uri, '/');
$session = curl_init();
// Curious as why i have to do this
if ($method === 'PUT') {
curl_setopt($session, CURLOPT_POSTFIELDS, http_build_query($data));
} else {
$path .= '?' . http_build_query($data);
}
curl_setopt($session, CURLOPT_HEADER, true);
curl_setopt($session, CURLOPT_HTTPHEADER, $this->defaultHeaders());
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
curl_setopt($session, CURLOPT_POST, $method !== 'GET');
curl_setopt($session, CURLOPT_URL, $path);
curl_setopt($session, CURLOPT_CUSTOMREQUEST, $method);
$response = curl_exec($session);
$statusCode = curl_getinfo($session, CURLINFO_HTTP_CODE);
$headerSize = curl_getinfo($session, CURLINFO_HEADER_SIZE);
$body = substr($response, $headerSize);
if ($statusCode !== 200) {
throw new InvalidRequest($body);
}
curl_close($session);
return json_decode($body, true);
} | php | public function request($method, $uri, array $data = array())
{
$path = $this->path() . '/' . trim($uri, '/');
$session = curl_init();
// Curious as why i have to do this
if ($method === 'PUT') {
curl_setopt($session, CURLOPT_POSTFIELDS, http_build_query($data));
} else {
$path .= '?' . http_build_query($data);
}
curl_setopt($session, CURLOPT_HEADER, true);
curl_setopt($session, CURLOPT_HTTPHEADER, $this->defaultHeaders());
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
curl_setopt($session, CURLOPT_POST, $method !== 'GET');
curl_setopt($session, CURLOPT_URL, $path);
curl_setopt($session, CURLOPT_CUSTOMREQUEST, $method);
$response = curl_exec($session);
$statusCode = curl_getinfo($session, CURLINFO_HTTP_CODE);
$headerSize = curl_getinfo($session, CURLINFO_HEADER_SIZE);
$body = substr($response, $headerSize);
if ($statusCode !== 200) {
throw new InvalidRequest($body);
}
curl_close($session);
return json_decode($body, true);
} | [
"public",
"function",
"request",
"(",
"$",
"method",
",",
"$",
"uri",
",",
"array",
"$",
"data",
"=",
"array",
"(",
")",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"path",
"(",
")",
".",
"'/'",
".",
"trim",
"(",
"$",
"uri",
",",
"'/'",
")... | Send an API request to Ontraport.
@see https://github.com/Ontraport/ontra_api_examples/blob/master/contacts_add_contact.php
@param string $method
@param string $uri
@param array $data
@return array | [
"Send",
"an",
"API",
"request",
"to",
"Ontraport",
"."
] | 55467fd63637083f76e497897af4aee13fc2c8b1 | https://github.com/wallstreetio/ontraport/blob/55467fd63637083f76e497897af4aee13fc2c8b1/src/Clients/CurlClient.php#L53-L85 |
231,844 | volumnet/bitrix24 | src/Webhook.php | Webhook.method | public function method($methodName, array $data = array())
{
$curl = new CURL();
$url = $this->url . $methodName . '.json';
$result = $curl->getURL($url, $data);
$json = json_decode($result);
if (!$result) {
throw new Exception('No response retrieved');
} elseif (!$json) {
throw new Exception('Cannot parse JSON');
} elseif ($json->error) {
throw new Exception($result);
}
return $json;
} | php | public function method($methodName, array $data = array())
{
$curl = new CURL();
$url = $this->url . $methodName . '.json';
$result = $curl->getURL($url, $data);
$json = json_decode($result);
if (!$result) {
throw new Exception('No response retrieved');
} elseif (!$json) {
throw new Exception('Cannot parse JSON');
} elseif ($json->error) {
throw new Exception($result);
}
return $json;
} | [
"public",
"function",
"method",
"(",
"$",
"methodName",
",",
"array",
"$",
"data",
"=",
"array",
"(",
")",
")",
"{",
"$",
"curl",
"=",
"new",
"CURL",
"(",
")",
";",
"$",
"url",
"=",
"$",
"this",
"->",
"url",
".",
"$",
"methodName",
".",
"'.json'"... | Calls certain method
@param string $methodName Method name, without transport extension (i.e. .xml or .json)
@param array $data Method data
@return mixed Parsed data from method
@throws Exception Exception with error response from the method | [
"Calls",
"certain",
"method"
] | 06d997db456791227c9adb94a55a2b513baca403 | https://github.com/volumnet/bitrix24/blob/06d997db456791227c9adb94a55a2b513baca403/src/Webhook.php#L42-L56 |
231,845 | php-fp/php-fp-either | src/Either.php | Either.tryCatch | final public static function tryCatch(callable $f) : Either
{
try {
return self::of($f());
} catch (\Exception $e) {
return self::left($e);
}
} | php | final public static function tryCatch(callable $f) : Either
{
try {
return self::of($f());
} catch (\Exception $e) {
return self::left($e);
}
} | [
"final",
"public",
"static",
"function",
"tryCatch",
"(",
"callable",
"$",
"f",
")",
":",
"Either",
"{",
"try",
"{",
"return",
"self",
"::",
"of",
"(",
"$",
"f",
"(",
")",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"retur... | Capture an exception-throwing function in an Either.
@param callable $f The exception-throwing function.
@return Either Right (with success), or Left (with exception). | [
"Capture",
"an",
"exception",
"-",
"throwing",
"function",
"in",
"an",
"Either",
"."
] | 48c81c055cf08fbdb8c9de41a678fbb83a3d9c72 | https://github.com/php-fp/php-fp-either/blob/48c81c055cf08fbdb8c9de41a678fbb83a3d9c72/src/Either.php#L47-L54 |
231,846 | stratifyphp/router | src/Route/RouteBuilder.php | RouteBuilder.method | public function method(string ...$methods) : RouteBuilder
{
foreach ($this->routes as $route) {
$route->allows($methods);
}
return $this;
} | php | public function method(string ...$methods) : RouteBuilder
{
foreach ($this->routes as $route) {
$route->allows($methods);
}
return $this;
} | [
"public",
"function",
"method",
"(",
"string",
"...",
"$",
"methods",
")",
":",
"RouteBuilder",
"{",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
"{",
"$",
"route",
"->",
"allows",
"(",
"$",
"methods",
")",
";",
"}",
"return"... | Set HTTP methods accepted for this route.
Example:
->method('GET')
->method('GET', 'POST') | [
"Set",
"HTTP",
"methods",
"accepted",
"for",
"this",
"route",
"."
] | 5026d54c7f7a18c83e942f42e8da001e6e2f180f | https://github.com/stratifyphp/router/blob/5026d54c7f7a18c83e942f42e8da001e6e2f180f/src/Route/RouteBuilder.php#L76-L82 |
231,847 | stratifyphp/router | src/Route/RouteBuilder.php | RouteBuilder.optional | public function optional(string $parameter, string $defaultValue) : RouteBuilder
{
foreach ($this->routes as $route) {
$route->tokens([
$parameter => '([^/]+)?',
]);
$route->defaults([
$parameter => $defaultValue,
]);
}
return $this;
} | php | public function optional(string $parameter, string $defaultValue) : RouteBuilder
{
foreach ($this->routes as $route) {
$route->tokens([
$parameter => '([^/]+)?',
]);
$route->defaults([
$parameter => $defaultValue,
]);
}
return $this;
} | [
"public",
"function",
"optional",
"(",
"string",
"$",
"parameter",
",",
"string",
"$",
"defaultValue",
")",
":",
"RouteBuilder",
"{",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
"{",
"$",
"route",
"->",
"tokens",
"(",
"[",
"$"... | Mark a path parameter as optional.
- sets the following pattern for the parameter: `([^/]+)?`
- sets the provided default value
**Warning:** if you set a custom pattern for the parameter, it will be replaced
to be `([^/]+)?`.
Example for "/blog/article.{format}":
->optional('format', 'json') | [
"Mark",
"a",
"path",
"parameter",
"as",
"optional",
"."
] | 5026d54c7f7a18c83e942f42e8da001e6e2f180f | https://github.com/stratifyphp/router/blob/5026d54c7f7a18c83e942f42e8da001e6e2f180f/src/Route/RouteBuilder.php#L97-L108 |
231,848 | stratifyphp/router | src/Route/RouteBuilder.php | RouteBuilder.secure | public function secure(bool $secure = true) : RouteBuilder
{
foreach ($this->routes as $route) {
$route->secure($secure);
}
return $this;
} | php | public function secure(bool $secure = true) : RouteBuilder
{
foreach ($this->routes as $route) {
$route->secure($secure);
}
return $this;
} | [
"public",
"function",
"secure",
"(",
"bool",
"$",
"secure",
"=",
"true",
")",
":",
"RouteBuilder",
"{",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
"{",
"$",
"route",
"->",
"secure",
"(",
"$",
"secure",
")",
";",
"}",
"ret... | Set whether or not the route must use HTTPS.
If set to true, the request must be an HTTPS request;
if false, it must *not* be HTTPS.
Example:
->secure() | [
"Set",
"whether",
"or",
"not",
"the",
"route",
"must",
"use",
"HTTPS",
"."
] | 5026d54c7f7a18c83e942f42e8da001e6e2f180f | https://github.com/stratifyphp/router/blob/5026d54c7f7a18c83e942f42e8da001e6e2f180f/src/Route/RouteBuilder.php#L120-L126 |
231,849 | praxisnetau/silverware | src/Tools/ClassTools.php | ClassTools.getObjectAncestry | public function getObjectAncestry($nameOrObject, $stopAt = null, $removeNamespaces = false)
{
$classes = [];
foreach ($this->getReverseAncestry($nameOrObject) as $className) {
if ($removeNamespaces) {
$classes[] = $this->getClassWithoutNamespace($className);
} else {
$classes[] = $className;
}
if ($className == $stopAt) {
break;
}
}
return $classes;
} | php | public function getObjectAncestry($nameOrObject, $stopAt = null, $removeNamespaces = false)
{
$classes = [];
foreach ($this->getReverseAncestry($nameOrObject) as $className) {
if ($removeNamespaces) {
$classes[] = $this->getClassWithoutNamespace($className);
} else {
$classes[] = $className;
}
if ($className == $stopAt) {
break;
}
}
return $classes;
} | [
"public",
"function",
"getObjectAncestry",
"(",
"$",
"nameOrObject",
",",
"$",
"stopAt",
"=",
"null",
",",
"$",
"removeNamespaces",
"=",
"false",
")",
"{",
"$",
"classes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getReverseAncestry",
"(",
... | Answers an array containing the class names of the ancestors of the object.
@param string|object $nameOrObject Class name or object.
@param string $stopAt Ancestor class to stop at.
@param boolean $removeNamespaces If true, remove namespaces from class names.
@return array | [
"Answers",
"an",
"array",
"containing",
"the",
"class",
"names",
"of",
"the",
"ancestors",
"of",
"the",
"object",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Tools/ClassTools.php#L51-L70 |
231,850 | praxisnetau/silverware | src/Tools/ClassTools.php | ClassTools.getVisibleSubClasses | public function getVisibleSubClasses($name)
{
$remove = [];
$classes = ClassInfo::getValidSubClasses($name);
foreach ($classes as $class) {
$instance = Injector::inst()->get($class);
if ($ancestor = $instance->stat('hide_ancestor')) {
$remove[strtolower($ancestor)] = $ancestor;
}
if ($instance instanceof HiddenClass) {
$remove[strtolower($class)] = $class;
}
}
return array_diff_key($classes, $remove);
} | php | public function getVisibleSubClasses($name)
{
$remove = [];
$classes = ClassInfo::getValidSubClasses($name);
foreach ($classes as $class) {
$instance = Injector::inst()->get($class);
if ($ancestor = $instance->stat('hide_ancestor')) {
$remove[strtolower($ancestor)] = $ancestor;
}
if ($instance instanceof HiddenClass) {
$remove[strtolower($class)] = $class;
}
}
return array_diff_key($classes, $remove);
} | [
"public",
"function",
"getVisibleSubClasses",
"(",
"$",
"name",
")",
"{",
"$",
"remove",
"=",
"[",
"]",
";",
"$",
"classes",
"=",
"ClassInfo",
"::",
"getValidSubClasses",
"(",
"$",
"name",
")",
";",
"foreach",
"(",
"$",
"classes",
"as",
"$",
"class",
"... | Answers the visible subclasses of the specified class name.
@param string $name Name of parent class.
@return array | [
"Answers",
"the",
"visible",
"subclasses",
"of",
"the",
"specified",
"class",
"name",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Tools/ClassTools.php#L103-L123 |
231,851 | praxisnetau/silverware | src/Tools/ClassTools.php | ClassTools.getImplementorMap | public function getImplementorMap($interface, $baseClass = null)
{
// Create Map Array:
$map = [];
// Define Base Class (if none given):
if (!$baseClass) {
$baseClass = SiteTree::class;
}
// Obtain Implementors:
if ($implementors = ClassInfo::implementorsOf($interface)) {
// Filter Implementors:
$records = $baseClass::get()->filter([
'ClassName' => $implementors
])->sort('ClassName');
// Define Map Array:
foreach ($records as $record) {
$map[$record->ID] = sprintf(
'%s (%s)',
$record->hasMethod('NestedTitle') ? $record->NestedTitle(5, ' > ') : $record->Title,
$record->i18n_singular_name()
);
}
}
// Answer Map Array:
return $map;
} | php | public function getImplementorMap($interface, $baseClass = null)
{
// Create Map Array:
$map = [];
// Define Base Class (if none given):
if (!$baseClass) {
$baseClass = SiteTree::class;
}
// Obtain Implementors:
if ($implementors = ClassInfo::implementorsOf($interface)) {
// Filter Implementors:
$records = $baseClass::get()->filter([
'ClassName' => $implementors
])->sort('ClassName');
// Define Map Array:
foreach ($records as $record) {
$map[$record->ID] = sprintf(
'%s (%s)',
$record->hasMethod('NestedTitle') ? $record->NestedTitle(5, ' > ') : $record->Title,
$record->i18n_singular_name()
);
}
}
// Answer Map Array:
return $map;
} | [
"public",
"function",
"getImplementorMap",
"(",
"$",
"interface",
",",
"$",
"baseClass",
"=",
"null",
")",
"{",
"// Create Map Array:",
"$",
"map",
"=",
"[",
"]",
";",
"// Define Base Class (if none given):",
"if",
"(",
"!",
"$",
"baseClass",
")",
"{",
"$",
... | Answers a map of class names to singular names for implementors of the specified interface.
@param string $interface Name of interface to implement.
@param string $baseClass Base class to filter (defaults to SiteTree).
@return array | [
"Answers",
"a",
"map",
"of",
"class",
"names",
"to",
"singular",
"names",
"for",
"implementors",
"of",
"the",
"specified",
"interface",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Tools/ClassTools.php#L133-L170 |
231,852 | praxisnetau/silverware | src/Tools/ClassTools.php | ClassTools.getClassWithoutNamespace | public function getClassWithoutNamespace($name)
{
$pos = strrpos($name, '\\');
return ($pos === false) ? $name : substr($name, $pos + 1);
} | php | public function getClassWithoutNamespace($name)
{
$pos = strrpos($name, '\\');
return ($pos === false) ? $name : substr($name, $pos + 1);
} | [
"public",
"function",
"getClassWithoutNamespace",
"(",
"$",
"name",
")",
"{",
"$",
"pos",
"=",
"strrpos",
"(",
"$",
"name",
",",
"'\\\\'",
")",
";",
"return",
"(",
"$",
"pos",
"===",
"false",
")",
"?",
"$",
"name",
":",
"substr",
"(",
"$",
"name",
... | Removes the namespace from the given class name.
@param string $name
@return string | [
"Removes",
"the",
"namespace",
"from",
"the",
"given",
"class",
"name",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Tools/ClassTools.php#L179-L184 |
231,853 | terra-ops/terra-cli | src/terra/Command/Environment/EnvironmentAdd.php | EnvironmentAdd.createTerraYml | protected function createTerraYml(InputInterface $input, OutputInterface $output, EnvironmentFactory $environment)
{
$helper = $this->getHelper('question');
$question = new ConfirmationQuestion('No .terra.yml found. Would you like to create one? [y\N] ', false);
// If yes, gather the necessary info for creating .terra.yml.
if ($helper->ask($input, $output, $question)) {
$question = new Question('Please enter the relative path to your exposed web files: [.] ', '.');
$document_root = $helper->ask($input, $output, $question);
$environment->config['document_root'] = $document_root;
// Create the terra.yml file.
if($environment->writeTerraYml()) {
$output->writeln('.terra.yml has been created in the repository root.');
}
else{
$output->writeln('There was an error creating .terra.yml.');
}
}
} | php | protected function createTerraYml(InputInterface $input, OutputInterface $output, EnvironmentFactory $environment)
{
$helper = $this->getHelper('question');
$question = new ConfirmationQuestion('No .terra.yml found. Would you like to create one? [y\N] ', false);
// If yes, gather the necessary info for creating .terra.yml.
if ($helper->ask($input, $output, $question)) {
$question = new Question('Please enter the relative path to your exposed web files: [.] ', '.');
$document_root = $helper->ask($input, $output, $question);
$environment->config['document_root'] = $document_root;
// Create the terra.yml file.
if($environment->writeTerraYml()) {
$output->writeln('.terra.yml has been created in the repository root.');
}
else{
$output->writeln('There was an error creating .terra.yml.');
}
}
} | [
"protected",
"function",
"createTerraYml",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
",",
"EnvironmentFactory",
"$",
"environment",
")",
"{",
"$",
"helper",
"=",
"$",
"this",
"->",
"getHelper",
"(",
"'question'",
")",
";",
"$"... | Help the user create their .terra.yml file.
@param \Symfony\Component\Console\Input\InputInterface $input
@param \Symfony\Component\Console\Output\OutputInterface $output
@param \terra\Factory\EnvironmentFactory $environment | [
"Help",
"the",
"user",
"create",
"their",
".",
"terra",
".",
"yml",
"file",
"."
] | b176cca562534c1d65efbcef6c128f669a2ebed8 | https://github.com/terra-ops/terra-cli/blob/b176cca562534c1d65efbcef6c128f669a2ebed8/src/terra/Command/Environment/EnvironmentAdd.php#L208-L227 |
231,854 | flagrow/flarum-ext-guardian | src/Checks/Users/Ip.php | Ip.execute | protected function execute()
{
$ips = $this->user->posts()->whereNotNull('ip_address')->lists('ip_address');
$this->report['locations'] = "Ip's used: ".count($ips);
$this->report['related'] = [];
User::whereHas('posts', function ($q) use ($ips) {
$q->whereIn('ip_address', $ips);
})
->where('id', '!=', $this->user->id)
->chunk(10, function ($users) {
foreach ($users as $user) {
$this->report['related'][] = $user->toJson();
}
});
} | php | protected function execute()
{
$ips = $this->user->posts()->whereNotNull('ip_address')->lists('ip_address');
$this->report['locations'] = "Ip's used: ".count($ips);
$this->report['related'] = [];
User::whereHas('posts', function ($q) use ($ips) {
$q->whereIn('ip_address', $ips);
})
->where('id', '!=', $this->user->id)
->chunk(10, function ($users) {
foreach ($users as $user) {
$this->report['related'][] = $user->toJson();
}
});
} | [
"protected",
"function",
"execute",
"(",
")",
"{",
"$",
"ips",
"=",
"$",
"this",
"->",
"user",
"->",
"posts",
"(",
")",
"->",
"whereNotNull",
"(",
"'ip_address'",
")",
"->",
"lists",
"(",
"'ip_address'",
")",
";",
"$",
"this",
"->",
"report",
"[",
"'... | Executes the check.
@todo use only one query, instead of the two seperate queries
@return void | [
"Executes",
"the",
"check",
"."
] | fc5f1d19ad71578ff0f2323efbdb85a0864a7923 | https://github.com/flagrow/flarum-ext-guardian/blob/fc5f1d19ad71578ff0f2323efbdb85a0864a7923/src/Checks/Users/Ip.php#L40-L56 |
231,855 | praxisnetau/silverware | src/Components/TagCloudComponent.php | TagCloudComponent.getInitial | public function getInitial()
{
$initial = [
(float) $this->InitialRotationH,
(float) $this->InitialRotationV
];
return json_encode($initial);
} | php | public function getInitial()
{
$initial = [
(float) $this->InitialRotationH,
(float) $this->InitialRotationV
];
return json_encode($initial);
} | [
"public",
"function",
"getInitial",
"(",
")",
"{",
"$",
"initial",
"=",
"[",
"(",
"float",
")",
"$",
"this",
"->",
"InitialRotationH",
",",
"(",
"float",
")",
"$",
"this",
"->",
"InitialRotationV",
"]",
";",
"return",
"json_encode",
"(",
"$",
"initial",
... | Answers the initial rotation settings for the tag cloud as a string.
@return string | [
"Answers",
"the",
"initial",
"rotation",
"settings",
"for",
"the",
"tag",
"cloud",
"as",
"a",
"string",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Components/TagCloudComponent.php#L395-L403 |
231,856 | praxisnetau/silverware | src/Components/TagCloudComponent.php | TagCloudComponent.getRangeOptions | public function getRangeOptions($min, $max, $step)
{
$options = [];
foreach (range($min, $max, $step) as $value) {
$options[number_format($value, 1)] = number_format($value, 1);
}
return $options;
} | php | public function getRangeOptions($min, $max, $step)
{
$options = [];
foreach (range($min, $max, $step) as $value) {
$options[number_format($value, 1)] = number_format($value, 1);
}
return $options;
} | [
"public",
"function",
"getRangeOptions",
"(",
"$",
"min",
",",
"$",
"max",
",",
"$",
"step",
")",
"{",
"$",
"options",
"=",
"[",
"]",
";",
"foreach",
"(",
"range",
"(",
"$",
"min",
",",
"$",
"max",
",",
"$",
"step",
")",
"as",
"$",
"value",
")"... | Answers an array of range options for a dropdown field.
@param float $min
@param float $max
@param float $step
@return array | [
"Answers",
"an",
"array",
"of",
"range",
"options",
"for",
"a",
"dropdown",
"field",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Components/TagCloudComponent.php#L428-L437 |
231,857 | volumnet/bitrix24 | src/QuickLead.php | QuickLead.send | public function send(array $data = array())
{
if (!$this->login || !$this->password) {
throw new Exception('No login/password specified');
}
if (!$data['TITLE']) {
throw new Exception('No title provided');
}
$curl = new CURL();
$POST = array_merge(
array('LOGIN' => $this->login, 'PASSWORD' => $this->password, 'SOURCE_ID' => self::SOURCE_ID),
$data
);
$result = $curl->getURL($this->url, $POST);
$result = $this->fixJSON($result);
$result = json_decode($result);
if (!$result) {
throw new Exception('No response retrieved');
} elseif ($result->error && ((int)$result->error != self::ERR_OK)) {
throw new Exception($result->error_message, (int)$result->error);
}
return $result;
} | php | public function send(array $data = array())
{
if (!$this->login || !$this->password) {
throw new Exception('No login/password specified');
}
if (!$data['TITLE']) {
throw new Exception('No title provided');
}
$curl = new CURL();
$POST = array_merge(
array('LOGIN' => $this->login, 'PASSWORD' => $this->password, 'SOURCE_ID' => self::SOURCE_ID),
$data
);
$result = $curl->getURL($this->url, $POST);
$result = $this->fixJSON($result);
$result = json_decode($result);
if (!$result) {
throw new Exception('No response retrieved');
} elseif ($result->error && ((int)$result->error != self::ERR_OK)) {
throw new Exception($result->error_message, (int)$result->error);
}
return $result;
} | [
"public",
"function",
"send",
"(",
"array",
"$",
"data",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"login",
"||",
"!",
"$",
"this",
"->",
"password",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'No login/password specified'"... | Send data to quick lead creation
@param array $data Data in the following format: https://dev.1c-bitrix.ru/community/blogs/chaos/crm-sozdanie-lidov-iz-drugikh-servisov.php
@return mixed Response
@throws Exception exception with error code and message from remote url | [
"Send",
"data",
"to",
"quick",
"lead",
"creation"
] | 06d997db456791227c9adb94a55a2b513baca403 | https://github.com/volumnet/bitrix24/blob/06d997db456791227c9adb94a55a2b513baca403/src/QuickLead.php#L65-L89 |
231,858 | praxisnetau/silverware | src/Core/App.php | App.loadDefaults | public function loadDefaults()
{
// Obtain Default and Current Site Config:
$default = SiteConfig::create();
$current = SiteConfig::current_site_config();
// Check App Title:
if (!is_null($this->config()->title)) {
// Update Site Title:
if ($current->Title == $default->Title) {
$current->Title = $this->config()->title;
}
}
// Check App Tagline:
if (!is_null($this->config()->tagline)) {
// Update Site Tagline:
if ($current->Tagline == $default->Tagline) {
$current->Tagline = $this->config()->tagline;
}
}
// Save Site Config Changes:
if ($current->isChanged('Title') || $current->isChanged('Tagline')) {
if ($current->isChanged('Title')) {
DB::alteration_message(
sprintf(
'Updating App Title to "%s"',
$current->Title
),
'changed'
);
}
if ($current->isChanged('Tagline')) {
DB::alteration_message(
sprintf(
'Updating App Tagline to "%s"',
$current->Tagline
),
'changed'
);
}
$current->write();
}
} | php | public function loadDefaults()
{
// Obtain Default and Current Site Config:
$default = SiteConfig::create();
$current = SiteConfig::current_site_config();
// Check App Title:
if (!is_null($this->config()->title)) {
// Update Site Title:
if ($current->Title == $default->Title) {
$current->Title = $this->config()->title;
}
}
// Check App Tagline:
if (!is_null($this->config()->tagline)) {
// Update Site Tagline:
if ($current->Tagline == $default->Tagline) {
$current->Tagline = $this->config()->tagline;
}
}
// Save Site Config Changes:
if ($current->isChanged('Title') || $current->isChanged('Tagline')) {
if ($current->isChanged('Title')) {
DB::alteration_message(
sprintf(
'Updating App Title to "%s"',
$current->Title
),
'changed'
);
}
if ($current->isChanged('Tagline')) {
DB::alteration_message(
sprintf(
'Updating App Tagline to "%s"',
$current->Tagline
),
'changed'
);
}
$current->write();
}
} | [
"public",
"function",
"loadDefaults",
"(",
")",
"{",
"// Obtain Default and Current Site Config:",
"$",
"default",
"=",
"SiteConfig",
"::",
"create",
"(",
")",
";",
"$",
"current",
"=",
"SiteConfig",
"::",
"current_site_config",
"(",
")",
";",
"// Check App Title:",... | Loads the defaults defined by application configuration.
@return void | [
"Loads",
"the",
"defaults",
"defined",
"by",
"application",
"configuration",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Core/App.php#L179-L242 |
231,859 | praxisnetau/silverware | src/Core/App.php | App.loadFixtures | public function loadFixtures()
{
// Using Live Environment?
if ($this->loadFixturesDisabled()) {
return;
}
// Initialise:
$errored = false;
// Load Fixture Files:
foreach ($this->config()->fixtures as $file) {
try {
// Attempt Fixture Loading:
YamlFixture::create($file)->writeInto($this->factory);
} catch (Exception $e) {
$errored = true;
$message = $e->getMessage();
if (strpos($message, 'YamlFixture::') === 0 && strpos($message, 'not found') !== false) {
$message = sprintf('Cannot load fixture file: %s', $file);
}
DB::alteration_message(
sprintf(
'App fixture loading failed with exception: "%s"',
$message
),
'error'
);
}
}
if (!$errored) {
// Update App Status:
$this->FixturesLoaded = true;
// Record App Status:
$this->write();
}
} | php | public function loadFixtures()
{
// Using Live Environment?
if ($this->loadFixturesDisabled()) {
return;
}
// Initialise:
$errored = false;
// Load Fixture Files:
foreach ($this->config()->fixtures as $file) {
try {
// Attempt Fixture Loading:
YamlFixture::create($file)->writeInto($this->factory);
} catch (Exception $e) {
$errored = true;
$message = $e->getMessage();
if (strpos($message, 'YamlFixture::') === 0 && strpos($message, 'not found') !== false) {
$message = sprintf('Cannot load fixture file: %s', $file);
}
DB::alteration_message(
sprintf(
'App fixture loading failed with exception: "%s"',
$message
),
'error'
);
}
}
if (!$errored) {
// Update App Status:
$this->FixturesLoaded = true;
// Record App Status:
$this->write();
}
} | [
"public",
"function",
"loadFixtures",
"(",
")",
"{",
"// Using Live Environment?",
"if",
"(",
"$",
"this",
"->",
"loadFixturesDisabled",
"(",
")",
")",
"{",
"return",
";",
"}",
"// Initialise:",
"$",
"errored",
"=",
"false",
";",
"// Load Fixture Files:",
"forea... | Loads the fixtures defined by application configuration.
@return void | [
"Loads",
"the",
"fixtures",
"defined",
"by",
"application",
"configuration",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Core/App.php#L249-L304 |
231,860 | praxisnetau/silverware | src/Core/App.php | App.loadFixturesDisabled | protected function loadFixturesDisabled()
{
if (!$this->config()->load_fixtures) {
return true;
}
if ($this->config()->load_fixtures_once && $this->FixturesLoaded) {
return true;
}
return false;
} | php | protected function loadFixturesDisabled()
{
if (!$this->config()->load_fixtures) {
return true;
}
if ($this->config()->load_fixtures_once && $this->FixturesLoaded) {
return true;
}
return false;
} | [
"protected",
"function",
"loadFixturesDisabled",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"load_fixtures",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"load_fixtures_o... | Answers true if fixture loading is disabled.
@return boolean | [
"Answers",
"true",
"if",
"fixture",
"loading",
"is",
"disabled",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Core/App.php#L311-L322 |
231,861 | mattrmiller/laravel-potion | src/ClassyGeeks/Potion/PotionServiceProvider.php | PotionServiceProvider.registerBladeExtensions | protected function registerBladeExtensions()
{
// Potion asset url
\Blade::extend(function($view, $compiler)
{
$pattern = $this->createBladeMatcher('potion_asset_url');
return preg_replace($pattern, '$1<?php echo(\ClassyGeeks\Potion\BladeHelpers::assetUrl$2); ?>', $view);
});
// Potion Css
\Blade::extend(function($view, $compiler)
{
$pattern = $this->createBladeMatcher('potion_asset_css');
return preg_replace($pattern, '$1<?php echo(\ClassyGeeks\Potion\BladeHelpers::assetCss$2); ?>', $view);
});
// Potion Js
\Blade::extend(function($view, $compiler)
{
$pattern = $this->createBladeMatcher('potion_asset_js');
return preg_replace($pattern, '$1<?php echo(\ClassyGeeks\Potion\BladeHelpers::assetJs$2); ?>', $view);
});
// Potion Img
\Blade::extend(function($view, $compiler)
{
$pattern = $this->createBladeMatcher('potion_asset_img');
return preg_replace($pattern, '$1<?php echo(\ClassyGeeks\Potion\BladeHelpers::assetImg$2); ?>', $view);
});
} | php | protected function registerBladeExtensions()
{
// Potion asset url
\Blade::extend(function($view, $compiler)
{
$pattern = $this->createBladeMatcher('potion_asset_url');
return preg_replace($pattern, '$1<?php echo(\ClassyGeeks\Potion\BladeHelpers::assetUrl$2); ?>', $view);
});
// Potion Css
\Blade::extend(function($view, $compiler)
{
$pattern = $this->createBladeMatcher('potion_asset_css');
return preg_replace($pattern, '$1<?php echo(\ClassyGeeks\Potion\BladeHelpers::assetCss$2); ?>', $view);
});
// Potion Js
\Blade::extend(function($view, $compiler)
{
$pattern = $this->createBladeMatcher('potion_asset_js');
return preg_replace($pattern, '$1<?php echo(\ClassyGeeks\Potion\BladeHelpers::assetJs$2); ?>', $view);
});
// Potion Img
\Blade::extend(function($view, $compiler)
{
$pattern = $this->createBladeMatcher('potion_asset_img');
return preg_replace($pattern, '$1<?php echo(\ClassyGeeks\Potion\BladeHelpers::assetImg$2); ?>', $view);
});
} | [
"protected",
"function",
"registerBladeExtensions",
"(",
")",
"{",
"// Potion asset url",
"\\",
"Blade",
"::",
"extend",
"(",
"function",
"(",
"$",
"view",
",",
"$",
"compiler",
")",
"{",
"$",
"pattern",
"=",
"$",
"this",
"->",
"createBladeMatcher",
"(",
"'p... | Register blade extensions | [
"Register",
"blade",
"extensions"
] | a57fe22679b9148fb58f67d6b34588225467e357 | https://github.com/mattrmiller/laravel-potion/blob/a57fe22679b9148fb58f67d6b34588225467e357/src/ClassyGeeks/Potion/PotionServiceProvider.php#L90-L119 |
231,862 | terra-ops/terra-cli | src/terra/Console/Application.php | Application.getDefaultCommands | protected function getDefaultCommands()
{
$commands = parent::getDefaultCommands();
$commands[] = new Command\App\AppAdd();
$commands[] = new Command\App\AppRemove();
$commands[] = new Command\Environment\EnvironmentAdd();
$commands[] = new Command\Environment\EnvironmentRemove();
$commands[] = new Command\Environment\EnvironmentEnable();
$commands[] = new Command\Environment\EnvironmentDisable();
$commands[] = new Command\Environment\EnvironmentDeploy();
$commands[] = new Command\Environment\EnvironmentShell();
$commands[] = new Command\Environment\EnvironmentScale();
$commands[] = new Command\Environment\EnvironmentProxyEnable();
$commands[] = new Command\Environment\EnvironmentTest();
$commands[] = new Command\Environment\EnvironmentRebuild();
$commands[] = new Command\Environment\EnvironmentDomains();
$commands[] = new Command\Environment\EnvironmentDrush();
$commands[] = new Command\Environment\EnvironmentRun();
$commands[] = new Command\Environment\EnvironmentUpdate();
$commands[] = new Command\Status();
$commands[] = new Command\Queue();
return $commands;
} | php | protected function getDefaultCommands()
{
$commands = parent::getDefaultCommands();
$commands[] = new Command\App\AppAdd();
$commands[] = new Command\App\AppRemove();
$commands[] = new Command\Environment\EnvironmentAdd();
$commands[] = new Command\Environment\EnvironmentRemove();
$commands[] = new Command\Environment\EnvironmentEnable();
$commands[] = new Command\Environment\EnvironmentDisable();
$commands[] = new Command\Environment\EnvironmentDeploy();
$commands[] = new Command\Environment\EnvironmentShell();
$commands[] = new Command\Environment\EnvironmentScale();
$commands[] = new Command\Environment\EnvironmentProxyEnable();
$commands[] = new Command\Environment\EnvironmentTest();
$commands[] = new Command\Environment\EnvironmentRebuild();
$commands[] = new Command\Environment\EnvironmentDomains();
$commands[] = new Command\Environment\EnvironmentDrush();
$commands[] = new Command\Environment\EnvironmentRun();
$commands[] = new Command\Environment\EnvironmentUpdate();
$commands[] = new Command\Status();
$commands[] = new Command\Queue();
return $commands;
} | [
"protected",
"function",
"getDefaultCommands",
"(",
")",
"{",
"$",
"commands",
"=",
"parent",
"::",
"getDefaultCommands",
"(",
")",
";",
"$",
"commands",
"[",
"]",
"=",
"new",
"Command",
"\\",
"App",
"\\",
"AppAdd",
"(",
")",
";",
"$",
"commands",
"[",
... | Initializes all the Terra commands. | [
"Initializes",
"all",
"the",
"Terra",
"commands",
"."
] | b176cca562534c1d65efbcef6c128f669a2ebed8 | https://github.com/terra-ops/terra-cli/blob/b176cca562534c1d65efbcef6c128f669a2ebed8/src/terra/Console/Application.php#L51-L75 |
231,863 | terra-ops/terra-cli | src/terra/Console/Application.php | Application.getProcess | public function getProcess($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array())
{
if ($this->process === null) {
// @codeCoverageIgnoreStart
// We ignore this since we mock it.
return new Process($commandline, $cwd, $env, $input, $timeout, $options);
// @codeCoverageIgnoreEnd
}
return $this->process;
} | php | public function getProcess($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array())
{
if ($this->process === null) {
// @codeCoverageIgnoreStart
// We ignore this since we mock it.
return new Process($commandline, $cwd, $env, $input, $timeout, $options);
// @codeCoverageIgnoreEnd
}
return $this->process;
} | [
"public",
"function",
"getProcess",
"(",
"$",
"commandline",
",",
"$",
"cwd",
"=",
"null",
",",
"array",
"$",
"env",
"=",
"null",
",",
"$",
"input",
"=",
"null",
",",
"$",
"timeout",
"=",
"60",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
... | Used instead of Symfony\Component\Process\Process so we can easily mock it.
This returns either an instantiated Symfony\Component\Process\Process or a mock object.
@param $commandline
@param null $cwd
@param array $env
@param null $input
@param int $timeout
@param array $options
@return Process
@see Symfony\Component\Process\Process | [
"Used",
"instead",
"of",
"Symfony",
"\\",
"Component",
"\\",
"Process",
"\\",
"Process",
"so",
"we",
"can",
"easily",
"mock",
"it",
"."
] | b176cca562534c1d65efbcef6c128f669a2ebed8 | https://github.com/terra-ops/terra-cli/blob/b176cca562534c1d65efbcef6c128f669a2ebed8/src/terra/Console/Application.php#L153-L163 |
231,864 | terra-ops/terra-cli | src/terra/Console/Application.php | Application.getTerra | public function getTerra()
{
if (null === $this->terra) {
$this->terra = Factory::create();
}
return $this->terra;
} | php | public function getTerra()
{
if (null === $this->terra) {
$this->terra = Factory::create();
}
return $this->terra;
} | [
"public",
"function",
"getTerra",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"terra",
")",
"{",
"$",
"this",
"->",
"terra",
"=",
"Factory",
"::",
"create",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"terra",
";",
"}"
] | Get a configured Terra object.
@return Terra
A configured Terra object. | [
"Get",
"a",
"configured",
"Terra",
"object",
"."
] | b176cca562534c1d65efbcef6c128f669a2ebed8 | https://github.com/terra-ops/terra-cli/blob/b176cca562534c1d65efbcef6c128f669a2ebed8/src/terra/Console/Application.php#L171-L178 |
231,865 | UserScape/php-customerio | src/Customerio/Request.php | Request.deleteCustomer | public function deleteCustomer($id)
{
try {
$response = $this->client->delete('/api/v1/customers/'.$id, array(
'auth' => $this->auth,
));
} catch (BadResponseException $e) {
$response = $e->getResponse();
} catch (RequestException $e) {
return new Response($e->getCode(), $e->getMessage());
}
return new Response($response->getStatusCode(), $response->getReasonPhrase());
} | php | public function deleteCustomer($id)
{
try {
$response = $this->client->delete('/api/v1/customers/'.$id, array(
'auth' => $this->auth,
));
} catch (BadResponseException $e) {
$response = $e->getResponse();
} catch (RequestException $e) {
return new Response($e->getCode(), $e->getMessage());
}
return new Response($response->getStatusCode(), $response->getReasonPhrase());
} | [
"public",
"function",
"deleteCustomer",
"(",
"$",
"id",
")",
"{",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"delete",
"(",
"'/api/v1/customers/'",
".",
"$",
"id",
",",
"array",
"(",
"'auth'",
"=>",
"$",
"this",
"->",
"auth",
... | Send Delete Customer Request
@param $id
@return Response | [
"Send",
"Delete",
"Customer",
"Request"
] | f84ee5b08c6196d4812f31f165f3f56e3a37630b | https://github.com/UserScape/php-customerio/blob/f84ee5b08c6196d4812f31f165f3f56e3a37630b/src/Customerio/Request.php#L70-L83 |
231,866 | UserScape/php-customerio | src/Customerio/Request.php | Request.pageview | public function pageview($id, $url, $referrer = '')
{
$body = array_merge( array('name' => $url, 'type' => 'page'), $this->parseData( array( 'referrer' => $referrer ) ) );
try {
$response = $this->client->post('/api/v1/customers/'.$id.'/events', array(
'auth' => $this->auth,
'json' => $body,
));
} catch (BadResponseException $e) {
$response = $e->getResponse();
} catch (RequestException $e) {
return new Response($e->getCode(), $e->getMessage());
}
return new Response($response->getStatusCode(), $response->getReasonPhrase());
} | php | public function pageview($id, $url, $referrer = '')
{
$body = array_merge( array('name' => $url, 'type' => 'page'), $this->parseData( array( 'referrer' => $referrer ) ) );
try {
$response = $this->client->post('/api/v1/customers/'.$id.'/events', array(
'auth' => $this->auth,
'json' => $body,
));
} catch (BadResponseException $e) {
$response = $e->getResponse();
} catch (RequestException $e) {
return new Response($e->getCode(), $e->getMessage());
}
return new Response($response->getStatusCode(), $response->getReasonPhrase());
} | [
"public",
"function",
"pageview",
"(",
"$",
"id",
",",
"$",
"url",
",",
"$",
"referrer",
"=",
"''",
")",
"{",
"$",
"body",
"=",
"array_merge",
"(",
"array",
"(",
"'name'",
"=>",
"$",
"url",
",",
"'type'",
"=>",
"'page'",
")",
",",
"$",
"this",
"-... | Send a pageview to Customer.io
@param $id
@param $url
@param $referrer
@return Response | [
"Send",
"a",
"pageview",
"to",
"Customer",
".",
"io"
] | f84ee5b08c6196d4812f31f165f3f56e3a37630b | https://github.com/UserScape/php-customerio/blob/f84ee5b08c6196d4812f31f165f3f56e3a37630b/src/Customerio/Request.php#L92-L108 |
231,867 | UserScape/php-customerio | src/Customerio/Request.php | Request.event | public function event($id, $name, $data, $timestamp)
{
if (is_null($timestamp)) {
$body = array_merge( array('name' => $name), $this->parseData($data) );
} else {
$body = array_merge( array('name' => $name, 'timestamp' => $timestamp), $this->parseData($data) );
}
try {
$response = $this->client->post('/api/v1/customers/'.$id.'/events', array(
'auth' => $this->auth,
'json' => $body,
));
} catch (BadResponseException $e) {
$response = $e->getResponse();
} catch (RequestException $e) {
return new Response($e->getCode(), $e->getMessage());
}
return new Response($response->getStatusCode(), $response->getReasonPhrase());
} | php | public function event($id, $name, $data, $timestamp)
{
if (is_null($timestamp)) {
$body = array_merge( array('name' => $name), $this->parseData($data) );
} else {
$body = array_merge( array('name' => $name, 'timestamp' => $timestamp), $this->parseData($data) );
}
try {
$response = $this->client->post('/api/v1/customers/'.$id.'/events', array(
'auth' => $this->auth,
'json' => $body,
));
} catch (BadResponseException $e) {
$response = $e->getResponse();
} catch (RequestException $e) {
return new Response($e->getCode(), $e->getMessage());
}
return new Response($response->getStatusCode(), $response->getReasonPhrase());
} | [
"public",
"function",
"event",
"(",
"$",
"id",
",",
"$",
"name",
",",
"$",
"data",
",",
"$",
"timestamp",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"timestamp",
")",
")",
"{",
"$",
"body",
"=",
"array_merge",
"(",
"array",
"(",
"'name'",
"=>",
"$... | Send and Event to Customer.io
@param $id
@param $name
@param $data
@param $timestamp (optional)
@return Response | [
"Send",
"and",
"Event",
"to",
"Customer",
".",
"io"
] | f84ee5b08c6196d4812f31f165f3f56e3a37630b | https://github.com/UserScape/php-customerio/blob/f84ee5b08c6196d4812f31f165f3f56e3a37630b/src/Customerio/Request.php#L118-L138 |
231,868 | UserScape/php-customerio | src/Customerio/Request.php | Request.anonymousEvent | public function anonymousEvent($name, $data)
{
$body = array_merge( array('name' => $name), $this->parseData($data) );
try {
$response = $this->client->post('/api/v1/events', array(
'auth' => $this->auth,
'json' => $body,
));
} catch (BadResponseException $e) {
$response = $e->getResponse();
} catch (RequestException $e) {
return new Response($e->getCode(), $e->getMessage());
}
return new Response($response->getStatusCode(), $response->getReasonPhrase());
} | php | public function anonymousEvent($name, $data)
{
$body = array_merge( array('name' => $name), $this->parseData($data) );
try {
$response = $this->client->post('/api/v1/events', array(
'auth' => $this->auth,
'json' => $body,
));
} catch (BadResponseException $e) {
$response = $e->getResponse();
} catch (RequestException $e) {
return new Response($e->getCode(), $e->getMessage());
}
return new Response($response->getStatusCode(), $response->getReasonPhrase());
} | [
"public",
"function",
"anonymousEvent",
"(",
"$",
"name",
",",
"$",
"data",
")",
"{",
"$",
"body",
"=",
"array_merge",
"(",
"array",
"(",
"'name'",
"=>",
"$",
"name",
")",
",",
"$",
"this",
"->",
"parseData",
"(",
"$",
"data",
")",
")",
";",
"try",... | Send an Event to Customer.io not associated to any existing Customer.io user
@param $name
@param $data
@return Response | [
"Send",
"an",
"Event",
"to",
"Customer",
".",
"io",
"not",
"associated",
"to",
"any",
"existing",
"Customer",
".",
"io",
"user"
] | f84ee5b08c6196d4812f31f165f3f56e3a37630b | https://github.com/UserScape/php-customerio/blob/f84ee5b08c6196d4812f31f165f3f56e3a37630b/src/Customerio/Request.php#L146-L162 |
231,869 | UserScape/php-customerio | src/Customerio/Request.php | Request.authenticate | public function authenticate($apiKey, $apiSecret)
{
$this->auth[0] = $apiKey;
$this->auth[1] = $apiSecret;
return $this;
} | php | public function authenticate($apiKey, $apiSecret)
{
$this->auth[0] = $apiKey;
$this->auth[1] = $apiSecret;
return $this;
} | [
"public",
"function",
"authenticate",
"(",
"$",
"apiKey",
",",
"$",
"apiSecret",
")",
"{",
"$",
"this",
"->",
"auth",
"[",
"0",
"]",
"=",
"$",
"apiKey",
";",
"$",
"this",
"->",
"auth",
"[",
"1",
"]",
"=",
"$",
"apiSecret",
";",
"return",
"$",
"th... | Set Authentication credentials
@param $apiKey
@param $apiSecret
@return $this | [
"Set",
"Authentication",
"credentials"
] | f84ee5b08c6196d4812f31f165f3f56e3a37630b | https://github.com/UserScape/php-customerio/blob/f84ee5b08c6196d4812f31f165f3f56e3a37630b/src/Customerio/Request.php#L170-L176 |
231,870 | praxisnetau/silverware | src/Components/CopyrightComponent.php | CopyrightComponent.populateDefaults | public function populateDefaults()
{
// Populate Defaults (from parent):
parent::populateDefaults();
// Populate Defaults:
$this->CopyrightNoun = _t(
__CLASS__ . '.DEFAULTCOPYRIGHTNOUN',
'Copyright'
);
$this->CopyrightText = _t(
__CLASS__ . '.DEFAULTCOPYRIGHTTEXT',
'{copyright} © {year} {entity}. All Rights Reserved.'
);
} | php | public function populateDefaults()
{
// Populate Defaults (from parent):
parent::populateDefaults();
// Populate Defaults:
$this->CopyrightNoun = _t(
__CLASS__ . '.DEFAULTCOPYRIGHTNOUN',
'Copyright'
);
$this->CopyrightText = _t(
__CLASS__ . '.DEFAULTCOPYRIGHTTEXT',
'{copyright} © {year} {entity}. All Rights Reserved.'
);
} | [
"public",
"function",
"populateDefaults",
"(",
")",
"{",
"// Populate Defaults (from parent):",
"parent",
"::",
"populateDefaults",
"(",
")",
";",
"// Populate Defaults:",
"$",
"this",
"->",
"CopyrightNoun",
"=",
"_t",
"(",
"__CLASS__",
".",
"'.DEFAULTCOPYRIGHTNOUN'",
... | Populates the default values for the fields of the receiver.
@return void | [
"Populates",
"the",
"default",
"values",
"for",
"the",
"fields",
"of",
"the",
"receiver",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Components/CopyrightComponent.php#L358-L375 |
231,871 | praxisnetau/silverware | src/Components/CopyrightComponent.php | CopyrightComponent.getEntityLink | public function getEntityLink()
{
if ($this->EntityURL) {
return $this->dbObject('EntityURL')->URL();
}
if ($this->EntityPageID) {
return $this->EntityPage()->Link();
}
} | php | public function getEntityLink()
{
if ($this->EntityURL) {
return $this->dbObject('EntityURL')->URL();
}
if ($this->EntityPageID) {
return $this->EntityPage()->Link();
}
} | [
"public",
"function",
"getEntityLink",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"EntityURL",
")",
"{",
"return",
"$",
"this",
"->",
"dbObject",
"(",
"'EntityURL'",
")",
"->",
"URL",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"EntityPageID"... | Answers the link to the entity page.
@return string | [
"Answers",
"the",
"link",
"to",
"the",
"entity",
"page",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Components/CopyrightComponent.php#L396-L405 |
231,872 | praxisnetau/silverware | src/Components/CopyrightComponent.php | CopyrightComponent.getCopyrightLink | public function getCopyrightLink()
{
if ($this->CopyrightURL) {
return $this->dbObject('CopyrightURL')->URL();
}
if ($this->CopyrightPageID) {
return $this->CopyrightPage()->Link();
}
} | php | public function getCopyrightLink()
{
if ($this->CopyrightURL) {
return $this->dbObject('CopyrightURL')->URL();
}
if ($this->CopyrightPageID) {
return $this->CopyrightPage()->Link();
}
} | [
"public",
"function",
"getCopyrightLink",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"CopyrightURL",
")",
"{",
"return",
"$",
"this",
"->",
"dbObject",
"(",
"'CopyrightURL'",
")",
"->",
"URL",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"Copy... | Answers the link to the copyright page.
@return string | [
"Answers",
"the",
"link",
"to",
"the",
"copyright",
"page",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Components/CopyrightComponent.php#L412-L421 |
231,873 | praxisnetau/silverware | src/Components/CopyrightComponent.php | CopyrightComponent.getEntityNameLink | public function getEntityNameLink()
{
if ($this->hasEntityLink() && !$this->EntityLinkDisabled) {
$target = $this->OpenEntityLinkInNewTab ? ' target="_blank"' : '';
return sprintf(
'<a href="%s" rel="nofollow"%s>%s</a>',
$this->EntityLink,
$target,
$this->EntityName
);
}
return $this->EntityName;
} | php | public function getEntityNameLink()
{
if ($this->hasEntityLink() && !$this->EntityLinkDisabled) {
$target = $this->OpenEntityLinkInNewTab ? ' target="_blank"' : '';
return sprintf(
'<a href="%s" rel="nofollow"%s>%s</a>',
$this->EntityLink,
$target,
$this->EntityName
);
}
return $this->EntityName;
} | [
"public",
"function",
"getEntityNameLink",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasEntityLink",
"(",
")",
"&&",
"!",
"$",
"this",
"->",
"EntityLinkDisabled",
")",
"{",
"$",
"target",
"=",
"$",
"this",
"->",
"OpenEntityLinkInNewTab",
"?",
"' target... | Answers the entity name link for the template.
@return string | [
"Answers",
"the",
"entity",
"name",
"link",
"for",
"the",
"template",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Components/CopyrightComponent.php#L448-L464 |
231,874 | praxisnetau/silverware | src/Components/CopyrightComponent.php | CopyrightComponent.getCopyrightNounLink | public function getCopyrightNounLink()
{
if ($this->hasCopyrightLink() && !$this->CopyrightLinkDisabled) {
$target = $this->OpenCopyrightLinkInNewTab ? ' target="_blank"' : '';
return sprintf(
'<a href="%s" rel="nofollow"%s>%s</a>',
$this->CopyrightLink,
$target,
$this->CopyrightNoun
);
}
return $this->CopyrightNoun;
} | php | public function getCopyrightNounLink()
{
if ($this->hasCopyrightLink() && !$this->CopyrightLinkDisabled) {
$target = $this->OpenCopyrightLinkInNewTab ? ' target="_blank"' : '';
return sprintf(
'<a href="%s" rel="nofollow"%s>%s</a>',
$this->CopyrightLink,
$target,
$this->CopyrightNoun
);
}
return $this->CopyrightNoun;
} | [
"public",
"function",
"getCopyrightNounLink",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasCopyrightLink",
"(",
")",
"&&",
"!",
"$",
"this",
"->",
"CopyrightLinkDisabled",
")",
"{",
"$",
"target",
"=",
"$",
"this",
"->",
"OpenCopyrightLinkInNewTab",
"?",... | Answers the copyright noun link for the template.
@return string | [
"Answers",
"the",
"copyright",
"noun",
"link",
"for",
"the",
"template",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Components/CopyrightComponent.php#L471-L487 |
231,875 | praxisnetau/silverware | src/Components/CopyrightComponent.php | CopyrightComponent.getCopyrightYear | public function getCopyrightYear()
{
if ($this->YearStart && $this->YearFinish) {
return sprintf('%d-%d', $this->YearStart, $this->YearFinish);
} elseif ($this->YearStart && !$this->YearFinish) {
return sprintf('%d-%d', $this->YearStart, date('Y'));
} elseif (!$this->YearStart && $this->YearFinish) {
return $this->YearFinish;
}
return (string) date('Y');
} | php | public function getCopyrightYear()
{
if ($this->YearStart && $this->YearFinish) {
return sprintf('%d-%d', $this->YearStart, $this->YearFinish);
} elseif ($this->YearStart && !$this->YearFinish) {
return sprintf('%d-%d', $this->YearStart, date('Y'));
} elseif (!$this->YearStart && $this->YearFinish) {
return $this->YearFinish;
}
return (string) date('Y');
} | [
"public",
"function",
"getCopyrightYear",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"YearStart",
"&&",
"$",
"this",
"->",
"YearFinish",
")",
"{",
"return",
"sprintf",
"(",
"'%d-%d'",
",",
"$",
"this",
"->",
"YearStart",
",",
"$",
"this",
"->",
"Year... | Answers the copyright year for the template.
@return string | [
"Answers",
"the",
"copyright",
"year",
"for",
"the",
"template",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Components/CopyrightComponent.php#L494-L505 |
231,876 | praxisnetau/silverware | src/Extensions/Config/AppIconConfig.php | AppIconConfig.getAppIconTouchResized | public function getAppIconTouchResized($width, $height)
{
if ($this->owner->AppIconTouch()->exists()) {
return $this->owner->AppIconTouch()->ResizedImage($width, $height);
}
} | php | public function getAppIconTouchResized($width, $height)
{
if ($this->owner->AppIconTouch()->exists()) {
return $this->owner->AppIconTouch()->ResizedImage($width, $height);
}
} | [
"public",
"function",
"getAppIconTouchResized",
"(",
"$",
"width",
",",
"$",
"height",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"owner",
"->",
"AppIconTouch",
"(",
")",
"->",
"exists",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"owner",
"->",
"A... | Answers a resized version of the app touch icon.
@param integer $width
@param integer $height
@return Image | [
"Answers",
"a",
"resized",
"version",
"of",
"the",
"app",
"touch",
"icon",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Config/AppIconConfig.php#L213-L218 |
231,877 | praxisnetau/silverware | src/Dev/Installer.php | Installer.handle | public function handle(Event $event)
{
// Define Event:
$this->setEvent($event);
// Check Event Name:
if (!$this->hasHandler($event->getName())) {
throw new InvalidArgumentException(
sprintf(
'An event handler does not exist for "%s"',
$event->getName()
)
);
}
// Handle Event:
$this->{$this->handlers[$event->getName()]}();
} | php | public function handle(Event $event)
{
// Define Event:
$this->setEvent($event);
// Check Event Name:
if (!$this->hasHandler($event->getName())) {
throw new InvalidArgumentException(
sprintf(
'An event handler does not exist for "%s"',
$event->getName()
)
);
}
// Handle Event:
$this->{$this->handlers[$event->getName()]}();
} | [
"public",
"function",
"handle",
"(",
"Event",
"$",
"event",
")",
"{",
"// Define Event:",
"$",
"this",
"->",
"setEvent",
"(",
"$",
"event",
")",
";",
"// Check Event Name:",
"if",
"(",
"!",
"$",
"this",
"->",
"hasHandler",
"(",
"$",
"event",
"->",
"getNa... | Handles the given Composer script event.
@param Event $event
@throws InvalidArgumentException
@return void | [
"Handles",
"the",
"given",
"Composer",
"script",
"event",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/Installer.php#L179-L201 |
231,878 | praxisnetau/silverware | src/Dev/Installer.php | Installer.setConfig | public function setConfig($arg1, $arg2 = null)
{
if (is_array($arg1)) {
$this->config = $arg1;
} else {
$this->config[$arg1] = $arg2;
}
return $this;
} | php | public function setConfig($arg1, $arg2 = null)
{
if (is_array($arg1)) {
$this->config = $arg1;
} else {
$this->config[$arg1] = $arg2;
}
return $this;
} | [
"public",
"function",
"setConfig",
"(",
"$",
"arg1",
",",
"$",
"arg2",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"arg1",
")",
")",
"{",
"$",
"this",
"->",
"config",
"=",
"$",
"arg1",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"conf... | Defines either the named config value, or the config array.
@param string|array $arg1
@param string $arg2
@return $this | [
"Defines",
"either",
"the",
"named",
"config",
"value",
"or",
"the",
"config",
"array",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/Installer.php#L471-L480 |
231,879 | praxisnetau/silverware | src/Dev/Installer.php | Installer.init | private function init()
{
// Define Default Config:
$this->setConfig(self::$default_config);
// Load JSON Config File:
$file = new JsonFile(self::CONFIG_FILE);
// Merge JSON Config (if file exists):
if ($file->exists()) {
$this->mergeConfig($file->read());
}
} | php | private function init()
{
// Define Default Config:
$this->setConfig(self::$default_config);
// Load JSON Config File:
$file = new JsonFile(self::CONFIG_FILE);
// Merge JSON Config (if file exists):
if ($file->exists()) {
$this->mergeConfig($file->read());
}
} | [
"private",
"function",
"init",
"(",
")",
"{",
"// Define Default Config:",
"$",
"this",
"->",
"setConfig",
"(",
"self",
"::",
"$",
"default_config",
")",
";",
"// Load JSON Config File:",
"$",
"file",
"=",
"new",
"JsonFile",
"(",
"self",
"::",
"CONFIG_FILE",
"... | Initialises the receiver from configuration.
@return void | [
"Initialises",
"the",
"receiver",
"from",
"configuration",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/Installer.php#L547-L562 |
231,880 | praxisnetau/silverware | src/Dev/Installer.php | Installer.ask | private function ask($question, $default = null, $data = [])
{
// Initialise:
$text = [];
// Process Question:
list($question, $type) = array_pad(explode(':', $question), 2, null);
// Add Question:
$text[] = $this->color(
$question,
$this->getConfig('fg-question')
);
// Add Type:
if ($type) {
$text[] = $this->color(
sprintf($this->getConfig('format-type'), $type),
$this->getConfig('fg-type')
);
}
// Add Default:
if ($default) {
// Replace Tokens:
$default = $this->replace($default, $data);
// Add Default Text:
$text[] = $this->color(
sprintf($this->getConfig('format-default'), $default),
$this->getConfig('fg-default')
);
}
// Add Colon:
$text[] = ': ';
// Ask Question and Answer:
if ($answer = $this->io()->ask(implode('', $text))) {
return $answer;
}
// Answer Default:
return $default;
} | php | private function ask($question, $default = null, $data = [])
{
// Initialise:
$text = [];
// Process Question:
list($question, $type) = array_pad(explode(':', $question), 2, null);
// Add Question:
$text[] = $this->color(
$question,
$this->getConfig('fg-question')
);
// Add Type:
if ($type) {
$text[] = $this->color(
sprintf($this->getConfig('format-type'), $type),
$this->getConfig('fg-type')
);
}
// Add Default:
if ($default) {
// Replace Tokens:
$default = $this->replace($default, $data);
// Add Default Text:
$text[] = $this->color(
sprintf($this->getConfig('format-default'), $default),
$this->getConfig('fg-default')
);
}
// Add Colon:
$text[] = ': ';
// Ask Question and Answer:
if ($answer = $this->io()->ask(implode('', $text))) {
return $answer;
}
// Answer Default:
return $default;
} | [
"private",
"function",
"ask",
"(",
"$",
"question",
",",
"$",
"default",
"=",
"null",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"// Initialise:",
"$",
"text",
"=",
"[",
"]",
";",
"// Process Question:",
"list",
"(",
"$",
"question",
",",
"$",
"type"... | Asks a question with an optional default value to the developer.
@param string $question Question to ask the developer (with optional type).
@param string $default Optional default value for the answer.
@param array $data Array of data values for token replacement.
@return string | [
"Asks",
"a",
"question",
"with",
"an",
"optional",
"default",
"value",
"to",
"the",
"developer",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/Installer.php#L583-L641 |
231,881 | praxisnetau/silverware | src/Dev/Installer.php | Installer.color | private function color($text, $fg, $bg = null)
{
if ($this->getConfig('use-colors')) {
$colors = [];
if ($fg != 'none') {
$colors[] = sprintf('fg=%s', $fg);
}
if ($bg && $bg != 'none') {
$colors[] = sprintf('bg=%s', $bg);
}
if (!empty($colors)) {
return sprintf('<%s>%s</>', implode(';', $colors), $text);
}
}
return $text;
} | php | private function color($text, $fg, $bg = null)
{
if ($this->getConfig('use-colors')) {
$colors = [];
if ($fg != 'none') {
$colors[] = sprintf('fg=%s', $fg);
}
if ($bg && $bg != 'none') {
$colors[] = sprintf('bg=%s', $bg);
}
if (!empty($colors)) {
return sprintf('<%s>%s</>', implode(';', $colors), $text);
}
}
return $text;
} | [
"private",
"function",
"color",
"(",
"$",
"text",
",",
"$",
"fg",
",",
"$",
"bg",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getConfig",
"(",
"'use-colors'",
")",
")",
"{",
"$",
"colors",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"fg",
"... | Applies the given foreground and background colors to the provided text.
@param string $text Text to color.
@param string $fg Foreground color.
@param string $bg Background color (optional).
@return string | [
"Applies",
"the",
"given",
"foreground",
"and",
"background",
"colors",
"to",
"the",
"provided",
"text",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/Installer.php#L652-L672 |
231,882 | praxisnetau/silverware | src/Dev/Installer.php | Installer.header | private function header($text)
{
$this->io()->write($this->line(strlen($text)));
$this->io()->write($this->color($text, $this->getConfig('fg-header')));
$this->io()->write($this->line(strlen($text)));
} | php | private function header($text)
{
$this->io()->write($this->line(strlen($text)));
$this->io()->write($this->color($text, $this->getConfig('fg-header')));
$this->io()->write($this->line(strlen($text)));
} | [
"private",
"function",
"header",
"(",
"$",
"text",
")",
"{",
"$",
"this",
"->",
"io",
"(",
")",
"->",
"write",
"(",
"$",
"this",
"->",
"line",
"(",
"strlen",
"(",
"$",
"text",
")",
")",
")",
";",
"$",
"this",
"->",
"io",
"(",
")",
"->",
"writ... | Outputs a header block with the given text.
@param string $text
@return void | [
"Outputs",
"a",
"header",
"block",
"with",
"the",
"given",
"text",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/Installer.php#L681-L686 |
231,883 | praxisnetau/silverware | src/Dev/Installer.php | Installer.replace | private function replace($text, $data)
{
// Replace Data Tokens:
foreach ($data as $key => $value) {
if (is_scalar($value)) {
$text = str_replace("{{$key}}", $value, $text);
}
}
// Replace Config Tokens:
foreach ($this->config as $key => $value) {
if (is_scalar($value)) {
$text = str_replace("{{$key}}", $value, $text);
}
}
// Answer Text:
return $text;
} | php | private function replace($text, $data)
{
// Replace Data Tokens:
foreach ($data as $key => $value) {
if (is_scalar($value)) {
$text = str_replace("{{$key}}", $value, $text);
}
}
// Replace Config Tokens:
foreach ($this->config as $key => $value) {
if (is_scalar($value)) {
$text = str_replace("{{$key}}", $value, $text);
}
}
// Answer Text:
return $text;
} | [
"private",
"function",
"replace",
"(",
"$",
"text",
",",
"$",
"data",
")",
"{",
"// Replace Data Tokens:",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_scalar",
"(",
"$",
"value",
")",
")",
"{",
"$",
"... | Replaces named tokens within the given text with values from the provided array and configuration.
@param string $text
@param array $data
@return string | [
"Replaces",
"named",
"tokens",
"within",
"the",
"given",
"text",
"with",
"values",
"from",
"the",
"provided",
"array",
"and",
"configuration",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/Installer.php#L709-L734 |
231,884 | praxisnetau/silverware | src/Dev/Installer.php | Installer.replaceNamespace | private function replaceNamespace($text, $namespace, $escape = false)
{
// Clean Values:
$default = rtrim($this->getConfig('default-app-namespace'), '\\');
$namespace = rtrim($namespace, '\\');
// Handle Escaping:
if ($escape) {
$default = addslashes($default);
$namespace = addslashes($namespace);
}
// Replace Namespace:
$text = str_replace($default, $namespace, $text);
// Answer Text:
return $text;
} | php | private function replaceNamespace($text, $namespace, $escape = false)
{
// Clean Values:
$default = rtrim($this->getConfig('default-app-namespace'), '\\');
$namespace = rtrim($namespace, '\\');
// Handle Escaping:
if ($escape) {
$default = addslashes($default);
$namespace = addslashes($namespace);
}
// Replace Namespace:
$text = str_replace($default, $namespace, $text);
// Answer Text:
return $text;
} | [
"private",
"function",
"replaceNamespace",
"(",
"$",
"text",
",",
"$",
"namespace",
",",
"$",
"escape",
"=",
"false",
")",
"{",
"// Clean Values:",
"$",
"default",
"=",
"rtrim",
"(",
"$",
"this",
"->",
"getConfig",
"(",
"'default-app-namespace'",
")",
",",
... | Replaces the default namespace within the given text with the given namespace.
@param string $text
@param string $namespace
@param boolean $escape
@return string | [
"Replaces",
"the",
"default",
"namespace",
"within",
"the",
"given",
"text",
"with",
"the",
"given",
"namespace",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/Installer.php#L745-L766 |
231,885 | praxisnetau/silverware | src/Dev/Installer.php | Installer.writeData | private function writeData($data, $files)
{
// Initialise:
$result = true;
// Check Parameters:
if (is_array($data) && is_array($files)) {
// Iterate Files:
foreach ($files as $file) {
// Attempt to Process File:
try {
// Read File Contents:
$contents = file_get_contents($file);
// Replace Tokens in Contents:
$contents = $this->replace($contents, $data);
// Write File Contents:
file_put_contents($file, $contents);
// Define Status:
$status = 'success';
} catch (ErrorException $e) {
// Write Debug Info:
$this->io()->writeError(
sprintf(
'<warning>Exception: %s</warning>',
$e->getMessage()
),
true,
IOInterface::DEBUG
);
// Define Result:
$result = false;
// Define Status:
$status = 'failure';
}
// Output Status:
$this->io()->write(
sprintf(
'[%s] %s',
$this->color($this->getConfig("text-file-{$status}"), $this->getConfig("fg-{$status}")),
$this->color("Writing to '{$file}'...", $this->getConfig('fg-writing'))
)
);
}
}
// Answer Result:
return $result;
} | php | private function writeData($data, $files)
{
// Initialise:
$result = true;
// Check Parameters:
if (is_array($data) && is_array($files)) {
// Iterate Files:
foreach ($files as $file) {
// Attempt to Process File:
try {
// Read File Contents:
$contents = file_get_contents($file);
// Replace Tokens in Contents:
$contents = $this->replace($contents, $data);
// Write File Contents:
file_put_contents($file, $contents);
// Define Status:
$status = 'success';
} catch (ErrorException $e) {
// Write Debug Info:
$this->io()->writeError(
sprintf(
'<warning>Exception: %s</warning>',
$e->getMessage()
),
true,
IOInterface::DEBUG
);
// Define Result:
$result = false;
// Define Status:
$status = 'failure';
}
// Output Status:
$this->io()->write(
sprintf(
'[%s] %s',
$this->color($this->getConfig("text-file-{$status}"), $this->getConfig("fg-{$status}")),
$this->color("Writing to '{$file}'...", $this->getConfig('fg-writing'))
)
);
}
}
// Answer Result:
return $result;
} | [
"private",
"function",
"writeData",
"(",
"$",
"data",
",",
"$",
"files",
")",
"{",
"// Initialise:",
"$",
"result",
"=",
"true",
";",
"// Check Parameters:",
"if",
"(",
"is_array",
"(",
"$",
"data",
")",
"&&",
"is_array",
"(",
"$",
"files",
")",
")",
"... | Writes values from the given data array to the specified files.
@param array $data
@param array $files
@throws ErrorException
@return boolean | [
"Writes",
"values",
"from",
"the",
"given",
"data",
"array",
"to",
"the",
"specified",
"files",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/Installer.php#L778-L852 |
231,886 | praxisnetau/silverware | src/Dev/Installer.php | Installer.writeNamespace | private function writeNamespace($namespace, $files)
{
// Initialise:
$result = true;
// Check Namespace Change:
if ($namespace == $this->getConfig('default-app-namespace')) {
return $result;
}
// Check Parameters:
if ($namespace && is_array($files)) {
// Iterate Files:
foreach ($files as $file => $escape) {
// Attempt to Process File:
try {
// Read File Contents:
$contents = file_get_contents($file);
// Replace Namespace in Contents:
$contents = $this->replaceNamespace($contents, $namespace, $escape);
// Write File Contents:
file_put_contents($file, $contents);
// Define Status:
$status = 'success';
} catch (ErrorException $e) {
// Write Debug Info:
$this->io()->writeError(
sprintf(
'<warning>Exception: %s</warning>',
$e->getMessage()
),
true,
IOInterface::DEBUG
);
// Define Result:
$result = false;
// Define Status:
$status = 'failure';
}
// Output Status:
$this->io()->write(
sprintf(
'[%s] %s',
$this->color($this->getConfig("text-file-{$status}"), $this->getConfig("fg-{$status}")),
$this->color("Writing namespace to '{$file}'...", $this->getConfig('fg-writing'))
)
);
}
}
// Answer Result:
return $result;
} | php | private function writeNamespace($namespace, $files)
{
// Initialise:
$result = true;
// Check Namespace Change:
if ($namespace == $this->getConfig('default-app-namespace')) {
return $result;
}
// Check Parameters:
if ($namespace && is_array($files)) {
// Iterate Files:
foreach ($files as $file => $escape) {
// Attempt to Process File:
try {
// Read File Contents:
$contents = file_get_contents($file);
// Replace Namespace in Contents:
$contents = $this->replaceNamespace($contents, $namespace, $escape);
// Write File Contents:
file_put_contents($file, $contents);
// Define Status:
$status = 'success';
} catch (ErrorException $e) {
// Write Debug Info:
$this->io()->writeError(
sprintf(
'<warning>Exception: %s</warning>',
$e->getMessage()
),
true,
IOInterface::DEBUG
);
// Define Result:
$result = false;
// Define Status:
$status = 'failure';
}
// Output Status:
$this->io()->write(
sprintf(
'[%s] %s',
$this->color($this->getConfig("text-file-{$status}"), $this->getConfig("fg-{$status}")),
$this->color("Writing namespace to '{$file}'...", $this->getConfig('fg-writing'))
)
);
}
}
// Answer Result:
return $result;
} | [
"private",
"function",
"writeNamespace",
"(",
"$",
"namespace",
",",
"$",
"files",
")",
"{",
"// Initialise:",
"$",
"result",
"=",
"true",
";",
"// Check Namespace Change:",
"if",
"(",
"$",
"namespace",
"==",
"$",
"this",
"->",
"getConfig",
"(",
"'default-app-... | Writes the app namespace to the specified files.
@param string $namespace
@param array $files
@throws ErrorException
@return boolean | [
"Writes",
"the",
"app",
"namespace",
"to",
"the",
"specified",
"files",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Dev/Installer.php#L864-L944 |
231,887 | praxisnetau/silverware | src/Tools/ImageTools.php | ImageTools.getAlignmentOptions | public function getAlignmentOptions()
{
return [
self::ALIGN_LEFT_ALONE => _t(__CLASS__ . '.ALIGNLEFTALONE', 'Left'),
self::ALIGN_CENTER => _t(__CLASS__ . '.ALIGNCENTER', 'Center'),
self::ALIGN_LEFT => _t(__CLASS__ . '.ALIGNLEFT', 'Left wrap'),
self::ALIGN_RIGHT => _t(__CLASS__ . '.ALIGNRIGHT', 'Right wrap')
];
} | php | public function getAlignmentOptions()
{
return [
self::ALIGN_LEFT_ALONE => _t(__CLASS__ . '.ALIGNLEFTALONE', 'Left'),
self::ALIGN_CENTER => _t(__CLASS__ . '.ALIGNCENTER', 'Center'),
self::ALIGN_LEFT => _t(__CLASS__ . '.ALIGNLEFT', 'Left wrap'),
self::ALIGN_RIGHT => _t(__CLASS__ . '.ALIGNRIGHT', 'Right wrap')
];
} | [
"public",
"function",
"getAlignmentOptions",
"(",
")",
"{",
"return",
"[",
"self",
"::",
"ALIGN_LEFT_ALONE",
"=>",
"_t",
"(",
"__CLASS__",
".",
"'.ALIGNLEFTALONE'",
",",
"'Left'",
")",
",",
"self",
"::",
"ALIGN_CENTER",
"=>",
"_t",
"(",
"__CLASS__",
".",
"'.... | Answers an array of the available image alignment options.
@return array | [
"Answers",
"an",
"array",
"of",
"the",
"available",
"image",
"alignment",
"options",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Tools/ImageTools.php#L93-L101 |
231,888 | praxisnetau/silverware | src/Tools/ImageTools.php | ImageTools.resize | public function resize(Image $image, $width, $height, $method)
{
// Get Image Dimensions:
$imageWidth = $image->getWidth();
$imageHeight = $image->getHeight();
// Calculate Width and Height (if required):
if ($width && !$height && $imageWidth) {
$height = round(($width / $imageWidth) * $imageHeight);
} elseif (!$width && $height && $imageHeight) {
$width = round(($height / $imageHeight) * $imageWidth);
}
// Perform Image Resizing:
if ($width && $height) {
switch (strtolower($method)) {
case self::RESIZE_CROP_WIDTH:
return $image->CropWidth($width);
case self::RESIZE_CROP_HEIGHT:
return $image->CropHeight($height);
case self::RESIZE_FILL:
return $image->Fill($width, $height);
case self::RESIZE_FILL_MAX:
return $image->FillMax($width, $height);
case self::RESIZE_FILL_PRIORITY:
return $image->FillPriority($width, $height);
case self::RESIZE_FIT:
return $image->Fit($width, $height);
case self::RESIZE_FIT_MAX:
return $image->FitMax($width, $height);
case self::RESIZE_PAD:
return $image->Pad($width, $height);
case self::RESIZE_SCALE_WIDTH:
return $image->ScaleWidth($width);
case self::RESIZE_SCALE_HEIGHT:
return $image->ScaleHeight($height);
case self::RESIZE_SCALE_MAX_WIDTH:
return $image->ScaleMaxWidth($width);
case self::RESIZE_SCALE_MAX_HEIGHT:
return $image->ScaleMaxHeight($height);
}
}
// Answer Original Image:
return $image;
} | php | public function resize(Image $image, $width, $height, $method)
{
// Get Image Dimensions:
$imageWidth = $image->getWidth();
$imageHeight = $image->getHeight();
// Calculate Width and Height (if required):
if ($width && !$height && $imageWidth) {
$height = round(($width / $imageWidth) * $imageHeight);
} elseif (!$width && $height && $imageHeight) {
$width = round(($height / $imageHeight) * $imageWidth);
}
// Perform Image Resizing:
if ($width && $height) {
switch (strtolower($method)) {
case self::RESIZE_CROP_WIDTH:
return $image->CropWidth($width);
case self::RESIZE_CROP_HEIGHT:
return $image->CropHeight($height);
case self::RESIZE_FILL:
return $image->Fill($width, $height);
case self::RESIZE_FILL_MAX:
return $image->FillMax($width, $height);
case self::RESIZE_FILL_PRIORITY:
return $image->FillPriority($width, $height);
case self::RESIZE_FIT:
return $image->Fit($width, $height);
case self::RESIZE_FIT_MAX:
return $image->FitMax($width, $height);
case self::RESIZE_PAD:
return $image->Pad($width, $height);
case self::RESIZE_SCALE_WIDTH:
return $image->ScaleWidth($width);
case self::RESIZE_SCALE_HEIGHT:
return $image->ScaleHeight($height);
case self::RESIZE_SCALE_MAX_WIDTH:
return $image->ScaleMaxWidth($width);
case self::RESIZE_SCALE_MAX_HEIGHT:
return $image->ScaleMaxHeight($height);
}
}
// Answer Original Image:
return $image;
} | [
"public",
"function",
"resize",
"(",
"Image",
"$",
"image",
",",
"$",
"width",
",",
"$",
"height",
",",
"$",
"method",
")",
"{",
"// Get Image Dimensions:",
"$",
"imageWidth",
"=",
"$",
"image",
"->",
"getWidth",
"(",
")",
";",
"$",
"imageHeight",
"=",
... | Resizes the given image using the specified dimensions and resize method.
@param Image $image
@param integer $width
@param integer $height
@param string $method
@return Image | [
"Resizes",
"the",
"given",
"image",
"using",
"the",
"specified",
"dimensions",
"and",
"resize",
"method",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Tools/ImageTools.php#L113-L177 |
231,889 | praxisnetau/silverware | src/Extensions/Lists/ListItemExtension.php | ListItemExtension.getListItemClassNames | public function getListItemClassNames()
{
// Initialise:
$classes = ['item'];
// Merge Ancestor Class Names:
$classes = array_merge(
$classes,
ViewTools::singleton()->getAncestorClassNames(
$this->owner,
$this->owner->baseClass()
)
);
// Merge Meta Class Names:
if ($this->owner->hasMethod('getMetaClassNames')) {
$classes = array_merge($classes, $this->owner->getMetaClassNames());
}
// Update Class Names via Renderer:
if ($this->owner->getRenderer()->hasMethod('updateListItemClassNames')) {
$this->owner->getRenderer()->updateListItemClassNames($classes);
}
// Answer Classes:
return $classes;
} | php | public function getListItemClassNames()
{
// Initialise:
$classes = ['item'];
// Merge Ancestor Class Names:
$classes = array_merge(
$classes,
ViewTools::singleton()->getAncestorClassNames(
$this->owner,
$this->owner->baseClass()
)
);
// Merge Meta Class Names:
if ($this->owner->hasMethod('getMetaClassNames')) {
$classes = array_merge($classes, $this->owner->getMetaClassNames());
}
// Update Class Names via Renderer:
if ($this->owner->getRenderer()->hasMethod('updateListItemClassNames')) {
$this->owner->getRenderer()->updateListItemClassNames($classes);
}
// Answer Classes:
return $classes;
} | [
"public",
"function",
"getListItemClassNames",
"(",
")",
"{",
"// Initialise:",
"$",
"classes",
"=",
"[",
"'item'",
"]",
";",
"// Merge Ancestor Class Names:",
"$",
"classes",
"=",
"array_merge",
"(",
"$",
"classes",
",",
"ViewTools",
"::",
"singleton",
"(",
")"... | Answers an array of list item class names for the HTML template.
@return array | [
"Answers",
"an",
"array",
"of",
"list",
"item",
"class",
"names",
"for",
"the",
"HTML",
"template",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Lists/ListItemExtension.php#L108-L139 |
231,890 | praxisnetau/silverware | src/Extensions/Lists/ListItemExtension.php | ListItemExtension.getListItemTemplate | public function getListItemTemplate()
{
// Define Template by Class:
$template = sprintf('%s\ListItem', get_class($this->owner));
// Define Template via Renderer:
if ($this->owner->getRenderer()->hasMethod('getListItemTemplate')) {
$template = $this->owner->getRenderer()->getListItemTemplate(get_class($this->owner));
}
// Verify Template Exists:
if (SSViewer::hasTemplate($template)) {
return $template;
}
// Answer Default Template:
return $this->owner->getDefaultListItemTemplate();
} | php | public function getListItemTemplate()
{
// Define Template by Class:
$template = sprintf('%s\ListItem', get_class($this->owner));
// Define Template via Renderer:
if ($this->owner->getRenderer()->hasMethod('getListItemTemplate')) {
$template = $this->owner->getRenderer()->getListItemTemplate(get_class($this->owner));
}
// Verify Template Exists:
if (SSViewer::hasTemplate($template)) {
return $template;
}
// Answer Default Template:
return $this->owner->getDefaultListItemTemplate();
} | [
"public",
"function",
"getListItemTemplate",
"(",
")",
"{",
"// Define Template by Class:",
"$",
"template",
"=",
"sprintf",
"(",
"'%s\\ListItem'",
",",
"get_class",
"(",
"$",
"this",
"->",
"owner",
")",
")",
";",
"// Define Template via Renderer:",
"if",
"(",
"$"... | Answers the name of the list item template.
@return string | [
"Answers",
"the",
"name",
"of",
"the",
"list",
"item",
"template",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Lists/ListItemExtension.php#L186-L207 |
231,891 | praxisnetau/silverware | src/Extensions/Lists/ListItemExtension.php | ListItemExtension.renderListItem | public function renderListItem($isFirst = false, $isMiddle = false, $isLast = false, $wtf = false)
{
return $this->owner->customise([
'isFirst' => $isFirst,
'isMiddle' => $isMiddle,
'isLast' => $isLast
])->renderWith($this->owner->getListItemTemplate());
} | php | public function renderListItem($isFirst = false, $isMiddle = false, $isLast = false, $wtf = false)
{
return $this->owner->customise([
'isFirst' => $isFirst,
'isMiddle' => $isMiddle,
'isLast' => $isLast
])->renderWith($this->owner->getListItemTemplate());
} | [
"public",
"function",
"renderListItem",
"(",
"$",
"isFirst",
"=",
"false",
",",
"$",
"isMiddle",
"=",
"false",
",",
"$",
"isLast",
"=",
"false",
",",
"$",
"wtf",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"owner",
"->",
"customise",
"(",
"[... | Renders the object as a list item for the HTML template.
@param boolean $isFirst Item is first in the list.
@param boolean $isMiddle Item is in the middle of the list.
@param boolean $isLast Item is last in the list.
@return DBHTMLText | [
"Renders",
"the",
"object",
"as",
"a",
"list",
"item",
"for",
"the",
"HTML",
"template",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Lists/ListItemExtension.php#L228-L235 |
231,892 | praxisnetau/silverware | src/Extensions/Lists/ListItemExtension.php | ListItemExtension.getListItemDetails | public function getListItemDetails()
{
$details = ArrayList::create();
foreach ($this->owner->getListItemDetailsConfig() as $name => $spec) {
if ($spec) {
foreach ($spec as $item => $value) {
$args = [];
if (is_array($value)) {
$args = $value;
$value = array_shift($args);
}
$spec[$item] = $this->processListItemValue($value, $args);
}
if (isset($spec['show']) && !$this->owner->{$spec['show']}) {
continue;
}
$details->push(
ArrayData::create([
'Name' => $name,
'Icon' => isset($spec['icon']) ? $spec['icon'] : null,
'Text' => isset($spec['text']) ? $spec['text'] : null
])
);
}
}
return $details;
} | php | public function getListItemDetails()
{
$details = ArrayList::create();
foreach ($this->owner->getListItemDetailsConfig() as $name => $spec) {
if ($spec) {
foreach ($spec as $item => $value) {
$args = [];
if (is_array($value)) {
$args = $value;
$value = array_shift($args);
}
$spec[$item] = $this->processListItemValue($value, $args);
}
if (isset($spec['show']) && !$this->owner->{$spec['show']}) {
continue;
}
$details->push(
ArrayData::create([
'Name' => $name,
'Icon' => isset($spec['icon']) ? $spec['icon'] : null,
'Text' => isset($spec['text']) ? $spec['text'] : null
])
);
}
}
return $details;
} | [
"public",
"function",
"getListItemDetails",
"(",
")",
"{",
"$",
"details",
"=",
"ArrayList",
"::",
"create",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"owner",
"->",
"getListItemDetailsConfig",
"(",
")",
"as",
"$",
"name",
"=>",
"$",
"spec",
")",... | Answers an array list object containing the item details for the template.
@return ArrayList | [
"Answers",
"an",
"array",
"list",
"object",
"containing",
"the",
"item",
"details",
"for",
"the",
"template",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Lists/ListItemExtension.php#L242-L280 |
231,893 | praxisnetau/silverware | src/Extensions/Lists/ListItemExtension.php | ListItemExtension.getListItemDetailsConfig | public function getListItemDetailsConfig()
{
$config = [];
if (is_array($this->owner->config()->default_list_item_details)) {
$config = $this->owner->config()->default_list_item_details;
}
if (is_array($this->owner->config()->list_item_details)) {
foreach ($this->owner->config()->list_item_details as $name => $spec) {
if (!$spec) {
unset($config[$name]);
}
}
$config = array_merge_recursive($config, $this->owner->config()->list_item_details);
}
return $config;
} | php | public function getListItemDetailsConfig()
{
$config = [];
if (is_array($this->owner->config()->default_list_item_details)) {
$config = $this->owner->config()->default_list_item_details;
}
if (is_array($this->owner->config()->list_item_details)) {
foreach ($this->owner->config()->list_item_details as $name => $spec) {
if (!$spec) {
unset($config[$name]);
}
}
$config = array_merge_recursive($config, $this->owner->config()->list_item_details);
}
return $config;
} | [
"public",
"function",
"getListItemDetailsConfig",
"(",
")",
"{",
"$",
"config",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"owner",
"->",
"config",
"(",
")",
"->",
"default_list_item_details",
")",
")",
"{",
"$",
"config",
"=",
... | Answers the list item details config for the receiver.
@return array | [
"Answers",
"the",
"list",
"item",
"details",
"config",
"for",
"the",
"receiver",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Lists/ListItemExtension.php#L287-L310 |
231,894 | praxisnetau/silverware | src/Extensions/Lists/ListItemExtension.php | ListItemExtension.getListItemButtons | public function getListItemButtons()
{
$buttons = ArrayList::create();
foreach ($this->owner->getListItemButtonsConfig() as $name => $spec) {
if ($spec) {
foreach ($spec as $item => $value) {
$args = [];
if (is_array($value)) {
$args = $value;
$value = array_shift($args);
}
$spec[$item] = $this->processListItemValue($value, $args);
}
if (isset($spec['show']) && !$this->owner->{$spec['show']}) {
continue;
}
$href = isset($spec['href']) ? $spec['href'] : null;
$type = null;
$extra = null;
if ($renderer = $this->owner->getRenderer()) {
$type = $renderer->ButtonTypeStyle;
$extra = $renderer->ButtonExtraClass;
}
if ($href) {
$buttons->push(
ArrayData::create([
'Icon' => isset($spec['icon']) ? $spec['icon'] : null,
'Type' => isset($spec['type']) ? $spec['type'] : $type,
'HREF' => isset($spec['href']) ? $spec['href'] : null,
'Text' => isset($spec['text']) ? $spec['text'] : null,
'ExtraClass' => isset($spec['extraClass']) ? $spec['extraClass'] : $extra
])
);
}
}
}
return $buttons;
} | php | public function getListItemButtons()
{
$buttons = ArrayList::create();
foreach ($this->owner->getListItemButtonsConfig() as $name => $spec) {
if ($spec) {
foreach ($spec as $item => $value) {
$args = [];
if (is_array($value)) {
$args = $value;
$value = array_shift($args);
}
$spec[$item] = $this->processListItemValue($value, $args);
}
if (isset($spec['show']) && !$this->owner->{$spec['show']}) {
continue;
}
$href = isset($spec['href']) ? $spec['href'] : null;
$type = null;
$extra = null;
if ($renderer = $this->owner->getRenderer()) {
$type = $renderer->ButtonTypeStyle;
$extra = $renderer->ButtonExtraClass;
}
if ($href) {
$buttons->push(
ArrayData::create([
'Icon' => isset($spec['icon']) ? $spec['icon'] : null,
'Type' => isset($spec['type']) ? $spec['type'] : $type,
'HREF' => isset($spec['href']) ? $spec['href'] : null,
'Text' => isset($spec['text']) ? $spec['text'] : null,
'ExtraClass' => isset($spec['extraClass']) ? $spec['extraClass'] : $extra
])
);
}
}
}
return $buttons;
} | [
"public",
"function",
"getListItemButtons",
"(",
")",
"{",
"$",
"buttons",
"=",
"ArrayList",
"::",
"create",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"owner",
"->",
"getListItemButtonsConfig",
"(",
")",
"as",
"$",
"name",
"=>",
"$",
"spec",
")",... | Answers an array list object containing the item buttons for the template.
@return ArrayList | [
"Answers",
"an",
"array",
"list",
"object",
"containing",
"the",
"item",
"buttons",
"for",
"the",
"template",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Lists/ListItemExtension.php#L317-L371 |
231,895 | praxisnetau/silverware | src/Extensions/Lists/ListItemExtension.php | ListItemExtension.getListItemButtonsConfig | public function getListItemButtonsConfig()
{
$config = [];
if (is_array($this->owner->config()->default_list_item_buttons)) {
$config = $this->owner->config()->default_list_item_buttons;
}
if (is_array($this->owner->config()->list_item_buttons)) {
foreach ($this->owner->config()->list_item_buttons as $name => $spec) {
if (!$spec) {
unset($config[$name]);
}
}
$config = array_merge_recursive($config, $this->owner->config()->list_item_buttons);
}
return $config;
} | php | public function getListItemButtonsConfig()
{
$config = [];
if (is_array($this->owner->config()->default_list_item_buttons)) {
$config = $this->owner->config()->default_list_item_buttons;
}
if (is_array($this->owner->config()->list_item_buttons)) {
foreach ($this->owner->config()->list_item_buttons as $name => $spec) {
if (!$spec) {
unset($config[$name]);
}
}
$config = array_merge_recursive($config, $this->owner->config()->list_item_buttons);
}
return $config;
} | [
"public",
"function",
"getListItemButtonsConfig",
"(",
")",
"{",
"$",
"config",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"owner",
"->",
"config",
"(",
")",
"->",
"default_list_item_buttons",
")",
")",
"{",
"$",
"config",
"=",
... | Answers the list item buttons config for the receiver.
@return array | [
"Answers",
"the",
"list",
"item",
"buttons",
"config",
"for",
"the",
"receiver",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Lists/ListItemExtension.php#L378-L401 |
231,896 | i-am-tom/schemer | src/Validator/Collection.php | Collection.max | public function max(int $count) : Collection
{
return $this->pipe(
self::predicate(
function (array $values) use ($count) : bool {
return count($values) <= $count;
},
'not at most ' . self::elementf($count)
)
);
} | php | public function max(int $count) : Collection
{
return $this->pipe(
self::predicate(
function (array $values) use ($count) : bool {
return count($values) <= $count;
},
'not at most ' . self::elementf($count)
)
);
} | [
"public",
"function",
"max",
"(",
"int",
"$",
"count",
")",
":",
"Collection",
"{",
"return",
"$",
"this",
"->",
"pipe",
"(",
"self",
"::",
"predicate",
"(",
"function",
"(",
"array",
"$",
"values",
")",
"use",
"(",
"$",
"count",
")",
":",
"bool",
... | The collection must have no more than a given number of elements.
@param int $count The maximum number of elements.
@return Schemer\Validator\Collection | [
"The",
"collection",
"must",
"have",
"no",
"more",
"than",
"a",
"given",
"number",
"of",
"elements",
"."
] | aa4ff458eae636ca61ada07d05859e27d3b4584d | https://github.com/i-am-tom/schemer/blob/aa4ff458eae636ca61ada07d05859e27d3b4584d/src/Validator/Collection.php#L72-L82 |
231,897 | i-am-tom/schemer | src/Validator/Collection.php | Collection.ordered | public function ordered(callable $comparator = null) : Collection
{
return $this->pipe(
self::predicate(
function (array $values) use ($comparator) : bool {
$sorted = $values;
$comparator !== null
? usort($values, $comparator)
: sort($values);
return $sorted === $values;
},
'not ordered'
)
);
} | php | public function ordered(callable $comparator = null) : Collection
{
return $this->pipe(
self::predicate(
function (array $values) use ($comparator) : bool {
$sorted = $values;
$comparator !== null
? usort($values, $comparator)
: sort($values);
return $sorted === $values;
},
'not ordered'
)
);
} | [
"public",
"function",
"ordered",
"(",
"callable",
"$",
"comparator",
"=",
"null",
")",
":",
"Collection",
"{",
"return",
"$",
"this",
"->",
"pipe",
"(",
"self",
"::",
"predicate",
"(",
"function",
"(",
"array",
"$",
"values",
")",
"use",
"(",
"$",
"com... | This collection values must be ordered in some way.
@param callable $comparator A custom comparator function.
@return Schemer\Validator\Schemer | [
"This",
"collection",
"values",
"must",
"be",
"ordered",
"in",
"some",
"way",
"."
] | aa4ff458eae636ca61ada07d05859e27d3b4584d | https://github.com/i-am-tom/schemer/blob/aa4ff458eae636ca61ada07d05859e27d3b4584d/src/Validator/Collection.php#L106-L122 |
231,898 | i-am-tom/schemer | src/Validator/Collection.php | Collection.unique | public function unique() : Collection
{
return $this->pipe(
self::predicate(
function (array $values) : bool {
return array_unique($values) === $values;
},
'not all unique elements'
)
);
} | php | public function unique() : Collection
{
return $this->pipe(
self::predicate(
function (array $values) : bool {
return array_unique($values) === $values;
},
'not all unique elements'
)
);
} | [
"public",
"function",
"unique",
"(",
")",
":",
"Collection",
"{",
"return",
"$",
"this",
"->",
"pipe",
"(",
"self",
"::",
"predicate",
"(",
"function",
"(",
"array",
"$",
"values",
")",
":",
"bool",
"{",
"return",
"array_unique",
"(",
"$",
"values",
")... | This collection must not contain duplicates.
@return Schemer\Validator\Collection | [
"This",
"collection",
"must",
"not",
"contain",
"duplicates",
"."
] | aa4ff458eae636ca61ada07d05859e27d3b4584d | https://github.com/i-am-tom/schemer/blob/aa4ff458eae636ca61ada07d05859e27d3b4584d/src/Validator/Collection.php#L128-L138 |
231,899 | praxisnetau/silverware | src/Extensions/Lists/ListViewExtension.php | ListViewExtension.getListComponent | public function getListComponent()
{
// Obtain List Object:
$list = $this->owner->getListObjectInherited();
// Define List Parent:
$list->setParentInstance($this->owner);
// Define List Source:
$list->setSource($this->owner->getListSource());
// Initialise Component:
$list->doInit();
// Answer List Component:
return $list;
} | php | public function getListComponent()
{
// Obtain List Object:
$list = $this->owner->getListObjectInherited();
// Define List Parent:
$list->setParentInstance($this->owner);
// Define List Source:
$list->setSource($this->owner->getListSource());
// Initialise Component:
$list->doInit();
// Answer List Component:
return $list;
} | [
"public",
"function",
"getListComponent",
"(",
")",
"{",
"// Obtain List Object:",
"$",
"list",
"=",
"$",
"this",
"->",
"owner",
"->",
"getListObjectInherited",
"(",
")",
";",
"// Define List Parent:",
"$",
"list",
"->",
"setParentInstance",
"(",
"$",
"this",
"-... | Answers the list component for the template.
@return BaseListComponent | [
"Answers",
"the",
"list",
"component",
"for",
"the",
"template",
"."
] | 2fa731c7f0737b350e0cbc676e93ac5beb430792 | https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Lists/ListViewExtension.php#L546-L567 |
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.