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,900
praxisnetau/silverware
src/Extensions/Lists/ListViewExtension.php
ListViewExtension.getListClassOptions
public function getListClassOptions() { $options = []; foreach (ClassTools::singleton()->getVisibleSubClasses(BaseListComponent::class) as $class) { $options[$class] = Injector::inst()->get($class)->i18n_singular_name(); } return $options; }
php
public function getListClassOptions() { $options = []; foreach (ClassTools::singleton()->getVisibleSubClasses(BaseListComponent::class) as $class) { $options[$class] = Injector::inst()->get($class)->i18n_singular_name(); } return $options; }
[ "public", "function", "getListClassOptions", "(", ")", "{", "$", "options", "=", "[", "]", ";", "foreach", "(", "ClassTools", "::", "singleton", "(", ")", "->", "getVisibleSubClasses", "(", "BaseListComponent", "::", "class", ")", "as", "$", "class", ")", "{", "$", "options", "[", "$", "class", "]", "=", "Injector", "::", "inst", "(", ")", "->", "get", "(", "$", "class", ")", "->", "i18n_singular_name", "(", ")", ";", "}", "return", "$", "options", ";", "}" ]
Answers an array of options for the list class field. @return array
[ "Answers", "an", "array", "of", "options", "for", "the", "list", "class", "field", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Lists/ListViewExtension.php#L584-L593
231,901
praxisnetau/silverware
src/Extensions/Lists/ListViewExtension.php
ListViewExtension.getListObjectInherited
public function getListObjectInherited() { return $this->owner->ListInherit ? $this->owner->getParent()->getListObject() : $this->owner->getListObject(); }
php
public function getListObjectInherited() { return $this->owner->ListInherit ? $this->owner->getParent()->getListObject() : $this->owner->getListObject(); }
[ "public", "function", "getListObjectInherited", "(", ")", "{", "return", "$", "this", "->", "owner", "->", "ListInherit", "?", "$", "this", "->", "owner", "->", "getParent", "(", ")", "->", "getListObject", "(", ")", ":", "$", "this", "->", "owner", "->", "getListObject", "(", ")", ";", "}" ]
Answers the list component instance associated with the extended object or alternatively the parent. @return BaseListComponent
[ "Answers", "the", "list", "component", "instance", "associated", "with", "the", "extended", "object", "or", "alternatively", "the", "parent", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Lists/ListViewExtension.php#L612-L615
231,902
praxisnetau/silverware
src/Extensions/Lists/ListViewExtension.php
ListViewExtension.createListObject
public function createListObject() { // Create List Object: $object = Injector::inst()->create( $this->owner->getListComponentClass(), $this->owner->getListComponentDefaults() ); // Define List Object: $object->Title = $this->owner->Title; $object->HideTitle = 1; if ($folder = ComponentFolder::find()) { $object->ParentID = $folder->ID; $object->write(); } // Answer List Object: return $object; }
php
public function createListObject() { // Create List Object: $object = Injector::inst()->create( $this->owner->getListComponentClass(), $this->owner->getListComponentDefaults() ); // Define List Object: $object->Title = $this->owner->Title; $object->HideTitle = 1; if ($folder = ComponentFolder::find()) { $object->ParentID = $folder->ID; $object->write(); } // Answer List Object: return $object; }
[ "public", "function", "createListObject", "(", ")", "{", "// Create List Object:", "$", "object", "=", "Injector", "::", "inst", "(", ")", "->", "create", "(", "$", "this", "->", "owner", "->", "getListComponentClass", "(", ")", ",", "$", "this", "->", "owner", "->", "getListComponentDefaults", "(", ")", ")", ";", "// Define List Object:", "$", "object", "->", "Title", "=", "$", "this", "->", "owner", "->", "Title", ";", "$", "object", "->", "HideTitle", "=", "1", ";", "if", "(", "$", "folder", "=", "ComponentFolder", "::", "find", "(", ")", ")", "{", "$", "object", "->", "ParentID", "=", "$", "folder", "->", "ID", ";", "$", "object", "->", "write", "(", ")", ";", "}", "// Answer List Object:", "return", "$", "object", ";", "}" ]
Create a new instance of the list component. @return BaseListComponent
[ "Create", "a", "new", "instance", "of", "the", "list", "component", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Lists/ListViewExtension.php#L622-L644
231,903
praxisnetau/silverware
src/Extensions/Lists/ListViewExtension.php
ListViewExtension.findOrMakeListObject
public function findOrMakeListObject() { // Obtain List Object: $object = $this->owner->getListObject(); // Create List Object (if required): if (!$object->isInDB()) { $object = $this->owner->createListObject(); } // Answer List Object: return $object; }
php
public function findOrMakeListObject() { // Obtain List Object: $object = $this->owner->getListObject(); // Create List Object (if required): if (!$object->isInDB()) { $object = $this->owner->createListObject(); } // Answer List Object: return $object; }
[ "public", "function", "findOrMakeListObject", "(", ")", "{", "// Obtain List Object:", "$", "object", "=", "$", "this", "->", "owner", "->", "getListObject", "(", ")", ";", "// Create List Object (if required):", "if", "(", "!", "$", "object", "->", "isInDB", "(", ")", ")", "{", "$", "object", "=", "$", "this", "->", "owner", "->", "createListObject", "(", ")", ";", "}", "// Answer List Object:", "return", "$", "object", ";", "}" ]
Answers either an existing instance or a new instance of the list object. @return BaseListComponent
[ "Answers", "either", "an", "existing", "instance", "or", "a", "new", "instance", "of", "the", "list", "object", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Lists/ListViewExtension.php#L651-L666
231,904
praxisnetau/silverware
src/Extensions/Lists/ListViewExtension.php
ListViewExtension.updateListObject
public function updateListObject() { // Bail Early (if not draft): if (Versioned::get_stage() !== Versioned::DRAFT) { return; } // Obtain List Object: $object = $this->owner->findOrMakeListObject(); // Verify List Object Exists: if ($object->isInDB()) { // Obtain List Object Class: $class = $this->owner->getListComponentClass(); // Mutate List Object (if required): if ($object->ClassName != $class) { $object = $object->newClassInstance($class); } // Define List Object: if ($request = Controller::curr()->getRequest()) { if ($config = $request->postVar(self::FIELD_WRAPPER)) { foreach ($config as $name => $value) { $object->$name = $value; } } } // Update List Title: if ($object->Title === $this->getNewTitle()) { $object->Title = $this->owner->Title; } // Record List Object: $object->write(); // Associate with Owner: $this->owner->ListObjectID = $object->ID; } }
php
public function updateListObject() { // Bail Early (if not draft): if (Versioned::get_stage() !== Versioned::DRAFT) { return; } // Obtain List Object: $object = $this->owner->findOrMakeListObject(); // Verify List Object Exists: if ($object->isInDB()) { // Obtain List Object Class: $class = $this->owner->getListComponentClass(); // Mutate List Object (if required): if ($object->ClassName != $class) { $object = $object->newClassInstance($class); } // Define List Object: if ($request = Controller::curr()->getRequest()) { if ($config = $request->postVar(self::FIELD_WRAPPER)) { foreach ($config as $name => $value) { $object->$name = $value; } } } // Update List Title: if ($object->Title === $this->getNewTitle()) { $object->Title = $this->owner->Title; } // Record List Object: $object->write(); // Associate with Owner: $this->owner->ListObjectID = $object->ID; } }
[ "public", "function", "updateListObject", "(", ")", "{", "// Bail Early (if not draft):", "if", "(", "Versioned", "::", "get_stage", "(", ")", "!==", "Versioned", "::", "DRAFT", ")", "{", "return", ";", "}", "// Obtain List Object:", "$", "object", "=", "$", "this", "->", "owner", "->", "findOrMakeListObject", "(", ")", ";", "// Verify List Object Exists:", "if", "(", "$", "object", "->", "isInDB", "(", ")", ")", "{", "// Obtain List Object Class:", "$", "class", "=", "$", "this", "->", "owner", "->", "getListComponentClass", "(", ")", ";", "// Mutate List Object (if required):", "if", "(", "$", "object", "->", "ClassName", "!=", "$", "class", ")", "{", "$", "object", "=", "$", "object", "->", "newClassInstance", "(", "$", "class", ")", ";", "}", "// Define List Object:", "if", "(", "$", "request", "=", "Controller", "::", "curr", "(", ")", "->", "getRequest", "(", ")", ")", "{", "if", "(", "$", "config", "=", "$", "request", "->", "postVar", "(", "self", "::", "FIELD_WRAPPER", ")", ")", "{", "foreach", "(", "$", "config", "as", "$", "name", "=>", "$", "value", ")", "{", "$", "object", "->", "$", "name", "=", "$", "value", ";", "}", "}", "}", "// Update List Title:", "if", "(", "$", "object", "->", "Title", "===", "$", "this", "->", "getNewTitle", "(", ")", ")", "{", "$", "object", "->", "Title", "=", "$", "this", "->", "owner", "->", "Title", ";", "}", "// Record List Object:", "$", "object", "->", "write", "(", ")", ";", "// Associate with Owner:", "$", "this", "->", "owner", "->", "ListObjectID", "=", "$", "object", "->", "ID", ";", "}", "}" ]
Updates the list component instance within the database. @return void
[ "Updates", "the", "list", "component", "instance", "within", "the", "database", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Lists/ListViewExtension.php#L673-L728
231,905
praxisnetau/silverware
src/Extensions/Lists/ListViewExtension.php
ListViewExtension.getListStyleFields
protected function getListStyleFields() { $fields = FieldList::create(); if ($list = $this->owner->getListObject()) { $fields = $list->getListStyleFields(); foreach ($fields->dataFields() as $field) { $name = $field->getName(); if (isset($list->$name)) { $field->setValue($list->$name, $list); } } $this->hideFields($fields); } return $this->nest($fields); }
php
protected function getListStyleFields() { $fields = FieldList::create(); if ($list = $this->owner->getListObject()) { $fields = $list->getListStyleFields(); foreach ($fields->dataFields() as $field) { $name = $field->getName(); if (isset($list->$name)) { $field->setValue($list->$name, $list); } } $this->hideFields($fields); } return $this->nest($fields); }
[ "protected", "function", "getListStyleFields", "(", ")", "{", "$", "fields", "=", "FieldList", "::", "create", "(", ")", ";", "if", "(", "$", "list", "=", "$", "this", "->", "owner", "->", "getListObject", "(", ")", ")", "{", "$", "fields", "=", "$", "list", "->", "getListStyleFields", "(", ")", ";", "foreach", "(", "$", "fields", "->", "dataFields", "(", ")", "as", "$", "field", ")", "{", "$", "name", "=", "$", "field", "->", "getName", "(", ")", ";", "if", "(", "isset", "(", "$", "list", "->", "$", "name", ")", ")", "{", "$", "field", "->", "setValue", "(", "$", "list", "->", "$", "name", ",", "$", "list", ")", ";", "}", "}", "$", "this", "->", "hideFields", "(", "$", "fields", ")", ";", "}", "return", "$", "this", "->", "nest", "(", "$", "fields", ")", ";", "}" ]
Answers the style fields for the list component. @return FieldList
[ "Answers", "the", "style", "fields", "for", "the", "list", "component", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Lists/ListViewExtension.php#L751-L774
231,906
praxisnetau/silverware
src/Extensions/Lists/ListViewExtension.php
ListViewExtension.hideFields
protected function hideFields(FieldList $fields) { if ($this->owner->ListInherit) { foreach ($fields as $field) { $field->addExtraClass('hidden'); } } return $fields; }
php
protected function hideFields(FieldList $fields) { if ($this->owner->ListInherit) { foreach ($fields as $field) { $field->addExtraClass('hidden'); } } return $fields; }
[ "protected", "function", "hideFields", "(", "FieldList", "$", "fields", ")", "{", "if", "(", "$", "this", "->", "owner", "->", "ListInherit", ")", "{", "foreach", "(", "$", "fields", "as", "$", "field", ")", "{", "$", "field", "->", "addExtraClass", "(", "'hidden'", ")", ";", "}", "}", "return", "$", "fields", ";", "}" ]
Hides the given list of fields if the extended object inherits the list component. @param FieldList $fields @return FieldList
[ "Hides", "the", "given", "list", "of", "fields", "if", "the", "extended", "object", "inherits", "the", "list", "component", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Lists/ListViewExtension.php#L813-L824
231,907
praxisnetau/silverware
src/Extensions/Lists/ListViewExtension.php
ListViewExtension.nest
protected function nest(FieldList $fields) { // Iterate Data Fields: foreach ($fields->dataFields() as $field) { $field->setName($this->nestName($field->getName())); } // Answer Fields: return $fields; }
php
protected function nest(FieldList $fields) { // Iterate Data Fields: foreach ($fields->dataFields() as $field) { $field->setName($this->nestName($field->getName())); } // Answer Fields: return $fields; }
[ "protected", "function", "nest", "(", "FieldList", "$", "fields", ")", "{", "// Iterate Data Fields:", "foreach", "(", "$", "fields", "->", "dataFields", "(", ")", "as", "$", "field", ")", "{", "$", "field", "->", "setName", "(", "$", "this", "->", "nestName", "(", "$", "field", "->", "getName", "(", ")", ")", ")", ";", "}", "// Answer Fields:", "return", "$", "fields", ";", "}" ]
Nests the names of the given fields within the list config wrapper. @param FieldList $fields @return FieldList
[ "Nests", "the", "names", "of", "the", "given", "fields", "within", "the", "list", "config", "wrapper", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Lists/ListViewExtension.php#L846-L857
231,908
praxisnetau/silverware
src/Extensions/Lists/ListViewExtension.php
ListViewExtension.nestName
protected function nestName($name) { // Obtain Bracket Position: $bpos = strpos($name, '['); // Has Bracket? if ($bpos !== false) { // Answer Bracketed Name: return sprintf('%s[%s]%s', self::FIELD_WRAPPER, substr($name, 0, $bpos), substr($name, $bpos)); } else { // Answer Regular Name: return sprintf('%s[%s]', self::FIELD_WRAPPER, $name); } }
php
protected function nestName($name) { // Obtain Bracket Position: $bpos = strpos($name, '['); // Has Bracket? if ($bpos !== false) { // Answer Bracketed Name: return sprintf('%s[%s]%s', self::FIELD_WRAPPER, substr($name, 0, $bpos), substr($name, $bpos)); } else { // Answer Regular Name: return sprintf('%s[%s]', self::FIELD_WRAPPER, $name); } }
[ "protected", "function", "nestName", "(", "$", "name", ")", "{", "// Obtain Bracket Position:", "$", "bpos", "=", "strpos", "(", "$", "name", ",", "'['", ")", ";", "// Has Bracket?", "if", "(", "$", "bpos", "!==", "false", ")", "{", "// Answer Bracketed Name:", "return", "sprintf", "(", "'%s[%s]%s'", ",", "self", "::", "FIELD_WRAPPER", ",", "substr", "(", "$", "name", ",", "0", ",", "$", "bpos", ")", ",", "substr", "(", "$", "name", ",", "$", "bpos", ")", ")", ";", "}", "else", "{", "// Answer Regular Name:", "return", "sprintf", "(", "'%s[%s]'", ",", "self", "::", "FIELD_WRAPPER", ",", "$", "name", ")", ";", "}", "}" ]
Nests the given field name within the list config wrapper. @param string $name @return string
[ "Nests", "the", "given", "field", "name", "within", "the", "list", "config", "wrapper", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Lists/ListViewExtension.php#L866-L887
231,909
praxisnetau/silverware
src/Extensions/StyleExtension.php
StyleExtension.updateCustomCSS
public function updateCustomCSS(&$css) { $template = $this->owner->getStyleExtensionTemplate(static::class); if (SSViewer::hasTemplate($template)) { $css = ViewTools::singleton()->renderCSS($this->owner, $template, $css); } }
php
public function updateCustomCSS(&$css) { $template = $this->owner->getStyleExtensionTemplate(static::class); if (SSViewer::hasTemplate($template)) { $css = ViewTools::singleton()->renderCSS($this->owner, $template, $css); } }
[ "public", "function", "updateCustomCSS", "(", "&", "$", "css", ")", "{", "$", "template", "=", "$", "this", "->", "owner", "->", "getStyleExtensionTemplate", "(", "static", "::", "class", ")", ";", "if", "(", "SSViewer", "::", "hasTemplate", "(", "$", "template", ")", ")", "{", "$", "css", "=", "ViewTools", "::", "singleton", "(", ")", "->", "renderCSS", "(", "$", "this", "->", "owner", ",", "$", "template", ",", "$", "css", ")", ";", "}", "}" ]
Updates the array of custom CSS for the extended object. @param array $css @return void
[ "Updates", "the", "array", "of", "custom", "CSS", "for", "the", "extended", "object", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/StyleExtension.php#L82-L89
231,910
praxisnetau/silverware
src/Extensions/StyleExtension.php
StyleExtension.getAppliedStyles
protected function getAppliedStyles() { $applyStyles = $this->owner->config()->apply_styles; if (is_array($applyStyles)) { return $applyStyles; } elseif ($applyStyles == 'none') { return []; } }
php
protected function getAppliedStyles() { $applyStyles = $this->owner->config()->apply_styles; if (is_array($applyStyles)) { return $applyStyles; } elseif ($applyStyles == 'none') { return []; } }
[ "protected", "function", "getAppliedStyles", "(", ")", "{", "$", "applyStyles", "=", "$", "this", "->", "owner", "->", "config", "(", ")", "->", "apply_styles", ";", "if", "(", "is_array", "(", "$", "applyStyles", ")", ")", "{", "return", "$", "applyStyles", ";", "}", "elseif", "(", "$", "applyStyles", "==", "'none'", ")", "{", "return", "[", "]", ";", "}", "}" ]
Answers an array of the style extension classes to be applied to the extended object. @return array
[ "Answers", "an", "array", "of", "the", "style", "extension", "classes", "to", "be", "applied", "to", "the", "extended", "object", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/StyleExtension.php#L138-L147
231,911
sop/crypto-encoding
lib/CryptoEncoding/PEM.php
PEM.fromString
public static function fromString(string $str): self { if (!preg_match(self::PEM_REGEX, $str, $match)) { throw new \UnexpectedValueException("Not a PEM formatted string."); } $payload = preg_replace('/\s+/', "", $match[2]); $data = base64_decode($payload, true); if (false === $data) { throw new \UnexpectedValueException("Failed to decode PEM data."); } return new self($match[1], $data); }
php
public static function fromString(string $str): self { if (!preg_match(self::PEM_REGEX, $str, $match)) { throw new \UnexpectedValueException("Not a PEM formatted string."); } $payload = preg_replace('/\s+/', "", $match[2]); $data = base64_decode($payload, true); if (false === $data) { throw new \UnexpectedValueException("Failed to decode PEM data."); } return new self($match[1], $data); }
[ "public", "static", "function", "fromString", "(", "string", "$", "str", ")", ":", "self", "{", "if", "(", "!", "preg_match", "(", "self", "::", "PEM_REGEX", ",", "$", "str", ",", "$", "match", ")", ")", "{", "throw", "new", "\\", "UnexpectedValueException", "(", "\"Not a PEM formatted string.\"", ")", ";", "}", "$", "payload", "=", "preg_replace", "(", "'/\\s+/'", ",", "\"\"", ",", "$", "match", "[", "2", "]", ")", ";", "$", "data", "=", "base64_decode", "(", "$", "payload", ",", "true", ")", ";", "if", "(", "false", "===", "$", "data", ")", "{", "throw", "new", "\\", "UnexpectedValueException", "(", "\"Failed to decode PEM data.\"", ")", ";", "}", "return", "new", "self", "(", "$", "match", "[", "1", "]", ",", "$", "data", ")", ";", "}" ]
Initialize from a PEM-formatted string. @param string $str @throws \UnexpectedValueException If string is not valid PEM @return self
[ "Initialize", "from", "a", "PEM", "-", "formatted", "string", "." ]
b5958cc213d3092cb9fa7be179adf760a8fde1f6
https://github.com/sop/crypto-encoding/blob/b5958cc213d3092cb9fa7be179adf760a8fde1f6/lib/CryptoEncoding/PEM.php#L73-L84
231,912
EcomDev/cache-key
src/InvalidArgumentException.php
InvalidArgumentException.generateMessage
private function generateMessage($value) { if (is_object($value)) { return sprintf('An instance of "%s" is not suitable as cache key data', get_class($value)); } return sprintf('A variable of type "%s" is not suitable as cache key data', gettype($value)); }
php
private function generateMessage($value) { if (is_object($value)) { return sprintf('An instance of "%s" is not suitable as cache key data', get_class($value)); } return sprintf('A variable of type "%s" is not suitable as cache key data', gettype($value)); }
[ "private", "function", "generateMessage", "(", "$", "value", ")", "{", "if", "(", "is_object", "(", "$", "value", ")", ")", "{", "return", "sprintf", "(", "'An instance of \"%s\" is not suitable as cache key data'", ",", "get_class", "(", "$", "value", ")", ")", ";", "}", "return", "sprintf", "(", "'A variable of type \"%s\" is not suitable as cache key data'", ",", "gettype", "(", "$", "value", ")", ")", ";", "}" ]
Generates message based on variable type @param mixed $value @return string
[ "Generates", "message", "based", "on", "variable", "type" ]
5f90f5a013100ec57d7f3a842f48222ba8a4ccf9
https://github.com/EcomDev/cache-key/blob/5f90f5a013100ec57d7f3a842f48222ba8a4ccf9/src/InvalidArgumentException.php#L35-L42
231,913
praxisnetau/silverware
src/Extensions/Assets/RenderInlineExtension.php
RenderInlineExtension.getRenderInline
public function getRenderInline() { // Check File Exists / File Extension: if ($this->owner->exists() && $this->owner->getExtension() == 'svg') { // Create DOM Document: $dom = new DOMDocument(); // Load SVG Data into DOM: $dom->load(BASE_PATH . $this->owner->URL); // Normalise SVG Data: $dom->normalizeDocument(); // Render SVG as HTML: return DBField::create_field('HTMLFragment', $dom->saveHTML($dom->documentElement)); } }
php
public function getRenderInline() { // Check File Exists / File Extension: if ($this->owner->exists() && $this->owner->getExtension() == 'svg') { // Create DOM Document: $dom = new DOMDocument(); // Load SVG Data into DOM: $dom->load(BASE_PATH . $this->owner->URL); // Normalise SVG Data: $dom->normalizeDocument(); // Render SVG as HTML: return DBField::create_field('HTMLFragment', $dom->saveHTML($dom->documentElement)); } }
[ "public", "function", "getRenderInline", "(", ")", "{", "// Check File Exists / File Extension:", "if", "(", "$", "this", "->", "owner", "->", "exists", "(", ")", "&&", "$", "this", "->", "owner", "->", "getExtension", "(", ")", "==", "'svg'", ")", "{", "// Create DOM Document:", "$", "dom", "=", "new", "DOMDocument", "(", ")", ";", "// Load SVG Data into DOM:", "$", "dom", "->", "load", "(", "BASE_PATH", ".", "$", "this", "->", "owner", "->", "URL", ")", ";", "// Normalise SVG Data:", "$", "dom", "->", "normalizeDocument", "(", ")", ";", "// Render SVG as HTML:", "return", "DBField", "::", "create_field", "(", "'HTMLFragment'", ",", "$", "dom", "->", "saveHTML", "(", "$", "dom", "->", "documentElement", ")", ")", ";", "}", "}" ]
Renders the content of the extended object inline. @return DBHTMLText
[ "Renders", "the", "content", "of", "the", "extended", "object", "inline", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Assets/RenderInlineExtension.php#L40-L63
231,914
praxisnetau/silverware
src/Extensions/Model/URLSegmentExtension.php
URLSegmentExtension.validURLSegment
public function validURLSegment() { $list = DataList::create(get_class($this->owner))->filter(['URLSegment' => $this->owner->URLSegment]); if ($id = $this->owner->ID) { $list = $list->exclude(['ID' => $id]); } return !$list->exists(); }
php
public function validURLSegment() { $list = DataList::create(get_class($this->owner))->filter(['URLSegment' => $this->owner->URLSegment]); if ($id = $this->owner->ID) { $list = $list->exclude(['ID' => $id]); } return !$list->exists(); }
[ "public", "function", "validURLSegment", "(", ")", "{", "$", "list", "=", "DataList", "::", "create", "(", "get_class", "(", "$", "this", "->", "owner", ")", ")", "->", "filter", "(", "[", "'URLSegment'", "=>", "$", "this", "->", "owner", "->", "URLSegment", "]", ")", ";", "if", "(", "$", "id", "=", "$", "this", "->", "owner", "->", "ID", ")", "{", "$", "list", "=", "$", "list", "->", "exclude", "(", "[", "'ID'", "=>", "$", "id", "]", ")", ";", "}", "return", "!", "$", "list", "->", "exists", "(", ")", ";", "}" ]
Answers true if the extended object has a valid URL segment. @return boolean
[ "Answers", "true", "if", "the", "extended", "object", "has", "a", "valid", "URL", "segment", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/URLSegmentExtension.php#L95-L104
231,915
praxisnetau/silverware
src/Extensions/Model/URLSegmentExtension.php
URLSegmentExtension.generateURLSegment
public function generateURLSegment($string) { if (!$string) { $class = ClassTools::singleton()->getClassWithoutNamespace(get_class($this->owner)); $string = sprintf('%s-%s', $class, $this->owner->ID); } $segment = URLSegmentFilter::create()->filter($string); $this->owner->extend('updateURLSegment', $segment, $string); return $segment; }
php
public function generateURLSegment($string) { if (!$string) { $class = ClassTools::singleton()->getClassWithoutNamespace(get_class($this->owner)); $string = sprintf('%s-%s', $class, $this->owner->ID); } $segment = URLSegmentFilter::create()->filter($string); $this->owner->extend('updateURLSegment', $segment, $string); return $segment; }
[ "public", "function", "generateURLSegment", "(", "$", "string", ")", "{", "if", "(", "!", "$", "string", ")", "{", "$", "class", "=", "ClassTools", "::", "singleton", "(", ")", "->", "getClassWithoutNamespace", "(", "get_class", "(", "$", "this", "->", "owner", ")", ")", ";", "$", "string", "=", "sprintf", "(", "'%s-%s'", ",", "$", "class", ",", "$", "this", "->", "owner", "->", "ID", ")", ";", "}", "$", "segment", "=", "URLSegmentFilter", "::", "create", "(", ")", "->", "filter", "(", "$", "string", ")", ";", "$", "this", "->", "owner", "->", "extend", "(", "'updateURLSegment'", ",", "$", "segment", ",", "$", "string", ")", ";", "return", "$", "segment", ";", "}" ]
Generates a URL segment for the extended object based on the given string. @param string $string @return string
[ "Generates", "a", "URL", "segment", "for", "the", "extended", "object", "based", "on", "the", "given", "string", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/URLSegmentExtension.php#L113-L125
231,916
praxisnetau/silverware
src/Extensions/Model/URLSegmentExtension.php
URLSegmentExtension.generateValidURLSegment
public function generateValidURLSegment($string) { // Generate URL Segment: $this->owner->URLSegment = $this->owner->generateURLSegment($string); // Check for Duplicates: $count = 2; while (!$this->owner->validURLSegment()) { $this->owner->URLSegment = sprintf( '%s-%d', preg_replace('/-[0-9]+$/', '', $this->owner->URLSegment), $count ); $count++; } }
php
public function generateValidURLSegment($string) { // Generate URL Segment: $this->owner->URLSegment = $this->owner->generateURLSegment($string); // Check for Duplicates: $count = 2; while (!$this->owner->validURLSegment()) { $this->owner->URLSegment = sprintf( '%s-%d', preg_replace('/-[0-9]+$/', '', $this->owner->URLSegment), $count ); $count++; } }
[ "public", "function", "generateValidURLSegment", "(", "$", "string", ")", "{", "// Generate URL Segment:", "$", "this", "->", "owner", "->", "URLSegment", "=", "$", "this", "->", "owner", "->", "generateURLSegment", "(", "$", "string", ")", ";", "// Check for Duplicates:", "$", "count", "=", "2", ";", "while", "(", "!", "$", "this", "->", "owner", "->", "validURLSegment", "(", ")", ")", "{", "$", "this", "->", "owner", "->", "URLSegment", "=", "sprintf", "(", "'%s-%d'", ",", "preg_replace", "(", "'/-[0-9]+$/'", ",", "''", ",", "$", "this", "->", "owner", "->", "URLSegment", ")", ",", "$", "count", ")", ";", "$", "count", "++", ";", "}", "}" ]
Generates a valid URL segment for the extended object based on the given string. @param string $string @return string
[ "Generates", "a", "valid", "URL", "segment", "for", "the", "extended", "object", "based", "on", "the", "given", "string", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Model/URLSegmentExtension.php#L134-L155
231,917
EcomDev/cache-key
src/Generator.php
Generator.generate
public function generate($data) { if ($data instanceof InfoProviderInterface) { $data = $data->getCacheKeyInfo(); } if ($this->converter && !is_string($data)) { $convertedData = $this->converter->convert($data); if ($convertedData === false) { throw new InvalidArgumentException($data); } $data = $convertedData; } elseif (!is_string($data)) { throw new InvalidArgumentException($data); } $cacheKey = $this->normalizer->normalize($data); if ($this->prefix) { return $this->prefix . $cacheKey; } return $cacheKey; }
php
public function generate($data) { if ($data instanceof InfoProviderInterface) { $data = $data->getCacheKeyInfo(); } if ($this->converter && !is_string($data)) { $convertedData = $this->converter->convert($data); if ($convertedData === false) { throw new InvalidArgumentException($data); } $data = $convertedData; } elseif (!is_string($data)) { throw new InvalidArgumentException($data); } $cacheKey = $this->normalizer->normalize($data); if ($this->prefix) { return $this->prefix . $cacheKey; } return $cacheKey; }
[ "public", "function", "generate", "(", "$", "data", ")", "{", "if", "(", "$", "data", "instanceof", "InfoProviderInterface", ")", "{", "$", "data", "=", "$", "data", "->", "getCacheKeyInfo", "(", ")", ";", "}", "if", "(", "$", "this", "->", "converter", "&&", "!", "is_string", "(", "$", "data", ")", ")", "{", "$", "convertedData", "=", "$", "this", "->", "converter", "->", "convert", "(", "$", "data", ")", ";", "if", "(", "$", "convertedData", "===", "false", ")", "{", "throw", "new", "InvalidArgumentException", "(", "$", "data", ")", ";", "}", "$", "data", "=", "$", "convertedData", ";", "}", "elseif", "(", "!", "is_string", "(", "$", "data", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "$", "data", ")", ";", "}", "$", "cacheKey", "=", "$", "this", "->", "normalizer", "->", "normalize", "(", "$", "data", ")", ";", "if", "(", "$", "this", "->", "prefix", ")", "{", "return", "$", "this", "->", "prefix", ".", "$", "cacheKey", ";", "}", "return", "$", "cacheKey", ";", "}" ]
Generates a cache key based on provided data @param mixed $data @return string @throws InvalidArgumentException in case if value was not converted
[ "Generates", "a", "cache", "key", "based", "on", "provided", "data" ]
5f90f5a013100ec57d7f3a842f48222ba8a4ccf9
https://github.com/EcomDev/cache-key/blob/5f90f5a013100ec57d7f3a842f48222ba8a4ccf9/src/Generator.php#L60-L84
231,918
praxisnetau/silverware
src/Components/ContentComponent.php
ContentComponent.getLinkModeOptions
public function getLinkModeOptions() { return [ self::LINK_MODE_TITLE => _t(__CLASS__ . '.TITLE', 'Title'), self::LINK_MODE_BUTTON => _t(__CLASS__ . '.BUTTON', 'Button'), self::LINK_MODE_BOTH => _t(__CLASS__ . '.BOTHTITLEANDBUTTON', 'Both Title and Button') ]; }
php
public function getLinkModeOptions() { return [ self::LINK_MODE_TITLE => _t(__CLASS__ . '.TITLE', 'Title'), self::LINK_MODE_BUTTON => _t(__CLASS__ . '.BUTTON', 'Button'), self::LINK_MODE_BOTH => _t(__CLASS__ . '.BOTHTITLEANDBUTTON', 'Both Title and Button') ]; }
[ "public", "function", "getLinkModeOptions", "(", ")", "{", "return", "[", "self", "::", "LINK_MODE_TITLE", "=>", "_t", "(", "__CLASS__", ".", "'.TITLE'", ",", "'Title'", ")", ",", "self", "::", "LINK_MODE_BUTTON", "=>", "_t", "(", "__CLASS__", ".", "'.BUTTON'", ",", "'Button'", ")", ",", "self", "::", "LINK_MODE_BOTH", "=>", "_t", "(", "__CLASS__", ".", "'.BOTHTITLEANDBUTTON'", ",", "'Both Title and Button'", ")", "]", ";", "}" ]
Answers an array of options for the link mode field. @return array
[ "Answers", "an", "array", "of", "options", "for", "the", "link", "mode", "field", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Components/ContentComponent.php#L318-L325
231,919
kuzzleio/sdk-php
src/Security/Security.php
Security.createProfile
public function createProfile($id, array $policies, array $options = []) { $action = 'createProfile'; $data = [ '_id' => $id, 'body' => [ 'policies' => $policies ] ]; if (array_key_exists('replaceIfExist', $options)) { $action = 'createOrReplaceProfile'; } $response = $this->kuzzle->query( $this->buildQueryArgs($action), $data, $options ); return new Profile($this, $response['result']['_id'], $response['result']['_source'], $response['result']['_meta']); }
php
public function createProfile($id, array $policies, array $options = []) { $action = 'createProfile'; $data = [ '_id' => $id, 'body' => [ 'policies' => $policies ] ]; if (array_key_exists('replaceIfExist', $options)) { $action = 'createOrReplaceProfile'; } $response = $this->kuzzle->query( $this->buildQueryArgs($action), $data, $options ); return new Profile($this, $response['result']['_id'], $response['result']['_source'], $response['result']['_meta']); }
[ "public", "function", "createProfile", "(", "$", "id", ",", "array", "$", "policies", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "action", "=", "'createProfile'", ";", "$", "data", "=", "[", "'_id'", "=>", "$", "id", ",", "'body'", "=>", "[", "'policies'", "=>", "$", "policies", "]", "]", ";", "if", "(", "array_key_exists", "(", "'replaceIfExist'", ",", "$", "options", ")", ")", "{", "$", "action", "=", "'createOrReplaceProfile'", ";", "}", "$", "response", "=", "$", "this", "->", "kuzzle", "->", "query", "(", "$", "this", "->", "buildQueryArgs", "(", "$", "action", ")", ",", "$", "data", ",", "$", "options", ")", ";", "return", "new", "Profile", "(", "$", "this", ",", "$", "response", "[", "'result'", "]", "[", "'_id'", "]", ",", "$", "response", "[", "'result'", "]", "[", "'_source'", "]", ",", "$", "response", "[", "'result'", "]", "[", "'_meta'", "]", ")", ";", "}" ]
Create a new profile in Kuzzle. @param string $id Unique profile identifier @param array $policies List of policies to apply to this profile @param array $options Optional arguments @return Profile
[ "Create", "a", "new", "profile", "in", "Kuzzle", "." ]
b1e76cafaa9c7cc08d619c838c6208489e94565b
https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Security/Security.php#L60-L79
231,920
kuzzleio/sdk-php
src/Security/Security.php
Security.createRole
public function createRole($id, array $content, array $options = []) { $action = 'createRole'; $data = [ '_id' => $id, 'body' => $content ]; if (array_key_exists('replaceIfExist', $options)) { $action = 'createOrReplaceRole'; } $response = $this->kuzzle->query( $this->buildQueryArgs($action), $data, $options ); return new Role($this, $response['result']['_id'], $response['result']['_source'], $response['result']['_meta']); }
php
public function createRole($id, array $content, array $options = []) { $action = 'createRole'; $data = [ '_id' => $id, 'body' => $content ]; if (array_key_exists('replaceIfExist', $options)) { $action = 'createOrReplaceRole'; } $response = $this->kuzzle->query( $this->buildQueryArgs($action), $data, $options ); return new Role($this, $response['result']['_id'], $response['result']['_source'], $response['result']['_meta']); }
[ "public", "function", "createRole", "(", "$", "id", ",", "array", "$", "content", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "action", "=", "'createRole'", ";", "$", "data", "=", "[", "'_id'", "=>", "$", "id", ",", "'body'", "=>", "$", "content", "]", ";", "if", "(", "array_key_exists", "(", "'replaceIfExist'", ",", "$", "options", ")", ")", "{", "$", "action", "=", "'createOrReplaceRole'", ";", "}", "$", "response", "=", "$", "this", "->", "kuzzle", "->", "query", "(", "$", "this", "->", "buildQueryArgs", "(", "$", "action", ")", ",", "$", "data", ",", "$", "options", ")", ";", "return", "new", "Role", "(", "$", "this", ",", "$", "response", "[", "'result'", "]", "[", "'_id'", "]", ",", "$", "response", "[", "'result'", "]", "[", "'_source'", "]", ",", "$", "response", "[", "'result'", "]", "[", "'_meta'", "]", ")", ";", "}" ]
Create a new role in Kuzzle. @param integer $id Unique role identifier @param array $content Data representing the role @param array $options Optional arguments @return Role
[ "Create", "a", "new", "role", "in", "Kuzzle", "." ]
b1e76cafaa9c7cc08d619c838c6208489e94565b
https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Security/Security.php#L89-L108
231,921
kuzzleio/sdk-php
src/Security/Security.php
Security.createUser
public function createUser($id, array $content, array $options = []) { $action = 'createUser'; $data = [ '_id' => $id, 'body' => $content ]; $response = $this->kuzzle->query( $this->buildQueryArgs($action), $data, $options ); return new User($this, $response['result']['_id'], $response['result']['_source'], $response['result']['_meta']); }
php
public function createUser($id, array $content, array $options = []) { $action = 'createUser'; $data = [ '_id' => $id, 'body' => $content ]; $response = $this->kuzzle->query( $this->buildQueryArgs($action), $data, $options ); return new User($this, $response['result']['_id'], $response['result']['_source'], $response['result']['_meta']); }
[ "public", "function", "createUser", "(", "$", "id", ",", "array", "$", "content", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "action", "=", "'createUser'", ";", "$", "data", "=", "[", "'_id'", "=>", "$", "id", ",", "'body'", "=>", "$", "content", "]", ";", "$", "response", "=", "$", "this", "->", "kuzzle", "->", "query", "(", "$", "this", "->", "buildQueryArgs", "(", "$", "action", ")", ",", "$", "data", ",", "$", "options", ")", ";", "return", "new", "User", "(", "$", "this", ",", "$", "response", "[", "'result'", "]", "[", "'_id'", "]", ",", "$", "response", "[", "'result'", "]", "[", "'_source'", "]", ",", "$", "response", "[", "'result'", "]", "[", "'_meta'", "]", ")", ";", "}" ]
Create a new user in Kuzzle. @param integer $id Unique user identifier, will be used as username @param array $content Data representing the user @param array $options Optional arguments @return User
[ "Create", "a", "new", "user", "in", "Kuzzle", "." ]
b1e76cafaa9c7cc08d619c838c6208489e94565b
https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Security/Security.php#L118-L133
231,922
kuzzleio/sdk-php
src/Security/Security.php
Security.scrollProfiles
public function scrollProfiles($scrollId, array $options = []) { $options['httpParams'] = [':scrollId' => $scrollId]; $data = []; if (!$scrollId) { throw new InvalidArgumentException('Security.scrollProfiles: scrollId is required'); } if (isset($options['scroll'])) { $data['scroll'] = $options['scroll']; } $response = $this->kuzzle->query( $this->kuzzle->buildQueryArgs('security', 'scrollProfiles'), $data, $options ); $response['result']['hits'] = array_map(function ($document) { return new Profile($this, $document['_id'], $document['_source'], $document['_meta']); }, $response['result']['hits']); return new ProfilesSearchResult( $response['result']['total'], $response['result']['hits'], $scrollId ); }
php
public function scrollProfiles($scrollId, array $options = []) { $options['httpParams'] = [':scrollId' => $scrollId]; $data = []; if (!$scrollId) { throw new InvalidArgumentException('Security.scrollProfiles: scrollId is required'); } if (isset($options['scroll'])) { $data['scroll'] = $options['scroll']; } $response = $this->kuzzle->query( $this->kuzzle->buildQueryArgs('security', 'scrollProfiles'), $data, $options ); $response['result']['hits'] = array_map(function ($document) { return new Profile($this, $document['_id'], $document['_source'], $document['_meta']); }, $response['result']['hits']); return new ProfilesSearchResult( $response['result']['total'], $response['result']['hits'], $scrollId ); }
[ "public", "function", "scrollProfiles", "(", "$", "scrollId", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "options", "[", "'httpParams'", "]", "=", "[", "':scrollId'", "=>", "$", "scrollId", "]", ";", "$", "data", "=", "[", "]", ";", "if", "(", "!", "$", "scrollId", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Security.scrollProfiles: scrollId is required'", ")", ";", "}", "if", "(", "isset", "(", "$", "options", "[", "'scroll'", "]", ")", ")", "{", "$", "data", "[", "'scroll'", "]", "=", "$", "options", "[", "'scroll'", "]", ";", "}", "$", "response", "=", "$", "this", "->", "kuzzle", "->", "query", "(", "$", "this", "->", "kuzzle", "->", "buildQueryArgs", "(", "'security'", ",", "'scrollProfiles'", ")", ",", "$", "data", ",", "$", "options", ")", ";", "$", "response", "[", "'result'", "]", "[", "'hits'", "]", "=", "array_map", "(", "function", "(", "$", "document", ")", "{", "return", "new", "Profile", "(", "$", "this", ",", "$", "document", "[", "'_id'", "]", ",", "$", "document", "[", "'_source'", "]", ",", "$", "document", "[", "'_meta'", "]", ")", ";", "}", ",", "$", "response", "[", "'result'", "]", "[", "'hits'", "]", ")", ";", "return", "new", "ProfilesSearchResult", "(", "$", "response", "[", "'result'", "]", "[", "'total'", "]", ",", "$", "response", "[", "'result'", "]", "[", "'hits'", "]", ",", "$", "scrollId", ")", ";", "}" ]
Returns the next profiles result set with scroll query. @param string $scrollId @param array $options (optional) arguments @return ProfilesSearchResult @throws \Exception
[ "Returns", "the", "next", "profiles", "result", "set", "with", "scroll", "query", "." ]
b1e76cafaa9c7cc08d619c838c6208489e94565b
https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Security/Security.php#L215-L244
231,923
kuzzleio/sdk-php
src/Security/Security.php
Security.scrollUsers
public function scrollUsers($scrollId, array $options = []) { $options['httpParams'] = [':scrollId' => $scrollId]; $data = []; if (!$scrollId) { throw new InvalidArgumentException('Security.scrollUsers: scrollId is required'); } if (isset($options['scroll'])) { $data['scroll'] = $options['scroll']; } $response = $this->kuzzle->query( $this->kuzzle->buildQueryArgs('security', 'scrollUsers'), $data, $options ); $response['result']['hits'] = array_map(function ($document) { return new User($this, $document['_id'], $document['_source'], $document['_meta']); }, $response['result']['hits']); return new UsersSearchResult( $response['result']['total'], $response['result']['hits'], $scrollId ); }
php
public function scrollUsers($scrollId, array $options = []) { $options['httpParams'] = [':scrollId' => $scrollId]; $data = []; if (!$scrollId) { throw new InvalidArgumentException('Security.scrollUsers: scrollId is required'); } if (isset($options['scroll'])) { $data['scroll'] = $options['scroll']; } $response = $this->kuzzle->query( $this->kuzzle->buildQueryArgs('security', 'scrollUsers'), $data, $options ); $response['result']['hits'] = array_map(function ($document) { return new User($this, $document['_id'], $document['_source'], $document['_meta']); }, $response['result']['hits']); return new UsersSearchResult( $response['result']['total'], $response['result']['hits'], $scrollId ); }
[ "public", "function", "scrollUsers", "(", "$", "scrollId", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "options", "[", "'httpParams'", "]", "=", "[", "':scrollId'", "=>", "$", "scrollId", "]", ";", "$", "data", "=", "[", "]", ";", "if", "(", "!", "$", "scrollId", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Security.scrollUsers: scrollId is required'", ")", ";", "}", "if", "(", "isset", "(", "$", "options", "[", "'scroll'", "]", ")", ")", "{", "$", "data", "[", "'scroll'", "]", "=", "$", "options", "[", "'scroll'", "]", ";", "}", "$", "response", "=", "$", "this", "->", "kuzzle", "->", "query", "(", "$", "this", "->", "kuzzle", "->", "buildQueryArgs", "(", "'security'", ",", "'scrollUsers'", ")", ",", "$", "data", ",", "$", "options", ")", ";", "$", "response", "[", "'result'", "]", "[", "'hits'", "]", "=", "array_map", "(", "function", "(", "$", "document", ")", "{", "return", "new", "User", "(", "$", "this", ",", "$", "document", "[", "'_id'", "]", ",", "$", "document", "[", "'_source'", "]", ",", "$", "document", "[", "'_meta'", "]", ")", ";", "}", ",", "$", "response", "[", "'result'", "]", "[", "'hits'", "]", ")", ";", "return", "new", "UsersSearchResult", "(", "$", "response", "[", "'result'", "]", "[", "'total'", "]", ",", "$", "response", "[", "'result'", "]", "[", "'hits'", "]", ",", "$", "scrollId", ")", ";", "}" ]
Returns the next users result set with scroll query. @param string $scrollId @param array $options (optional) arguments @return UsersSearchResult @throws \Exception
[ "Returns", "the", "next", "users", "result", "set", "with", "scroll", "query", "." ]
b1e76cafaa9c7cc08d619c838c6208489e94565b
https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Security/Security.php#L298-L327
231,924
kuzzleio/sdk-php
src/Security/Security.php
Security.fetchProfile
public function fetchProfile($id, array $options = []) { $data = [ '_id' => $id ]; $response = $this->kuzzle->query( $this->buildQueryArgs('getProfile'), $data, $options ); return new Profile($this, $response['result']['_id'], $response['result']['_source'], $response['result']['_meta']); }
php
public function fetchProfile($id, array $options = []) { $data = [ '_id' => $id ]; $response = $this->kuzzle->query( $this->buildQueryArgs('getProfile'), $data, $options ); return new Profile($this, $response['result']['_id'], $response['result']['_source'], $response['result']['_meta']); }
[ "public", "function", "fetchProfile", "(", "$", "id", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "data", "=", "[", "'_id'", "=>", "$", "id", "]", ";", "$", "response", "=", "$", "this", "->", "kuzzle", "->", "query", "(", "$", "this", "->", "buildQueryArgs", "(", "'getProfile'", ")", ",", "$", "data", ",", "$", "options", ")", ";", "return", "new", "Profile", "(", "$", "this", ",", "$", "response", "[", "'result'", "]", "[", "'_id'", "]", ",", "$", "response", "[", "'result'", "]", "[", "'_source'", "]", ",", "$", "response", "[", "'result'", "]", "[", "'_meta'", "]", ")", ";", "}" ]
Retrieves a single stored profile using its unique ID. @param integer $id Unique profile identifier @param array $options Optional arguments @return Profile
[ "Retrieves", "a", "single", "stored", "profile", "using", "its", "unique", "ID", "." ]
b1e76cafaa9c7cc08d619c838c6208489e94565b
https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Security/Security.php#L336-L349
231,925
kuzzleio/sdk-php
src/Security/Security.php
Security.fetchRole
public function fetchRole($id, array $options = []) { $data = [ '_id' => $id ]; $response = $this->kuzzle->query( $this->buildQueryArgs('getRole'), $data, $options ); return new Role($this, $response['result']['_id'], $response['result']['_source'], $response['result']['_meta']); }
php
public function fetchRole($id, array $options = []) { $data = [ '_id' => $id ]; $response = $this->kuzzle->query( $this->buildQueryArgs('getRole'), $data, $options ); return new Role($this, $response['result']['_id'], $response['result']['_source'], $response['result']['_meta']); }
[ "public", "function", "fetchRole", "(", "$", "id", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "data", "=", "[", "'_id'", "=>", "$", "id", "]", ";", "$", "response", "=", "$", "this", "->", "kuzzle", "->", "query", "(", "$", "this", "->", "buildQueryArgs", "(", "'getRole'", ")", ",", "$", "data", ",", "$", "options", ")", ";", "return", "new", "Role", "(", "$", "this", ",", "$", "response", "[", "'result'", "]", "[", "'_id'", "]", ",", "$", "response", "[", "'result'", "]", "[", "'_source'", "]", ",", "$", "response", "[", "'result'", "]", "[", "'_meta'", "]", ")", ";", "}" ]
Retrieves a single stored role using its unique ID. @param integer $id Unique role identifier @param array $options Optional arguments @return Role
[ "Retrieves", "a", "single", "stored", "role", "using", "its", "unique", "ID", "." ]
b1e76cafaa9c7cc08d619c838c6208489e94565b
https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Security/Security.php#L358-L371
231,926
kuzzleio/sdk-php
src/Security/Security.php
Security.fetchUser
public function fetchUser($id, array $options = []) { $data = [ '_id' => $id ]; $response = $this->kuzzle->query( $this->buildQueryArgs('getUser'), $data, $options ); return new User($this, $response['result']['_id'], $response['result']['_source'], $response['result']['_meta']); }
php
public function fetchUser($id, array $options = []) { $data = [ '_id' => $id ]; $response = $this->kuzzle->query( $this->buildQueryArgs('getUser'), $data, $options ); return new User($this, $response['result']['_id'], $response['result']['_source'], $response['result']['_meta']); }
[ "public", "function", "fetchUser", "(", "$", "id", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "data", "=", "[", "'_id'", "=>", "$", "id", "]", ";", "$", "response", "=", "$", "this", "->", "kuzzle", "->", "query", "(", "$", "this", "->", "buildQueryArgs", "(", "'getUser'", ")", ",", "$", "data", ",", "$", "options", ")", ";", "return", "new", "User", "(", "$", "this", ",", "$", "response", "[", "'result'", "]", "[", "'_id'", "]", ",", "$", "response", "[", "'result'", "]", "[", "'_source'", "]", ",", "$", "response", "[", "'result'", "]", "[", "'_meta'", "]", ")", ";", "}" ]
Retrieves a single stored user using its unique ID. @param integer $id Unique user identifier @param array $options Optional arguments @return User
[ "Retrieves", "a", "single", "stored", "user", "using", "its", "unique", "ID", "." ]
b1e76cafaa9c7cc08d619c838c6208489e94565b
https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Security/Security.php#L380-L393
231,927
kuzzleio/sdk-php
src/Security/Security.php
Security.getUserRights
public function getUserRights($id, array $options = []) { $data = [ '_id' => $id ]; $response = $this->kuzzle->query( $this->buildQueryArgs('getUserRights'), $data, $options ); return $response['result']['hits']; }
php
public function getUserRights($id, array $options = []) { $data = [ '_id' => $id ]; $response = $this->kuzzle->query( $this->buildQueryArgs('getUserRights'), $data, $options ); return $response['result']['hits']; }
[ "public", "function", "getUserRights", "(", "$", "id", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "data", "=", "[", "'_id'", "=>", "$", "id", "]", ";", "$", "response", "=", "$", "this", "->", "kuzzle", "->", "query", "(", "$", "this", "->", "buildQueryArgs", "(", "'getUserRights'", ")", ",", "$", "data", ",", "$", "options", ")", ";", "return", "$", "response", "[", "'result'", "]", "[", "'hits'", "]", ";", "}" ]
Gets the rights of given user. @param integer $id Id of the user @param array $options Optional arguments @return array
[ "Gets", "the", "rights", "of", "given", "user", "." ]
b1e76cafaa9c7cc08d619c838c6208489e94565b
https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Security/Security.php#L402-L415
231,928
kuzzleio/sdk-php
src/Security/Security.php
Security.isActionAllowed
public function isActionAllowed(array $rights, $controller, $action, $index = '', $collection = '') { // We filter in all the rights that match the request (including wildcards). $filteredRights = array_filter($rights, function (array $right) use ($controller) { return array_key_exists('controller', $right) && ($right['controller'] === $controller || $right['controller'] === '*'); }); $filteredRights = array_filter($filteredRights, function (array $right) use ($action) { return array_key_exists('action', $right) && ($right['action'] === $action || $right['action'] === '*'); }); $filteredRights = array_filter($filteredRights, function (array $right) use ($index) { return array_key_exists('index', $right) && ($right['index'] === $index || $right['index'] === '*'); }); $filteredRights = array_filter($filteredRights, function (array $right) use ($collection) { return array_key_exists('collection', $right) && ($right['collection'] === $collection || $right['collection'] === '*'); }); $rightsValues = array_map(function ($element) { return $element['value']; }, $filteredRights); // Then, if at least one right allows the action, we return Security::ACTION_ALLOWED if (array_search(Security::ACTION_ALLOWED, $rightsValues) !== false) { return Security::ACTION_ALLOWED; } // If no right allows the action, we check for Security::ACTION_CONDITIONAL. elseif (array_search(Security::ACTION_CONDITIONAL, $rightsValues) !== false) { return Security::ACTION_CONDITIONAL; } // Otherwise we return Security::ACTION_DENIED. return Security::ACTION_DENIED; }
php
public function isActionAllowed(array $rights, $controller, $action, $index = '', $collection = '') { // We filter in all the rights that match the request (including wildcards). $filteredRights = array_filter($rights, function (array $right) use ($controller) { return array_key_exists('controller', $right) && ($right['controller'] === $controller || $right['controller'] === '*'); }); $filteredRights = array_filter($filteredRights, function (array $right) use ($action) { return array_key_exists('action', $right) && ($right['action'] === $action || $right['action'] === '*'); }); $filteredRights = array_filter($filteredRights, function (array $right) use ($index) { return array_key_exists('index', $right) && ($right['index'] === $index || $right['index'] === '*'); }); $filteredRights = array_filter($filteredRights, function (array $right) use ($collection) { return array_key_exists('collection', $right) && ($right['collection'] === $collection || $right['collection'] === '*'); }); $rightsValues = array_map(function ($element) { return $element['value']; }, $filteredRights); // Then, if at least one right allows the action, we return Security::ACTION_ALLOWED if (array_search(Security::ACTION_ALLOWED, $rightsValues) !== false) { return Security::ACTION_ALLOWED; } // If no right allows the action, we check for Security::ACTION_CONDITIONAL. elseif (array_search(Security::ACTION_CONDITIONAL, $rightsValues) !== false) { return Security::ACTION_CONDITIONAL; } // Otherwise we return Security::ACTION_DENIED. return Security::ACTION_DENIED; }
[ "public", "function", "isActionAllowed", "(", "array", "$", "rights", ",", "$", "controller", ",", "$", "action", ",", "$", "index", "=", "''", ",", "$", "collection", "=", "''", ")", "{", "// We filter in all the rights that match the request (including wildcards).", "$", "filteredRights", "=", "array_filter", "(", "$", "rights", ",", "function", "(", "array", "$", "right", ")", "use", "(", "$", "controller", ")", "{", "return", "array_key_exists", "(", "'controller'", ",", "$", "right", ")", "&&", "(", "$", "right", "[", "'controller'", "]", "===", "$", "controller", "||", "$", "right", "[", "'controller'", "]", "===", "'*'", ")", ";", "}", ")", ";", "$", "filteredRights", "=", "array_filter", "(", "$", "filteredRights", ",", "function", "(", "array", "$", "right", ")", "use", "(", "$", "action", ")", "{", "return", "array_key_exists", "(", "'action'", ",", "$", "right", ")", "&&", "(", "$", "right", "[", "'action'", "]", "===", "$", "action", "||", "$", "right", "[", "'action'", "]", "===", "'*'", ")", ";", "}", ")", ";", "$", "filteredRights", "=", "array_filter", "(", "$", "filteredRights", ",", "function", "(", "array", "$", "right", ")", "use", "(", "$", "index", ")", "{", "return", "array_key_exists", "(", "'index'", ",", "$", "right", ")", "&&", "(", "$", "right", "[", "'index'", "]", "===", "$", "index", "||", "$", "right", "[", "'index'", "]", "===", "'*'", ")", ";", "}", ")", ";", "$", "filteredRights", "=", "array_filter", "(", "$", "filteredRights", ",", "function", "(", "array", "$", "right", ")", "use", "(", "$", "collection", ")", "{", "return", "array_key_exists", "(", "'collection'", ",", "$", "right", ")", "&&", "(", "$", "right", "[", "'collection'", "]", "===", "$", "collection", "||", "$", "right", "[", "'collection'", "]", "===", "'*'", ")", ";", "}", ")", ";", "$", "rightsValues", "=", "array_map", "(", "function", "(", "$", "element", ")", "{", "return", "$", "element", "[", "'value'", "]", ";", "}", ",", "$", "filteredRights", ")", ";", "// Then, if at least one right allows the action, we return Security::ACTION_ALLOWED", "if", "(", "array_search", "(", "Security", "::", "ACTION_ALLOWED", ",", "$", "rightsValues", ")", "!==", "false", ")", "{", "return", "Security", "::", "ACTION_ALLOWED", ";", "}", "// If no right allows the action, we check for Security::ACTION_CONDITIONAL.", "elseif", "(", "array_search", "(", "Security", "::", "ACTION_CONDITIONAL", ",", "$", "rightsValues", ")", "!==", "false", ")", "{", "return", "Security", "::", "ACTION_CONDITIONAL", ";", "}", "// Otherwise we return Security::ACTION_DENIED.", "return", "Security", "::", "ACTION_DENIED", ";", "}" ]
Tells whether an action is allowed, denied or conditional based on the rights provided as the first argument @param array $rights Rights list (@see Security::getUserRights) @param string $controller The controller @param string $action The action @param string $index Optional index @param string $collection Optional collection @return string Security::ACTION_ALLOWED Security::ACTION_DENIED Security::ACTION_CONDITIONAL @throws ErrorException
[ "Tells", "whether", "an", "action", "is", "allowed", "denied", "or", "conditional", "based", "on", "the", "rights", "provided", "as", "the", "first", "argument" ]
b1e76cafaa9c7cc08d619c838c6208489e94565b
https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Security/Security.php#L432-L465
231,929
kuzzleio/sdk-php
src/Security/Security.php
Security.searchProfiles
public function searchProfiles(array $filters, array $options = []) { $data = [ 'body' => $filters ]; $scrollId = null; $response = $this->kuzzle->query( $this->buildQueryArgs('searchProfiles'), $data, $options ); $response['result']['hits'] = array_map(function ($profile) { return new Profile($this, $profile['_id'], $profile['_source'], $profile['_meta']); }, $response['result']['hits']); if (isset($response['result']['scrollId'])) { $scrollId = $response['result']['scrollId']; } return new ProfilesSearchResult($response['result']['total'], $response['result']['hits'], $scrollId); }
php
public function searchProfiles(array $filters, array $options = []) { $data = [ 'body' => $filters ]; $scrollId = null; $response = $this->kuzzle->query( $this->buildQueryArgs('searchProfiles'), $data, $options ); $response['result']['hits'] = array_map(function ($profile) { return new Profile($this, $profile['_id'], $profile['_source'], $profile['_meta']); }, $response['result']['hits']); if (isset($response['result']['scrollId'])) { $scrollId = $response['result']['scrollId']; } return new ProfilesSearchResult($response['result']['total'], $response['result']['hits'], $scrollId); }
[ "public", "function", "searchProfiles", "(", "array", "$", "filters", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "data", "=", "[", "'body'", "=>", "$", "filters", "]", ";", "$", "scrollId", "=", "null", ";", "$", "response", "=", "$", "this", "->", "kuzzle", "->", "query", "(", "$", "this", "->", "buildQueryArgs", "(", "'searchProfiles'", ")", ",", "$", "data", ",", "$", "options", ")", ";", "$", "response", "[", "'result'", "]", "[", "'hits'", "]", "=", "array_map", "(", "function", "(", "$", "profile", ")", "{", "return", "new", "Profile", "(", "$", "this", ",", "$", "profile", "[", "'_id'", "]", ",", "$", "profile", "[", "'_source'", "]", ",", "$", "profile", "[", "'_meta'", "]", ")", ";", "}", ",", "$", "response", "[", "'result'", "]", "[", "'hits'", "]", ")", ";", "if", "(", "isset", "(", "$", "response", "[", "'result'", "]", "[", "'scrollId'", "]", ")", ")", "{", "$", "scrollId", "=", "$", "response", "[", "'result'", "]", "[", "'scrollId'", "]", ";", "}", "return", "new", "ProfilesSearchResult", "(", "$", "response", "[", "'result'", "]", "[", "'total'", "]", ",", "$", "response", "[", "'result'", "]", "[", "'hits'", "]", ",", "$", "scrollId", ")", ";", "}" ]
Executes a search on profiles according to a filter @param array $filters List of filters to retrieves profiles @param array $options Optional arguments @return ProfilesSearchResult
[ "Executes", "a", "search", "on", "profiles", "according", "to", "a", "filter" ]
b1e76cafaa9c7cc08d619c838c6208489e94565b
https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Security/Security.php#L513-L536
231,930
kuzzleio/sdk-php
src/Security/Security.php
Security.searchRoles
public function searchRoles(array $filters, array $options = []) { $data = [ 'body' => $filters ]; $response = $this->kuzzle->query( $this->buildQueryArgs('searchRoles'), $data, $options ); $response['result']['hits'] = array_map(function ($role) { return new Role($this, $role['_id'], $role['_source'], $role['_meta']); }, $response['result']['hits']); return new RolesSearchResult($response['result']['total'], $response['result']['hits']); }
php
public function searchRoles(array $filters, array $options = []) { $data = [ 'body' => $filters ]; $response = $this->kuzzle->query( $this->buildQueryArgs('searchRoles'), $data, $options ); $response['result']['hits'] = array_map(function ($role) { return new Role($this, $role['_id'], $role['_source'], $role['_meta']); }, $response['result']['hits']); return new RolesSearchResult($response['result']['total'], $response['result']['hits']); }
[ "public", "function", "searchRoles", "(", "array", "$", "filters", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "data", "=", "[", "'body'", "=>", "$", "filters", "]", ";", "$", "response", "=", "$", "this", "->", "kuzzle", "->", "query", "(", "$", "this", "->", "buildQueryArgs", "(", "'searchRoles'", ")", ",", "$", "data", ",", "$", "options", ")", ";", "$", "response", "[", "'result'", "]", "[", "'hits'", "]", "=", "array_map", "(", "function", "(", "$", "role", ")", "{", "return", "new", "Role", "(", "$", "this", ",", "$", "role", "[", "'_id'", "]", ",", "$", "role", "[", "'_source'", "]", ",", "$", "role", "[", "'_meta'", "]", ")", ";", "}", ",", "$", "response", "[", "'result'", "]", "[", "'hits'", "]", ")", ";", "return", "new", "RolesSearchResult", "(", "$", "response", "[", "'result'", "]", "[", "'total'", "]", ",", "$", "response", "[", "'result'", "]", "[", "'hits'", "]", ")", ";", "}" ]
Executes a search on roles according to a filter @param array $filters List of filters to retrieves roles @param array $options Optional arguments @return RolesSearchResult
[ "Executes", "a", "search", "on", "roles", "according", "to", "a", "filter" ]
b1e76cafaa9c7cc08d619c838c6208489e94565b
https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Security/Security.php#L545-L562
231,931
kuzzleio/sdk-php
src/Security/Security.php
Security.searchUsers
public function searchUsers(array $filters, array $options = []) { $data = [ 'body' => $filters ]; $scrollId = null; $response = $this->kuzzle->query( $this->buildQueryArgs('searchUsers'), $data, $options ); $response['result']['hits'] = array_map(function ($user) { return new User($this, $user['_id'], $user['_source'], $user['_meta']); }, $response['result']['hits']); if (isset($response['result']['scrollId'])) { $scrollId = $response['result']['scrollId']; } return new UsersSearchResult($response['result']['total'], $response['result']['hits'], $scrollId); }
php
public function searchUsers(array $filters, array $options = []) { $data = [ 'body' => $filters ]; $scrollId = null; $response = $this->kuzzle->query( $this->buildQueryArgs('searchUsers'), $data, $options ); $response['result']['hits'] = array_map(function ($user) { return new User($this, $user['_id'], $user['_source'], $user['_meta']); }, $response['result']['hits']); if (isset($response['result']['scrollId'])) { $scrollId = $response['result']['scrollId']; } return new UsersSearchResult($response['result']['total'], $response['result']['hits'], $scrollId); }
[ "public", "function", "searchUsers", "(", "array", "$", "filters", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "data", "=", "[", "'body'", "=>", "$", "filters", "]", ";", "$", "scrollId", "=", "null", ";", "$", "response", "=", "$", "this", "->", "kuzzle", "->", "query", "(", "$", "this", "->", "buildQueryArgs", "(", "'searchUsers'", ")", ",", "$", "data", ",", "$", "options", ")", ";", "$", "response", "[", "'result'", "]", "[", "'hits'", "]", "=", "array_map", "(", "function", "(", "$", "user", ")", "{", "return", "new", "User", "(", "$", "this", ",", "$", "user", "[", "'_id'", "]", ",", "$", "user", "[", "'_source'", "]", ",", "$", "user", "[", "'_meta'", "]", ")", ";", "}", ",", "$", "response", "[", "'result'", "]", "[", "'hits'", "]", ")", ";", "if", "(", "isset", "(", "$", "response", "[", "'result'", "]", "[", "'scrollId'", "]", ")", ")", "{", "$", "scrollId", "=", "$", "response", "[", "'result'", "]", "[", "'scrollId'", "]", ";", "}", "return", "new", "UsersSearchResult", "(", "$", "response", "[", "'result'", "]", "[", "'total'", "]", ",", "$", "response", "[", "'result'", "]", "[", "'hits'", "]", ",", "$", "scrollId", ")", ";", "}" ]
Executes a search on users according to a filter @param array $filters List of filters to retrieves users @param array $options Optional arguments @return UsersSearchResult
[ "Executes", "a", "search", "on", "users", "according", "to", "a", "filter" ]
b1e76cafaa9c7cc08d619c838c6208489e94565b
https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Security/Security.php#L571-L594
231,932
kuzzleio/sdk-php
src/Security/Security.php
Security.updateProfile
public function updateProfile($id, array $policies, array $options = []) { $data = [ '_id' => $id, 'body' => [ 'policies' => $policies ] ]; $response = $this->kuzzle->query( $this->buildQueryArgs('updateProfile'), $data, $options ); return new Profile($this, $id, $response['result']['_source'], $response['result']['_meta']); }
php
public function updateProfile($id, array $policies, array $options = []) { $data = [ '_id' => $id, 'body' => [ 'policies' => $policies ] ]; $response = $this->kuzzle->query( $this->buildQueryArgs('updateProfile'), $data, $options ); return new Profile($this, $id, $response['result']['_source'], $response['result']['_meta']); }
[ "public", "function", "updateProfile", "(", "$", "id", ",", "array", "$", "policies", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "data", "=", "[", "'_id'", "=>", "$", "id", ",", "'body'", "=>", "[", "'policies'", "=>", "$", "policies", "]", "]", ";", "$", "response", "=", "$", "this", "->", "kuzzle", "->", "query", "(", "$", "this", "->", "buildQueryArgs", "(", "'updateProfile'", ")", ",", "$", "data", ",", "$", "options", ")", ";", "return", "new", "Profile", "(", "$", "this", ",", "$", "id", ",", "$", "response", "[", "'result'", "]", "[", "'_source'", "]", ",", "$", "response", "[", "'result'", "]", "[", "'_meta'", "]", ")", ";", "}" ]
Performs a partial update on an existing profile. @param string $id Unique profile identifier @param array $policies List of policies to apply to this profile @param array $options Optional arguments @return Profile
[ "Performs", "a", "partial", "update", "on", "an", "existing", "profile", "." ]
b1e76cafaa9c7cc08d619c838c6208489e94565b
https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Security/Security.php#L604-L618
231,933
kuzzleio/sdk-php
src/Security/Security.php
Security.updateRole
public function updateRole($id, array $content, array $options = []) { $data = [ '_id' => $id, 'body' => $content ]; $response = $this->kuzzle->query( $this->buildQueryArgs('updateRole'), $data, $options ); return new Role($this, $id, $response['result']['_source'], $response['result']['_meta']); }
php
public function updateRole($id, array $content, array $options = []) { $data = [ '_id' => $id, 'body' => $content ]; $response = $this->kuzzle->query( $this->buildQueryArgs('updateRole'), $data, $options ); return new Role($this, $id, $response['result']['_source'], $response['result']['_meta']); }
[ "public", "function", "updateRole", "(", "$", "id", ",", "array", "$", "content", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "data", "=", "[", "'_id'", "=>", "$", "id", ",", "'body'", "=>", "$", "content", "]", ";", "$", "response", "=", "$", "this", "->", "kuzzle", "->", "query", "(", "$", "this", "->", "buildQueryArgs", "(", "'updateRole'", ")", ",", "$", "data", ",", "$", "options", ")", ";", "return", "new", "Role", "(", "$", "this", ",", "$", "id", ",", "$", "response", "[", "'result'", "]", "[", "'_source'", "]", ",", "$", "response", "[", "'result'", "]", "[", "'_meta'", "]", ")", ";", "}" ]
Performs a partial update on an existing role. @param string $id Unique role identifier @param array $content Data representing the role @param array $options Optional arguments @return Role
[ "Performs", "a", "partial", "update", "on", "an", "existing", "role", "." ]
b1e76cafaa9c7cc08d619c838c6208489e94565b
https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Security/Security.php#L628-L642
231,934
kuzzleio/sdk-php
src/Security/Security.php
Security.updateUser
public function updateUser($id, array $content, array $options = []) { $data = [ '_id' => $id, 'body' => $content ]; $response = $this->kuzzle->query( $this->buildQueryArgs('updateUser'), $data, $options ); return new User($this, $id, $response['result']['_source'], $response['result']['_meta']); }
php
public function updateUser($id, array $content, array $options = []) { $data = [ '_id' => $id, 'body' => $content ]; $response = $this->kuzzle->query( $this->buildQueryArgs('updateUser'), $data, $options ); return new User($this, $id, $response['result']['_source'], $response['result']['_meta']); }
[ "public", "function", "updateUser", "(", "$", "id", ",", "array", "$", "content", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "data", "=", "[", "'_id'", "=>", "$", "id", ",", "'body'", "=>", "$", "content", "]", ";", "$", "response", "=", "$", "this", "->", "kuzzle", "->", "query", "(", "$", "this", "->", "buildQueryArgs", "(", "'updateUser'", ")", ",", "$", "data", ",", "$", "options", ")", ";", "return", "new", "User", "(", "$", "this", ",", "$", "id", ",", "$", "response", "[", "'result'", "]", "[", "'_source'", "]", ",", "$", "response", "[", "'result'", "]", "[", "'_meta'", "]", ")", ";", "}" ]
Performs a partial update on an existing user. @param string $id Unique user identifier @param array $content Data representing the user @param array $options Optional arguments @return User
[ "Performs", "a", "partial", "update", "on", "an", "existing", "user", "." ]
b1e76cafaa9c7cc08d619c838c6208489e94565b
https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Security/Security.php#L652-L666
231,935
wallstreetio/ontraport
src/Response.php
Response.item
public function item() { if (!empty($this->response['data'])) { return new Fluent($this->resource, $this->response['data']); } // On a valid response that does not have a data field, we can assume that // the request is an update/delete type of request that does not return an object. return true; }
php
public function item() { if (!empty($this->response['data'])) { return new Fluent($this->resource, $this->response['data']); } // On a valid response that does not have a data field, we can assume that // the request is an update/delete type of request that does not return an object. return true; }
[ "public", "function", "item", "(", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "response", "[", "'data'", "]", ")", ")", "{", "return", "new", "Fluent", "(", "$", "this", "->", "resource", ",", "$", "this", "->", "response", "[", "'data'", "]", ")", ";", "}", "// On a valid response that does not have a data field, we can assume that", "// the request is an update/delete type of request that does not return an object.", "return", "true", ";", "}" ]
Retrieve an item from the Ontraport response. @return bool|\Wsio\Ontraport\Fluent
[ "Retrieve", "an", "item", "from", "the", "Ontraport", "response", "." ]
55467fd63637083f76e497897af4aee13fc2c8b1
https://github.com/wallstreetio/ontraport/blob/55467fd63637083f76e497897af4aee13fc2c8b1/src/Response.php#L35-L45
231,936
wallstreetio/ontraport
src/Response.php
Response.collection
public function collection() { if (!empty($this->response['data'])) { $data = []; foreach ($this->response['data'] as $object) { $data[] = new Fluent($this->resource, $object); } return $data; } return []; }
php
public function collection() { if (!empty($this->response['data'])) { $data = []; foreach ($this->response['data'] as $object) { $data[] = new Fluent($this->resource, $object); } return $data; } return []; }
[ "public", "function", "collection", "(", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "response", "[", "'data'", "]", ")", ")", "{", "$", "data", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "response", "[", "'data'", "]", "as", "$", "object", ")", "{", "$", "data", "[", "]", "=", "new", "Fluent", "(", "$", "this", "->", "resource", ",", "$", "object", ")", ";", "}", "return", "$", "data", ";", "}", "return", "[", "]", ";", "}" ]
Retrieve an array of items from the Ontraport response. @return array
[ "Retrieve", "an", "array", "of", "items", "from", "the", "Ontraport", "response", "." ]
55467fd63637083f76e497897af4aee13fc2c8b1
https://github.com/wallstreetio/ontraport/blob/55467fd63637083f76e497897af4aee13fc2c8b1/src/Response.php#L52-L65
231,937
joomla-framework/facebook-api
src/User.php
User.createPhoto
public function createPhoto($user, $source, $message = null, $place = null, $noStory = null) { // Set POST request parameters. $data = array(); $data[basename($source)] = '@' . realpath($source); $data['message'] = $message; $data['place'] = $place; $data['no_story'] = $noStory; return $this->createConnection($user, 'photos', $data, array('Content-Type' => 'multipart/form-data')); }
php
public function createPhoto($user, $source, $message = null, $place = null, $noStory = null) { // Set POST request parameters. $data = array(); $data[basename($source)] = '@' . realpath($source); $data['message'] = $message; $data['place'] = $place; $data['no_story'] = $noStory; return $this->createConnection($user, 'photos', $data, array('Content-Type' => 'multipart/form-data')); }
[ "public", "function", "createPhoto", "(", "$", "user", ",", "$", "source", ",", "$", "message", "=", "null", ",", "$", "place", "=", "null", ",", "$", "noStory", "=", "null", ")", "{", "// Set POST request parameters.", "$", "data", "=", "array", "(", ")", ";", "$", "data", "[", "basename", "(", "$", "source", ")", "]", "=", "'@'", ".", "realpath", "(", "$", "source", ")", ";", "$", "data", "[", "'message'", "]", "=", "$", "message", ";", "$", "data", "[", "'place'", "]", "=", "$", "place", ";", "$", "data", "[", "'no_story'", "]", "=", "$", "noStory", ";", "return", "$", "this", "->", "createConnection", "(", "$", "user", ",", "'photos'", ",", "$", "data", ",", "array", "(", "'Content-Type'", "=>", "'multipart/form-data'", ")", ")", ";", "}" ]
Method to post a photo on user's wall. Requires authentication and publish_stream permission, user_groups or friends_groups permission. @param mixed $user Either an integer containing the user ID or a string containing the username. @param string $source Path to photo. @param string $message Photo description. @param string $place Facebook ID of the place associated with the photo. @param boolean $noStory If set to 1, optionally suppresses the feed story that is automatically generated on a user’s profile when they upload a photo using your application. @return mixed The decoded JSON response or false if the client is not authenticated. @since 1.0
[ "Method", "to", "post", "a", "photo", "on", "user", "s", "wall", ".", "Requires", "authentication", "and", "publish_stream", "permission", "user_groups", "or", "friends_groups", "permission", "." ]
e7666ec1e9516f288a6f55f23a43a3d4a4edc76d
https://github.com/joomla-framework/facebook-api/blob/e7666ec1e9516f288a6f55f23a43a3d4a4edc76d/src/User.php#L646-L656
231,938
praxisnetau/silverware
src/View/Renderable.php
Renderable.loadRequirements
public function loadRequirements() { // Load Required Themed JavaScript: if (ContentController::config()->load_themed_js) { foreach ($this->getRequiredThemedJS() as $js) { Requirements::themedJavascript($js); } } // Load Required Themed CSS: if (ContentController::config()->load_themed_css) { foreach ($this->getRequiredThemedCSS() as $css => $media) { Requirements::themedCSS($css, $media); } } // Load Required JavaScript: if (ContentController::config()->load_js) { foreach ($this->getRequiredJS() as $js) { Requirements::javascript($js); } } // Load Required CSS: if (ContentController::config()->load_css) { foreach ($this->getRequiredCSS() as $css => $media) { Requirements::css($css, $media); } } // Load Required Custom CSS: if (ContentController::config()->load_custom_css) { if ($css = $this->getCustomCSSAsString()) { Requirements::customCSS($css, $this->HTMLID); } } // Load Required JavaScript Templates: foreach ($this->getRequiredJSTemplates() as $file => $params) { ViewTools::singleton()->loadJSTemplate($file, $params['vars'], $params['id']); } }
php
public function loadRequirements() { // Load Required Themed JavaScript: if (ContentController::config()->load_themed_js) { foreach ($this->getRequiredThemedJS() as $js) { Requirements::themedJavascript($js); } } // Load Required Themed CSS: if (ContentController::config()->load_themed_css) { foreach ($this->getRequiredThemedCSS() as $css => $media) { Requirements::themedCSS($css, $media); } } // Load Required JavaScript: if (ContentController::config()->load_js) { foreach ($this->getRequiredJS() as $js) { Requirements::javascript($js); } } // Load Required CSS: if (ContentController::config()->load_css) { foreach ($this->getRequiredCSS() as $css => $media) { Requirements::css($css, $media); } } // Load Required Custom CSS: if (ContentController::config()->load_custom_css) { if ($css = $this->getCustomCSSAsString()) { Requirements::customCSS($css, $this->HTMLID); } } // Load Required JavaScript Templates: foreach ($this->getRequiredJSTemplates() as $file => $params) { ViewTools::singleton()->loadJSTemplate($file, $params['vars'], $params['id']); } }
[ "public", "function", "loadRequirements", "(", ")", "{", "// Load Required Themed JavaScript:", "if", "(", "ContentController", "::", "config", "(", ")", "->", "load_themed_js", ")", "{", "foreach", "(", "$", "this", "->", "getRequiredThemedJS", "(", ")", "as", "$", "js", ")", "{", "Requirements", "::", "themedJavascript", "(", "$", "js", ")", ";", "}", "}", "// Load Required Themed CSS:", "if", "(", "ContentController", "::", "config", "(", ")", "->", "load_themed_css", ")", "{", "foreach", "(", "$", "this", "->", "getRequiredThemedCSS", "(", ")", "as", "$", "css", "=>", "$", "media", ")", "{", "Requirements", "::", "themedCSS", "(", "$", "css", ",", "$", "media", ")", ";", "}", "}", "// Load Required JavaScript:", "if", "(", "ContentController", "::", "config", "(", ")", "->", "load_js", ")", "{", "foreach", "(", "$", "this", "->", "getRequiredJS", "(", ")", "as", "$", "js", ")", "{", "Requirements", "::", "javascript", "(", "$", "js", ")", ";", "}", "}", "// Load Required CSS:", "if", "(", "ContentController", "::", "config", "(", ")", "->", "load_css", ")", "{", "foreach", "(", "$", "this", "->", "getRequiredCSS", "(", ")", "as", "$", "css", "=>", "$", "media", ")", "{", "Requirements", "::", "css", "(", "$", "css", ",", "$", "media", ")", ";", "}", "}", "// Load Required Custom CSS:", "if", "(", "ContentController", "::", "config", "(", ")", "->", "load_custom_css", ")", "{", "if", "(", "$", "css", "=", "$", "this", "->", "getCustomCSSAsString", "(", ")", ")", "{", "Requirements", "::", "customCSS", "(", "$", "css", ",", "$", "this", "->", "HTMLID", ")", ";", "}", "}", "// Load Required JavaScript Templates:", "foreach", "(", "$", "this", "->", "getRequiredJSTemplates", "(", ")", "as", "$", "file", "=>", "$", "params", ")", "{", "ViewTools", "::", "singleton", "(", ")", "->", "loadJSTemplate", "(", "$", "file", ",", "$", "params", "[", "'vars'", "]", ",", "$", "params", "[", "'id'", "]", ")", ";", "}", "}" ]
Loads the requirements for the object. @return void
[ "Loads", "the", "requirements", "for", "the", "object", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/View/Renderable.php#L124-L181
231,939
praxisnetau/silverware
src/View/Renderable.php
Renderable.getRequiredCSS
public function getRequiredCSS() { $css = $this->config()->required_css; $this->extend('updateRequiredCSS', $css); return $this->processCSSConfig($css); }
php
public function getRequiredCSS() { $css = $this->config()->required_css; $this->extend('updateRequiredCSS', $css); return $this->processCSSConfig($css); }
[ "public", "function", "getRequiredCSS", "(", ")", "{", "$", "css", "=", "$", "this", "->", "config", "(", ")", "->", "required_css", ";", "$", "this", "->", "extend", "(", "'updateRequiredCSS'", ",", "$", "css", ")", ";", "return", "$", "this", "->", "processCSSConfig", "(", "$", "css", ")", ";", "}" ]
Answers an array of CSS files required by the object. @return array
[ "Answers", "an", "array", "of", "CSS", "files", "required", "by", "the", "object", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/View/Renderable.php#L202-L209
231,940
praxisnetau/silverware
src/View/Renderable.php
Renderable.getRequiredThemedCSS
public function getRequiredThemedCSS() { $css = $this->config()->required_themed_css; $this->extend('updateRequiredThemedCSS', $css); return $this->processCSSConfig($css); }
php
public function getRequiredThemedCSS() { $css = $this->config()->required_themed_css; $this->extend('updateRequiredThemedCSS', $css); return $this->processCSSConfig($css); }
[ "public", "function", "getRequiredThemedCSS", "(", ")", "{", "$", "css", "=", "$", "this", "->", "config", "(", ")", "->", "required_themed_css", ";", "$", "this", "->", "extend", "(", "'updateRequiredThemedCSS'", ",", "$", "css", ")", ";", "return", "$", "this", "->", "processCSSConfig", "(", "$", "css", ")", ";", "}" ]
Answers an array of themed CSS files required by the object. @return array
[ "Answers", "an", "array", "of", "themed", "CSS", "files", "required", "by", "the", "object", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/View/Renderable.php#L230-L237
231,941
praxisnetau/silverware
src/View/Renderable.php
Renderable.getRequiredJSTemplates
public function getRequiredJSTemplates() { $js = $this->config()->required_js_templates; $this->extend('updateRequiredJSTemplates', $js); return $this->processJSTemplateConfig($js); }
php
public function getRequiredJSTemplates() { $js = $this->config()->required_js_templates; $this->extend('updateRequiredJSTemplates', $js); return $this->processJSTemplateConfig($js); }
[ "public", "function", "getRequiredJSTemplates", "(", ")", "{", "$", "js", "=", "$", "this", "->", "config", "(", ")", "->", "required_js_templates", ";", "$", "this", "->", "extend", "(", "'updateRequiredJSTemplates'", ",", "$", "js", ")", ";", "return", "$", "this", "->", "processJSTemplateConfig", "(", "$", "js", ")", ";", "}" ]
Answers an array of JavaScript templates required by the object. @return array
[ "Answers", "an", "array", "of", "JavaScript", "templates", "required", "by", "the", "object", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/View/Renderable.php#L244-L251
231,942
praxisnetau/silverware
src/View/Renderable.php
Renderable.getAttributesHTML
public function getAttributesHTML($attributes = null) { // Initialise: $remove = []; // Detect Excluded Attributes: if (is_string($attributes)) { $remove = func_get_args(); } // Detect Passed Attributes: if (!$attributes || is_string($attributes)) { $attributes = $this->getAttributes(); } // Ensure Array Data Type: $attributes = (array) $attributes; // Remove Excluded Attributes: if (!empty($remove)) { $attributes = array_diff_key($attributes, array_flip($remove)); } // Answer Markup: return ViewTools::singleton()->getAttributesHTML($attributes); }
php
public function getAttributesHTML($attributes = null) { // Initialise: $remove = []; // Detect Excluded Attributes: if (is_string($attributes)) { $remove = func_get_args(); } // Detect Passed Attributes: if (!$attributes || is_string($attributes)) { $attributes = $this->getAttributes(); } // Ensure Array Data Type: $attributes = (array) $attributes; // Remove Excluded Attributes: if (!empty($remove)) { $attributes = array_diff_key($attributes, array_flip($remove)); } // Answer Markup: return ViewTools::singleton()->getAttributesHTML($attributes); }
[ "public", "function", "getAttributesHTML", "(", "$", "attributes", "=", "null", ")", "{", "// Initialise:", "$", "remove", "=", "[", "]", ";", "// Detect Excluded Attributes:", "if", "(", "is_string", "(", "$", "attributes", ")", ")", "{", "$", "remove", "=", "func_get_args", "(", ")", ";", "}", "// Detect Passed Attributes:", "if", "(", "!", "$", "attributes", "||", "is_string", "(", "$", "attributes", ")", ")", "{", "$", "attributes", "=", "$", "this", "->", "getAttributes", "(", ")", ";", "}", "// Ensure Array Data Type:", "$", "attributes", "=", "(", "array", ")", "$", "attributes", ";", "// Remove Excluded Attributes:", "if", "(", "!", "empty", "(", "$", "remove", ")", ")", "{", "$", "attributes", "=", "array_diff_key", "(", "$", "attributes", ",", "array_flip", "(", "$", "remove", ")", ")", ";", "}", "// Answer Markup:", "return", "ViewTools", "::", "singleton", "(", ")", "->", "getAttributesHTML", "(", "$", "attributes", ")", ";", "}" ]
Answers the HTML tag attributes of the object as a string. If $attributes is a string, all arguments act as named attributes to exclude from rendering. @param array|string $attributes @return string
[ "Answers", "the", "HTML", "tag", "attributes", "of", "the", "object", "as", "a", "string", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/View/Renderable.php#L460-L491
231,943
praxisnetau/silverware
src/View/Renderable.php
Renderable.setStyleIDFrom
public function setStyleIDFrom(DataObject $object, $suffix = null) { $this->StyleID = sprintf( '%s_%s', ClassTools::singleton()->getClassWithoutNamespace(get_class($object)), ClassTools::singleton()->getClassWithoutNamespace(get_class($this)) ); if (!is_null($suffix)) { $this->StyleID = sprintf( '%s_%s', $this->StyleID, $suffix ); } $this->StyleID = $this->cleanStyleID($this->StyleID); return $this; }
php
public function setStyleIDFrom(DataObject $object, $suffix = null) { $this->StyleID = sprintf( '%s_%s', ClassTools::singleton()->getClassWithoutNamespace(get_class($object)), ClassTools::singleton()->getClassWithoutNamespace(get_class($this)) ); if (!is_null($suffix)) { $this->StyleID = sprintf( '%s_%s', $this->StyleID, $suffix ); } $this->StyleID = $this->cleanStyleID($this->StyleID); return $this; }
[ "public", "function", "setStyleIDFrom", "(", "DataObject", "$", "object", ",", "$", "suffix", "=", "null", ")", "{", "$", "this", "->", "StyleID", "=", "sprintf", "(", "'%s_%s'", ",", "ClassTools", "::", "singleton", "(", ")", "->", "getClassWithoutNamespace", "(", "get_class", "(", "$", "object", ")", ")", ",", "ClassTools", "::", "singleton", "(", ")", "->", "getClassWithoutNamespace", "(", "get_class", "(", "$", "this", ")", ")", ")", ";", "if", "(", "!", "is_null", "(", "$", "suffix", ")", ")", "{", "$", "this", "->", "StyleID", "=", "sprintf", "(", "'%s_%s'", ",", "$", "this", "->", "StyleID", ",", "$", "suffix", ")", ";", "}", "$", "this", "->", "StyleID", "=", "$", "this", "->", "cleanStyleID", "(", "$", "this", "->", "StyleID", ")", ";", "return", "$", "this", ";", "}" ]
Defines the style ID of the receiver from the given data object and optional suffix. @param DataObject $object @param string $suffix @return $this
[ "Defines", "the", "style", "ID", "of", "the", "receiver", "from", "the", "given", "data", "object", "and", "optional", "suffix", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/View/Renderable.php#L543-L562
231,944
praxisnetau/silverware
src/View/Renderable.php
Renderable.getClassNameWithID
public function getClassNameWithID($includeNamespace = false) { $className = static::class; if (!$includeNamespace) { $className = ClassTools::singleton()->getClassWithoutNamespace($className); } return sprintf( '%s_%s', $className, $this->ID ); }
php
public function getClassNameWithID($includeNamespace = false) { $className = static::class; if (!$includeNamespace) { $className = ClassTools::singleton()->getClassWithoutNamespace($className); } return sprintf( '%s_%s', $className, $this->ID ); }
[ "public", "function", "getClassNameWithID", "(", "$", "includeNamespace", "=", "false", ")", "{", "$", "className", "=", "static", "::", "class", ";", "if", "(", "!", "$", "includeNamespace", ")", "{", "$", "className", "=", "ClassTools", "::", "singleton", "(", ")", "->", "getClassWithoutNamespace", "(", "$", "className", ")", ";", "}", "return", "sprintf", "(", "'%s_%s'", ",", "$", "className", ",", "$", "this", "->", "ID", ")", ";", "}" ]
Answers the class name and ID of the object as a string. @param boolean $includeNamespace If true, also include the namespace of the object. @return string
[ "Answers", "the", "class", "name", "and", "ID", "of", "the", "object", "as", "a", "string", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/View/Renderable.php#L571-L584
231,945
praxisnetau/silverware
src/View/Renderable.php
Renderable.getCustomCSS
public function getCustomCSS() { // Create CSS Array: $css = []; // Merge Custom CSS from Template: foreach (ClassTools::singleton()->getObjectAncestry($this, self::class) as $class) { $template = $this->getCustomCSSTemplate($class); if (SSViewer::hasTemplate($template)) { $css = ViewTools::singleton()->renderCSS($this, $template, $css); } } // Update CSS via Extensions: $this->extend('updateCustomCSS', $css); // Filter CSS Array: $css = array_filter($css); // Answer CSS Array: return $css; }
php
public function getCustomCSS() { // Create CSS Array: $css = []; // Merge Custom CSS from Template: foreach (ClassTools::singleton()->getObjectAncestry($this, self::class) as $class) { $template = $this->getCustomCSSTemplate($class); if (SSViewer::hasTemplate($template)) { $css = ViewTools::singleton()->renderCSS($this, $template, $css); } } // Update CSS via Extensions: $this->extend('updateCustomCSS', $css); // Filter CSS Array: $css = array_filter($css); // Answer CSS Array: return $css; }
[ "public", "function", "getCustomCSS", "(", ")", "{", "// Create CSS Array:", "$", "css", "=", "[", "]", ";", "// Merge Custom CSS from Template:", "foreach", "(", "ClassTools", "::", "singleton", "(", ")", "->", "getObjectAncestry", "(", "$", "this", ",", "self", "::", "class", ")", "as", "$", "class", ")", "{", "$", "template", "=", "$", "this", "->", "getCustomCSSTemplate", "(", "$", "class", ")", ";", "if", "(", "SSViewer", "::", "hasTemplate", "(", "$", "template", ")", ")", "{", "$", "css", "=", "ViewTools", "::", "singleton", "(", ")", "->", "renderCSS", "(", "$", "this", ",", "$", "template", ",", "$", "css", ")", ";", "}", "}", "// Update CSS via Extensions:", "$", "this", "->", "extend", "(", "'updateCustomCSS'", ",", "$", "css", ")", ";", "// Filter CSS Array:", "$", "css", "=", "array_filter", "(", "$", "css", ")", ";", "// Answer CSS Array:", "return", "$", "css", ";", "}" ]
Answers an array of custom CSS required for the template. @return array
[ "Answers", "an", "array", "of", "custom", "CSS", "required", "for", "the", "template", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/View/Renderable.php#L611-L640
231,946
praxisnetau/silverware
src/View/Renderable.php
Renderable.render
public function render($layout = null, $title = null) { // Initialise: $html = ''; // Load Requirements: $this->loadRequirements(); // Obtain Cached HTML (if enabled): if ($this->isCacheEnabled()) { $html = self::getRenderCache()->get($this->getRenderCacheID()); } // Render HTML: if (!$html) { // Render Self: $html = (string) $this->renderSelf($layout, $title); // Cache Rendered HTML: if ($this->isCacheEnabled()) { self::getRenderCache()->set($this->getRenderCacheID(), $html, $this->getRenderCacheLifetime()); } } elseif (isset($_REQUEST['debug_cache'])) { // Output Debug Information: Debug::message( sprintf( 'Rendered from cache: "%s" [%s]; lifetime: %d second(s)', $this->getTitle(), $this->getRenderCacheID(), $this->getRenderCacheLifetime() ), false ); } // Answer HTML: return $html; }
php
public function render($layout = null, $title = null) { // Initialise: $html = ''; // Load Requirements: $this->loadRequirements(); // Obtain Cached HTML (if enabled): if ($this->isCacheEnabled()) { $html = self::getRenderCache()->get($this->getRenderCacheID()); } // Render HTML: if (!$html) { // Render Self: $html = (string) $this->renderSelf($layout, $title); // Cache Rendered HTML: if ($this->isCacheEnabled()) { self::getRenderCache()->set($this->getRenderCacheID(), $html, $this->getRenderCacheLifetime()); } } elseif (isset($_REQUEST['debug_cache'])) { // Output Debug Information: Debug::message( sprintf( 'Rendered from cache: "%s" [%s]; lifetime: %d second(s)', $this->getTitle(), $this->getRenderCacheID(), $this->getRenderCacheLifetime() ), false ); } // Answer HTML: return $html; }
[ "public", "function", "render", "(", "$", "layout", "=", "null", ",", "$", "title", "=", "null", ")", "{", "// Initialise:", "$", "html", "=", "''", ";", "// Load Requirements:", "$", "this", "->", "loadRequirements", "(", ")", ";", "// Obtain Cached HTML (if enabled):", "if", "(", "$", "this", "->", "isCacheEnabled", "(", ")", ")", "{", "$", "html", "=", "self", "::", "getRenderCache", "(", ")", "->", "get", "(", "$", "this", "->", "getRenderCacheID", "(", ")", ")", ";", "}", "// Render HTML:", "if", "(", "!", "$", "html", ")", "{", "// Render Self:", "$", "html", "=", "(", "string", ")", "$", "this", "->", "renderSelf", "(", "$", "layout", ",", "$", "title", ")", ";", "// Cache Rendered HTML:", "if", "(", "$", "this", "->", "isCacheEnabled", "(", ")", ")", "{", "self", "::", "getRenderCache", "(", ")", "->", "set", "(", "$", "this", "->", "getRenderCacheID", "(", ")", ",", "$", "html", ",", "$", "this", "->", "getRenderCacheLifetime", "(", ")", ")", ";", "}", "}", "elseif", "(", "isset", "(", "$", "_REQUEST", "[", "'debug_cache'", "]", ")", ")", "{", "// Output Debug Information:", "Debug", "::", "message", "(", "sprintf", "(", "'Rendered from cache: \"%s\" [%s]; lifetime: %d second(s)'", ",", "$", "this", "->", "getTitle", "(", ")", ",", "$", "this", "->", "getRenderCacheID", "(", ")", ",", "$", "this", "->", "getRenderCacheLifetime", "(", ")", ")", ",", "false", ")", ";", "}", "// Answer HTML:", "return", "$", "html", ";", "}" ]
Renders the object for the HTML template. @param string $layout Page layout passed from template. @param string $title Page title passed from template. @return DBHTMLText|string
[ "Renders", "the", "object", "for", "the", "HTML", "template", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/View/Renderable.php#L778-L827
231,947
praxisnetau/silverware
src/View/Renderable.php
Renderable.processCSSConfig
protected function processCSSConfig($config) { if (!ArrayLib::is_associative($config)) { return array_fill_keys(array_values($config), null); } return $config; }
php
protected function processCSSConfig($config) { if (!ArrayLib::is_associative($config)) { return array_fill_keys(array_values($config), null); } return $config; }
[ "protected", "function", "processCSSConfig", "(", "$", "config", ")", "{", "if", "(", "!", "ArrayLib", "::", "is_associative", "(", "$", "config", ")", ")", "{", "return", "array_fill_keys", "(", "array_values", "(", "$", "config", ")", ",", "null", ")", ";", "}", "return", "$", "config", ";", "}" ]
Processes the given CSS config and answers an array suitable for loading requirements. @param array $config @return array
[ "Processes", "the", "given", "CSS", "config", "and", "answers", "an", "array", "suitable", "for", "loading", "requirements", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/View/Renderable.php#L836-L843
231,948
praxisnetau/silverware
src/View/Renderable.php
Renderable.processJSTemplateConfig
protected function processJSTemplateConfig($config) { $templates = []; foreach ($config as $key => $value) { if (is_integer($key)) { $templates[$value] = [ 'vars' => $this->getJSVars(), 'id' => $this->getHTMLID() ]; } else { $templates[$key] = [ 'vars' => $this->getJSTemplateVars(array_shift($value)), 'id' => $this->getJSTemplateID(array_shift($value)) ]; } } return $templates; }
php
protected function processJSTemplateConfig($config) { $templates = []; foreach ($config as $key => $value) { if (is_integer($key)) { $templates[$value] = [ 'vars' => $this->getJSVars(), 'id' => $this->getHTMLID() ]; } else { $templates[$key] = [ 'vars' => $this->getJSTemplateVars(array_shift($value)), 'id' => $this->getJSTemplateID(array_shift($value)) ]; } } return $templates; }
[ "protected", "function", "processJSTemplateConfig", "(", "$", "config", ")", "{", "$", "templates", "=", "[", "]", ";", "foreach", "(", "$", "config", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "is_integer", "(", "$", "key", ")", ")", "{", "$", "templates", "[", "$", "value", "]", "=", "[", "'vars'", "=>", "$", "this", "->", "getJSVars", "(", ")", ",", "'id'", "=>", "$", "this", "->", "getHTMLID", "(", ")", "]", ";", "}", "else", "{", "$", "templates", "[", "$", "key", "]", "=", "[", "'vars'", "=>", "$", "this", "->", "getJSTemplateVars", "(", "array_shift", "(", "$", "value", ")", ")", ",", "'id'", "=>", "$", "this", "->", "getJSTemplateID", "(", "array_shift", "(", "$", "value", ")", ")", "]", ";", "}", "}", "return", "$", "templates", ";", "}" ]
Processes the given JavaScript template config and answers an array suitable for loading requirements. @param array $config @return array
[ "Processes", "the", "given", "JavaScript", "template", "config", "and", "answers", "an", "array", "suitable", "for", "loading", "requirements", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/View/Renderable.php#L852-L877
231,949
praxisnetau/silverware
src/View/Renderable.php
Renderable.getJSTemplateVars
protected function getJSTemplateVars($vars) { if (is_array($vars)) { return $vars; } if ($this->hasMethod($vars)) { return $this->{$vars}(); } return []; }
php
protected function getJSTemplateVars($vars) { if (is_array($vars)) { return $vars; } if ($this->hasMethod($vars)) { return $this->{$vars}(); } return []; }
[ "protected", "function", "getJSTemplateVars", "(", "$", "vars", ")", "{", "if", "(", "is_array", "(", "$", "vars", ")", ")", "{", "return", "$", "vars", ";", "}", "if", "(", "$", "this", "->", "hasMethod", "(", "$", "vars", ")", ")", "{", "return", "$", "this", "->", "{", "$", "vars", "}", "(", ")", ";", "}", "return", "[", "]", ";", "}" ]
Answers an array of variables for a required JavaScript template. @param string|array $vars Array of variables or method name. @return array
[ "Answers", "an", "array", "of", "variables", "for", "a", "required", "JavaScript", "template", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/View/Renderable.php#L886-L897
231,950
EcomDev/cache-key
src/Converter/HashConverter.php
HashConverter.convert
public function convert($value) { if (!is_array($value)) { return false; } $value = json_encode($value); return md5($value); }
php
public function convert($value) { if (!is_array($value)) { return false; } $value = json_encode($value); return md5($value); }
[ "public", "function", "convert", "(", "$", "value", ")", "{", "if", "(", "!", "is_array", "(", "$", "value", ")", ")", "{", "return", "false", ";", "}", "$", "value", "=", "json_encode", "(", "$", "value", ")", ";", "return", "md5", "(", "$", "value", ")", ";", "}" ]
Converts array values into hash @param mixed $value @return bool
[ "Converts", "array", "values", "into", "hash" ]
5f90f5a013100ec57d7f3a842f48222ba8a4ccf9
https://github.com/EcomDev/cache-key/blob/5f90f5a013100ec57d7f3a842f48222ba8a4ccf9/src/Converter/HashConverter.php#L19-L27
231,951
i-am-tom/schemer
src/Formatter/Collection.php
Collection.sort
public function sort(callable $comparator = null) : Collection { return $this->pipe( function (array $value) use ($comparator) : array { $comparator !== null ? usort($value, $comparator) : sort($value); return $value; } ); }
php
public function sort(callable $comparator = null) : Collection { return $this->pipe( function (array $value) use ($comparator) : array { $comparator !== null ? usort($value, $comparator) : sort($value); return $value; } ); }
[ "public", "function", "sort", "(", "callable", "$", "comparator", "=", "null", ")", ":", "Collection", "{", "return", "$", "this", "->", "pipe", "(", "function", "(", "array", "$", "value", ")", "use", "(", "$", "comparator", ")", ":", "array", "{", "$", "comparator", "!==", "null", "?", "usort", "(", "$", "value", ",", "$", "comparator", ")", ":", "sort", "(", "$", "value", ")", ";", "return", "$", "value", ";", "}", ")", ";", "}" ]
THe array will be sorted, possibly by a given function. @param callable $comparator @return Schemer\Formatter\Collection
[ "THe", "array", "will", "be", "sorted", "possibly", "by", "a", "given", "function", "." ]
aa4ff458eae636ca61ada07d05859e27d3b4584d
https://github.com/i-am-tom/schemer/blob/aa4ff458eae636ca61ada07d05859e27d3b4584d/src/Formatter/Collection.php#L32-L43
231,952
i-am-tom/schemer
src/Formatter/Collection.php
Collection.truncate
public function truncate(int $maximum) : Collection { return $this->pipe( function (array $value) use ($maximum) : array { return count($value) > $maximum ? array_slice($value, 0, $maximum) : $value; } ); }
php
public function truncate(int $maximum) : Collection { return $this->pipe( function (array $value) use ($maximum) : array { return count($value) > $maximum ? array_slice($value, 0, $maximum) : $value; } ); }
[ "public", "function", "truncate", "(", "int", "$", "maximum", ")", ":", "Collection", "{", "return", "$", "this", "->", "pipe", "(", "function", "(", "array", "$", "value", ")", "use", "(", "$", "maximum", ")", ":", "array", "{", "return", "count", "(", "$", "value", ")", ">", "$", "maximum", "?", "array_slice", "(", "$", "value", ",", "0", ",", "$", "maximum", ")", ":", "$", "value", ";", "}", ")", ";", "}" ]
The array will have no more than a given number of elements. @param int $maximum @return Schemer\Formatter\Collection
[ "The", "array", "will", "have", "no", "more", "than", "a", "given", "number", "of", "elements", "." ]
aa4ff458eae636ca61ada07d05859e27d3b4584d
https://github.com/i-am-tom/schemer/blob/aa4ff458eae636ca61ada07d05859e27d3b4584d/src/Formatter/Collection.php#L50-L59
231,953
hakito/php-wirecard-checkout-seamless
src/Api/ConfirmationResponse.php
ConfirmationResponse.InitFromArrayWithSecret
public function InitFromArrayWithSecret($data, $secret) { if (!isset($data['paymentState'])) { throw new \InvalidArgumentException('No paymentState provided.'); } $validStates = array('CANCEL', 'PENDING', 'FAILURE', 'SUCCESS'); $paymentState = $data['paymentState']; if (!in_array($paymentState, $validStates)) { throw new \InvalidArgumentException('Invalid paymentState "' . $paymentState . '".'); } $this->InitFromArray($data); if ($this->GetPaymentState() != 'SUCCESS') { return; } $this->CheckFingerprint($secret); }
php
public function InitFromArrayWithSecret($data, $secret) { if (!isset($data['paymentState'])) { throw new \InvalidArgumentException('No paymentState provided.'); } $validStates = array('CANCEL', 'PENDING', 'FAILURE', 'SUCCESS'); $paymentState = $data['paymentState']; if (!in_array($paymentState, $validStates)) { throw new \InvalidArgumentException('Invalid paymentState "' . $paymentState . '".'); } $this->InitFromArray($data); if ($this->GetPaymentState() != 'SUCCESS') { return; } $this->CheckFingerprint($secret); }
[ "public", "function", "InitFromArrayWithSecret", "(", "$", "data", ",", "$", "secret", ")", "{", "if", "(", "!", "isset", "(", "$", "data", "[", "'paymentState'", "]", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'No paymentState provided.'", ")", ";", "}", "$", "validStates", "=", "array", "(", "'CANCEL'", ",", "'PENDING'", ",", "'FAILURE'", ",", "'SUCCESS'", ")", ";", "$", "paymentState", "=", "$", "data", "[", "'paymentState'", "]", ";", "if", "(", "!", "in_array", "(", "$", "paymentState", ",", "$", "validStates", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Invalid paymentState \"'", ".", "$", "paymentState", ".", "'\".'", ")", ";", "}", "$", "this", "->", "InitFromArray", "(", "$", "data", ")", ";", "if", "(", "$", "this", "->", "GetPaymentState", "(", ")", "!=", "'SUCCESS'", ")", "{", "return", ";", "}", "$", "this", "->", "CheckFingerprint", "(", "$", "secret", ")", ";", "}" ]
Initializes from data array. In case of success the fields will be validated using the fingerprint and the secret. @param type $data Normally you should forward the $_POST array here @param type $secret Your wirecard secret @throws \InvalidArgumentException when mandatory fields are missing @throws InvalidFingerprintException when fingerprint validation fails
[ "Initializes", "from", "data", "array", ".", "In", "case", "of", "success", "the", "fields", "will", "be", "validated", "using", "the", "fingerprint", "and", "the", "secret", "." ]
cdea47abb2fdcc2a4f7de7cafd64e3ba1a1b28ce
https://github.com/hakito/php-wirecard-checkout-seamless/blob/cdea47abb2fdcc2a4f7de7cafd64e3ba1a1b28ce/src/Api/ConfirmationResponse.php#L19-L42
231,954
crisu83/yii-sentry
components/SentryClient.php
SentryClient.captureException
public function captureException($exception, $options = array(), $logger = '', $context = null) { if (!$this->isEnvironmentEnabled()) { return null; } $this->processOptions($options); try { $eventId = $this->_client->getIdent( $this->_client->captureException($exception, $options, $logger, $context) ); } catch (Exception $e) { if (YII_DEBUG) { throw new CException('SentryClient failed to log exception: ' . $e->getMessage(), (int)$e->getCode()); } else { $this->log($e->getMessage(), CLogger::LEVEL_ERROR); throw new CException('SentryClient failed to log exception.', (int)$e->getCode()); } } $this->_loggedEventIds[] = $eventId; $this->log(sprintf('Exception logged to Sentry with event id: %d', $eventId), CLogger::LEVEL_INFO); return $eventId; }
php
public function captureException($exception, $options = array(), $logger = '', $context = null) { if (!$this->isEnvironmentEnabled()) { return null; } $this->processOptions($options); try { $eventId = $this->_client->getIdent( $this->_client->captureException($exception, $options, $logger, $context) ); } catch (Exception $e) { if (YII_DEBUG) { throw new CException('SentryClient failed to log exception: ' . $e->getMessage(), (int)$e->getCode()); } else { $this->log($e->getMessage(), CLogger::LEVEL_ERROR); throw new CException('SentryClient failed to log exception.', (int)$e->getCode()); } } $this->_loggedEventIds[] = $eventId; $this->log(sprintf('Exception logged to Sentry with event id: %d', $eventId), CLogger::LEVEL_INFO); return $eventId; }
[ "public", "function", "captureException", "(", "$", "exception", ",", "$", "options", "=", "array", "(", ")", ",", "$", "logger", "=", "''", ",", "$", "context", "=", "null", ")", "{", "if", "(", "!", "$", "this", "->", "isEnvironmentEnabled", "(", ")", ")", "{", "return", "null", ";", "}", "$", "this", "->", "processOptions", "(", "$", "options", ")", ";", "try", "{", "$", "eventId", "=", "$", "this", "->", "_client", "->", "getIdent", "(", "$", "this", "->", "_client", "->", "captureException", "(", "$", "exception", ",", "$", "options", ",", "$", "logger", ",", "$", "context", ")", ")", ";", "}", "catch", "(", "Exception", "$", "e", ")", "{", "if", "(", "YII_DEBUG", ")", "{", "throw", "new", "CException", "(", "'SentryClient failed to log exception: '", ".", "$", "e", "->", "getMessage", "(", ")", ",", "(", "int", ")", "$", "e", "->", "getCode", "(", ")", ")", ";", "}", "else", "{", "$", "this", "->", "log", "(", "$", "e", "->", "getMessage", "(", ")", ",", "CLogger", "::", "LEVEL_ERROR", ")", ";", "throw", "new", "CException", "(", "'SentryClient failed to log exception.'", ",", "(", "int", ")", "$", "e", "->", "getCode", "(", ")", ")", ";", "}", "}", "$", "this", "->", "_loggedEventIds", "[", "]", "=", "$", "eventId", ";", "$", "this", "->", "log", "(", "sprintf", "(", "'Exception logged to Sentry with event id: %d'", ",", "$", "eventId", ")", ",", "CLogger", "::", "LEVEL_INFO", ")", ";", "return", "$", "eventId", ";", "}" ]
Logs an exception to Sentry. @param Exception $exception exception to log. @param array $options capture options that can contain the following structure: culprit: (string) function call that caused the event extra: (array) additional metadata to store with the event @param string $logger name of the logger. @param mixed $context exception context. @return string event id (or null if not captured). @throws CException if logging the exception fails.
[ "Logs", "an", "exception", "to", "Sentry", "." ]
beacc88e06a0eb32903e4eae63cc6cddea901524
https://github.com/crisu83/yii-sentry/blob/beacc88e06a0eb32903e4eae63cc6cddea901524/components/SentryClient.php#L111-L132
231,955
crisu83/yii-sentry
components/SentryClient.php
SentryClient.captureMessage
public function captureMessage($message, $params = array(), $options = array(), $stack = false, $context = null) { if (strlen($message) > self::MAX_MESSAGE_LENGTH) { throw new CException(sprintf( 'SentryClient cannot send messages that contain more than %d characters.', self::MAX_MESSAGE_LENGTH )); } if (!$this->isEnvironmentEnabled()) { return null; } $this->processOptions($options); try { $eventId = $this->_client->getIdent( $this->_client->captureMessage($message, $params, $options, $stack, $context) ); } catch (Exception $e) { if (YII_DEBUG) { throw new CException('SentryClient failed to log message: ' . $e->getMessage(), (int)$e->getCode()); } else { $this->log($e->getMessage(), CLogger::LEVEL_ERROR); throw new CException('SentryClient failed to log message.', (int)$e->getCode()); } } $this->_loggedEventIds[] = $eventId; $this->log(sprintf('Message logged to Sentry with event id: %d', $eventId), CLogger::LEVEL_INFO); return $eventId; }
php
public function captureMessage($message, $params = array(), $options = array(), $stack = false, $context = null) { if (strlen($message) > self::MAX_MESSAGE_LENGTH) { throw new CException(sprintf( 'SentryClient cannot send messages that contain more than %d characters.', self::MAX_MESSAGE_LENGTH )); } if (!$this->isEnvironmentEnabled()) { return null; } $this->processOptions($options); try { $eventId = $this->_client->getIdent( $this->_client->captureMessage($message, $params, $options, $stack, $context) ); } catch (Exception $e) { if (YII_DEBUG) { throw new CException('SentryClient failed to log message: ' . $e->getMessage(), (int)$e->getCode()); } else { $this->log($e->getMessage(), CLogger::LEVEL_ERROR); throw new CException('SentryClient failed to log message.', (int)$e->getCode()); } } $this->_loggedEventIds[] = $eventId; $this->log(sprintf('Message logged to Sentry with event id: %d', $eventId), CLogger::LEVEL_INFO); return $eventId; }
[ "public", "function", "captureMessage", "(", "$", "message", ",", "$", "params", "=", "array", "(", ")", ",", "$", "options", "=", "array", "(", ")", ",", "$", "stack", "=", "false", ",", "$", "context", "=", "null", ")", "{", "if", "(", "strlen", "(", "$", "message", ")", ">", "self", "::", "MAX_MESSAGE_LENGTH", ")", "{", "throw", "new", "CException", "(", "sprintf", "(", "'SentryClient cannot send messages that contain more than %d characters.'", ",", "self", "::", "MAX_MESSAGE_LENGTH", ")", ")", ";", "}", "if", "(", "!", "$", "this", "->", "isEnvironmentEnabled", "(", ")", ")", "{", "return", "null", ";", "}", "$", "this", "->", "processOptions", "(", "$", "options", ")", ";", "try", "{", "$", "eventId", "=", "$", "this", "->", "_client", "->", "getIdent", "(", "$", "this", "->", "_client", "->", "captureMessage", "(", "$", "message", ",", "$", "params", ",", "$", "options", ",", "$", "stack", ",", "$", "context", ")", ")", ";", "}", "catch", "(", "Exception", "$", "e", ")", "{", "if", "(", "YII_DEBUG", ")", "{", "throw", "new", "CException", "(", "'SentryClient failed to log message: '", ".", "$", "e", "->", "getMessage", "(", ")", ",", "(", "int", ")", "$", "e", "->", "getCode", "(", ")", ")", ";", "}", "else", "{", "$", "this", "->", "log", "(", "$", "e", "->", "getMessage", "(", ")", ",", "CLogger", "::", "LEVEL_ERROR", ")", ";", "throw", "new", "CException", "(", "'SentryClient failed to log message.'", ",", "(", "int", ")", "$", "e", "->", "getCode", "(", ")", ")", ";", "}", "}", "$", "this", "->", "_loggedEventIds", "[", "]", "=", "$", "eventId", ";", "$", "this", "->", "log", "(", "sprintf", "(", "'Message logged to Sentry with event id: %d'", ",", "$", "eventId", ")", ",", "CLogger", "::", "LEVEL_INFO", ")", ";", "return", "$", "eventId", ";", "}" ]
Logs a message to Sentry. @param string $message message to log. @param array $params message parameters. @param array $options capture options that can contain the following structure: culprit: (string) function call that caused the event extra: (array) additional metadata to store with the event @param bool $stack whether to send the stack trace. @param mixed $context message context. @return string event id (or null if not captured). @throws CException if logging the message fails.
[ "Logs", "a", "message", "to", "Sentry", "." ]
beacc88e06a0eb32903e4eae63cc6cddea901524
https://github.com/crisu83/yii-sentry/blob/beacc88e06a0eb32903e4eae63cc6cddea901524/components/SentryClient.php#L146-L173
231,956
crisu83/yii-sentry
components/SentryClient.php
SentryClient.captureQuery
public function captureQuery($query, $level = CLogger::LEVEL_INFO, $engine = '') { if (!$this->isEnvironmentEnabled()) { return null; } try { $eventId = $this->_client->getIdent( $this->_client->captureQuery($query, $level, $engine) ); } catch (Exception $e) { if (YII_DEBUG) { throw new CException('SentryClient failed to log query: ' . $e->getMessage(), (int)$e->getCode()); } else { $this->log($e->getMessage(), CLogger::LEVEL_ERROR); throw new CException('SentryClient failed to log query.', (int)$e->getCode()); } } $this->_loggedEventIds[] = $eventId; $this->log(sprintf('Query logged to Sentry with event id: %d', $eventId), CLogger::LEVEL_INFO); return $eventId; }
php
public function captureQuery($query, $level = CLogger::LEVEL_INFO, $engine = '') { if (!$this->isEnvironmentEnabled()) { return null; } try { $eventId = $this->_client->getIdent( $this->_client->captureQuery($query, $level, $engine) ); } catch (Exception $e) { if (YII_DEBUG) { throw new CException('SentryClient failed to log query: ' . $e->getMessage(), (int)$e->getCode()); } else { $this->log($e->getMessage(), CLogger::LEVEL_ERROR); throw new CException('SentryClient failed to log query.', (int)$e->getCode()); } } $this->_loggedEventIds[] = $eventId; $this->log(sprintf('Query logged to Sentry with event id: %d', $eventId), CLogger::LEVEL_INFO); return $eventId; }
[ "public", "function", "captureQuery", "(", "$", "query", ",", "$", "level", "=", "CLogger", "::", "LEVEL_INFO", ",", "$", "engine", "=", "''", ")", "{", "if", "(", "!", "$", "this", "->", "isEnvironmentEnabled", "(", ")", ")", "{", "return", "null", ";", "}", "try", "{", "$", "eventId", "=", "$", "this", "->", "_client", "->", "getIdent", "(", "$", "this", "->", "_client", "->", "captureQuery", "(", "$", "query", ",", "$", "level", ",", "$", "engine", ")", ")", ";", "}", "catch", "(", "Exception", "$", "e", ")", "{", "if", "(", "YII_DEBUG", ")", "{", "throw", "new", "CException", "(", "'SentryClient failed to log query: '", ".", "$", "e", "->", "getMessage", "(", ")", ",", "(", "int", ")", "$", "e", "->", "getCode", "(", ")", ")", ";", "}", "else", "{", "$", "this", "->", "log", "(", "$", "e", "->", "getMessage", "(", ")", ",", "CLogger", "::", "LEVEL_ERROR", ")", ";", "throw", "new", "CException", "(", "'SentryClient failed to log query.'", ",", "(", "int", ")", "$", "e", "->", "getCode", "(", ")", ")", ";", "}", "}", "$", "this", "->", "_loggedEventIds", "[", "]", "=", "$", "eventId", ";", "$", "this", "->", "log", "(", "sprintf", "(", "'Query logged to Sentry with event id: %d'", ",", "$", "eventId", ")", ",", "CLogger", "::", "LEVEL_INFO", ")", ";", "return", "$", "eventId", ";", "}" ]
Logs a query to Sentry. @param string $query query to log. @param string $level log level. @param string $engine name of the sql driver. @return string event id (or null if not captured). @throws CException if logging the query fails.
[ "Logs", "a", "query", "to", "Sentry", "." ]
beacc88e06a0eb32903e4eae63cc6cddea901524
https://github.com/crisu83/yii-sentry/blob/beacc88e06a0eb32903e4eae63cc6cddea901524/components/SentryClient.php#L183-L203
231,957
crisu83/yii-sentry
components/SentryClient.php
SentryClient.processOptions
protected function processOptions(&$options) { if (!isset($options['extra'])) { $options['extra'] = array(); } $options['extra'] = CMap::mergeArray($this->extraVariables, $options['extra']); }
php
protected function processOptions(&$options) { if (!isset($options['extra'])) { $options['extra'] = array(); } $options['extra'] = CMap::mergeArray($this->extraVariables, $options['extra']); }
[ "protected", "function", "processOptions", "(", "&", "$", "options", ")", "{", "if", "(", "!", "isset", "(", "$", "options", "[", "'extra'", "]", ")", ")", "{", "$", "options", "[", "'extra'", "]", "=", "array", "(", ")", ";", "}", "$", "options", "[", "'extra'", "]", "=", "CMap", "::", "mergeArray", "(", "$", "this", "->", "extraVariables", ",", "$", "options", "[", "'extra'", "]", ")", ";", "}" ]
Processes the given options. @param array $options the options to process.
[ "Processes", "the", "given", "options", "." ]
beacc88e06a0eb32903e4eae63cc6cddea901524
https://github.com/crisu83/yii-sentry/blob/beacc88e06a0eb32903e4eae63cc6cddea901524/components/SentryClient.php#L218-L224
231,958
crisu83/yii-sentry
components/SentryClient.php
SentryClient.createClient
protected function createClient() { $options = CMap::mergeArray( array( 'logger' => 'yii', 'tags' => array( 'environment' => $this->environment, 'php_version' => phpversion(), ), ), $this->options ); try { $this->checkTags($options['tags']); return new Raven_Client($this->dns, $options); } catch (Exception $e) { if (YII_DEBUG) { throw new CException('SentryClient failed to create client: ' . $e->getMessage(), (int)$e->getCode()); } else { $this->log($e->getMessage(), CLogger::LEVEL_ERROR); throw new CException('SentryClient failed to create client.', (int)$e->getCode()); } } }
php
protected function createClient() { $options = CMap::mergeArray( array( 'logger' => 'yii', 'tags' => array( 'environment' => $this->environment, 'php_version' => phpversion(), ), ), $this->options ); try { $this->checkTags($options['tags']); return new Raven_Client($this->dns, $options); } catch (Exception $e) { if (YII_DEBUG) { throw new CException('SentryClient failed to create client: ' . $e->getMessage(), (int)$e->getCode()); } else { $this->log($e->getMessage(), CLogger::LEVEL_ERROR); throw new CException('SentryClient failed to create client.', (int)$e->getCode()); } } }
[ "protected", "function", "createClient", "(", ")", "{", "$", "options", "=", "CMap", "::", "mergeArray", "(", "array", "(", "'logger'", "=>", "'yii'", ",", "'tags'", "=>", "array", "(", "'environment'", "=>", "$", "this", "->", "environment", ",", "'php_version'", "=>", "phpversion", "(", ")", ",", ")", ",", ")", ",", "$", "this", "->", "options", ")", ";", "try", "{", "$", "this", "->", "checkTags", "(", "$", "options", "[", "'tags'", "]", ")", ";", "return", "new", "Raven_Client", "(", "$", "this", "->", "dns", ",", "$", "options", ")", ";", "}", "catch", "(", "Exception", "$", "e", ")", "{", "if", "(", "YII_DEBUG", ")", "{", "throw", "new", "CException", "(", "'SentryClient failed to create client: '", ".", "$", "e", "->", "getMessage", "(", ")", ",", "(", "int", ")", "$", "e", "->", "getCode", "(", ")", ")", ";", "}", "else", "{", "$", "this", "->", "log", "(", "$", "e", "->", "getMessage", "(", ")", ",", "CLogger", "::", "LEVEL_ERROR", ")", ";", "throw", "new", "CException", "(", "'SentryClient failed to create client.'", ",", "(", "int", ")", "$", "e", "->", "getCode", "(", ")", ")", ";", "}", "}", "}" ]
Creates a Raven client @return Raven_Client client instance. @throws CException if the client could not be created.
[ "Creates", "a", "Raven", "client" ]
beacc88e06a0eb32903e4eae63cc6cddea901524
https://github.com/crisu83/yii-sentry/blob/beacc88e06a0eb32903e4eae63cc6cddea901524/components/SentryClient.php#L241-L264
231,959
crisu83/yii-sentry
components/SentryClient.php
SentryClient.checkTags
protected function checkTags($tags) { foreach ($tags as $key => $value) { if (strlen($key) > self::MAX_TAG_KEY_LENGTH) { throw new CException(sprintf( 'SentryClient does not allow tag keys that contain more than %d characters.', self::MAX_TAG_KEY_LENGTH )); } if (strlen($value) > self::MAX_TAG_VALUE_LENGTH) { throw new CException(sprintf( 'SentryClient does not allow tag values that contain more than %d characters.', self::MAX_TAG_VALUE_LENGTH )); } } }
php
protected function checkTags($tags) { foreach ($tags as $key => $value) { if (strlen($key) > self::MAX_TAG_KEY_LENGTH) { throw new CException(sprintf( 'SentryClient does not allow tag keys that contain more than %d characters.', self::MAX_TAG_KEY_LENGTH )); } if (strlen($value) > self::MAX_TAG_VALUE_LENGTH) { throw new CException(sprintf( 'SentryClient does not allow tag values that contain more than %d characters.', self::MAX_TAG_VALUE_LENGTH )); } } }
[ "protected", "function", "checkTags", "(", "$", "tags", ")", "{", "foreach", "(", "$", "tags", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "strlen", "(", "$", "key", ")", ">", "self", "::", "MAX_TAG_KEY_LENGTH", ")", "{", "throw", "new", "CException", "(", "sprintf", "(", "'SentryClient does not allow tag keys that contain more than %d characters.'", ",", "self", "::", "MAX_TAG_KEY_LENGTH", ")", ")", ";", "}", "if", "(", "strlen", "(", "$", "value", ")", ">", "self", "::", "MAX_TAG_VALUE_LENGTH", ")", "{", "throw", "new", "CException", "(", "sprintf", "(", "'SentryClient does not allow tag values that contain more than %d characters.'", ",", "self", "::", "MAX_TAG_VALUE_LENGTH", ")", ")", ";", "}", "}", "}" ]
Checks that the given tags are valid. @param array $tags tags to check. @throws CException if a tag is invalid.
[ "Checks", "that", "the", "given", "tags", "are", "valid", "." ]
beacc88e06a0eb32903e4eae63cc6cddea901524
https://github.com/crisu83/yii-sentry/blob/beacc88e06a0eb32903e4eae63cc6cddea901524/components/SentryClient.php#L271-L287
231,960
crisu83/yii-sentry
components/SentryLogRoute.php
SentryLogRoute.processLogs
protected function processLogs($logs) { foreach ($logs as $log) { $this->getSentryClient()->captureMessage( $log[0], array(), array( 'extra' => array( 'message' => $log[0], 'level' => $log[1], 'category' => $log[2], 'log_time' => date('Y-m-d H:i:s', $log[3]), ), ) ); } }
php
protected function processLogs($logs) { foreach ($logs as $log) { $this->getSentryClient()->captureMessage( $log[0], array(), array( 'extra' => array( 'message' => $log[0], 'level' => $log[1], 'category' => $log[2], 'log_time' => date('Y-m-d H:i:s', $log[3]), ), ) ); } }
[ "protected", "function", "processLogs", "(", "$", "logs", ")", "{", "foreach", "(", "$", "logs", "as", "$", "log", ")", "{", "$", "this", "->", "getSentryClient", "(", ")", "->", "captureMessage", "(", "$", "log", "[", "0", "]", ",", "array", "(", ")", ",", "array", "(", "'extra'", "=>", "array", "(", "'message'", "=>", "$", "log", "[", "0", "]", ",", "'level'", "=>", "$", "log", "[", "1", "]", ",", "'category'", "=>", "$", "log", "[", "2", "]", ",", "'log_time'", "=>", "date", "(", "'Y-m-d H:i:s'", ",", "$", "log", "[", "3", "]", ")", ",", ")", ",", ")", ")", ";", "}", "}" ]
Processes log messages and sends them to specific destination. Derived child classes must implement this method. @param array $logs list of messages. Each array element represents one message with the following structure: array( [0] => message (string) [1] => level (string) [2] => category (string) [3] => timestamp (float, obtained by microtime(true) );
[ "Processes", "log", "messages", "and", "sends", "them", "to", "specific", "destination", ".", "Derived", "child", "classes", "must", "implement", "this", "method", "." ]
beacc88e06a0eb32903e4eae63cc6cddea901524
https://github.com/crisu83/yii-sentry/blob/beacc88e06a0eb32903e4eae63cc6cddea901524/components/SentryLogRoute.php#L32-L48
231,961
praxisnetau/silverware
src/Forms/GridField/GridFieldConfig_MultiClassEditor.php
GridFieldConfig_MultiClassEditor.setClasses
public function setClasses($classes, $default = null) { if ($component = $this->getComponentByType(GridFieldAddNewMultiClass::class)) { $component->setClasses($classes, $default); } return $this; }
php
public function setClasses($classes, $default = null) { if ($component = $this->getComponentByType(GridFieldAddNewMultiClass::class)) { $component->setClasses($classes, $default); } return $this; }
[ "public", "function", "setClasses", "(", "$", "classes", ",", "$", "default", "=", "null", ")", "{", "if", "(", "$", "component", "=", "$", "this", "->", "getComponentByType", "(", "GridFieldAddNewMultiClass", "::", "class", ")", ")", "{", "$", "component", "->", "setClasses", "(", "$", "classes", ",", "$", "default", ")", ";", "}", "return", "$", "this", ";", "}" ]
Defines the classes that can be created using the grid field. @param array $classes Class names optionally mapped to titles. @param string $default Optional default class name. @return $this
[ "Defines", "the", "classes", "that", "can", "be", "created", "using", "the", "grid", "field", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Forms/GridField/GridFieldConfig_MultiClassEditor.php#L69-L76
231,962
kuzzleio/sdk-php
src/Document.php
Document.delete
public function delete(array $options = []) { if (!$this->id) { throw new InvalidArgumentException('Kuzzle\Document::delete: cannot delete a document without a document ID'); } $this->collection->getKuzzle()->query( $this->collection->buildQueryArgs('document', 'delete'), $this->collection->getKuzzle()->addHeaders($this->serialize(), $this->headers), $options ); return $this->id; }
php
public function delete(array $options = []) { if (!$this->id) { throw new InvalidArgumentException('Kuzzle\Document::delete: cannot delete a document without a document ID'); } $this->collection->getKuzzle()->query( $this->collection->buildQueryArgs('document', 'delete'), $this->collection->getKuzzle()->addHeaders($this->serialize(), $this->headers), $options ); return $this->id; }
[ "public", "function", "delete", "(", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "$", "this", "->", "id", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Kuzzle\\Document::delete: cannot delete a document without a document ID'", ")", ";", "}", "$", "this", "->", "collection", "->", "getKuzzle", "(", ")", "->", "query", "(", "$", "this", "->", "collection", "->", "buildQueryArgs", "(", "'document'", ",", "'delete'", ")", ",", "$", "this", "->", "collection", "->", "getKuzzle", "(", ")", "->", "addHeaders", "(", "$", "this", "->", "serialize", "(", ")", ",", "$", "this", "->", "headers", ")", ",", "$", "options", ")", ";", "return", "$", "this", "->", "id", ";", "}" ]
Deletes this document in Kuzzle @param array $options Optional parameters @return integer Id of document deleted @throws InvalidArgumentException
[ "Deletes", "this", "document", "in", "Kuzzle" ]
b1e76cafaa9c7cc08d619c838c6208489e94565b
https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Document.php#L88-L101
231,963
kuzzleio/sdk-php
src/Document.php
Document.exists
public function exists(array $options = []) { if (!$this->id) { throw new InvalidArgumentException('Kuzzle\Document::exists: cannot check if the document exists without a document ID'); } $response = $this->collection->getKuzzle()->query( $this->collection->buildQueryArgs('document', 'exists'), $this->collection->getKuzzle()->addHeaders($this->serialize(), $this->headers), $options ); return $response['result']; }
php
public function exists(array $options = []) { if (!$this->id) { throw new InvalidArgumentException('Kuzzle\Document::exists: cannot check if the document exists without a document ID'); } $response = $this->collection->getKuzzle()->query( $this->collection->buildQueryArgs('document', 'exists'), $this->collection->getKuzzle()->addHeaders($this->serialize(), $this->headers), $options ); return $response['result']; }
[ "public", "function", "exists", "(", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "$", "this", "->", "id", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Kuzzle\\Document::exists: cannot check if the document exists without a document ID'", ")", ";", "}", "$", "response", "=", "$", "this", "->", "collection", "->", "getKuzzle", "(", ")", "->", "query", "(", "$", "this", "->", "collection", "->", "buildQueryArgs", "(", "'document'", ",", "'exists'", ")", ",", "$", "this", "->", "collection", "->", "getKuzzle", "(", ")", "->", "addHeaders", "(", "$", "this", "->", "serialize", "(", ")", ",", "$", "this", "->", "headers", ")", ",", "$", "options", ")", ";", "return", "$", "response", "[", "'result'", "]", ";", "}" ]
Checks if this document exists in Kuzzle. @param array $options @return boolean @throws InvalidArgumentException
[ "Checks", "if", "this", "document", "exists", "in", "Kuzzle", "." ]
b1e76cafaa9c7cc08d619c838c6208489e94565b
https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Document.php#L111-L124
231,964
kuzzleio/sdk-php
src/Document.php
Document.refresh
public function refresh(array $options = []) { if (!$this->id) { throw new InvalidArgumentException('Kuzzle\Document::refresh: cannot retrieve a document without a document ID'); } $data = [ '_id' => $this->id ]; $response = $this->collection->getKuzzle()->query( $this->collection->buildQueryArgs('document', 'get'), $this->collection->getKuzzle()->addHeaders($data, $this->headers), $options ); $documentContent = $response['result']['_source']; $documentContent['_version'] = $response['result']['_version']; $documentMeta = $response['result']['_meta']; return new Document($this->collection, $response['result']['_id'], $documentContent, $documentMeta); }
php
public function refresh(array $options = []) { if (!$this->id) { throw new InvalidArgumentException('Kuzzle\Document::refresh: cannot retrieve a document without a document ID'); } $data = [ '_id' => $this->id ]; $response = $this->collection->getKuzzle()->query( $this->collection->buildQueryArgs('document', 'get'), $this->collection->getKuzzle()->addHeaders($data, $this->headers), $options ); $documentContent = $response['result']['_source']; $documentContent['_version'] = $response['result']['_version']; $documentMeta = $response['result']['_meta']; return new Document($this->collection, $response['result']['_id'], $documentContent, $documentMeta); }
[ "public", "function", "refresh", "(", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "!", "$", "this", "->", "id", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Kuzzle\\Document::refresh: cannot retrieve a document without a document ID'", ")", ";", "}", "$", "data", "=", "[", "'_id'", "=>", "$", "this", "->", "id", "]", ";", "$", "response", "=", "$", "this", "->", "collection", "->", "getKuzzle", "(", ")", "->", "query", "(", "$", "this", "->", "collection", "->", "buildQueryArgs", "(", "'document'", ",", "'get'", ")", ",", "$", "this", "->", "collection", "->", "getKuzzle", "(", ")", "->", "addHeaders", "(", "$", "data", ",", "$", "this", "->", "headers", ")", ",", "$", "options", ")", ";", "$", "documentContent", "=", "$", "response", "[", "'result'", "]", "[", "'_source'", "]", ";", "$", "documentContent", "[", "'_version'", "]", "=", "$", "response", "[", "'result'", "]", "[", "'_version'", "]", ";", "$", "documentMeta", "=", "$", "response", "[", "'result'", "]", "[", "'_meta'", "]", ";", "return", "new", "Document", "(", "$", "this", "->", "collection", ",", "$", "response", "[", "'result'", "]", "[", "'_id'", "]", ",", "$", "documentContent", ",", "$", "documentMeta", ")", ";", "}" ]
Creates a new KuzzleDocument object with the last version of this document stored in Kuzzle. @param array $options Optional parameters @return Document @throws InvalidArgumentException
[ "Creates", "a", "new", "KuzzleDocument", "object", "with", "the", "last", "version", "of", "this", "document", "stored", "in", "Kuzzle", "." ]
b1e76cafaa9c7cc08d619c838c6208489e94565b
https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Document.php#L134-L155
231,965
kuzzleio/sdk-php
src/Document.php
Document.save
public function save(array $options = []) { $response = $this->collection->getKuzzle()->query( $this->collection->buildQueryArgs('document', 'createOrReplace'), $this->collection->getKuzzle()->addHeaders($this->serialize(), $this->headers), $options ); $this->id = $response['result']['_id']; $this->version = $response['result']['_version']; return $this; }
php
public function save(array $options = []) { $response = $this->collection->getKuzzle()->query( $this->collection->buildQueryArgs('document', 'createOrReplace'), $this->collection->getKuzzle()->addHeaders($this->serialize(), $this->headers), $options ); $this->id = $response['result']['_id']; $this->version = $response['result']['_version']; return $this; }
[ "public", "function", "save", "(", "array", "$", "options", "=", "[", "]", ")", "{", "$", "response", "=", "$", "this", "->", "collection", "->", "getKuzzle", "(", ")", "->", "query", "(", "$", "this", "->", "collection", "->", "buildQueryArgs", "(", "'document'", ",", "'createOrReplace'", ")", ",", "$", "this", "->", "collection", "->", "getKuzzle", "(", ")", "->", "addHeaders", "(", "$", "this", "->", "serialize", "(", ")", ",", "$", "this", "->", "headers", ")", ",", "$", "options", ")", ";", "$", "this", "->", "id", "=", "$", "response", "[", "'result'", "]", "[", "'_id'", "]", ";", "$", "this", "->", "version", "=", "$", "response", "[", "'result'", "]", "[", "'_version'", "]", ";", "return", "$", "this", ";", "}" ]
Saves this document into Kuzzle. If this is a new document, this function will create it in Kuzzle and the id property will be made available. Otherwise, this method will replace the latest version of this document in Kuzzle by the current content of this object. @param array $options Optional parameters @return Document
[ "Saves", "this", "document", "into", "Kuzzle", "." ]
b1e76cafaa9c7cc08d619c838c6208489e94565b
https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Document.php#L166-L178
231,966
kuzzleio/sdk-php
src/Document.php
Document.publish
public function publish(array $options = []) { $this->collection->getKuzzle()->query( $this->collection->buildQueryArgs('realtime', 'publish'), $this->collection->getKuzzle()->addHeaders($this->serialize(), $this->headers), $options ); return $this; }
php
public function publish(array $options = []) { $this->collection->getKuzzle()->query( $this->collection->buildQueryArgs('realtime', 'publish'), $this->collection->getKuzzle()->addHeaders($this->serialize(), $this->headers), $options ); return $this; }
[ "public", "function", "publish", "(", "array", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "collection", "->", "getKuzzle", "(", ")", "->", "query", "(", "$", "this", "->", "collection", "->", "buildQueryArgs", "(", "'realtime'", ",", "'publish'", ")", ",", "$", "this", "->", "collection", "->", "getKuzzle", "(", ")", "->", "addHeaders", "(", "$", "this", "->", "serialize", "(", ")", ",", "$", "this", "->", "headers", ")", ",", "$", "options", ")", ";", "return", "$", "this", ";", "}" ]
Sends the content of this document as a realtime message. Takes an optional argument object with the following properties: - volatile (object, default: null): Additional information passed to notifications to other users @param array $options @return Document
[ "Sends", "the", "content", "of", "this", "document", "as", "a", "realtime", "message", "." ]
b1e76cafaa9c7cc08d619c838c6208489e94565b
https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Document.php#L190-L199
231,967
kuzzleio/sdk-php
src/Document.php
Document.setContent
public function setContent(array $content, $replace = false) { if ($replace) { $this->content = $content; } else { foreach ($content as $key => $value) { $this->content[$key] = $value; } } return $this; }
php
public function setContent(array $content, $replace = false) { if ($replace) { $this->content = $content; } else { foreach ($content as $key => $value) { $this->content[$key] = $value; } } return $this; }
[ "public", "function", "setContent", "(", "array", "$", "content", ",", "$", "replace", "=", "false", ")", "{", "if", "(", "$", "replace", ")", "{", "$", "this", "->", "content", "=", "$", "content", ";", "}", "else", "{", "foreach", "(", "$", "content", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "this", "->", "content", "[", "$", "key", "]", "=", "$", "value", ";", "}", "}", "return", "$", "this", ";", "}" ]
Replaces the current content with new data. This is a helper function returning itself, allowing to easily chain calls. @param array $content @param bool $replace true: replace the current content with the provided data, false: merge it @return Document
[ "Replaces", "the", "current", "content", "with", "new", "data", ".", "This", "is", "a", "helper", "function", "returning", "itself", "allowing", "to", "easily", "chain", "calls", "." ]
b1e76cafaa9c7cc08d619c838c6208489e94565b
https://github.com/kuzzleio/sdk-php/blob/b1e76cafaa9c7cc08d619c838c6208489e94565b/src/Document.php#L210-L221
231,968
praxisnetau/silverware
src/Extensions/Style/ThemeStyle.php
ThemeStyle.getDropdownOptions
public function getDropdownOptions($name) { $config = Config::inst()->get(static::class, 'theme_styles'); return (isset($config[$name]) && is_array($config[$name])) ? $config[$name] : []; }
php
public function getDropdownOptions($name) { $config = Config::inst()->get(static::class, 'theme_styles'); return (isset($config[$name]) && is_array($config[$name])) ? $config[$name] : []; }
[ "public", "function", "getDropdownOptions", "(", "$", "name", ")", "{", "$", "config", "=", "Config", "::", "inst", "(", ")", "->", "get", "(", "static", "::", "class", ",", "'theme_styles'", ")", ";", "return", "(", "isset", "(", "$", "config", "[", "$", "name", "]", ")", "&&", "is_array", "(", "$", "config", "[", "$", "name", "]", ")", ")", "?", "$", "config", "[", "$", "name", "]", ":", "[", "]", ";", "}" ]
Answers an array of options with the given style name for a dropdown field. @param string $name @return array
[ "Answers", "an", "array", "of", "options", "with", "the", "given", "style", "name", "for", "a", "dropdown", "field", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Extensions/Style/ThemeStyle.php#L153-L158
231,969
praxisnetau/silverware
src/Model/Component.php
Component.setParentInstance
public function setParentInstance(SiteTree $parent) { $this->parentInstance = $parent; $this->setStyleIDFrom($parent); return $this; }
php
public function setParentInstance(SiteTree $parent) { $this->parentInstance = $parent; $this->setStyleIDFrom($parent); return $this; }
[ "public", "function", "setParentInstance", "(", "SiteTree", "$", "parent", ")", "{", "$", "this", "->", "parentInstance", "=", "$", "parent", ";", "$", "this", "->", "setStyleIDFrom", "(", "$", "parent", ")", ";", "return", "$", "this", ";", "}" ]
Defines the parent instance of the receiver. @param SiteTree $parent @return $this
[ "Defines", "the", "parent", "instance", "of", "the", "receiver", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Model/Component.php#L270-L277
231,970
praxisnetau/silverware
src/Model/Component.php
Component.getDefaultStyleID
public function getDefaultStyleID() { $ids = [$this->getTitleID()]; $parent = $this->getParent(); while ($parent instanceof Component) { $ids[] = $parent->getTitleID(); $parent = $parent->getParent(); } return implode('_', array_reverse($ids)); }
php
public function getDefaultStyleID() { $ids = [$this->getTitleID()]; $parent = $this->getParent(); while ($parent instanceof Component) { $ids[] = $parent->getTitleID(); $parent = $parent->getParent(); } return implode('_', array_reverse($ids)); }
[ "public", "function", "getDefaultStyleID", "(", ")", "{", "$", "ids", "=", "[", "$", "this", "->", "getTitleID", "(", ")", "]", ";", "$", "parent", "=", "$", "this", "->", "getParent", "(", ")", ";", "while", "(", "$", "parent", "instanceof", "Component", ")", "{", "$", "ids", "[", "]", "=", "$", "parent", "->", "getTitleID", "(", ")", ";", "$", "parent", "=", "$", "parent", "->", "getParent", "(", ")", ";", "}", "return", "implode", "(", "'_'", ",", "array_reverse", "(", "$", "ids", ")", ")", ";", "}" ]
Answers the default style ID for the HTML template. @return string
[ "Answers", "the", "default", "style", "ID", "for", "the", "HTML", "template", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Model/Component.php#L488-L500
231,971
praxisnetau/silverware
src/Model/Component.php
Component.getAllChildren
public function getAllChildren() { // Answer Cached Children (if available): if ($this->cacheAllChildren) { return $this->cacheAllChildren; } // Obtain Child Objects: $this->cacheAllChildren = $this->stageChildren(true); // Answer Child Objects: return $this->cacheAllChildren; }
php
public function getAllChildren() { // Answer Cached Children (if available): if ($this->cacheAllChildren) { return $this->cacheAllChildren; } // Obtain Child Objects: $this->cacheAllChildren = $this->stageChildren(true); // Answer Child Objects: return $this->cacheAllChildren; }
[ "public", "function", "getAllChildren", "(", ")", "{", "// Answer Cached Children (if available):", "if", "(", "$", "this", "->", "cacheAllChildren", ")", "{", "return", "$", "this", "->", "cacheAllChildren", ";", "}", "// Obtain Child Objects:", "$", "this", "->", "cacheAllChildren", "=", "$", "this", "->", "stageChildren", "(", "true", ")", ";", "// Answer Child Objects:", "return", "$", "this", "->", "cacheAllChildren", ";", "}" ]
Answers a list of all children within the receiver. @return DataList
[ "Answers", "a", "list", "of", "all", "children", "within", "the", "receiver", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Model/Component.php#L517-L532
231,972
praxisnetau/silverware
src/Model/Component.php
Component.getAllComponents
public function getAllComponents() { // Answer Cached Components (if available): if ($this->cacheAllComponents) { return $this->cacheAllComponents; } // Obtain Component Objects: $components = ArrayList::create(); foreach ($this->getAllChildren() as $child) { $components->push($child); $components->merge($child->getAllComponents()); } $this->cacheAllComponents = $components; // Answer Component Objects: return $this->cacheAllComponents; }
php
public function getAllComponents() { // Answer Cached Components (if available): if ($this->cacheAllComponents) { return $this->cacheAllComponents; } // Obtain Component Objects: $components = ArrayList::create(); foreach ($this->getAllChildren() as $child) { $components->push($child); $components->merge($child->getAllComponents()); } $this->cacheAllComponents = $components; // Answer Component Objects: return $this->cacheAllComponents; }
[ "public", "function", "getAllComponents", "(", ")", "{", "// Answer Cached Components (if available):", "if", "(", "$", "this", "->", "cacheAllComponents", ")", "{", "return", "$", "this", "->", "cacheAllComponents", ";", "}", "// Obtain Component Objects:", "$", "components", "=", "ArrayList", "::", "create", "(", ")", ";", "foreach", "(", "$", "this", "->", "getAllChildren", "(", ")", "as", "$", "child", ")", "{", "$", "components", "->", "push", "(", "$", "child", ")", ";", "$", "components", "->", "merge", "(", "$", "child", "->", "getAllComponents", "(", ")", ")", ";", "}", "$", "this", "->", "cacheAllComponents", "=", "$", "components", ";", "// Answer Component Objects:", "return", "$", "this", "->", "cacheAllComponents", ";", "}" ]
Answers a list of all components within the receiver. @return ArrayList
[ "Answers", "a", "list", "of", "all", "components", "within", "the", "receiver", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Model/Component.php#L551-L573
231,973
praxisnetau/silverware
src/Model/Component.php
Component.getEnabledChildren
public function getEnabledChildren() { // Answer Cached Children (if available): if ($this->cacheEnabledChildren) { return $this->cacheEnabledChildren; } // Obtain Child Objects: $this->cacheEnabledChildren = $this->getAllChildren()->filterByCallback(function ($child) { return ($child instanceof Component) ? $child->isEnabled() : false; }); // Answer Child Objects: return $this->cacheEnabledChildren; }
php
public function getEnabledChildren() { // Answer Cached Children (if available): if ($this->cacheEnabledChildren) { return $this->cacheEnabledChildren; } // Obtain Child Objects: $this->cacheEnabledChildren = $this->getAllChildren()->filterByCallback(function ($child) { return ($child instanceof Component) ? $child->isEnabled() : false; }); // Answer Child Objects: return $this->cacheEnabledChildren; }
[ "public", "function", "getEnabledChildren", "(", ")", "{", "// Answer Cached Children (if available):", "if", "(", "$", "this", "->", "cacheEnabledChildren", ")", "{", "return", "$", "this", "->", "cacheEnabledChildren", ";", "}", "// Obtain Child Objects:", "$", "this", "->", "cacheEnabledChildren", "=", "$", "this", "->", "getAllChildren", "(", ")", "->", "filterByCallback", "(", "function", "(", "$", "child", ")", "{", "return", "(", "$", "child", "instanceof", "Component", ")", "?", "$", "child", "->", "isEnabled", "(", ")", ":", "false", ";", "}", ")", ";", "// Answer Child Objects:", "return", "$", "this", "->", "cacheEnabledChildren", ";", "}" ]
Answers a list of the enabled children within the receiver. @return DataList
[ "Answers", "a", "list", "of", "the", "enabled", "children", "within", "the", "receiver", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Model/Component.php#L592-L609
231,974
praxisnetau/silverware
src/Model/Component.php
Component.getEnabledComponents
public function getEnabledComponents() { // Answer Cached Components (if available): if ($this->cacheEnabledComponents) { return $this->cacheEnabledComponents; } // Obtain Component Objects: $components = ArrayList::create(); foreach ($this->getEnabledChildren() as $child) { $components->push($child); $components->merge($child->getEnabledComponents()); } $this->cacheEnabledComponents = $components; // Answer Component Objects: return $this->cacheEnabledComponents; }
php
public function getEnabledComponents() { // Answer Cached Components (if available): if ($this->cacheEnabledComponents) { return $this->cacheEnabledComponents; } // Obtain Component Objects: $components = ArrayList::create(); foreach ($this->getEnabledChildren() as $child) { $components->push($child); $components->merge($child->getEnabledComponents()); } $this->cacheEnabledComponents = $components; // Answer Component Objects: return $this->cacheEnabledComponents; }
[ "public", "function", "getEnabledComponents", "(", ")", "{", "// Answer Cached Components (if available):", "if", "(", "$", "this", "->", "cacheEnabledComponents", ")", "{", "return", "$", "this", "->", "cacheEnabledComponents", ";", "}", "// Obtain Component Objects:", "$", "components", "=", "ArrayList", "::", "create", "(", ")", ";", "foreach", "(", "$", "this", "->", "getEnabledChildren", "(", ")", "as", "$", "child", ")", "{", "$", "components", "->", "push", "(", "$", "child", ")", ";", "$", "components", "->", "merge", "(", "$", "child", "->", "getEnabledComponents", "(", ")", ")", ";", "}", "$", "this", "->", "cacheEnabledComponents", "=", "$", "components", ";", "// Answer Component Objects:", "return", "$", "this", "->", "cacheEnabledComponents", ";", "}" ]
Answers a list of all the enabled components within the receiver. @return ArrayList
[ "Answers", "a", "list", "of", "all", "the", "enabled", "components", "within", "the", "receiver", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Model/Component.php#L616-L638
231,975
praxisnetau/silverware
src/Model/Component.php
Component.renderChildren
public function renderChildren($layout = null, $title = null) { $html = ''; foreach ($this->getEnabledChildren() as $child) { $html .= $child->render($layout, $title); } return $html; }
php
public function renderChildren($layout = null, $title = null) { $html = ''; foreach ($this->getEnabledChildren() as $child) { $html .= $child->render($layout, $title); } return $html; }
[ "public", "function", "renderChildren", "(", "$", "layout", "=", "null", ",", "$", "title", "=", "null", ")", "{", "$", "html", "=", "''", ";", "foreach", "(", "$", "this", "->", "getEnabledChildren", "(", ")", "as", "$", "child", ")", "{", "$", "html", ".=", "$", "child", "->", "render", "(", "$", "layout", ",", "$", "title", ")", ";", "}", "return", "$", "html", ";", "}" ]
Renders the enabled children within the component for the HTML template. @param string $layout Page layout passed from template. @param string $title Page title passed from template. @return DBHTMLText|string
[ "Renders", "the", "enabled", "children", "within", "the", "component", "for", "the", "HTML", "template", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Model/Component.php#L909-L918
231,976
praxisnetau/silverware
src/Components/ImageComponent.php
ImageComponent.getImageAttributes
public function getImageAttributes() { $attributes = [ 'src' => $this->ImageURL, 'class' => $this->ImageClass, 'title' => $this->ImageTitleText, 'alt' => $this->ImageAltText ]; if ($this->hasVectorImage()) { if ($width = $this->ImageResizeWidth) { $attributes['width'] = $width; } if ($height = $this->ImageResizeHeight) { $attributes['height'] = $height; } } $this->extend('updateImageAttributes', $attributes); return $attributes; }
php
public function getImageAttributes() { $attributes = [ 'src' => $this->ImageURL, 'class' => $this->ImageClass, 'title' => $this->ImageTitleText, 'alt' => $this->ImageAltText ]; if ($this->hasVectorImage()) { if ($width = $this->ImageResizeWidth) { $attributes['width'] = $width; } if ($height = $this->ImageResizeHeight) { $attributes['height'] = $height; } } $this->extend('updateImageAttributes', $attributes); return $attributes; }
[ "public", "function", "getImageAttributes", "(", ")", "{", "$", "attributes", "=", "[", "'src'", "=>", "$", "this", "->", "ImageURL", ",", "'class'", "=>", "$", "this", "->", "ImageClass", ",", "'title'", "=>", "$", "this", "->", "ImageTitleText", ",", "'alt'", "=>", "$", "this", "->", "ImageAltText", "]", ";", "if", "(", "$", "this", "->", "hasVectorImage", "(", ")", ")", "{", "if", "(", "$", "width", "=", "$", "this", "->", "ImageResizeWidth", ")", "{", "$", "attributes", "[", "'width'", "]", "=", "$", "width", ";", "}", "if", "(", "$", "height", "=", "$", "this", "->", "ImageResizeHeight", ")", "{", "$", "attributes", "[", "'height'", "]", "=", "$", "height", ";", "}", "}", "$", "this", "->", "extend", "(", "'updateImageAttributes'", ",", "$", "attributes", ")", ";", "return", "$", "attributes", ";", "}" ]
Answers an array of attributes for the image element. @return array
[ "Answers", "an", "array", "of", "attributes", "for", "the", "image", "element", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Components/ImageComponent.php#L344-L368
231,977
wallstreetio/ontraport
src/Objects.php
Objects.set
public function set($object, $id = null) { if (is_array($object)) { return $this->setAll($object); } $this->objects[$object] = $id; }
php
public function set($object, $id = null) { if (is_array($object)) { return $this->setAll($object); } $this->objects[$object] = $id; }
[ "public", "function", "set", "(", "$", "object", ",", "$", "id", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "object", ")", ")", "{", "return", "$", "this", "->", "setAll", "(", "$", "object", ")", ";", "}", "$", "this", "->", "objects", "[", "$", "object", "]", "=", "$", "id", ";", "}" ]
Set an Ontraport object by its name and id. @param string $object @param mixed $id @return void
[ "Set", "an", "Ontraport", "object", "by", "its", "name", "and", "id", "." ]
55467fd63637083f76e497897af4aee13fc2c8b1
https://github.com/wallstreetio/ontraport/blob/55467fd63637083f76e497897af4aee13fc2c8b1/src/Objects.php#L34-L41
231,978
wallstreetio/ontraport
src/Objects.php
Objects.get
public function get($name = null) { if (is_null($name)) { return $this->all(); } return $this->find($name); }
php
public function get($name = null) { if (is_null($name)) { return $this->all(); } return $this->find($name); }
[ "public", "function", "get", "(", "$", "name", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "name", ")", ")", "{", "return", "$", "this", "->", "all", "(", ")", ";", "}", "return", "$", "this", "->", "find", "(", "$", "name", ")", ";", "}" ]
Retrieve all Ontraport objects. @param string $name @return mixed
[ "Retrieve", "all", "Ontraport", "objects", "." ]
55467fd63637083f76e497897af4aee13fc2c8b1
https://github.com/wallstreetio/ontraport/blob/55467fd63637083f76e497897af4aee13fc2c8b1/src/Objects.php#L70-L77
231,979
wallstreetio/ontraport
src/Objects.php
Objects.find
public function find($name) { $name = strtolower($name); if (isset($this->objects[$name])) { return $this->objects[$name]; } throw new InvalidCustomObject("The object [{$name}] does not exist."); }
php
public function find($name) { $name = strtolower($name); if (isset($this->objects[$name])) { return $this->objects[$name]; } throw new InvalidCustomObject("The object [{$name}] does not exist."); }
[ "public", "function", "find", "(", "$", "name", ")", "{", "$", "name", "=", "strtolower", "(", "$", "name", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "objects", "[", "$", "name", "]", ")", ")", "{", "return", "$", "this", "->", "objects", "[", "$", "name", "]", ";", "}", "throw", "new", "InvalidCustomObject", "(", "\"The object [{$name}] does not exist.\"", ")", ";", "}" ]
Find an Ontraport object by its name. @param string $name @return void
[ "Find", "an", "Ontraport", "object", "by", "its", "name", "." ]
55467fd63637083f76e497897af4aee13fc2c8b1
https://github.com/wallstreetio/ontraport/blob/55467fd63637083f76e497897af4aee13fc2c8b1/src/Objects.php#L85-L93
231,980
slimphp-api/slim-phinx
src/Module.php
Module.loadDependencies
public function loadDependencies() { $config = []; $files = glob(dirname(__DIR__).'/config/*.config.php', GLOB_BRACE); foreach ($files as $file) { $config = array_merge($config, (require $file)); } return $config; }
php
public function loadDependencies() { $config = []; $files = glob(dirname(__DIR__).'/config/*.config.php', GLOB_BRACE); foreach ($files as $file) { $config = array_merge($config, (require $file)); } return $config; }
[ "public", "function", "loadDependencies", "(", ")", "{", "$", "config", "=", "[", "]", ";", "$", "files", "=", "glob", "(", "dirname", "(", "__DIR__", ")", ".", "'/config/*.config.php'", ",", "GLOB_BRACE", ")", ";", "foreach", "(", "$", "files", "as", "$", "file", ")", "{", "$", "config", "=", "array_merge", "(", "$", "config", ",", "(", "require", "$", "file", ")", ")", ";", "}", "return", "$", "config", ";", "}" ]
load the dependencies for the module.
[ "load", "the", "dependencies", "for", "the", "module", "." ]
48560f6083e0651389ef0790e59325c751e6574e
https://github.com/slimphp-api/slim-phinx/blob/48560f6083e0651389ef0790e59325c751e6574e/src/Module.php#L9-L17
231,981
terra-ops/terra-cli
src/terra/Command/Environment/EnvironmentDomains.php
EnvironmentDomains.executeAddDomain
protected function executeAddDomain(InputInterface $input, OutputInterface $output) { // Ask for a domain $domain_question = new Question('What domain would you like to add as a VIRTUAL_HOST for the server? (Do NOT include http://) '); $name = $this->getAnswer($input, $output, $domain_question, 'domain', 'argument', TRUE); // Add the domain to the domain property. $output->writeln("Adding domain: <info>{$name}</info>"); $this->environment->domains[] = $name; $helper = $this->getHelper('question'); $question = new ConfirmationQuestion("Add the domain <comment>$name</comment> to the environment <info>{$this->app->name}:{$this->environment->name}</info> [y/N]? ", FALSE); if (!$helper->ask($input, $output, $question)) { $output->writeln("<fg=red>Domain not added.</>"); $output->writeln(''); exit; } // Save the new version to the config. $this->getApplication()->getTerra()->getConfig()->add('apps', array($this->app->name, 'environments', $this->environment->name), (array) $this->environment); $this->getApplication()->getTerra()->getConfig()->save(); $output->writeln("<info>Domain added!</info> Changes won't take effect until the environment is restarted."); $output->writeln(''); }
php
protected function executeAddDomain(InputInterface $input, OutputInterface $output) { // Ask for a domain $domain_question = new Question('What domain would you like to add as a VIRTUAL_HOST for the server? (Do NOT include http://) '); $name = $this->getAnswer($input, $output, $domain_question, 'domain', 'argument', TRUE); // Add the domain to the domain property. $output->writeln("Adding domain: <info>{$name}</info>"); $this->environment->domains[] = $name; $helper = $this->getHelper('question'); $question = new ConfirmationQuestion("Add the domain <comment>$name</comment> to the environment <info>{$this->app->name}:{$this->environment->name}</info> [y/N]? ", FALSE); if (!$helper->ask($input, $output, $question)) { $output->writeln("<fg=red>Domain not added.</>"); $output->writeln(''); exit; } // Save the new version to the config. $this->getApplication()->getTerra()->getConfig()->add('apps', array($this->app->name, 'environments', $this->environment->name), (array) $this->environment); $this->getApplication()->getTerra()->getConfig()->save(); $output->writeln("<info>Domain added!</info> Changes won't take effect until the environment is restarted."); $output->writeln(''); }
[ "protected", "function", "executeAddDomain", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "// Ask for a domain", "$", "domain_question", "=", "new", "Question", "(", "'What domain would you like to add as a VIRTUAL_HOST for the server? (Do NOT include http://) '", ")", ";", "$", "name", "=", "$", "this", "->", "getAnswer", "(", "$", "input", ",", "$", "output", ",", "$", "domain_question", ",", "'domain'", ",", "'argument'", ",", "TRUE", ")", ";", "// Add the domain to the domain property.", "$", "output", "->", "writeln", "(", "\"Adding domain: <info>{$name}</info>\"", ")", ";", "$", "this", "->", "environment", "->", "domains", "[", "]", "=", "$", "name", ";", "$", "helper", "=", "$", "this", "->", "getHelper", "(", "'question'", ")", ";", "$", "question", "=", "new", "ConfirmationQuestion", "(", "\"Add the domain <comment>$name</comment> to the environment <info>{$this->app->name}:{$this->environment->name}</info> [y/N]? \"", ",", "FALSE", ")", ";", "if", "(", "!", "$", "helper", "->", "ask", "(", "$", "input", ",", "$", "output", ",", "$", "question", ")", ")", "{", "$", "output", "->", "writeln", "(", "\"<fg=red>Domain not added.</>\"", ")", ";", "$", "output", "->", "writeln", "(", "''", ")", ";", "exit", ";", "}", "// Save the new version to the config.", "$", "this", "->", "getApplication", "(", ")", "->", "getTerra", "(", ")", "->", "getConfig", "(", ")", "->", "add", "(", "'apps'", ",", "array", "(", "$", "this", "->", "app", "->", "name", ",", "'environments'", ",", "$", "this", "->", "environment", "->", "name", ")", ",", "(", "array", ")", "$", "this", "->", "environment", ")", ";", "$", "this", "->", "getApplication", "(", ")", "->", "getTerra", "(", ")", "->", "getConfig", "(", ")", "->", "save", "(", ")", ";", "$", "output", "->", "writeln", "(", "\"<info>Domain added!</info> Changes won't take effect until the environment is restarted.\"", ")", ";", "$", "output", "->", "writeln", "(", "''", ")", ";", "}" ]
Add a domain. @param InputInterface $input @param OutputInterface $output
[ "Add", "a", "domain", "." ]
b176cca562534c1d65efbcef6c128f669a2ebed8
https://github.com/terra-ops/terra-cli/blob/b176cca562534c1d65efbcef6c128f669a2ebed8/src/terra/Command/Environment/EnvironmentDomains.php#L118-L143
231,982
terra-ops/terra-cli
src/terra/Command/Environment/EnvironmentDomains.php
EnvironmentDomains.executeRemoveDomain
protected function executeRemoveDomain(InputInterface $input, OutputInterface $output) { // If no domains are left, exit if (empty($this->environment->domains)) { $output->writeln('<comment>There are no domains assigned to this environment!</comment>'); exit; } // Ask for a domain if ($input->getArgument('domain') == NULL) { $helper = $this->getHelper('question'); $domains = $this->environment->domains; $question = new ChoiceQuestion( 'Which domain would you like to remove? ', $domains, null ); $name = $helper->ask($input, $output, $question); } // Confirm removal. $helper = $this->getHelper('question'); $question = new ConfirmationQuestion("Remove the domain <comment>$name</comment> from the environment <info>{$this->app->name}:{$this->environment->name}</info> [y/N]? ", FALSE); if (!$helper->ask($input, $output, $question)) { $output->writeln("<fg=red>Domain not removed.</>"); $output->writeln(''); exit; } // Find and remove the domain from the config. $key = array_search($name, $this->environment->domains); unset($this->environment->domains[$key]); // Save the new version to the config. $this->getApplication()->getTerra()->getConfig()->add('apps', array($this->app->name, 'environments', $this->environment->name), (array) $this->environment); $this->getApplication()->getTerra()->getConfig()->save(); $output->writeln("<info>Domain removed.</info> Changes won't take effect until the environment is restarted."); $output->writeln(''); }
php
protected function executeRemoveDomain(InputInterface $input, OutputInterface $output) { // If no domains are left, exit if (empty($this->environment->domains)) { $output->writeln('<comment>There are no domains assigned to this environment!</comment>'); exit; } // Ask for a domain if ($input->getArgument('domain') == NULL) { $helper = $this->getHelper('question'); $domains = $this->environment->domains; $question = new ChoiceQuestion( 'Which domain would you like to remove? ', $domains, null ); $name = $helper->ask($input, $output, $question); } // Confirm removal. $helper = $this->getHelper('question'); $question = new ConfirmationQuestion("Remove the domain <comment>$name</comment> from the environment <info>{$this->app->name}:{$this->environment->name}</info> [y/N]? ", FALSE); if (!$helper->ask($input, $output, $question)) { $output->writeln("<fg=red>Domain not removed.</>"); $output->writeln(''); exit; } // Find and remove the domain from the config. $key = array_search($name, $this->environment->domains); unset($this->environment->domains[$key]); // Save the new version to the config. $this->getApplication()->getTerra()->getConfig()->add('apps', array($this->app->name, 'environments', $this->environment->name), (array) $this->environment); $this->getApplication()->getTerra()->getConfig()->save(); $output->writeln("<info>Domain removed.</info> Changes won't take effect until the environment is restarted."); $output->writeln(''); }
[ "protected", "function", "executeRemoveDomain", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "// If no domains are left, exit", "if", "(", "empty", "(", "$", "this", "->", "environment", "->", "domains", ")", ")", "{", "$", "output", "->", "writeln", "(", "'<comment>There are no domains assigned to this environment!</comment>'", ")", ";", "exit", ";", "}", "// Ask for a domain", "if", "(", "$", "input", "->", "getArgument", "(", "'domain'", ")", "==", "NULL", ")", "{", "$", "helper", "=", "$", "this", "->", "getHelper", "(", "'question'", ")", ";", "$", "domains", "=", "$", "this", "->", "environment", "->", "domains", ";", "$", "question", "=", "new", "ChoiceQuestion", "(", "'Which domain would you like to remove? '", ",", "$", "domains", ",", "null", ")", ";", "$", "name", "=", "$", "helper", "->", "ask", "(", "$", "input", ",", "$", "output", ",", "$", "question", ")", ";", "}", "// Confirm removal.", "$", "helper", "=", "$", "this", "->", "getHelper", "(", "'question'", ")", ";", "$", "question", "=", "new", "ConfirmationQuestion", "(", "\"Remove the domain <comment>$name</comment> from the environment <info>{$this->app->name}:{$this->environment->name}</info> [y/N]? \"", ",", "FALSE", ")", ";", "if", "(", "!", "$", "helper", "->", "ask", "(", "$", "input", ",", "$", "output", ",", "$", "question", ")", ")", "{", "$", "output", "->", "writeln", "(", "\"<fg=red>Domain not removed.</>\"", ")", ";", "$", "output", "->", "writeln", "(", "''", ")", ";", "exit", ";", "}", "// Find and remove the domain from the config.", "$", "key", "=", "array_search", "(", "$", "name", ",", "$", "this", "->", "environment", "->", "domains", ")", ";", "unset", "(", "$", "this", "->", "environment", "->", "domains", "[", "$", "key", "]", ")", ";", "// Save the new version to the config.", "$", "this", "->", "getApplication", "(", ")", "->", "getTerra", "(", ")", "->", "getConfig", "(", ")", "->", "add", "(", "'apps'", ",", "array", "(", "$", "this", "->", "app", "->", "name", ",", "'environments'", ",", "$", "this", "->", "environment", "->", "name", ")", ",", "(", "array", ")", "$", "this", "->", "environment", ")", ";", "$", "this", "->", "getApplication", "(", ")", "->", "getTerra", "(", ")", "->", "getConfig", "(", ")", "->", "save", "(", ")", ";", "$", "output", "->", "writeln", "(", "\"<info>Domain removed.</info> Changes won't take effect until the environment is restarted.\"", ")", ";", "$", "output", "->", "writeln", "(", "''", ")", ";", "}" ]
Remove a domain. @param InputInterface $input @param OutputInterface $output
[ "Remove", "a", "domain", "." ]
b176cca562534c1d65efbcef6c128f669a2ebed8
https://github.com/terra-ops/terra-cli/blob/b176cca562534c1d65efbcef6c128f669a2ebed8/src/terra/Command/Environment/EnvironmentDomains.php#L150-L189
231,983
i-am-tom/schemer
src/NestableResult.php
NestableResult.isError
public function isError() : bool { if ($this->outer->isError()) { return true; } foreach ($this as $inner) { if ($inner->isError()) { return true; } } return false; }
php
public function isError() : bool { if ($this->outer->isError()) { return true; } foreach ($this as $inner) { if ($inner->isError()) { return true; } } return false; }
[ "public", "function", "isError", "(", ")", ":", "bool", "{", "if", "(", "$", "this", "->", "outer", "->", "isError", "(", ")", ")", "{", "return", "true", ";", "}", "foreach", "(", "$", "this", "as", "$", "inner", ")", "{", "if", "(", "$", "inner", "->", "isError", "(", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Are there any errors within this result? @return boolean
[ "Are", "there", "any", "errors", "within", "this", "result?" ]
aa4ff458eae636ca61ada07d05859e27d3b4584d
https://github.com/i-am-tom/schemer/blob/aa4ff458eae636ca61ada07d05859e27d3b4584d/src/NestableResult.php#L110-L123
231,984
i-am-tom/schemer
src/NestableResult.php
NestableResult.isFatal
public function isFatal() : bool { if ($this->outer->isFatal()) { return true; } foreach ($this as $inner) { if ($inner->isFatal()) { return true; } } return false; }
php
public function isFatal() : bool { if ($this->outer->isFatal()) { return true; } foreach ($this as $inner) { if ($inner->isFatal()) { return true; } } return false; }
[ "public", "function", "isFatal", "(", ")", ":", "bool", "{", "if", "(", "$", "this", "->", "outer", "->", "isFatal", "(", ")", ")", "{", "return", "true", ";", "}", "foreach", "(", "$", "this", "as", "$", "inner", ")", "{", "if", "(", "$", "inner", "->", "isFatal", "(", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Are there any fatals within this result? @return boolean
[ "Are", "there", "any", "fatals", "within", "this", "result?" ]
aa4ff458eae636ca61ada07d05859e27d3b4584d
https://github.com/i-am-tom/schemer/blob/aa4ff458eae636ca61ada07d05859e27d3b4584d/src/NestableResult.php#L129-L142
231,985
praxisnetau/silverware
src/Tools/StringTools.php
StringTools.getContentSummary
public function getContentSummary(DBHTMLText $content, $maxWords = 50, $add = '...') { // Get Plain Text Version: $value = $this->getContentAsPlainText($content); // Bail Early (if empty): if (!$value) { return ''; } // Split on Sentences (do not remove period): $sentences = array_filter(array_map(function ($str) { return trim($str); }, preg_split('@(?<=\.)@', $value))); $wordCount = count(preg_split('#\s+#u', $sentences[0])); // If the First Sentence is Too Long, Show Only the First $maxWords Words: if ($wordCount > $maxWords) { return implode(' ', array_slice(explode(' ', $sentences[0]), 0, $maxWords)) . $add; } // Add Each Sentence (while there are enough words to do so): $result = ''; do { // Add Next Sentence: $result .= ' ' . array_shift($sentences); // If More Sentences, Count Number of Words: if ($sentences) { $wordCount += count(preg_split('#\s+#u', $sentences[0])); } } while ($wordCount < $maxWords && $sentences && trim($sentences[0])); // Answer Result String: return trim($result); }
php
public function getContentSummary(DBHTMLText $content, $maxWords = 50, $add = '...') { // Get Plain Text Version: $value = $this->getContentAsPlainText($content); // Bail Early (if empty): if (!$value) { return ''; } // Split on Sentences (do not remove period): $sentences = array_filter(array_map(function ($str) { return trim($str); }, preg_split('@(?<=\.)@', $value))); $wordCount = count(preg_split('#\s+#u', $sentences[0])); // If the First Sentence is Too Long, Show Only the First $maxWords Words: if ($wordCount > $maxWords) { return implode(' ', array_slice(explode(' ', $sentences[0]), 0, $maxWords)) . $add; } // Add Each Sentence (while there are enough words to do so): $result = ''; do { // Add Next Sentence: $result .= ' ' . array_shift($sentences); // If More Sentences, Count Number of Words: if ($sentences) { $wordCount += count(preg_split('#\s+#u', $sentences[0])); } } while ($wordCount < $maxWords && $sentences && trim($sentences[0])); // Answer Result String: return trim($result); }
[ "public", "function", "getContentSummary", "(", "DBHTMLText", "$", "content", ",", "$", "maxWords", "=", "50", ",", "$", "add", "=", "'...'", ")", "{", "// Get Plain Text Version:", "$", "value", "=", "$", "this", "->", "getContentAsPlainText", "(", "$", "content", ")", ";", "// Bail Early (if empty):", "if", "(", "!", "$", "value", ")", "{", "return", "''", ";", "}", "// Split on Sentences (do not remove period):", "$", "sentences", "=", "array_filter", "(", "array_map", "(", "function", "(", "$", "str", ")", "{", "return", "trim", "(", "$", "str", ")", ";", "}", ",", "preg_split", "(", "'@(?<=\\.)@'", ",", "$", "value", ")", ")", ")", ";", "$", "wordCount", "=", "count", "(", "preg_split", "(", "'#\\s+#u'", ",", "$", "sentences", "[", "0", "]", ")", ")", ";", "// If the First Sentence is Too Long, Show Only the First $maxWords Words:", "if", "(", "$", "wordCount", ">", "$", "maxWords", ")", "{", "return", "implode", "(", "' '", ",", "array_slice", "(", "explode", "(", "' '", ",", "$", "sentences", "[", "0", "]", ")", ",", "0", ",", "$", "maxWords", ")", ")", ".", "$", "add", ";", "}", "// Add Each Sentence (while there are enough words to do so):", "$", "result", "=", "''", ";", "do", "{", "// Add Next Sentence:", "$", "result", ".=", "' '", ".", "array_shift", "(", "$", "sentences", ")", ";", "// If More Sentences, Count Number of Words:", "if", "(", "$", "sentences", ")", "{", "$", "wordCount", "+=", "count", "(", "preg_split", "(", "'#\\s+#u'", ",", "$", "sentences", "[", "0", "]", ")", ")", ";", "}", "}", "while", "(", "$", "wordCount", "<", "$", "maxWords", "&&", "$", "sentences", "&&", "trim", "(", "$", "sentences", "[", "0", "]", ")", ")", ";", "// Answer Result String:", "return", "trim", "(", "$", "result", ")", ";", "}" ]
Answers a summary of the given content field using an improved method of removing tags. @param DBHTMLText $content @param integer $maxWords @param string $add @return string
[ "Answers", "a", "summary", "of", "the", "given", "content", "field", "using", "an", "improved", "method", "of", "removing", "tags", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Tools/StringTools.php#L46-L93
231,986
praxisnetau/silverware
src/Tools/StringTools.php
StringTools.getContentAsPlainText
public function getContentAsPlainText(DBHTMLText $content) { // Preserve Line Breaks: $text = preg_replace('/\<br(\s*)?\/?\>/i', "\n", $content->RAW()); // Convert Paragraph Breaks to Multi-Lines: $text = preg_replace('/\<\/p\>/i', "\n\n", $text); // Remove HTML Tags: $text = $this->removeTags($text); // Implode >3 Consecutive Linebreaks into 2: $text = preg_replace('~(\R){2,}~', "\n\n", $text); // Decode HTML Entities Back to Plain Text: return trim(Convert::xml2raw($text)); }
php
public function getContentAsPlainText(DBHTMLText $content) { // Preserve Line Breaks: $text = preg_replace('/\<br(\s*)?\/?\>/i', "\n", $content->RAW()); // Convert Paragraph Breaks to Multi-Lines: $text = preg_replace('/\<\/p\>/i', "\n\n", $text); // Remove HTML Tags: $text = $this->removeTags($text); // Implode >3 Consecutive Linebreaks into 2: $text = preg_replace('~(\R){2,}~', "\n\n", $text); // Decode HTML Entities Back to Plain Text: return trim(Convert::xml2raw($text)); }
[ "public", "function", "getContentAsPlainText", "(", "DBHTMLText", "$", "content", ")", "{", "// Preserve Line Breaks:", "$", "text", "=", "preg_replace", "(", "'/\\<br(\\s*)?\\/?\\>/i'", ",", "\"\\n\"", ",", "$", "content", "->", "RAW", "(", ")", ")", ";", "// Convert Paragraph Breaks to Multi-Lines:", "$", "text", "=", "preg_replace", "(", "'/\\<\\/p\\>/i'", ",", "\"\\n\\n\"", ",", "$", "text", ")", ";", "// Remove HTML Tags:", "$", "text", "=", "$", "this", "->", "removeTags", "(", "$", "text", ")", ";", "// Implode >3 Consecutive Linebreaks into 2:", "$", "text", "=", "preg_replace", "(", "'~(\\R){2,}~'", ",", "\"\\n\\n\"", ",", "$", "text", ")", ";", "// Decode HTML Entities Back to Plain Text:", "return", "trim", "(", "Convert", "::", "xml2raw", "(", "$", "text", ")", ")", ";", "}" ]
Converts the given content field to a plain text string using an improved method of removing tags. @param DBHTMLText $content @return string
[ "Converts", "the", "given", "content", "field", "to", "a", "plain", "text", "string", "using", "an", "improved", "method", "of", "removing", "tags", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Tools/StringTools.php#L102-L123
231,987
praxisnetau/silverware
src/Tools/StringTools.php
StringTools.removeTags
public function removeTags($string) { // Remove HTML Tags: $string = preg_replace('/<[^>]*>/', ' ', $string); // Remove Control Characters: $string = str_replace("\r", '', $string); // replace with empty space $string = str_replace("\n", ' ', $string); // replace with single space $string = str_replace("\t", ' ', $string); // replace with single space // Remove Multiple Spaces: $string = trim(preg_replace('/ {2,}/', ' ', $string)); // Answer String: return $string; }
php
public function removeTags($string) { // Remove HTML Tags: $string = preg_replace('/<[^>]*>/', ' ', $string); // Remove Control Characters: $string = str_replace("\r", '', $string); // replace with empty space $string = str_replace("\n", ' ', $string); // replace with single space $string = str_replace("\t", ' ', $string); // replace with single space // Remove Multiple Spaces: $string = trim(preg_replace('/ {2,}/', ' ', $string)); // Answer String: return $string; }
[ "public", "function", "removeTags", "(", "$", "string", ")", "{", "// Remove HTML Tags:", "$", "string", "=", "preg_replace", "(", "'/<[^>]*>/'", ",", "' '", ",", "$", "string", ")", ";", "// Remove Control Characters:", "$", "string", "=", "str_replace", "(", "\"\\r\"", ",", "''", ",", "$", "string", ")", ";", "// replace with empty space", "$", "string", "=", "str_replace", "(", "\"\\n\"", ",", "' '", ",", "$", "string", ")", ";", "// replace with single space", "$", "string", "=", "str_replace", "(", "\"\\t\"", ",", "' '", ",", "$", "string", ")", ";", "// replace with single space", "// Remove Multiple Spaces:", "$", "string", "=", "trim", "(", "preg_replace", "(", "'/ {2,}/'", ",", "' '", ",", "$", "string", ")", ")", ";", "// Answer String:", "return", "$", "string", ";", "}" ]
Removes HTML tags from the given string while maintaining whitespace. @param string $string @return string
[ "Removes", "HTML", "tags", "from", "the", "given", "string", "while", "maintaining", "whitespace", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Tools/StringTools.php#L132-L151
231,988
praxisnetau/silverware
src/Model/Slide.php
Slide.getSlideAttributes
public function getSlideAttributes($isFirst = false, $isMiddle = false, $isLast = false) { $attributes = ['class' => $this->getSlideClass($isFirst, $isMiddle, $isLast)]; if ($this->getParent()->hasMethod('getSlideAttributes')) { $attributes = array_merge( $attributes, $this->getParent()->getSlideAttributes( $this, $isFirst, $isMiddle, $isLast ) ); } $this->extend('updateSlideAttributes', $attributes); return $attributes; }
php
public function getSlideAttributes($isFirst = false, $isMiddle = false, $isLast = false) { $attributes = ['class' => $this->getSlideClass($isFirst, $isMiddle, $isLast)]; if ($this->getParent()->hasMethod('getSlideAttributes')) { $attributes = array_merge( $attributes, $this->getParent()->getSlideAttributes( $this, $isFirst, $isMiddle, $isLast ) ); } $this->extend('updateSlideAttributes', $attributes); return $attributes; }
[ "public", "function", "getSlideAttributes", "(", "$", "isFirst", "=", "false", ",", "$", "isMiddle", "=", "false", ",", "$", "isLast", "=", "false", ")", "{", "$", "attributes", "=", "[", "'class'", "=>", "$", "this", "->", "getSlideClass", "(", "$", "isFirst", ",", "$", "isMiddle", ",", "$", "isLast", ")", "]", ";", "if", "(", "$", "this", "->", "getParent", "(", ")", "->", "hasMethod", "(", "'getSlideAttributes'", ")", ")", "{", "$", "attributes", "=", "array_merge", "(", "$", "attributes", ",", "$", "this", "->", "getParent", "(", ")", "->", "getSlideAttributes", "(", "$", "this", ",", "$", "isFirst", ",", "$", "isMiddle", ",", "$", "isLast", ")", ")", ";", "}", "$", "this", "->", "extend", "(", "'updateSlideAttributes'", ",", "$", "attributes", ")", ";", "return", "$", "attributes", ";", "}" ]
Answers an array of HTML tag attributes for the slide. @param boolean $isFirst Slide is first in the list. @param boolean $isMiddle Slide is in the middle of the list. @param boolean $isLast Slide is last in the list. @return array
[ "Answers", "an", "array", "of", "HTML", "tag", "attributes", "for", "the", "slide", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Model/Slide.php#L381-L402
231,989
praxisnetau/silverware
src/Model/Slide.php
Slide.getSlideAttributesHTML
public function getSlideAttributesHTML($isFirst = false, $isMiddle = false, $isLast = false) { return $this->getAttributesHTML($this->getSlideAttributes($isFirst, $isMiddle, $isLast)); }
php
public function getSlideAttributesHTML($isFirst = false, $isMiddle = false, $isLast = false) { return $this->getAttributesHTML($this->getSlideAttributes($isFirst, $isMiddle, $isLast)); }
[ "public", "function", "getSlideAttributesHTML", "(", "$", "isFirst", "=", "false", ",", "$", "isMiddle", "=", "false", ",", "$", "isLast", "=", "false", ")", "{", "return", "$", "this", "->", "getAttributesHTML", "(", "$", "this", "->", "getSlideAttributes", "(", "$", "isFirst", ",", "$", "isMiddle", ",", "$", "isLast", ")", ")", ";", "}" ]
Answers the HTML tag attributes for the slide as a string. @param boolean $isFirst Slide is first in the list. @param boolean $isMiddle Slide is in the middle of the list. @param boolean $isLast Slide is last in the list. @return string
[ "Answers", "the", "HTML", "tag", "attributes", "for", "the", "slide", "as", "a", "string", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Model/Slide.php#L413-L416
231,990
praxisnetau/silverware
src/Model/Slide.php
Slide.getSlideClass
public function getSlideClass($isFirst = false, $isMiddle = false, $isLast = false) { return ViewTools::singleton()->array2att($this->getSlideClassNames($isFirst, $isMiddle, $isLast)); }
php
public function getSlideClass($isFirst = false, $isMiddle = false, $isLast = false) { return ViewTools::singleton()->array2att($this->getSlideClassNames($isFirst, $isMiddle, $isLast)); }
[ "public", "function", "getSlideClass", "(", "$", "isFirst", "=", "false", ",", "$", "isMiddle", "=", "false", ",", "$", "isLast", "=", "false", ")", "{", "return", "ViewTools", "::", "singleton", "(", ")", "->", "array2att", "(", "$", "this", "->", "getSlideClassNames", "(", "$", "isFirst", ",", "$", "isMiddle", ",", "$", "isLast", ")", ")", ";", "}" ]
Answers a string of slide class names for the HTML template. @param boolean $isFirst Slide is first in the list. @param boolean $isMiddle Slide is in the middle of the list. @param boolean $isLast Slide is last in the list. @return string
[ "Answers", "a", "string", "of", "slide", "class", "names", "for", "the", "HTML", "template", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Model/Slide.php#L427-L430
231,991
praxisnetau/silverware
src/Model/Slide.php
Slide.getImageClassNames
public function getImageClassNames() { $classes = ['slide-image']; if ($this->getParent()->hasMethod('getImageClassNames')) { $classes = array_merge($classes, $this->getParent()->getImageClassNames($this)); } $this->extend('updateImageClassNames', $classes); return $classes; }
php
public function getImageClassNames() { $classes = ['slide-image']; if ($this->getParent()->hasMethod('getImageClassNames')) { $classes = array_merge($classes, $this->getParent()->getImageClassNames($this)); } $this->extend('updateImageClassNames', $classes); return $classes; }
[ "public", "function", "getImageClassNames", "(", ")", "{", "$", "classes", "=", "[", "'slide-image'", "]", ";", "if", "(", "$", "this", "->", "getParent", "(", ")", "->", "hasMethod", "(", "'getImageClassNames'", ")", ")", "{", "$", "classes", "=", "array_merge", "(", "$", "classes", ",", "$", "this", "->", "getParent", "(", ")", "->", "getImageClassNames", "(", "$", "this", ")", ")", ";", "}", "$", "this", "->", "extend", "(", "'updateImageClassNames'", ",", "$", "classes", ")", ";", "return", "$", "classes", ";", "}" ]
Answers an array of image class names for the HTML template. @return array
[ "Answers", "an", "array", "of", "image", "class", "names", "for", "the", "HTML", "template", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Model/Slide.php#L471-L482
231,992
praxisnetau/silverware
src/Model/Slide.php
Slide.getSlideImage
public function getSlideImage() { if ($this->hasImage()) { if ($this->Image()->exists()) { return $this->Image(); } elseif ($this->LinkPage()->hasMetaImage()) { return $this->LinkPage()->getMetaImage(); } } }
php
public function getSlideImage() { if ($this->hasImage()) { if ($this->Image()->exists()) { return $this->Image(); } elseif ($this->LinkPage()->hasMetaImage()) { return $this->LinkPage()->getMetaImage(); } } }
[ "public", "function", "getSlideImage", "(", ")", "{", "if", "(", "$", "this", "->", "hasImage", "(", ")", ")", "{", "if", "(", "$", "this", "->", "Image", "(", ")", "->", "exists", "(", ")", ")", "{", "return", "$", "this", "->", "Image", "(", ")", ";", "}", "elseif", "(", "$", "this", "->", "LinkPage", "(", ")", "->", "hasMetaImage", "(", ")", ")", "{", "return", "$", "this", "->", "LinkPage", "(", ")", "->", "getMetaImage", "(", ")", ";", "}", "}", "}" ]
Answers the image for the slide. @return Image
[ "Answers", "the", "image", "for", "the", "slide", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Model/Slide.php#L577-L588
231,993
praxisnetau/silverware
src/Model/Slide.php
Slide.getImageResized
public function getImageResized($width = null, $height = null, $method = null) { if ($this->hasImage()) { $image = $this->getSlideImage(); if ($width || $height || $method) { return ImageTools::singleton()->resize($image, $width, $height, $method); } if ($this->getParent()->hasMethod('performImageResize')) { return $this->getParent()->performImageResize($image); } return $image; } }
php
public function getImageResized($width = null, $height = null, $method = null) { if ($this->hasImage()) { $image = $this->getSlideImage(); if ($width || $height || $method) { return ImageTools::singleton()->resize($image, $width, $height, $method); } if ($this->getParent()->hasMethod('performImageResize')) { return $this->getParent()->performImageResize($image); } return $image; } }
[ "public", "function", "getImageResized", "(", "$", "width", "=", "null", ",", "$", "height", "=", "null", ",", "$", "method", "=", "null", ")", "{", "if", "(", "$", "this", "->", "hasImage", "(", ")", ")", "{", "$", "image", "=", "$", "this", "->", "getSlideImage", "(", ")", ";", "if", "(", "$", "width", "||", "$", "height", "||", "$", "method", ")", "{", "return", "ImageTools", "::", "singleton", "(", ")", "->", "resize", "(", "$", "image", ",", "$", "width", ",", "$", "height", ",", "$", "method", ")", ";", "}", "if", "(", "$", "this", "->", "getParent", "(", ")", "->", "hasMethod", "(", "'performImageResize'", ")", ")", "{", "return", "$", "this", "->", "getParent", "(", ")", "->", "performImageResize", "(", "$", "image", ")", ";", "}", "return", "$", "image", ";", "}", "}" ]
Answers a resized image using the dimensions and resize method from the parent object. @param integer $width @param integer $height @param string $method @return Image
[ "Answers", "a", "resized", "image", "using", "the", "dimensions", "and", "resize", "method", "from", "the", "parent", "object", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Model/Slide.php#L599-L616
231,994
praxisnetau/silverware
src/Model/Slide.php
Slide.getLinkClassNames
public function getLinkClassNames() { if ($this->isButtonLink() || !$this->LinkInFooter) { return []; } $classes = [ $this->style('button'), $this->ButtonTypeClass ]; if ($this->ButtonExtraClass) { $classes[] = $this->ButtonExtraClass; } return $classes; }
php
public function getLinkClassNames() { if ($this->isButtonLink() || !$this->LinkInFooter) { return []; } $classes = [ $this->style('button'), $this->ButtonTypeClass ]; if ($this->ButtonExtraClass) { $classes[] = $this->ButtonExtraClass; } return $classes; }
[ "public", "function", "getLinkClassNames", "(", ")", "{", "if", "(", "$", "this", "->", "isButtonLink", "(", ")", "||", "!", "$", "this", "->", "LinkInFooter", ")", "{", "return", "[", "]", ";", "}", "$", "classes", "=", "[", "$", "this", "->", "style", "(", "'button'", ")", ",", "$", "this", "->", "ButtonTypeClass", "]", ";", "if", "(", "$", "this", "->", "ButtonExtraClass", ")", "{", "$", "classes", "[", "]", "=", "$", "this", "->", "ButtonExtraClass", ";", "}", "return", "$", "classes", ";", "}" ]
Answers an array of link class names for the template. @return array
[ "Answers", "an", "array", "of", "link", "class", "names", "for", "the", "template", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Model/Slide.php#L673-L689
231,995
praxisnetau/silverware
src/Model/Slide.php
Slide.renderSlide
public function renderSlide($isFirst = false, $isMiddle = false, $isLast = false) { return $this->customise([ 'isFirst' => $isFirst, 'isMiddle' => $isMiddle, 'isLast' => $isLast ])->renderWith($this->getTemplate()); }
php
public function renderSlide($isFirst = false, $isMiddle = false, $isLast = false) { return $this->customise([ 'isFirst' => $isFirst, 'isMiddle' => $isMiddle, 'isLast' => $isLast ])->renderWith($this->getTemplate()); }
[ "public", "function", "renderSlide", "(", "$", "isFirst", "=", "false", ",", "$", "isMiddle", "=", "false", ",", "$", "isLast", "=", "false", ")", "{", "return", "$", "this", "->", "customise", "(", "[", "'isFirst'", "=>", "$", "isFirst", ",", "'isMiddle'", "=>", "$", "isMiddle", ",", "'isLast'", "=>", "$", "isLast", "]", ")", "->", "renderWith", "(", "$", "this", "->", "getTemplate", "(", ")", ")", ";", "}" ]
Renders the object as a slide for the HTML template. @param boolean $isFirst Slide is first in the list. @param boolean $isMiddle Slide is in the middle of the list. @param boolean $isLast Slide is last in the list. @return DBHTMLText
[ "Renders", "the", "object", "as", "a", "slide", "for", "the", "HTML", "template", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Model/Slide.php#L760-L767
231,996
praxisnetau/silverware
src/Forms/HasOneField.php
HasOneField.getDataDefault
public function getDataDefault($name) { return isset($this->dataDefaults[$name]) ? $this->dataDefaults[$name] : null; }
php
public function getDataDefault($name) { return isset($this->dataDefaults[$name]) ? $this->dataDefaults[$name] : null; }
[ "public", "function", "getDataDefault", "(", "$", "name", ")", "{", "return", "isset", "(", "$", "this", "->", "dataDefaults", "[", "$", "name", "]", ")", "?", "$", "this", "->", "dataDefaults", "[", "$", "name", "]", ":", "null", ";", "}" ]
Answers the value of an individual data default. @param string $name @return mixed
[ "Answers", "the", "value", "of", "an", "individual", "data", "default", "." ]
2fa731c7f0737b350e0cbc676e93ac5beb430792
https://github.com/praxisnetau/silverware/blob/2fa731c7f0737b350e0cbc676e93ac5beb430792/src/Forms/HasOneField.php#L165-L168
231,997
terra-ops/terra-cli
src/terra/Command/Command.php
Command.initialize
protected function initialize(InputInterface $input, OutputInterface $output) { // Determine app and environment from path. $cwd = getcwd(); $config = $this->getApplication()->getTerra()->getConfig(); foreach ($config->get('apps') as $app) { if (!isset($app['environments'])) { $app['environments'] = array(); } foreach ($app['environments'] as $environment) { if (strpos($cwd, $environment['path']) === 0) { if ($input->hasArgument('app_name')) { $input->setArgument('app_name', $app['name']); } if ($input->hasArgument('environment_name')) { $input->setArgument('environment_name', $environment['name']); } $environment_string = $app['name'] . ':' . $environment['name']; $output->writeln("Using environment <question>$environment_string</question>"); } } } }
php
protected function initialize(InputInterface $input, OutputInterface $output) { // Determine app and environment from path. $cwd = getcwd(); $config = $this->getApplication()->getTerra()->getConfig(); foreach ($config->get('apps') as $app) { if (!isset($app['environments'])) { $app['environments'] = array(); } foreach ($app['environments'] as $environment) { if (strpos($cwd, $environment['path']) === 0) { if ($input->hasArgument('app_name')) { $input->setArgument('app_name', $app['name']); } if ($input->hasArgument('environment_name')) { $input->setArgument('environment_name', $environment['name']); } $environment_string = $app['name'] . ':' . $environment['name']; $output->writeln("Using environment <question>$environment_string</question>"); } } } }
[ "protected", "function", "initialize", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "// Determine app and environment from path.", "$", "cwd", "=", "getcwd", "(", ")", ";", "$", "config", "=", "$", "this", "->", "getApplication", "(", ")", "->", "getTerra", "(", ")", "->", "getConfig", "(", ")", ";", "foreach", "(", "$", "config", "->", "get", "(", "'apps'", ")", "as", "$", "app", ")", "{", "if", "(", "!", "isset", "(", "$", "app", "[", "'environments'", "]", ")", ")", "{", "$", "app", "[", "'environments'", "]", "=", "array", "(", ")", ";", "}", "foreach", "(", "$", "app", "[", "'environments'", "]", "as", "$", "environment", ")", "{", "if", "(", "strpos", "(", "$", "cwd", ",", "$", "environment", "[", "'path'", "]", ")", "===", "0", ")", "{", "if", "(", "$", "input", "->", "hasArgument", "(", "'app_name'", ")", ")", "{", "$", "input", "->", "setArgument", "(", "'app_name'", ",", "$", "app", "[", "'name'", "]", ")", ";", "}", "if", "(", "$", "input", "->", "hasArgument", "(", "'environment_name'", ")", ")", "{", "$", "input", "->", "setArgument", "(", "'environment_name'", ",", "$", "environment", "[", "'name'", "]", ")", ";", "}", "$", "environment_string", "=", "$", "app", "[", "'name'", "]", ".", "':'", ".", "$", "environment", "[", "'name'", "]", ";", "$", "output", "->", "writeln", "(", "\"Using environment <question>$environment_string</question>\"", ")", ";", "}", "}", "}", "}" ]
Detect app and environment from current path. @param InputInterface $input An InputInterface instance @param OutputInterface $output An OutputInterface instance
[ "Detect", "app", "and", "environment", "from", "current", "path", "." ]
b176cca562534c1d65efbcef6c128f669a2ebed8
https://github.com/terra-ops/terra-cli/blob/b176cca562534c1d65efbcef6c128f669a2ebed8/src/terra/Command/Command.php#L28-L55
231,998
terra-ops/terra-cli
src/terra/Command/Command.php
Command.getAnswer
public function getAnswer(InputInterface $input, OutputInterface $output, Question $question, $argument_name, $type = 'argument', $required = FALSE) { $helper = $this->getHelper('question'); if ($type == 'argument') { $value = $input->getArgument($argument_name); } elseif ($type == 'option') { $value = $input->getOption($argument_name); } if (empty($value)) { // If we are in non-interactive mode, we have no choice but to return nothing. if ($input->getOption('yes')) { return ''; } if ($required) { while (empty($value)) { $value = $helper->ask($input, $output, $question); } } else { $value = $helper->ask($input, $output, $question); } } return $value; }
php
public function getAnswer(InputInterface $input, OutputInterface $output, Question $question, $argument_name, $type = 'argument', $required = FALSE) { $helper = $this->getHelper('question'); if ($type == 'argument') { $value = $input->getArgument($argument_name); } elseif ($type == 'option') { $value = $input->getOption($argument_name); } if (empty($value)) { // If we are in non-interactive mode, we have no choice but to return nothing. if ($input->getOption('yes')) { return ''; } if ($required) { while (empty($value)) { $value = $helper->ask($input, $output, $question); } } else { $value = $helper->ask($input, $output, $question); } } return $value; }
[ "public", "function", "getAnswer", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ",", "Question", "$", "question", ",", "$", "argument_name", ",", "$", "type", "=", "'argument'", ",", "$", "required", "=", "FALSE", ")", "{", "$", "helper", "=", "$", "this", "->", "getHelper", "(", "'question'", ")", ";", "if", "(", "$", "type", "==", "'argument'", ")", "{", "$", "value", "=", "$", "input", "->", "getArgument", "(", "$", "argument_name", ")", ";", "}", "elseif", "(", "$", "type", "==", "'option'", ")", "{", "$", "value", "=", "$", "input", "->", "getOption", "(", "$", "argument_name", ")", ";", "}", "if", "(", "empty", "(", "$", "value", ")", ")", "{", "// If we are in non-interactive mode, we have no choice but to return nothing.", "if", "(", "$", "input", "->", "getOption", "(", "'yes'", ")", ")", "{", "return", "''", ";", "}", "if", "(", "$", "required", ")", "{", "while", "(", "empty", "(", "$", "value", ")", ")", "{", "$", "value", "=", "$", "helper", "->", "ask", "(", "$", "input", ",", "$", "output", ",", "$", "question", ")", ";", "}", "}", "else", "{", "$", "value", "=", "$", "helper", "->", "ask", "(", "$", "input", ",", "$", "output", ",", "$", "question", ")", ";", "}", "}", "return", "$", "value", ";", "}" ]
Helper to ask a question only if a default argument is not present. @param InputInterface $input @param OutputInterface $output @param Question $question A Question object @param $argument_name Name of the argument or option to default to. @param string $type Either "argument" (default) or "option" @return mixed The value derived from either the argument/option or the value.
[ "Helper", "to", "ask", "a", "question", "only", "if", "a", "default", "argument", "is", "not", "present", "." ]
b176cca562534c1d65efbcef6c128f669a2ebed8
https://github.com/terra-ops/terra-cli/blob/b176cca562534c1d65efbcef6c128f669a2ebed8/src/terra/Command/Command.php#L72-L99
231,999
ejsmont-artur/php-circuit-breaker-bundle
Factory.php
Factory.getDoctrineCacheInstance
public static function getDoctrineCacheInstance(Cache $doctrineCache, $maxFailures = 20, $retryTimeout = 30) { $storage = new ArrayDecorator(new DoctrineCacheAdapter($doctrineCache)); return new CircuitBreaker($storage, $maxFailures, $retryTimeout); }
php
public static function getDoctrineCacheInstance(Cache $doctrineCache, $maxFailures = 20, $retryTimeout = 30) { $storage = new ArrayDecorator(new DoctrineCacheAdapter($doctrineCache)); return new CircuitBreaker($storage, $maxFailures, $retryTimeout); }
[ "public", "static", "function", "getDoctrineCacheInstance", "(", "Cache", "$", "doctrineCache", ",", "$", "maxFailures", "=", "20", ",", "$", "retryTimeout", "=", "30", ")", "{", "$", "storage", "=", "new", "ArrayDecorator", "(", "new", "DoctrineCacheAdapter", "(", "$", "doctrineCache", ")", ")", ";", "return", "new", "CircuitBreaker", "(", "$", "storage", ",", "$", "maxFailures", ",", "$", "retryTimeout", ")", ";", "}" ]
Creates a circuit breaker instance using doctrine cache adapter. @param Cache $doctrineCache instance of a doctrine cache backend to use @param int $maxFailures how many times do we allow service to fail before considering it offline @param int $retryTimeout how many seconds should we wait before attempting retry @return CircuitBreakerInterface
[ "Creates", "a", "circuit", "breaker", "instance", "using", "doctrine", "cache", "adapter", "." ]
3327b0fff0c5f87154376eb3b0d8984358a3e033
https://github.com/ejsmont-artur/php-circuit-breaker-bundle/blob/3327b0fff0c5f87154376eb3b0d8984358a3e033/Factory.php#L24-L27