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
30,800
BKWLD/decoy
classes/Models/Base.php
Base.makeDeleteAction
protected function makeDeleteAction($data) { extract($data); // Check if this model can be deleted. This mirrors code found in the table // partial for generating the edit link on the title if (!(app('decoy.user')->can('destroy', $controller) || ($many_to_many && app('...
php
protected function makeDeleteAction($data) { extract($data); // Check if this model can be deleted. This mirrors code found in the table // partial for generating the edit link on the title if (!(app('decoy.user')->can('destroy', $controller) || ($many_to_many && app('...
[ "protected", "function", "makeDeleteAction", "(", "$", "data", ")", "{", "extract", "(", "$", "data", ")", ";", "// Check if this model can be deleted. This mirrors code found in the table", "// partial for generating the edit link on the title", "if", "(", "!", "(", "app",...
Make the delete action @param array $data The data passed to a listing view @return string
[ "Make", "the", "delete", "action" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Base.php#L525-L556
30,801
BKWLD/decoy
classes/Models/Base.php
Base.scopePositioned
public function scopePositioned($query) { $query->orderBy($this->getTable().'.position', 'asc'); if ($this->usesTimestamps()) { $query->orderBy($this->getTable().'.created_at', 'desc'); } return $query; }
php
public function scopePositioned($query) { $query->orderBy($this->getTable().'.position', 'asc'); if ($this->usesTimestamps()) { $query->orderBy($this->getTable().'.created_at', 'desc'); } return $query; }
[ "public", "function", "scopePositioned", "(", "$", "query", ")", "{", "$", "query", "->", "orderBy", "(", "$", "this", "->", "getTable", "(", ")", ".", "'.position'", ",", "'asc'", ")", ";", "if", "(", "$", "this", "->", "usesTimestamps", "(", ")", "...
Order a table that has a position value @param Illuminate\Database\Query\Builder $query @return Illuminate\Database\Query\Builder
[ "Order", "a", "table", "that", "has", "a", "position", "value" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Base.php#L666-L673
30,802
BKWLD/decoy
classes/Models/Base.php
Base.scopeRandomize
public function scopeRandomize($query, $seed = false) { if ($seed === true) { $seed = Session::getId(); } if ($seed) { return $query->orderBy(DB::raw('RAND("'.$seed.'")')); } return $query->orderBy(DB::raw('RAND()')); }
php
public function scopeRandomize($query, $seed = false) { if ($seed === true) { $seed = Session::getId(); } if ($seed) { return $query->orderBy(DB::raw('RAND("'.$seed.'")')); } return $query->orderBy(DB::raw('RAND()')); }
[ "public", "function", "scopeRandomize", "(", "$", "query", ",", "$", "seed", "=", "false", ")", "{", "if", "(", "$", "seed", "===", "true", ")", "{", "$", "seed", "=", "Session", "::", "getId", "(", ")", ";", "}", "if", "(", "$", "seed", ")", "...
Randomize the results in the DB. This shouldn't be used for large datasets cause it's not very performant @param Illuminate\Database\Query\Builder $query @param mixed $seed Providing a seed keeps the order the same on subsequent queries @return Illuminate\Database\Query\Builder
[ "Randomize", "the", "results", "in", "the", "DB", ".", "This", "shouldn", "t", "be", "used", "for", "large", "datasets", "cause", "it", "s", "not", "very", "performant" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Base.php#L694-L705
30,803
BKWLD/decoy
classes/Models/Base.php
Base.scopeOtherLocalizations
public function scopeOtherLocalizations($query) { return $query->where('locale_group', $this->locale_group) ->where($this->getKeyName(), '!=', $this->getKey()); }
php
public function scopeOtherLocalizations($query) { return $query->where('locale_group', $this->locale_group) ->where($this->getKeyName(), '!=', $this->getKey()); }
[ "public", "function", "scopeOtherLocalizations", "(", "$", "query", ")", "{", "return", "$", "query", "->", "where", "(", "'locale_group'", ",", "$", "this", "->", "locale_group", ")", "->", "where", "(", "$", "this", "->", "getKeyName", "(", ")", ",", "...
Get localized siblings of this model @param Illuminate\Database\Query\Builder $query @return Illuminate\Database\Query\Builder
[ "Get", "localized", "siblings", "of", "this", "model" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Base.php#L725-L729
30,804
BKWLD/decoy
classes/Models/Base.php
Base.findBySlugOrFail
public static function findBySlugOrFail($slug, array $columns = ['*']) { // Model not found, throw exception if (!$item = static::findBySlug($slug)) { throw (new ModelNotFoundException)->setModel(get_called_class()); } // Return the model if visible $item->enforc...
php
public static function findBySlugOrFail($slug, array $columns = ['*']) { // Model not found, throw exception if (!$item = static::findBySlug($slug)) { throw (new ModelNotFoundException)->setModel(get_called_class()); } // Return the model if visible $item->enforc...
[ "public", "static", "function", "findBySlugOrFail", "(", "$", "slug", ",", "array", "$", "columns", "=", "[", "'*'", "]", ")", "{", "// Model not found, throw exception", "if", "(", "!", "$", "item", "=", "static", "::", "findBySlug", "(", "$", "slug", ")"...
Find by the slug and fail if missing. Invokes methods from the Sluggable trait. @param string $string @param array $columns @return Illuminate\Database\Eloquent\Model @throws Illuminate\Database\Eloquent\ModelNotFoundException
[ "Find", "by", "the", "slug", "and", "fail", "if", "missing", ".", "Invokes", "methods", "from", "the", "Sluggable", "trait", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Base.php#L741-L752
30,805
BKWLD/decoy
classes/Models/Base.php
Base.fireDecoyEvent
public function fireDecoyEvent($event, $args = null) { $event = "decoy::model.{$event}: ".get_class($this); return Event::fire($event, $args); }
php
public function fireDecoyEvent($event, $args = null) { $event = "decoy::model.{$event}: ".get_class($this); return Event::fire($event, $args); }
[ "public", "function", "fireDecoyEvent", "(", "$", "event", ",", "$", "args", "=", "null", ")", "{", "$", "event", "=", "\"decoy::model.{$event}: \"", ".", "get_class", "(", "$", "this", ")", ";", "return", "Event", "::", "fire", "(", "$", "event", ",", ...
Fire an Decoy model event. @param $string event The name of this event @param $array args An array of params that will be passed to the handler @return object
[ "Fire", "an", "Decoy", "model", "event", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Base.php#L779-L784
30,806
BKWLD/decoy
classes/Models/Base.php
Base.titleAttributes
public function titleAttributes() { // Convert to an array so I can test for the presence of values. As an // object, it would throw exceptions $row = $this->getAttributes(); // Name before title to cover the case of people with job titles if (isset($row['name'])) { ...
php
public function titleAttributes() { // Convert to an array so I can test for the presence of values. As an // object, it would throw exceptions $row = $this->getAttributes(); // Name before title to cover the case of people with job titles if (isset($row['name'])) { ...
[ "public", "function", "titleAttributes", "(", ")", "{", "// Convert to an array so I can test for the presence of values. As an", "// object, it would throw exceptions", "$", "row", "=", "$", "this", "->", "getAttributes", "(", ")", ";", "// Name before title to cover the case of...
Deduce the source for the title of the model @return array
[ "Deduce", "the", "source", "for", "the", "title", "of", "the", "model" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Base.php#L791-L814
30,807
BKWLD/decoy
classes/Input/Sidebar.php
Sidebar.render
public function render() { // Massage the response from base controller subclassings of sidebar $items = array_map(function ($item) { // If a listing instance, apply defaults common to all sidebar instances if (is_a($item, 'Bkwld\Decoy\Fields\Listing')) { ret...
php
public function render() { // Massage the response from base controller subclassings of sidebar $items = array_map(function ($item) { // If a listing instance, apply defaults common to all sidebar instances if (is_a($item, 'Bkwld\Decoy\Fields\Listing')) { ret...
[ "public", "function", "render", "(", ")", "{", "// Massage the response from base controller subclassings of sidebar", "$", "items", "=", "array_map", "(", "function", "(", "$", "item", ")", "{", "// If a listing instance, apply defaults common to all sidebar instances", "if", ...
Render an array of listing objects to an HTML string @return string HTML
[ "Render", "an", "array", "of", "listing", "objects", "to", "an", "HTML", "string" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/Sidebar.php#L85-L103
30,808
BKWLD/decoy
classes/Fields/Former/MethodDispatcher.php
MethodDispatcher.getClassFromMethod
protected function getClassFromMethod($method) { // Look for a studly class $class = Str::singular(Str::studly($method)); foreach ($this->repositories as $repository) { if (class_exists($repository.$class)) { return $repository.$class; } } ...
php
protected function getClassFromMethod($method) { // Look for a studly class $class = Str::singular(Str::studly($method)); foreach ($this->repositories as $repository) { if (class_exists($repository.$class)) { return $repository.$class; } } ...
[ "protected", "function", "getClassFromMethod", "(", "$", "method", ")", "{", "// Look for a studly class", "$", "class", "=", "Str", "::", "singular", "(", "Str", "::", "studly", "(", "$", "method", ")", ")", ";", "foreach", "(", "$", "this", "->", "reposi...
Override the parent so that study class names are respected on case sensitive file systems. @param string $method The field created @return string The correct class
[ "Override", "the", "parent", "so", "that", "study", "class", "names", "are", "respected", "on", "case", "sensitive", "file", "systems", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Fields/Former/MethodDispatcher.php#L20-L33
30,809
BKWLD/decoy
classes/Fields/Datetime.php
Datetime.value
public function value($value) { // Set the value using parent, so that if there is already one specified // from populate or POST parent::value($value); // Set the value of the subfields $this->date->value($value); $this->time->value($value); // Chainable ...
php
public function value($value) { // Set the value using parent, so that if there is already one specified // from populate or POST parent::value($value); // Set the value of the subfields $this->date->value($value); $this->time->value($value); // Chainable ...
[ "public", "function", "value", "(", "$", "value", ")", "{", "// Set the value using parent, so that if there is already one specified", "// from populate or POST", "parent", "::", "value", "(", "$", "value", ")", ";", "// Set the value of the subfields", "$", "this", "->", ...
Massage inputted string values into dates @param string $value A new value @return $this
[ "Massage", "inputted", "string", "values", "into", "dates" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Fields/Datetime.php#L67-L79
30,810
BKWLD/decoy
classes/Models/Traits/Encodable.php
Encodable.encoding
public function encoding($attribute = 'video') { $encodings = $this->encodings; if (!is_a($encodings, Collection::class)) { $encodings = Encoding::hydrate($encodings); } return $encodings->first(function ($i, $encoding) use ($attribute) { return data_get($enc...
php
public function encoding($attribute = 'video') { $encodings = $this->encodings; if (!is_a($encodings, Collection::class)) { $encodings = Encoding::hydrate($encodings); } return $encodings->first(function ($i, $encoding) use ($attribute) { return data_get($enc...
[ "public", "function", "encoding", "(", "$", "attribute", "=", "'video'", ")", "{", "$", "encodings", "=", "$", "this", "->", "encodings", ";", "if", "(", "!", "is_a", "(", "$", "encodings", ",", "Collection", "::", "class", ")", ")", "{", "$", "encod...
Find the encoding for a given database field @param string $attribute @return Encoding|false
[ "Find", "the", "encoding", "for", "a", "given", "database", "field" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Traits/Encodable.php#L52-L62
30,811
BKWLD/decoy
classes/Models/Traits/Encodable.php
Encodable.getDirtyEncodableAttributes
public function getDirtyEncodableAttributes() { if (empty($this->encodable_attributes)) { return []; } return array_filter($this->encodable_attributes, function ($attribute) { // The file has changed if ($this->isDirty($attribute)) { retu...
php
public function getDirtyEncodableAttributes() { if (empty($this->encodable_attributes)) { return []; } return array_filter($this->encodable_attributes, function ($attribute) { // The file has changed if ($this->isDirty($attribute)) { retu...
[ "public", "function", "getDirtyEncodableAttributes", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "encodable_attributes", ")", ")", "{", "return", "[", "]", ";", "}", "return", "array_filter", "(", "$", "this", "->", "encodable_attributes", ","...
Get all the attributes on a model who support video encodes and are dirty. An encode is considered dirty if a file is uploaded, replaced, marked for deletion OR if it's preset has changed. @return array
[ "Get", "all", "the", "attributes", "on", "a", "model", "who", "support", "video", "encodes", "and", "are", "dirty", ".", "An", "encode", "is", "considered", "dirty", "if", "a", "file", "is", "uploaded", "replaced", "marked", "for", "deletion", "OR", "if", ...
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Traits/Encodable.php#L71-L87
30,812
BKWLD/decoy
classes/Models/Traits/Encodable.php
Encodable.hasDirtyPreset
public function hasDirtyPreset($attribute) { // Require a previous encoding instance return ($encoding = $this->encoding($attribute)) // Make sure the input actually contains a preset. It won't in cases like // the AJAX PUT during listing drag and drop sorting or visibilit...
php
public function hasDirtyPreset($attribute) { // Require a previous encoding instance return ($encoding = $this->encoding($attribute)) // Make sure the input actually contains a preset. It won't in cases like // the AJAX PUT during listing drag and drop sorting or visibilit...
[ "public", "function", "hasDirtyPreset", "(", "$", "attribute", ")", "{", "// Require a previous encoding instance", "return", "(", "$", "encoding", "=", "$", "this", "->", "encoding", "(", "$", "attribute", ")", ")", "// Make sure the input actually contains a preset. ...
Check if the preset choice is dirty @param string $attribute @return boolean
[ "Check", "if", "the", "preset", "choice", "is", "dirty" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Traits/Encodable.php#L95-L108
30,813
BKWLD/decoy
classes/Models/Traits/Encodable.php
Encodable.adminColEncodeStatus
public function adminColEncodeStatus() { if (!$encode = $this->encoding()) { return '<span class="label">Pending</span>'; } switch ($encode->status) { case 'pending': return '<span class="label">'.ucfirst($encode->status).'</span>'; case '...
php
public function adminColEncodeStatus() { if (!$encode = $this->encoding()) { return '<span class="label">Pending</span>'; } switch ($encode->status) { case 'pending': return '<span class="label">'.ucfirst($encode->status).'</span>'; case '...
[ "public", "function", "adminColEncodeStatus", "(", ")", "{", "if", "(", "!", "$", "encode", "=", "$", "this", "->", "encoding", "(", ")", ")", "{", "return", "'<span class=\"label\">Pending</span>'", ";", "}", "switch", "(", "$", "encode", "->", "status", ...
A utitliy function to create status badges for Decoy listings @return string HTML
[ "A", "utitliy", "function", "to", "create", "status", "badges", "for", "Decoy", "listings" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Traits/Encodable.php#L140-L160
30,814
BKWLD/decoy
classes/Models/Traits/Encodable.php
Encodable.encode
public function encode($attribute, $preset) { $encoding = new Encoding([ 'encodable_attribute' => $attribute, 'preset' => $preset, ]); $this->encodings()->save($encoding); return $encoding; }
php
public function encode($attribute, $preset) { $encoding = new Encoding([ 'encodable_attribute' => $attribute, 'preset' => $preset, ]); $this->encodings()->save($encoding); return $encoding; }
[ "public", "function", "encode", "(", "$", "attribute", ",", "$", "preset", ")", "{", "$", "encoding", "=", "new", "Encoding", "(", "[", "'encodable_attribute'", "=>", "$", "attribute", ",", "'preset'", "=>", "$", "preset", ",", "]", ")", ";", "$", "thi...
Delete any existing encoding for the attribute and then encode from the source. The deleting happens automatically onCreating. @param string $attribute The attribute on the model to use as source @param string $preset The output config key @return Encoding The new output instance
[ "Delete", "any", "existing", "encoding", "for", "the", "attribute", "and", "then", "encode", "from", "the", "source", ".", "The", "deleting", "happens", "automatically", "onCreating", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Traits/Encodable.php#L208-L218
30,815
BKWLD/decoy
classes/Fields/BelongsTo.php
BelongsTo.wrapAndRender
public function wrapAndRender() { // Apend the edit button $this->appendEditButton(); // Add control group attributes $this->addGroupClass('belongs-to'); $this->group->setAttribute('data-js-view', 'belongs-to'); if ($this->route) { $this->group->setAttrib...
php
public function wrapAndRender() { // Apend the edit button $this->appendEditButton(); // Add control group attributes $this->addGroupClass('belongs-to'); $this->group->setAttribute('data-js-view', 'belongs-to'); if ($this->route) { $this->group->setAttrib...
[ "public", "function", "wrapAndRender", "(", ")", "{", "// Apend the edit button", "$", "this", "->", "appendEditButton", "(", ")", ";", "// Add control group attributes", "$", "this", "->", "addGroupClass", "(", "'belongs-to'", ")", ";", "$", "this", "->", "group"...
Prints out the field, wrapped in its group. This is the opportunity to tack additional stuff onto the control group @return string
[ "Prints", "out", "the", "field", "wrapped", "in", "its", "group", ".", "This", "is", "the", "opportunity", "to", "tack", "additional", "stuff", "onto", "the", "control", "group" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Fields/BelongsTo.php#L128-L142
30,816
BKWLD/decoy
classes/Fields/BelongsTo.php
BelongsTo.parentModel
public function parentModel() { if ($this->value && ($relation = $this->guessRelation()) && ($model = $this->getModel()) && method_exists($model, $relation)) { return $model->$relation; } }
php
public function parentModel() { if ($this->value && ($relation = $this->guessRelation()) && ($model = $this->getModel()) && method_exists($model, $relation)) { return $model->$relation; } }
[ "public", "function", "parentModel", "(", ")", "{", "if", "(", "$", "this", "->", "value", "&&", "(", "$", "relation", "=", "$", "this", "->", "guessRelation", "(", ")", ")", "&&", "(", "$", "model", "=", "$", "this", "->", "getModel", "(", ")", ...
Get the parent record of the form instance @return Illuminate\Database\Eloquent\Model
[ "Get", "the", "parent", "record", "of", "the", "form", "instance" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Fields/BelongsTo.php#L197-L205
30,817
BKWLD/decoy
classes/Fields/BelongsTo.php
BelongsTo.guessRelation
protected function guessRelation() { if ($this->relation) { return $this->relation; } return Str::camel(str_replace('_id', '', $this->name)); }
php
protected function guessRelation() { if ($this->relation) { return $this->relation; } return Str::camel(str_replace('_id', '', $this->name)); }
[ "protected", "function", "guessRelation", "(", ")", "{", "if", "(", "$", "this", "->", "relation", ")", "{", "return", "$", "this", "->", "relation", ";", "}", "return", "Str", "::", "camel", "(", "str_replace", "(", "'_id'", ",", "''", ",", "$", "th...
Guess at the relationship name by removing id from the name and camel casing @return string
[ "Guess", "at", "the", "relationship", "name", "by", "removing", "id", "from", "the", "name", "and", "camel", "casing" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Fields/BelongsTo.php#L212-L219
30,818
BKWLD/decoy
classes/Input/NestedModels.php
NestedModels.relateTo
public function relateTo($model) { // Vars $relation_attributes = []; $input = Decoy::filteredInput(); // Loop through the input, looking for relationships foreach ($input as $name => $data) { if (!$relation = $this->makeRelation($model, $name, $data)) { ...
php
public function relateTo($model) { // Vars $relation_attributes = []; $input = Decoy::filteredInput(); // Loop through the input, looking for relationships foreach ($input as $name => $data) { if (!$relation = $this->makeRelation($model, $name, $data)) { ...
[ "public", "function", "relateTo", "(", "$", "model", ")", "{", "// Vars", "$", "relation_attributes", "=", "[", "]", ";", "$", "input", "=", "Decoy", "::", "filteredInput", "(", ")", ";", "// Loop through the input, looking for relationships", "foreach", "(", "$...
Check the input for related models data. Remove it from the input if it exists. And then listen for the model to be saved and write the related models. @param Eloquent\Model $model @return array The input with attributes that were relations removed
[ "Check", "the", "input", "for", "related", "models", "data", ".", "Remove", "it", "from", "the", "input", "if", "it", "exists", ".", "And", "then", "listen", "for", "the", "model", "to", "be", "saved", "and", "write", "the", "related", "models", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/NestedModels.php#L29-L55
30,819
BKWLD/decoy
classes/Input/NestedModels.php
NestedModels.makeRelation
protected function makeRelation($model, $name, $data) { // The data must be an array and must contain arrays if (!is_array($data) || empty($data) || count(array_filter($data, function ($child) { return !is_array($child); }))) { return f...
php
protected function makeRelation($model, $name, $data) { // The data must be an array and must contain arrays if (!is_array($data) || empty($data) || count(array_filter($data, function ($child) { return !is_array($child); }))) { return f...
[ "protected", "function", "makeRelation", "(", "$", "model", ",", "$", "name", ",", "$", "data", ")", "{", "// The data must be an array and must contain arrays", "if", "(", "!", "is_array", "(", "$", "data", ")", "||", "empty", "(", "$", "data", ")", "||", ...
Check if the input is a relation and, if it is, return the relationship object @param Model $model @param string $name The input name, like from <input name="$name">, which is also the naem of the relationship function. @param mixed $data @return false|Relation
[ "Check", "if", "the", "input", "is", "a", "relation", "and", "if", "it", "is", "return", "the", "relationship", "object" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/NestedModels.php#L67-L91
30,820
BKWLD/decoy
classes/Input/NestedModels.php
NestedModels.storeChild
protected function storeChild($relation, $input, $prefix) { $child = $relation->getRelated()->newInstance(); $child->fill($input); $rules = $this->getRules($relation, $input); (new ModelValidator)->validateAndPrefixErrors($prefix, $child, $rules); $relation->save($child); ...
php
protected function storeChild($relation, $input, $prefix) { $child = $relation->getRelated()->newInstance(); $child->fill($input); $rules = $this->getRules($relation, $input); (new ModelValidator)->validateAndPrefixErrors($prefix, $child, $rules); $relation->save($child); ...
[ "protected", "function", "storeChild", "(", "$", "relation", ",", "$", "input", ",", "$", "prefix", ")", "{", "$", "child", "=", "$", "relation", "->", "getRelated", "(", ")", "->", "newInstance", "(", ")", ";", "$", "child", "->", "fill", "(", "$", ...
Create a new child record @param Relation $relation @param array $input The data for the nested model @param string $prefix The input name prefix, for validation @return void
[ "Create", "a", "new", "child", "record" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/NestedModels.php#L124-L131
30,821
BKWLD/decoy
classes/Input/NestedModels.php
NestedModels.updateChild
protected function updateChild($relation, $id, $input, $prefix) { $child = $relation->getRelated()->findOrFail($id); $child->fill($input); $rules = $this->getRules($relation, $input); (new ModelValidator)->validateAndPrefixErrors($prefix, $child, $rules); $child->save(); ...
php
protected function updateChild($relation, $id, $input, $prefix) { $child = $relation->getRelated()->findOrFail($id); $child->fill($input); $rules = $this->getRules($relation, $input); (new ModelValidator)->validateAndPrefixErrors($prefix, $child, $rules); $child->save(); ...
[ "protected", "function", "updateChild", "(", "$", "relation", ",", "$", "id", ",", "$", "input", ",", "$", "prefix", ")", "{", "$", "child", "=", "$", "relation", "->", "getRelated", "(", ")", "->", "findOrFail", "(", "$", "id", ")", ";", "$", "chi...
Update an existing child record @param Relation $relation @param integer $id @param array $input The data for the nested model @param string $prefix The input name prefix, for validation @return void
[ "Update", "an", "existing", "child", "record" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/NestedModels.php#L142-L149
30,822
BKWLD/decoy
classes/Input/NestedModels.php
NestedModels.getRules
public function getRules($relation, $input) { $child = $relation->getRelated(); // If nested is not an Image, don't do anything special. This will result // in the default validation behavior which gets the rules off of the child. if (!is_a($child, Image::class)) { retu...
php
public function getRules($relation, $input) { $child = $relation->getRelated(); // If nested is not an Image, don't do anything special. This will result // in the default validation behavior which gets the rules off of the child. if (!is_a($child, Image::class)) { retu...
[ "public", "function", "getRules", "(", "$", "relation", ",", "$", "input", ")", "{", "$", "child", "=", "$", "relation", "->", "getRelated", "(", ")", ";", "// If nested is not an Image, don't do anything special. This will result", "// in the default validation behavior...
Get the validation rules. They are generally on the child except for in the special case of Images @param Relation $relation @param array $input The data for the nested model @return array
[ "Get", "the", "validation", "rules", ".", "They", "are", "generally", "on", "the", "child", "except", "for", "in", "the", "special", "case", "of", "Images" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/NestedModels.php#L159-L181
30,823
BKWLD/decoy
classes/Fields/ManyToManyChecklist.php
ManyToManyChecklist.getRelations
public function getRelations() { $class = ucfirst('App\\'.ucfirst(Str::singular($this->name))); $query = call_user_func([$class, 'ordered']); if ($this->scope) { call_user_func($this->scope, $query); } return $query->get(); }
php
public function getRelations() { $class = ucfirst('App\\'.ucfirst(Str::singular($this->name))); $query = call_user_func([$class, 'ordered']); if ($this->scope) { call_user_func($this->scope, $query); } return $query->get(); }
[ "public", "function", "getRelations", "(", ")", "{", "$", "class", "=", "ucfirst", "(", "'App\\\\'", ".", "ucfirst", "(", "Str", "::", "singular", "(", "$", "this", "->", "name", ")", ")", ")", ";", "$", "query", "=", "call_user_func", "(", "[", "$",...
Get all the options in the related table. Each will become a checkbox. @return Illuminate\Database\Eloquent\Collection
[ "Get", "all", "the", "options", "in", "the", "related", "table", ".", "Each", "will", "become", "a", "checkbox", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Fields/ManyToManyChecklist.php#L104-L114
30,824
BKWLD/decoy
classes/Fields/ManyToManyChecklist.php
ManyToManyChecklist.generateBox
protected function generateBox($row) { return [ 'name' => $this->boxName(), 'value' => $row->getKey(), 'checked' => ($children = $this->children()) && $children->contains($row->getKey()), // Former is giving these a class of "form-control" whi...
php
protected function generateBox($row) { return [ 'name' => $this->boxName(), 'value' => $row->getKey(), 'checked' => ($children = $this->children()) && $children->contains($row->getKey()), // Former is giving these a class of "form-control" whi...
[ "protected", "function", "generateBox", "(", "$", "row", ")", "{", "return", "[", "'name'", "=>", "$", "this", "->", "boxName", "(", ")", ",", "'value'", "=>", "$", "row", "->", "getKey", "(", ")", ",", "'checked'", "=>", "(", "$", "children", "=", ...
Take a model instance and generate a checkbox for it @param Illuminate\Database\Eloquent\Model $row @return array Configuration that is used by Former for a checkbox
[ "Take", "a", "model", "instance", "and", "generate", "a", "checkbox", "for", "it" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Fields/ManyToManyChecklist.php#L133-L147
30,825
BKWLD/decoy
classes/Fields/ManyToManyChecklist.php
ManyToManyChecklist.generateBoxLabel
protected function generateBoxLabel($row) { // Generate the title $html = '<span class="title">'.$row->getAdminTitleHtmlAttribute().'</span>'; // Add link to edit $url = '/'.Config::get('decoy.core.dir').'/'.Str::snake($this->name, '-') .'/'.$row->getKey().'/edit'; ...
php
protected function generateBoxLabel($row) { // Generate the title $html = '<span class="title">'.$row->getAdminTitleHtmlAttribute().'</span>'; // Add link to edit $url = '/'.Config::get('decoy.core.dir').'/'.Str::snake($this->name, '-') .'/'.$row->getKey().'/edit'; ...
[ "protected", "function", "generateBoxLabel", "(", "$", "row", ")", "{", "// Generate the title", "$", "html", "=", "'<span class=\"title\">'", ".", "$", "row", "->", "getAdminTitleHtmlAttribute", "(", ")", ".", "'</span>'", ";", "// Add link to edit", "$", "url", ...
Create the HTML label for a checkbox @param Illuminate\Database\Eloquent\Model $row @return string HTML
[ "Create", "the", "HTML", "label", "for", "a", "checkbox" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Fields/ManyToManyChecklist.php#L155-L171
30,826
BKWLD/decoy
classes/Fields/ManyToManyChecklist.php
ManyToManyChecklist.children
protected function children() { if (($item = $this->getModel()) && method_exists($item, $this->name)) { return $item->{$this->name}; } }
php
protected function children() { if (($item = $this->getModel()) && method_exists($item, $this->name)) { return $item->{$this->name}; } }
[ "protected", "function", "children", "(", ")", "{", "if", "(", "(", "$", "item", "=", "$", "this", "->", "getModel", "(", ")", ")", "&&", "method_exists", "(", "$", "item", ",", "$", "this", "->", "name", ")", ")", "{", "return", "$", "item", "->...
Get a collection of all the children that are already associated with the parent @return Illuminate\Database\Eloquent\Collection
[ "Get", "a", "collection", "of", "all", "the", "children", "that", "are", "already", "associated", "with", "the", "parent" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Fields/ManyToManyChecklist.php#L178-L183
30,827
BKWLD/decoy
classes/Fields/ManyToManyChecklist.php
ManyToManyChecklist.createCheckable
protected function createCheckable($item, $fallbackValue = 1) { // Get the model reference out of the item and remove it before it's // rendered. Otherwise it gets created as a data atrribute $model = $item['attributes']['model']; unset($item['attributes']['model']); // Ren...
php
protected function createCheckable($item, $fallbackValue = 1) { // Get the model reference out of the item and remove it before it's // rendered. Otherwise it gets created as a data atrribute $model = $item['attributes']['model']; unset($item['attributes']['model']); // Ren...
[ "protected", "function", "createCheckable", "(", "$", "item", ",", "$", "fallbackValue", "=", "1", ")", "{", "// Get the model reference out of the item and remove it before it's", "// rendered. Otherwise it gets created as a data atrribute", "$", "model", "=", "$", "item", ...
Renders a checkable. This overrides the Former subclass so we can decorate each individual `.checkbox`div. @param string|array $item A checkable item @param integer $fallbackValue A fallback value if none is set @return string
[ "Renders", "a", "checkable", ".", "This", "overrides", "the", "Former", "subclass", "so", "we", "can", "decorate", "each", "individual", ".", "checkbox", "div", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Fields/ManyToManyChecklist.php#L194-L211
30,828
BKWLD/decoy
classes/Observers/ValidateExistingFiles.php
ValidateExistingFiles.onValidating
public function onValidating($event, $payload) { // Destructure payload list($model, $validation) = $payload; // Only act on locally hosted files if (config('upchuck.disk.driver') != 'local') { return; } // Get all the file related rules // https...
php
public function onValidating($event, $payload) { // Destructure payload list($model, $validation) = $payload; // Only act on locally hosted files if (config('upchuck.disk.driver') != 'local') { return; } // Get all the file related rules // https...
[ "public", "function", "onValidating", "(", "$", "event", ",", "$", "payload", ")", "{", "// Destructure payload", "list", "(", "$", "model", ",", "$", "validation", ")", "=", "$", "payload", ";", "// Only act on locally hosted files", "if", "(", "config", "(",...
Massage validation handling @param string $event @param array $payload Contains: - Bkwld\Decoy\Models\Base - Illuminate\Validation\Validator @return void
[ "Massage", "validation", "handling" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Observers/ValidateExistingFiles.php#L25-L78
30,829
BKWLD/decoy
classes/Observers/ValidateExistingFiles.php
ValidateExistingFiles.makeFileFromPath
public function makeFileFromPath($path) { $upchuck_path = app('upchuck')->path($path); $absolute_path = config('upchuck.disk.path').'/'.$upchuck_path; return new UploadedFile( $absolute_path, basename($absolute_path), null, null, // Default mime and error ...
php
public function makeFileFromPath($path) { $upchuck_path = app('upchuck')->path($path); $absolute_path = config('upchuck.disk.path').'/'.$upchuck_path; return new UploadedFile( $absolute_path, basename($absolute_path), null, null, // Default mime and error ...
[ "public", "function", "makeFileFromPath", "(", "$", "path", ")", "{", "$", "upchuck_path", "=", "app", "(", "'upchuck'", ")", "->", "path", "(", "$", "path", ")", ";", "$", "absolute_path", "=", "config", "(", "'upchuck.disk.path'", ")", ".", "'/'", ".",...
Make an UploadedFile instance using Upchuck from the string input value @param string $path @return UploadedFile
[ "Make", "an", "UploadedFile", "instance", "using", "Upchuck", "from", "the", "string", "input", "value" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Observers/ValidateExistingFiles.php#L86-L94
30,830
BKWLD/decoy
classes/Models/Worker.php
Worker.execute
protected function execute(InputInterface $input, OutputInterface $output) { if ($this->option('worker')) { return $this->worker(); } if ($this->option('cron')) { return $this->cron(); } if ($this->option('heartbeat')) { return $this->hea...
php
protected function execute(InputInterface $input, OutputInterface $output) { if ($this->option('worker')) { return $this->worker(); } if ($this->option('cron')) { return $this->cron(); } if ($this->option('heartbeat')) { return $this->hea...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "if", "(", "$", "this", "->", "option", "(", "'worker'", ")", ")", "{", "return", "$", "this", "->", "worker", "(", ")", ";", "}",...
Tap into the Laravel method that invokes the fire command to check for and act on options
[ "Tap", "into", "the", "Laravel", "method", "that", "invokes", "the", "fire", "command", "to", "check", "for", "and", "act", "on", "options" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Worker.php#L63-L78
30,831
BKWLD/decoy
classes/Models/Worker.php
Worker.heartbeat
protected function heartbeat() { // Update the heartbeat $last = Cache::get($this->HEARTBEAT_CRON_KEY); if (empty($last->interval)) { $interval = 'calculating'; } else { $interval = time() - $last->time; } Cache::forever($this->HEARTBEAT_CRON_...
php
protected function heartbeat() { // Update the heartbeat $last = Cache::get($this->HEARTBEAT_CRON_KEY); if (empty($last->interval)) { $interval = 'calculating'; } else { $interval = time() - $last->time; } Cache::forever($this->HEARTBEAT_CRON_...
[ "protected", "function", "heartbeat", "(", ")", "{", "// Update the heartbeat", "$", "last", "=", "Cache", "::", "get", "(", "$", "this", "->", "HEARTBEAT_CRON_KEY", ")", ";", "if", "(", "empty", "(", "$", "last", "->", "interval", ")", ")", "{", "$", ...
This heartbeat function is called by cron to verify that the worker is still running
[ "This", "heartbeat", "function", "is", "called", "by", "cron", "to", "verify", "that", "the", "worker", "is", "still", "running" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Worker.php#L124-L153
30,832
BKWLD/decoy
classes/Models/Worker.php
Worker.log
public function log($level, $message, $context = []) { // This will be empty when output messages are triggered by the command // when it's NOT called by a worker option if (empty($this->logger)) { return; } // Call the logger's level specific methods $me...
php
public function log($level, $message, $context = []) { // This will be empty when output messages are triggered by the command // when it's NOT called by a worker option if (empty($this->logger)) { return; } // Call the logger's level specific methods $me...
[ "public", "function", "log", "(", "$", "level", ",", "$", "message", ",", "$", "context", "=", "[", "]", ")", "{", "// This will be empty when output messages are triggered by the command", "// when it's NOT called by a worker option", "if", "(", "empty", "(", "$", "t...
Write Command output types to the log @param $level @param $message @param array $context
[ "Write", "Command", "output", "types", "to", "the", "log" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Worker.php#L188-L199
30,833
BKWLD/decoy
classes/Models/Worker.php
Worker.all
public static function all() { $output = array(); $namespaced = Command::allCustom(); foreach ($namespaced as $namespace => $commands) { foreach ($commands as $title => $command) { if (is_a($command, 'Bkwld\Decoy\Models\Worker')) { $output[] = ...
php
public static function all() { $output = array(); $namespaced = Command::allCustom(); foreach ($namespaced as $namespace => $commands) { foreach ($commands as $title => $command) { if (is_a($command, 'Bkwld\Decoy\Models\Worker')) { $output[] = ...
[ "public", "static", "function", "all", "(", ")", "{", "$", "output", "=", "array", "(", ")", ";", "$", "namespaced", "=", "Command", "::", "allCustom", "(", ")", ";", "foreach", "(", "$", "namespaced", "as", "$", "namespace", "=>", "$", "commands", "...
Get all the tasks that have workers
[ "Get", "all", "the", "tasks", "that", "have", "workers" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Worker.php#L227-L240
30,834
BKWLD/decoy
classes/Models/Worker.php
Worker.lastHeartbeatCheck
public function lastHeartbeatCheck() { $check = Cache::get($this->HEARTBEAT_CRON_KEY); if (empty($check)) { return 'never'; } return date(Library\Utils\Constants::COMMON_DATETIME.' T', $check->time); }
php
public function lastHeartbeatCheck() { $check = Cache::get($this->HEARTBEAT_CRON_KEY); if (empty($check)) { return 'never'; } return date(Library\Utils\Constants::COMMON_DATETIME.' T', $check->time); }
[ "public", "function", "lastHeartbeatCheck", "(", ")", "{", "$", "check", "=", "Cache", "::", "get", "(", "$", "this", "->", "HEARTBEAT_CRON_KEY", ")", ";", "if", "(", "empty", "(", "$", "check", ")", ")", "{", "return", "'never'", ";", "}", "return", ...
Last time the heartbeat was checked
[ "Last", "time", "the", "heartbeat", "was", "checked" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Worker.php#L253-L261
30,835
BKWLD/decoy
classes/Models/Worker.php
Worker.lastHeartbeat
public function lastHeartbeat() { $check = Cache::get($this->HEARTBEAT_WORKER_KEY); if (empty($check)) { return 'never'; } return date(Library\Utils\Constants::COMMON_DATETIME.' T', $check); }
php
public function lastHeartbeat() { $check = Cache::get($this->HEARTBEAT_WORKER_KEY); if (empty($check)) { return 'never'; } return date(Library\Utils\Constants::COMMON_DATETIME.' T', $check); }
[ "public", "function", "lastHeartbeat", "(", ")", "{", "$", "check", "=", "Cache", "::", "get", "(", "$", "this", "->", "HEARTBEAT_WORKER_KEY", ")", ";", "if", "(", "empty", "(", "$", "check", ")", ")", "{", "return", "'never'", ";", "}", "return", "d...
The last time the worker ran
[ "The", "last", "time", "the", "worker", "ran" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Worker.php#L266-L274
30,836
BKWLD/decoy
classes/Models/Worker.php
Worker.currentInterval
public function currentInterval($format = null) { // Relative time formatting $abbreviated = [ 'pluraling' => false, 'spacing' => false, 'labels' => ['now', 's', 'm', 'h', 'd', 'm', 'y'], ]; // Figure stuff out if ($this->isRunning()) { ...
php
public function currentInterval($format = null) { // Relative time formatting $abbreviated = [ 'pluraling' => false, 'spacing' => false, 'labels' => ['now', 's', 'm', 'h', 'd', 'm', 'y'], ]; // Figure stuff out if ($this->isRunning()) { ...
[ "public", "function", "currentInterval", "(", "$", "format", "=", "null", ")", "{", "// Relative time formatting", "$", "abbreviated", "=", "[", "'pluraling'", "=>", "false", ",", "'spacing'", "=>", "false", ",", "'labels'", "=>", "[", "'now'", ",", "'s'", "...
The current interval that heartbeats are running at
[ "The", "current", "interval", "that", "heartbeats", "are", "running", "at" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Worker.php#L279-L315
30,837
BKWLD/decoy
classes/Layout/Nav.php
Nav.generate
public function generate() { // Get the navigation pages from the config $pages = Config::get('decoy.site.nav'); if (is_callable($pages)) { $pages = call_user_func($pages); } // Loop through the list of pages and massage $massaged = []; foreach ($...
php
public function generate() { // Get the navigation pages from the config $pages = Config::get('decoy.site.nav'); if (is_callable($pages)) { $pages = call_user_func($pages); } // Loop through the list of pages and massage $massaged = []; foreach ($...
[ "public", "function", "generate", "(", ")", "{", "// Get the navigation pages from the config", "$", "pages", "=", "Config", "::", "get", "(", "'decoy.site.nav'", ")", ";", "if", "(", "is_callable", "(", "$", "pages", ")", ")", "{", "$", "pages", "=", "call_...
Generate the nav config @return array
[ "Generate", "the", "nav", "config" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Layout/Nav.php#L18-L63
30,838
BKWLD/decoy
classes/Layout/Nav.php
Nav.makeIcon
protected function makeIcon($label_and_icon) { $parts = explode(',', $label_and_icon); if (count($parts) == 2) { return ['label' => $parts[0], 'icon' => $parts[1]]; } return ['label' => $parts[0], 'icon' => 'default']; }
php
protected function makeIcon($label_and_icon) { $parts = explode(',', $label_and_icon); if (count($parts) == 2) { return ['label' => $parts[0], 'icon' => $parts[1]]; } return ['label' => $parts[0], 'icon' => 'default']; }
[ "protected", "function", "makeIcon", "(", "$", "label_and_icon", ")", "{", "$", "parts", "=", "explode", "(", "','", ",", "$", "label_and_icon", ")", ";", "if", "(", "count", "(", "$", "parts", ")", "==", "2", ")", "{", "return", "[", "'label'", "=>"...
Break the icon out of the label, returning an arary of label and icon
[ "Break", "the", "icon", "out", "of", "the", "label", "returning", "an", "arary", "of", "label", "and", "icon" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Layout/Nav.php#L68-L76
30,839
BKWLD/decoy
classes/Layout/Nav.php
Nav.makePage
protected function makePage($key, $val) { // Check if it's a divider if ($val === '-') { return (object) ['divider' => true]; } // Create a new page $page = ['url' => $val, 'divider' => false]; $page = array_merge($page, $this->makeIcon($key)); /...
php
protected function makePage($key, $val) { // Check if it's a divider if ($val === '-') { return (object) ['divider' => true]; } // Create a new page $page = ['url' => $val, 'divider' => false]; $page = array_merge($page, $this->makeIcon($key)); /...
[ "protected", "function", "makePage", "(", "$", "key", ",", "$", "val", ")", "{", "// Check if it's a divider", "if", "(", "$", "val", "===", "'-'", ")", "{", "return", "(", "object", ")", "[", "'divider'", "=>", "true", "]", ";", "}", "// Create a new pa...
Make a page object @return object
[ "Make", "a", "page", "object" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Layout/Nav.php#L83-L102
30,840
BKWLD/decoy
classes/Controllers/Commands.php
Commands.execute
public function execute($command_name) { // Find it if (!($command = Command::find($command_name))) { App::abort(404); } // Run it, ignoring all output set_time_limit(self::MAX_EXECUTION_TIME); ob_start(); Artisan::call($command->getName()); ...
php
public function execute($command_name) { // Find it if (!($command = Command::find($command_name))) { App::abort(404); } // Run it, ignoring all output set_time_limit(self::MAX_EXECUTION_TIME); ob_start(); Artisan::call($command->getName()); ...
[ "public", "function", "execute", "(", "$", "command_name", ")", "{", "// Find it", "if", "(", "!", "(", "$", "command", "=", "Command", "::", "find", "(", "$", "command_name", ")", ")", ")", "{", "App", "::", "abort", "(", "404", ")", ";", "}", "//...
Run one of the commands, designed to be called via AJAX @return Response
[ "Run", "one", "of", "the", "commands", "designed", "to", "be", "called", "via", "AJAX" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Controllers/Commands.php#L49-L64
30,841
BKWLD/decoy
classes/Routing/Wildcard.php
Wildcard.detectAndExecute
public function detectAndExecute() { // Get the controller if (!($controller = $this->detectController())) { return false; } // Get the action $action = $this->detectAction(); if (!$action || !method_exists($controller, $action)) { return fals...
php
public function detectAndExecute() { // Get the controller if (!($controller = $this->detectController())) { return false; } // Get the action $action = $this->detectAction(); if (!$action || !method_exists($controller, $action)) { return fals...
[ "public", "function", "detectAndExecute", "(", ")", "{", "// Get the controller", "if", "(", "!", "(", "$", "controller", "=", "$", "this", "->", "detectController", "(", ")", ")", ")", "{", "return", "false", ";", "}", "// Get the action", "$", "action", ...
Detect the controller for a given route and then execute the action that is specified in the route.
[ "Detect", "the", "controller", "for", "a", "given", "route", "and", "then", "execute", "the", "action", "that", "is", "specified", "in", "the", "route", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Routing/Wildcard.php#L48-L80
30,842
BKWLD/decoy
classes/Routing/Wildcard.php
Wildcard.detectController
public function detectController($class_name = null) { // Setup the two schemes if (!$class_name) { $class_name = $this->detectControllerClass(); } $app = 'App\\Http\\Controllers\\' . ucfirst(Str::studly($this->dir)) . '\\'.$class_name; $d...
php
public function detectController($class_name = null) { // Setup the two schemes if (!$class_name) { $class_name = $this->detectControllerClass(); } $app = 'App\\Http\\Controllers\\' . ucfirst(Str::studly($this->dir)) . '\\'.$class_name; $d...
[ "public", "function", "detectController", "(", "$", "class_name", "=", "null", ")", "{", "// Setup the two schemes", "if", "(", "!", "$", "class_name", ")", "{", "$", "class_name", "=", "$", "this", "->", "detectControllerClass", "(", ")", ";", "}", "$", "...
Get the full namespaced controller @return string i.e. App\Http\Controllers\Admin\People or Bkwld\Decoy\Controllers\Admins
[ "Get", "the", "full", "namespaced", "controller" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Routing/Wildcard.php#L88-L108
30,843
BKWLD/decoy
classes/Routing/Wildcard.php
Wildcard.detectControllerClass
public function detectControllerClass($name = null) { // The path must begin with the config dir if (!preg_match('#^'.$this->dir.'#i', $this->path, $matches)) { return false; } // Find the controller from the end of the path if (!$name) { $name = $thi...
php
public function detectControllerClass($name = null) { // The path must begin with the config dir if (!preg_match('#^'.$this->dir.'#i', $this->path, $matches)) { return false; } // Find the controller from the end of the path if (!$name) { $name = $thi...
[ "public", "function", "detectControllerClass", "(", "$", "name", "=", "null", ")", "{", "// The path must begin with the config dir", "if", "(", "!", "preg_match", "(", "'#^'", ".", "$", "this", "->", "dir", ".", "'#i'", ",", "$", "this", "->", "path", ",", ...
Detect the controller for a path. Which is the last non-action string in the path @return string The controller class, i.e. Articles
[ "Detect", "the", "controller", "for", "a", "path", ".", "Which", "is", "the", "last", "non", "-", "action", "string", "in", "the", "path" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Routing/Wildcard.php#L116-L130
30,844
BKWLD/decoy
classes/Routing/Wildcard.php
Wildcard.detectControllerName
public function detectControllerName() { $pattern = '#/'.$this->controllerNameRegex().'#i'; if (!preg_match($pattern, $this->path, $matches)) { return false; } return $matches[1]; }
php
public function detectControllerName() { $pattern = '#/'.$this->controllerNameRegex().'#i'; if (!preg_match($pattern, $this->path, $matches)) { return false; } return $matches[1]; }
[ "public", "function", "detectControllerName", "(", ")", "{", "$", "pattern", "=", "'#/'", ".", "$", "this", "->", "controllerNameRegex", "(", ")", ".", "'#i'", ";", "if", "(", "!", "preg_match", "(", "$", "pattern", ",", "$", "this", "->", "path", ",",...
Get just the controller's short name from the path @return mixed false if not found, otherwise a string like "news" or "slides"
[ "Get", "just", "the", "controller", "s", "short", "name", "from", "the", "path" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Routing/Wildcard.php#L136-L144
30,845
BKWLD/decoy
classes/Routing/Wildcard.php
Wildcard.detectAction
public function detectAction() { // If the path ends in one of the special actions, use that as the action // as long as the verb is a GET if (preg_match('#[a-z-]+$#i', $this->path, $matches)) { $action = $matches[0]; // If posting to the create/edit route, treat as...
php
public function detectAction() { // If the path ends in one of the special actions, use that as the action // as long as the verb is a GET if (preg_match('#[a-z-]+$#i', $this->path, $matches)) { $action = $matches[0]; // If posting to the create/edit route, treat as...
[ "public", "function", "detectAction", "(", ")", "{", "// If the path ends in one of the special actions, use that as the action", "// as long as the verb is a GET", "if", "(", "preg_match", "(", "'#[a-z-]+$#i'", ",", "$", "this", "->", "path", ",", "$", "matches", ")", ")...
Detect the action for a path @return string 'create', 'update', 'edit', ....
[ "Detect", "the", "action", "for", "a", "path" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Routing/Wildcard.php#L159-L208
30,846
BKWLD/decoy
classes/Routing/Wildcard.php
Wildcard.detectId
public function detectId() { // If there is an id, it will be the last number if (preg_match('#\d+$#', $this->path, $matches)) { return $matches[0]; } // .. or the route will be an action preceeded by an id $pattern = '#(\d+)/('.implode('|', $this->actions).')$#i...
php
public function detectId() { // If there is an id, it will be the last number if (preg_match('#\d+$#', $this->path, $matches)) { return $matches[0]; } // .. or the route will be an action preceeded by an id $pattern = '#(\d+)/('.implode('|', $this->actions).')$#i...
[ "public", "function", "detectId", "(", ")", "{", "// If there is an id, it will be the last number", "if", "(", "preg_match", "(", "'#\\d+$#'", ",", "$", "this", "->", "path", ",", "$", "matches", ")", ")", "{", "return", "$", "matches", "[", "0", "]", ";", ...
Detect the id for the path @return integer An id number for a DB record
[ "Detect", "the", "id", "for", "the", "path" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Routing/Wildcard.php#L214-L229
30,847
BKWLD/decoy
classes/Routing/Wildcard.php
Wildcard.detectParent
public function detectParent() { // Look for a string, then a number (the parent id), followed by a non-action // string, then possiby a number and/or an action string and then the end $pattern = '#([a-z-]+)/(\d+)/(?!'.implode('|', $this->actions).')[a-z-]+(?:/\d+)?(/('.implode('|', $this->a...
php
public function detectParent() { // Look for a string, then a number (the parent id), followed by a non-action // string, then possiby a number and/or an action string and then the end $pattern = '#([a-z-]+)/(\d+)/(?!'.implode('|', $this->actions).')[a-z-]+(?:/\d+)?(/('.implode('|', $this->a...
[ "public", "function", "detectParent", "(", ")", "{", "// Look for a string, then a number (the parent id), followed by a non-action", "// string, then possiby a number and/or an action string and then the end", "$", "pattern", "=", "'#([a-z-]+)/(\\d+)/(?!'", ".", "implode", "(", "'|'",...
Detect the parent id of the path @return mixed False or an array containing: - The slug of the parent controller - The id of the parent record
[ "Detect", "the", "parent", "id", "of", "the", "path" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Routing/Wildcard.php#L238-L248
30,848
BKWLD/decoy
classes/Routing/Wildcard.php
Wildcard.getAllClasses
public function getAllClasses() { // Get all slugs that lead with a slash $pattern = '#(?:/([a-z-]+))#i'; // If no matches, return an empty array. Matches will be at first index; preg_match_all($pattern, $this->path, $matches); if (count($matches) <= 1) { return...
php
public function getAllClasses() { // Get all slugs that lead with a slash $pattern = '#(?:/([a-z-]+))#i'; // If no matches, return an empty array. Matches will be at first index; preg_match_all($pattern, $this->path, $matches); if (count($matches) <= 1) { return...
[ "public", "function", "getAllClasses", "(", ")", "{", "// Get all slugs that lead with a slash", "$", "pattern", "=", "'#(?:/([a-z-]+))#i'", ";", "// If no matches, return an empty array. Matches will be at first index;", "preg_match_all", "(", "$", "pattern", ",", "$", "this"...
Return an array of all classes represented in the URL
[ "Return", "an", "array", "of", "all", "classes", "represented", "in", "the", "URL" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Routing/Wildcard.php#L253-L274
30,849
BKWLD/decoy
classes/Models/Traits/Loggable.php
Loggable.showTrashedVersion
private static function showTrashedVersion(Builder $builder) { if (($change = static::lookupRequestedChange()) && static::builderMatchesChange($change, $builder)) { $builder->withoutGlobalScope(SoftDeletingScope::class); } }
php
private static function showTrashedVersion(Builder $builder) { if (($change = static::lookupRequestedChange()) && static::builderMatchesChange($change, $builder)) { $builder->withoutGlobalScope(SoftDeletingScope::class); } }
[ "private", "static", "function", "showTrashedVersion", "(", "Builder", "$", "builder", ")", "{", "if", "(", "(", "$", "change", "=", "static", "::", "lookupRequestedChange", "(", ")", ")", "&&", "static", "::", "builderMatchesChange", "(", "$", "change", ","...
Show trashed models for matching change @param Builder $builder @return void
[ "Show", "trashed", "models", "for", "matching", "change" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Traits/Loggable.php#L84-L90
30,850
BKWLD/decoy
classes/Models/Traits/Loggable.php
Loggable.lookupRequestedChange
private static function lookupRequestedChange() { // Only run if the query param is present if (!$change_id = request(Change::QUERY_KEY)) { return; } // Don't execute for classes that result in recusirve queries when the // Change model gets built below $...
php
private static function lookupRequestedChange() { // Only run if the query param is present if (!$change_id = request(Change::QUERY_KEY)) { return; } // Don't execute for classes that result in recusirve queries when the // Change model gets built below $...
[ "private", "static", "function", "lookupRequestedChange", "(", ")", "{", "// Only run if the query param is present", "if", "(", "!", "$", "change_id", "=", "request", "(", "Change", "::", "QUERY_KEY", ")", ")", "{", "return", ";", "}", "// Don't execute for classes...
Get a Change record mentioned in the query, if appropriate @return Change|void
[ "Get", "a", "Change", "record", "mentioned", "in", "the", "query", "if", "appropriate" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Traits/Loggable.php#L97-L116
30,851
BKWLD/decoy
classes/Models/Traits/Loggable.php
Loggable.builderMatchesChange
private static function builderMatchesChange(Change $change, Builder $builder) { $class = $change->model; $route_key_name = (new $class)->getRouteKeyName(); return collect($builder->getQuery()->wheres) ->contains(function($where) use ($change, $route_key_name) { ...
php
private static function builderMatchesChange(Change $change, Builder $builder) { $class = $change->model; $route_key_name = (new $class)->getRouteKeyName(); return collect($builder->getQuery()->wheres) ->contains(function($where) use ($change, $route_key_name) { ...
[ "private", "static", "function", "builderMatchesChange", "(", "Change", "$", "change", ",", "Builder", "$", "builder", ")", "{", "$", "class", "=", "$", "change", "->", "model", ";", "$", "route_key_name", "=", "(", "new", "$", "class", ")", "->", "getRo...
Does the Change referenced in the GET query match the conditions already applied in the query builder? @param Change $change @param Builder $builder @return boolean
[ "Does", "the", "Change", "referenced", "in", "the", "GET", "query", "match", "the", "conditions", "already", "applied", "in", "the", "query", "builder?" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Traits/Loggable.php#L126-L152
30,852
BKWLD/decoy
classes/Models/Traits/Loggable.php
Loggable.replaceAttributesWithChange
private function replaceAttributesWithChange() { if (($change = static::lookupRequestedChange()) && $change->key == $this->getKey()) { $this->attributes = array_merge( $this->attributes, $this->attributesAtChange($change) ); } }
php
private function replaceAttributesWithChange() { if (($change = static::lookupRequestedChange()) && $change->key == $this->getKey()) { $this->attributes = array_merge( $this->attributes, $this->attributesAtChange($change) ); } }
[ "private", "function", "replaceAttributesWithChange", "(", ")", "{", "if", "(", "(", "$", "change", "=", "static", "::", "lookupRequestedChange", "(", ")", ")", "&&", "$", "change", "->", "key", "==", "$", "this", "->", "getKey", "(", ")", ")", "{", "$...
Replace all the attributes with those from the specified Change specified in the reqeust query. @return void
[ "Replace", "all", "the", "attributes", "with", "those", "from", "the", "specified", "Change", "specified", "in", "the", "reqeust", "query", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Traits/Loggable.php#L160-L169
30,853
BKWLD/decoy
classes/Models/Traits/Loggable.php
Loggable.attributesAtChange
private function attributesAtChange(Change $change) { return $this->previousChanges($change) ->reduce(function($attributes, $change) { return array_merge($attributes, $change->changed); }, []); }
php
private function attributesAtChange(Change $change) { return $this->previousChanges($change) ->reduce(function($attributes, $change) { return array_merge($attributes, $change->changed); }, []); }
[ "private", "function", "attributesAtChange", "(", "Change", "$", "change", ")", "{", "return", "$", "this", "->", "previousChanges", "(", "$", "change", ")", "->", "reduce", "(", "function", "(", "$", "attributes", ",", "$", "change", ")", "{", "return", ...
Get the attributes of the model at a given Change @param Change $change @return array
[ "Get", "the", "attributes", "of", "the", "model", "at", "a", "given", "Change" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Traits/Loggable.php#L177-L183
30,854
BKWLD/decoy
classes/Models/Traits/Loggable.php
Loggable.previousChanges
private function previousChanges(Change $change) { return $this->changes() ->where('changes.id', '<=', $change->id) ->orderBy('changes.id', 'asc') ->get(); }
php
private function previousChanges(Change $change) { return $this->changes() ->where('changes.id', '<=', $change->id) ->orderBy('changes.id', 'asc') ->get(); }
[ "private", "function", "previousChanges", "(", "Change", "$", "change", ")", "{", "return", "$", "this", "->", "changes", "(", ")", "->", "where", "(", "'changes.id'", ",", "'<='", ",", "$", "change", "->", "id", ")", "->", "orderBy", "(", "'changes.id'"...
Get the list of pervious changes of this model, storing it to reduce future lookups @param Change $change @return Collection
[ "Get", "the", "list", "of", "pervious", "changes", "of", "this", "model", "storing", "it", "to", "reduce", "future", "lookups" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Models/Traits/Loggable.php#L192-L199
30,855
BKWLD/decoy
classes/Input/EncodingProviders/EncodingProvider.php
EncodingProvider.mergeConfigWithDefaults
protected function mergeConfigWithDefaults($preset) { // Get the preset settings if (!$settings = Config::get('decoy.encode.presets.'.$preset.'.settings')) { throw new Exception('Encoding preset not found: '.$preset); } // If the settings are an assoc array, then there i...
php
protected function mergeConfigWithDefaults($preset) { // Get the preset settings if (!$settings = Config::get('decoy.encode.presets.'.$preset.'.settings')) { throw new Exception('Encoding preset not found: '.$preset); } // If the settings are an assoc array, then there i...
[ "protected", "function", "mergeConfigWithDefaults", "(", "$", "preset", ")", "{", "// Get the preset settings", "if", "(", "!", "$", "settings", "=", "Config", "::", "get", "(", "'decoy.encode.presets.'", ".", "$", "preset", ".", "'.settings'", ")", ")", "{", ...
Update the default configwith the user config @param string $preset @return array @throws Exception
[ "Update", "the", "default", "configwith", "the", "user", "config" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Input/EncodingProviders/EncodingProvider.php#L77-L94
30,856
BKWLD/decoy
classes/Fields/Image.php
Image.applyRules
protected function applyRules() { // Check if there are rules for this field $rules_key = 'images.' . ($this->name ?: 'default'); if (!$rules = Former::getRules($rules_key)) { return; } // If there already is an image, drop the forced requirement if ($thi...
php
protected function applyRules() { // Check if there are rules for this field $rules_key = 'images.' . ($this->name ?: 'default'); if (!$rules = Former::getRules($rules_key)) { return; } // If there already is an image, drop the forced requirement if ($thi...
[ "protected", "function", "applyRules", "(", ")", "{", "// Check if there are rules for this field", "$", "rules_key", "=", "'images.'", ".", "(", "$", "this", "->", "name", "?", ":", "'default'", ")", ";", "if", "(", "!", "$", "rules", "=", "Former", "::", ...
Apply validation rules @return void
[ "Apply", "validation", "rules" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Fields/Image.php#L84-L101
30,857
BKWLD/decoy
classes/Fields/Image.php
Image.showErrors
public function showErrors() { $key = sprintf('images.%s.file', $this->inputId()); if (session('errors') && ($error = session('errors')->first($key))) { $this->help($error); $this->group->addClass('has-error'); } }
php
public function showErrors() { $key = sprintf('images.%s.file', $this->inputId()); if (session('errors') && ($error = session('errors')->first($key))) { $this->help($error); $this->group->addClass('has-error'); } }
[ "public", "function", "showErrors", "(", ")", "{", "$", "key", "=", "sprintf", "(", "'images.%s.file'", ",", "$", "this", "->", "inputId", "(", ")", ")", ";", "if", "(", "session", "(", "'errors'", ")", "&&", "(", "$", "error", "=", "session", "(", ...
Show errors that will have been stored on the `file` proeperty @return void
[ "Show", "errors", "that", "will", "have", "been", "stored", "on", "the", "file", "proeperty" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Fields/Image.php#L108-L115
30,858
BKWLD/decoy
classes/Fields/Image.php
Image.wrapAndRender
public function wrapAndRender() { // Get additional UI first so it can modify the normal form-group UI. $html = $this->renderEditor(); // Add the aspect ratio choice $this->group->dataAspectRatio($this->ratio ?: false); // Set errors $this->showErrors(); //...
php
public function wrapAndRender() { // Get additional UI first so it can modify the normal form-group UI. $html = $this->renderEditor(); // Add the aspect ratio choice $this->group->dataAspectRatio($this->ratio ?: false); // Set errors $this->showErrors(); //...
[ "public", "function", "wrapAndRender", "(", ")", "{", "// Get additional UI first so it can modify the normal form-group UI.", "$", "html", "=", "$", "this", "->", "renderEditor", "(", ")", ";", "// Add the aspect ratio choice", "$", "this", "->", "group", "->", "dataAs...
Prints out the field, wrapped in its group. Additional review UI is tacked on here. @return string
[ "Prints", "out", "the", "field", "wrapped", "in", "its", "group", ".", "Additional", "review", "UI", "is", "tacked", "on", "here", "." ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Fields/Image.php#L135-L153
30,859
BKWLD/decoy
classes/Fields/Image.php
Image.createHidden
protected function createHidden($name, $value = null) { $field = Former::hidden($this->inputName($name))->class('input-'.$name); if ($value) { if (!is_scalar($value)) { $value = json_encode($value); } $field->forceValue($value); } ...
php
protected function createHidden($name, $value = null) { $field = Former::hidden($this->inputName($name))->class('input-'.$name); if ($value) { if (!is_scalar($value)) { $value = json_encode($value); } $field->forceValue($value); } ...
[ "protected", "function", "createHidden", "(", "$", "name", ",", "$", "value", "=", "null", ")", "{", "$", "field", "=", "Former", "::", "hidden", "(", "$", "this", "->", "inputName", "(", "$", "name", ")", ")", "->", "class", "(", "'input-'", ".", ...
Make a hidden field @param string $name @param string $value @return string
[ "Make", "a", "hidden", "field" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Fields/Image.php#L234-L245
30,860
BKWLD/decoy
classes/Fields/Image.php
Image.inputId
protected function inputId() { // If we're editing an already existing image, return it's Image id if (($image = $this->image()) && $image->id) { return $image->id; } // Otherwise, use the name of the field, which should be unique compared // to other image field...
php
protected function inputId() { // If we're editing an already existing image, return it's Image id if (($image = $this->image()) && $image->id) { return $image->id; } // Otherwise, use the name of the field, which should be unique compared // to other image field...
[ "protected", "function", "inputId", "(", ")", "{", "// If we're editing an already existing image, return it's Image id", "if", "(", "(", "$", "image", "=", "$", "this", "->", "image", "(", ")", ")", "&&", "$", "image", "->", "id", ")", "{", "return", "$", "...
Get the id to use in all inputs for this Image @return string Either a model id or an arbitrary number prefixed by _
[ "Get", "the", "id", "to", "use", "in", "all", "inputs", "for", "this", "Image" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Fields/Image.php#L263-L277
30,861
BKWLD/decoy
classes/Fields/Image.php
Image.forElement
public function forElement(Element $el) { // Add help $this->model($el)->blockhelp($el->help); // Populate the image array with the image instance. This will create an // Image instance from the default value if it doesn't exist. $pop = app('former.populator')->all(); ...
php
public function forElement(Element $el) { // Add help $this->model($el)->blockhelp($el->help); // Populate the image array with the image instance. This will create an // Image instance from the default value if it doesn't exist. $pop = app('former.populator')->all(); ...
[ "public", "function", "forElement", "(", "Element", "$", "el", ")", "{", "// Add help", "$", "this", "->", "model", "(", "$", "el", ")", "->", "blockhelp", "(", "$", "el", "->", "help", ")", ";", "// Populate the image array with the image instance. This will c...
Logic for rendering an Image field for editing Element images @param Element $element @return $this
[ "Logic", "for", "rendering", "an", "Image", "field", "for", "editing", "Element", "images" ]
7a4acfa8e00cdca7ef4d82672a6547bae61f8e73
https://github.com/BKWLD/decoy/blob/7a4acfa8e00cdca7ef4d82672a6547bae61f8e73/classes/Fields/Image.php#L325-L338
30,862
bovigo/callmap
src/main/php/CallMap.php
CallMap.hasResultFor
public function hasResultFor(string $method, int $invocationCount): bool { if (!array_key_exists($method, $this->callMap)) { return false; } if ($this->callMap[$method] instanceof InvocationResults) { return $this->callMap[$method]->hasResultForInvocation($invocation...
php
public function hasResultFor(string $method, int $invocationCount): bool { if (!array_key_exists($method, $this->callMap)) { return false; } if ($this->callMap[$method] instanceof InvocationResults) { return $this->callMap[$method]->hasResultForInvocation($invocation...
[ "public", "function", "hasResultFor", "(", "string", "$", "method", ",", "int", "$", "invocationCount", ")", ":", "bool", "{", "if", "(", "!", "array_key_exists", "(", "$", "method", ",", "$", "this", "->", "callMap", ")", ")", "{", "return", "false", ...
checks whether callmap has a result for the invocation of method @param string $method name of invoked method @param int $invocationCount denotes which nth invocation of the method this is @return bool
[ "checks", "whether", "callmap", "has", "a", "result", "for", "the", "invocation", "of", "method" ]
0dbf2c234469bf18f4cc06d31962b6141923754b
https://github.com/bovigo/callmap/blob/0dbf2c234469bf18f4cc06d31962b6141923754b/src/main/php/CallMap.php#L41-L52
30,863
bovigo/callmap
src/main/php/CallMap.php
CallMap.resultFor
public function resultFor(string $method, array $arguments, int $invocationCount) { if (!isset($this->callMap[$method])) { return null; } if ($this->callMap[$method] instanceof InvocationResults) { $result = $this->callMap[$method]->resultForInvocation($invocationCou...
php
public function resultFor(string $method, array $arguments, int $invocationCount) { if (!isset($this->callMap[$method])) { return null; } if ($this->callMap[$method] instanceof InvocationResults) { $result = $this->callMap[$method]->resultForInvocation($invocationCou...
[ "public", "function", "resultFor", "(", "string", "$", "method", ",", "array", "$", "arguments", ",", "int", "$", "invocationCount", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "callMap", "[", "$", "method", "]", ")", ")", "{", "return...
returns the result for the method invocation done with given arguments @param string $method name of invoked method @param mixed[] $arguments arguments passed for the method call @param int $invocationCount denotes which nth invocation of the method this is @return mixed @throws \Exce...
[ "returns", "the", "result", "for", "the", "method", "invocation", "done", "with", "given", "arguments" ]
0dbf2c234469bf18f4cc06d31962b6141923754b
https://github.com/bovigo/callmap/blob/0dbf2c234469bf18f4cc06d31962b6141923754b/src/main/php/CallMap.php#L63-L80
30,864
bovigo/callmap
src/main/php/NewCallable.php
NewCallable.callMapClass
private static function callMapClass(string $function): \ReflectionClass { if (!isset(self::$functions[$function])) { self::$functions[$function] = self::forkCallMapClass( new \ReflectionFunction($function) ); } return self::$functions[$function];...
php
private static function callMapClass(string $function): \ReflectionClass { if (!isset(self::$functions[$function])) { self::$functions[$function] = self::forkCallMapClass( new \ReflectionFunction($function) ); } return self::$functions[$function];...
[ "private", "static", "function", "callMapClass", "(", "string", "$", "function", ")", ":", "\\", "ReflectionClass", "{", "if", "(", "!", "isset", "(", "self", "::", "$", "functions", "[", "$", "function", "]", ")", ")", "{", "self", "::", "$", "functio...
returns the proxy class for given function @param string $function @return \ReflectionClass
[ "returns", "the", "proxy", "class", "for", "given", "function" ]
0dbf2c234469bf18f4cc06d31962b6141923754b
https://github.com/bovigo/callmap/blob/0dbf2c234469bf18f4cc06d31962b6141923754b/src/main/php/NewCallable.php#L64-L73
30,865
bovigo/callmap
src/main/php/NewCallable.php
NewCallable.forkCallMapClass
private static function forkCallMapClass(\ReflectionFunction $function): \ReflectionClass { try { $compile = self::$compile; $compile(self::createProxyCode($function)); } catch (\ParseError $pe) { throw new ProxyCreationFailure( 'Failure while ...
php
private static function forkCallMapClass(\ReflectionFunction $function): \ReflectionClass { try { $compile = self::$compile; $compile(self::createProxyCode($function)); } catch (\ParseError $pe) { throw new ProxyCreationFailure( 'Failure while ...
[ "private", "static", "function", "forkCallMapClass", "(", "\\", "ReflectionFunction", "$", "function", ")", ":", "\\", "ReflectionClass", "{", "try", "{", "$", "compile", "=", "self", "::", "$", "compile", ";", "$", "compile", "(", "self", "::", "createProxy...
creates a new class from the given function which uses the CallMap trait @param \ReflectionFunction $function @return \ReflectionClass @throws ProxyCreationFailure
[ "creates", "a", "new", "class", "from", "the", "given", "function", "which", "uses", "the", "CallMap", "trait" ]
0dbf2c234469bf18f4cc06d31962b6141923754b
https://github.com/bovigo/callmap/blob/0dbf2c234469bf18f4cc06d31962b6141923754b/src/main/php/NewCallable.php#L90-L104
30,866
gocom/rah_flat
src/Rah/Flat.php
Rah_Flat.import
public function import() { $skin = \Txp::get('\Textpattern\Skin\Skin'); $skin->setNames(array_keys((array)$skin->getUploaded()))->import(true, true); }
php
public function import() { $skin = \Txp::get('\Textpattern\Skin\Skin'); $skin->setNames(array_keys((array)$skin->getUploaded()))->import(true, true); }
[ "public", "function", "import", "(", ")", "{", "$", "skin", "=", "\\", "Txp", "::", "get", "(", "'\\Textpattern\\Skin\\Skin'", ")", ";", "$", "skin", "->", "setNames", "(", "array_keys", "(", "(", "array", ")", "$", "skin", "->", "getUploaded", "(", ")...
Imports themes. @return void
[ "Imports", "themes", "." ]
2af2f68ffa1d65151302032a4bbab0bf4f6503d0
https://github.com/gocom/rah_flat/blob/2af2f68ffa1d65151302032a4bbab0bf4f6503d0/src/Rah/Flat.php#L49-L53
30,867
bovigo/callmap
src/main/php/Verification.php
Verification.wasCalledAtLeastOnce
public function wasCalledAtLeastOnce(): bool { if (count($this->invocations) < 1) { throw new CallAmountViolation(sprintf( '%s was expected to be called at least once,' . ' but was never called.', $this->invocations->name() ...
php
public function wasCalledAtLeastOnce(): bool { if (count($this->invocations) < 1) { throw new CallAmountViolation(sprintf( '%s was expected to be called at least once,' . ' but was never called.', $this->invocations->name() ...
[ "public", "function", "wasCalledAtLeastOnce", "(", ")", ":", "bool", "{", "if", "(", "count", "(", "$", "this", "->", "invocations", ")", "<", "1", ")", "{", "throw", "new", "CallAmountViolation", "(", "sprintf", "(", "'%s was expected to be called at least once...
verifies that the method on the class was called at least once @api @return bool @throws \bovigo\callmap\CallAmountViolation
[ "verifies", "that", "the", "method", "on", "the", "class", "was", "called", "at", "least", "once" ]
0dbf2c234469bf18f4cc06d31962b6141923754b
https://github.com/bovigo/callmap/blob/0dbf2c234469bf18f4cc06d31962b6141923754b/src/main/php/Verification.php#L63-L74
30,868
bovigo/callmap
src/main/php/Verification.php
Verification.wasCalledOnce
public function wasCalledOnce(): bool { $callsReceived = count($this->invocations); if (1 !== $callsReceived) { throw new CallAmountViolation(sprintf( '%s was expected to be called once, but actually %s.', $this->invocations->name(), ...
php
public function wasCalledOnce(): bool { $callsReceived = count($this->invocations); if (1 !== $callsReceived) { throw new CallAmountViolation(sprintf( '%s was expected to be called once, but actually %s.', $this->invocations->name(), ...
[ "public", "function", "wasCalledOnce", "(", ")", ":", "bool", "{", "$", "callsReceived", "=", "count", "(", "$", "this", "->", "invocations", ")", ";", "if", "(", "1", "!==", "$", "callsReceived", ")", "{", "throw", "new", "CallAmountViolation", "(", "sp...
verifies that the method on the class was called exactly once @api @return bool @throws \bovigo\callmap\CallAmountViolation
[ "verifies", "that", "the", "method", "on", "the", "class", "was", "called", "exactly", "once" ]
0dbf2c234469bf18f4cc06d31962b6141923754b
https://github.com/bovigo/callmap/blob/0dbf2c234469bf18f4cc06d31962b6141923754b/src/main/php/Verification.php#L106-L121
30,869
bovigo/callmap
src/main/php/Verification.php
Verification.wasNeverCalled
public function wasNeverCalled(): bool { if (count($this->invocations) > 0) { throw new CallAmountViolation(sprintf( '%s was not expected to be called,' . ' but actually called %d time(s).', $this->invocations->name(), ...
php
public function wasNeverCalled(): bool { if (count($this->invocations) > 0) { throw new CallAmountViolation(sprintf( '%s was not expected to be called,' . ' but actually called %d time(s).', $this->invocations->name(), ...
[ "public", "function", "wasNeverCalled", "(", ")", ":", "bool", "{", "if", "(", "count", "(", "$", "this", "->", "invocations", ")", ">", "0", ")", "{", "throw", "new", "CallAmountViolation", "(", "sprintf", "(", "'%s was not expected to be called,'", ".", "'...
verifies that the method on the class was never called @api @return bool @throws \bovigo\callmap\CallAmountViolation
[ "verifies", "that", "the", "method", "on", "the", "class", "was", "never", "called" ]
0dbf2c234469bf18f4cc06d31962b6141923754b
https://github.com/bovigo/callmap/blob/0dbf2c234469bf18f4cc06d31962b6141923754b/src/main/php/Verification.php#L153-L165
30,870
bovigo/callmap
src/main/php/Verification.php
Verification.receivedNothing
public function receivedNothing(int $invocation = 1): bool { $received = $this->invocations->argumentsOf($invocation); if (count($received) === 0) { return true; } throw new ArgumentMismatch(sprintf( 'Argument count for invocation #%d of %s is too' ...
php
public function receivedNothing(int $invocation = 1): bool { $received = $this->invocations->argumentsOf($invocation); if (count($received) === 0) { return true; } throw new ArgumentMismatch(sprintf( 'Argument count for invocation #%d of %s is too' ...
[ "public", "function", "receivedNothing", "(", "int", "$", "invocation", "=", "1", ")", ":", "bool", "{", "$", "received", "=", "$", "this", "->", "invocations", "->", "argumentsOf", "(", "$", "invocation", ")", ";", "if", "(", "count", "(", "$", "recei...
verifies that the method received nothing on the given invocation @api @param int $invocation optional nth invocation to check, defaults to 1 aka first invocation @return bool @throws \bovigo\callmap\ArgumentMismatch
[ "verifies", "that", "the", "method", "received", "nothing", "on", "the", "given", "invocation" ]
0dbf2c234469bf18f4cc06d31962b6141923754b
https://github.com/bovigo/callmap/blob/0dbf2c234469bf18f4cc06d31962b6141923754b/src/main/php/Verification.php#L175-L189
30,871
bovigo/callmap
src/main/php/Verification.php
Verification.verifyArgs
private function verifyArgs(int $invocation, array $expected): bool { $received = $this->invocations->argumentsOf($invocation); if (count($received) < count($expected)) { throw new ArgumentMismatch(sprintf( 'Argument count for invocation #%d of %s is too' ...
php
private function verifyArgs(int $invocation, array $expected): bool { $received = $this->invocations->argumentsOf($invocation); if (count($received) < count($expected)) { throw new ArgumentMismatch(sprintf( 'Argument count for invocation #%d of %s is too' ...
[ "private", "function", "verifyArgs", "(", "int", "$", "invocation", ",", "array", "$", "expected", ")", ":", "bool", "{", "$", "received", "=", "$", "this", "->", "invocations", "->", "argumentsOf", "(", "$", "invocation", ")", ";", "if", "(", "count", ...
verifies arguments of given invocation with the expected constraints If a constraint is not an instance of PHPUnit\Framework\Constraint\Constraint it will automatically use PHPUnit\Framework\Constraint\IsEqual. @param int $invocation number of invocation to check @param array $expected constraints which d...
[ "verifies", "arguments", "of", "given", "invocation", "with", "the", "expected", "constraints" ]
0dbf2c234469bf18f4cc06d31962b6141923754b
https://github.com/bovigo/callmap/blob/0dbf2c234469bf18f4cc06d31962b6141923754b/src/main/php/Verification.php#L233-L263
30,872
bovigo/callmap
src/main/php/Verification.php
Verification.evaluate
private function evaluate($constraint, $received, string $description): bool { if (function_exists('bovigo\assert\assertThat')) { return \bovigo\assert\assertThat( $received, $this->predicateFor($constraint), $description );...
php
private function evaluate($constraint, $received, string $description): bool { if (function_exists('bovigo\assert\assertThat')) { return \bovigo\assert\assertThat( $received, $this->predicateFor($constraint), $description );...
[ "private", "function", "evaluate", "(", "$", "constraint", ",", "$", "received", ",", "string", "$", "description", ")", ":", "bool", "{", "if", "(", "function_exists", "(", "'bovigo\\assert\\assertThat'", ")", ")", "{", "return", "\\", "bovigo", "\\", "asse...
evaluates given constraint given received argument @param mixed|\bovigo\assert\predicate\Predicate|\PHPUnit\Framework\Constraint\Constraint $constraint constraint for argument @param mixed $received actually received argument @param string ...
[ "evaluates", "given", "constraint", "given", "received", "argument" ]
0dbf2c234469bf18f4cc06d31962b6141923754b
https://github.com/bovigo/callmap/blob/0dbf2c234469bf18f4cc06d31962b6141923754b/src/main/php/Verification.php#L274-L293
30,873
bovigo/callmap
src/main/php/Verification.php
Verification.predicateFor
private function predicateFor($constraint): \bovigo\assert\predicate\Predicate { if ($constraint instanceof \PHPUnit\Framework\Constraint\Constraint) { return new \bovigo\assert\phpunit\ConstraintAdapter($constraint); } if ($constraint instanceof \bovigo\assert\predicate\Predica...
php
private function predicateFor($constraint): \bovigo\assert\predicate\Predicate { if ($constraint instanceof \PHPUnit\Framework\Constraint\Constraint) { return new \bovigo\assert\phpunit\ConstraintAdapter($constraint); } if ($constraint instanceof \bovigo\assert\predicate\Predica...
[ "private", "function", "predicateFor", "(", "$", "constraint", ")", ":", "\\", "bovigo", "\\", "assert", "\\", "predicate", "\\", "Predicate", "{", "if", "(", "$", "constraint", "instanceof", "\\", "PHPUnit", "\\", "Framework", "\\", "Constraint", "\\", "Con...
creates precicate for given constraint @param mixed|\bovigo\assert\predicate\Predicate|\PHPUnit\Framework\Constraint\Constraint $constraint @return \bovigo\assert\predicate\Predicate
[ "creates", "precicate", "for", "given", "constraint" ]
0dbf2c234469bf18f4cc06d31962b6141923754b
https://github.com/bovigo/callmap/blob/0dbf2c234469bf18f4cc06d31962b6141923754b/src/main/php/Verification.php#L301-L312
30,874
bovigo/callmap
src/main/php/Verification.php
Verification.evaluateWithPhpUnit
protected function evaluateWithPhpUnit($constraint, $received, string $description): bool { if ($constraint instanceof \PHPUnit\Framework\Constraint\Constraint) { return $constraint->evaluate($received, $description); } return (new \PHPUnit\Framework\Constraint\IsEqual($constrai...
php
protected function evaluateWithPhpUnit($constraint, $received, string $description): bool { if ($constraint instanceof \PHPUnit\Framework\Constraint\Constraint) { return $constraint->evaluate($received, $description); } return (new \PHPUnit\Framework\Constraint\IsEqual($constrai...
[ "protected", "function", "evaluateWithPhpUnit", "(", "$", "constraint", ",", "$", "received", ",", "string", "$", "description", ")", ":", "bool", "{", "if", "(", "$", "constraint", "instanceof", "\\", "PHPUnit", "\\", "Framework", "\\", "Constraint", "\\", ...
evaluates given constraint using PHPUnit If given constraint is not a instance of \PHPUnit\Framework\Constraint\Constraint it will be wrapped with \PHPUnit\Framework\Constraint\IsEqual. @param mixed|\PHPUnit\Framework\Constraint\Constraint $constraint constraint for argument @param mixed ...
[ "evaluates", "given", "constraint", "using", "PHPUnit" ]
0dbf2c234469bf18f4cc06d31962b6141923754b
https://github.com/bovigo/callmap/blob/0dbf2c234469bf18f4cc06d31962b6141923754b/src/main/php/Verification.php#L325-L333
30,875
dshanske/parse-this
includes/class-parse-this-mf2.php
Parse_This_MF2.is_type
public static function is_type( $mf, $type ) { return is_array( $mf ) && ! empty( $mf['type'] ) && is_array( $mf['type'] ) && in_array( $type, $mf['type'], true ); }
php
public static function is_type( $mf, $type ) { return is_array( $mf ) && ! empty( $mf['type'] ) && is_array( $mf['type'] ) && in_array( $type, $mf['type'], true ); }
[ "public", "static", "function", "is_type", "(", "$", "mf", ",", "$", "type", ")", "{", "return", "is_array", "(", "$", "mf", ")", "&&", "!", "empty", "(", "$", "mf", "[", "'type'", "]", ")", "&&", "is_array", "(", "$", "mf", "[", "'type'", "]", ...
is this what type @param array $mf Parsed Microformats Array @param string $type Type @return bool
[ "is", "this", "what", "type" ]
722154e91fe47bca185256bd6388324de7bea012
https://github.com/dshanske/parse-this/blob/722154e91fe47bca185256bd6388324de7bea012/includes/class-parse-this-mf2.php#L18-L20
30,876
dshanske/parse-this
includes/class-parse-this-mf2.php
Parse_This_MF2.get_prop
public static function get_prop( array $mf, $propname, $fallback = null ) { return self::get_plaintext( $mf, $propname, $fallback ); }
php
public static function get_prop( array $mf, $propname, $fallback = null ) { return self::get_plaintext( $mf, $propname, $fallback ); }
[ "public", "static", "function", "get_prop", "(", "array", "$", "mf", ",", "$", "propname", ",", "$", "fallback", "=", "null", ")", "{", "return", "self", "::", "get_plaintext", "(", "$", "mf", ",", "$", "propname", ",", "$", "fallback", ")", ";", "}"...
shortcut for getPlaintext. @deprecated use getPlaintext from now on @param array $mf @param $propname @param null|string $fallback @return mixed|null
[ "shortcut", "for", "getPlaintext", "." ]
722154e91fe47bca185256bd6388324de7bea012
https://github.com/dshanske/parse-this/blob/722154e91fe47bca185256bd6388324de7bea012/includes/class-parse-this-mf2.php#L117-L119
30,877
dshanske/parse-this
includes/class-parse-this-mf2.php
Parse_This_MF2.get_prop_array
public static function get_prop_array( array $mf, $properties, $args = null ) { if ( ! self::is_microformat( $mf ) ) { return array(); } $data = array(); foreach ( $properties as $p ) { if ( array_key_exists( $p, $mf['properties'] ) ) { foreach ( $mf['properties'][ $p ] as $v ) { if ( self::is_m...
php
public static function get_prop_array( array $mf, $properties, $args = null ) { if ( ! self::is_microformat( $mf ) ) { return array(); } $data = array(); foreach ( $properties as $p ) { if ( array_key_exists( $p, $mf['properties'] ) ) { foreach ( $mf['properties'][ $p ] as $v ) { if ( self::is_m...
[ "public", "static", "function", "get_prop_array", "(", "array", "$", "mf", ",", "$", "properties", ",", "$", "args", "=", "null", ")", "{", "if", "(", "!", "self", "::", "is_microformat", "(", "$", "mf", ")", ")", "{", "return", "array", "(", ")", ...
Return an array of properties, and may contain plaintext content @param array $mf @param array $properties @return null|array
[ "Return", "an", "array", "of", "properties", "and", "may", "contain", "plaintext", "content" ]
722154e91fe47bca185256bd6388324de7bea012
https://github.com/dshanske/parse-this/blob/722154e91fe47bca185256bd6388324de7bea012/includes/class-parse-this-mf2.php#L173-L195
30,878
dshanske/parse-this
includes/class-parse-this-mf2.php
Parse_This_MF2.get_datetime_property
public static function get_datetime_property( $name, array $mf, $ensurevalid = false, $fallback = null ) { $compliment = 'published' === $name ? 'updated' : 'published'; if ( self::has_prop( $mf, $name ) ) { $return = self::get_prop( $mf, $name ); } elseif ( self::has_prop( $mf, $compliment ) ) { $return = se...
php
public static function get_datetime_property( $name, array $mf, $ensurevalid = false, $fallback = null ) { $compliment = 'published' === $name ? 'updated' : 'published'; if ( self::has_prop( $mf, $name ) ) { $return = self::get_prop( $mf, $name ); } elseif ( self::has_prop( $mf, $compliment ) ) { $return = se...
[ "public", "static", "function", "get_datetime_property", "(", "$", "name", ",", "array", "$", "mf", ",", "$", "ensurevalid", "=", "false", ",", "$", "fallback", "=", "null", ")", "{", "$", "compliment", "=", "'published'", "===", "$", "name", "?", "'upda...
Gets the DateTime properties including published or updated, depending on params. @param $name string updated or published @param array $mf @param bool $ensurevalid @param null|string $fallback @return mixed|null
[ "Gets", "the", "DateTime", "properties", "including", "published", "or", "updated", "depending", "on", "params", "." ]
722154e91fe47bca185256bd6388324de7bea012
https://github.com/dshanske/parse-this/blob/722154e91fe47bca185256bd6388324de7bea012/includes/class-parse-this-mf2.php#L282-L298
30,879
dshanske/parse-this
includes/class-parse-this-mf2.php
Parse_This_MF2.parse_url
public static function parse_url( $url ) { $r = wp_parse_url( $url ); $r['pathname'] = empty( $r['path'] ) ? '/' : $r['path']; return $r; }
php
public static function parse_url( $url ) { $r = wp_parse_url( $url ); $r['pathname'] = empty( $r['path'] ) ? '/' : $r['path']; return $r; }
[ "public", "static", "function", "parse_url", "(", "$", "url", ")", "{", "$", "r", "=", "wp_parse_url", "(", "$", "url", ")", ";", "$", "r", "[", "'pathname'", "]", "=", "empty", "(", "$", "r", "[", "'path'", "]", ")", "?", "'/'", ":", "$", "r",...
Returns array per parse_url standard with pathname key added. @param $url @return mixed @link http://php.net/manual/en/function.parse-url.php
[ "Returns", "array", "per", "parse_url", "standard", "with", "pathname", "key", "added", "." ]
722154e91fe47bca185256bd6388324de7bea012
https://github.com/dshanske/parse-this/blob/722154e91fe47bca185256bd6388324de7bea012/includes/class-parse-this-mf2.php#L380-L384
30,880
dshanske/parse-this
includes/class-parse-this-mf2.php
Parse_This_MF2.normalize_feed
public static function normalize_feed( $input ) { $hcard = array(); foreach ( $input['items'] as $key => $item ) { if ( self::is_type( $item, 'h-card' ) ) { $hcard = $item; unset( $input['items'][ $key ] ); break; } } if ( 1 === count( $input['items'] ) ) { if ( self::has_prop( $input['item...
php
public static function normalize_feed( $input ) { $hcard = array(); foreach ( $input['items'] as $key => $item ) { if ( self::is_type( $item, 'h-card' ) ) { $hcard = $item; unset( $input['items'][ $key ] ); break; } } if ( 1 === count( $input['items'] ) ) { if ( self::has_prop( $input['item...
[ "public", "static", "function", "normalize_feed", "(", "$", "input", ")", "{", "$", "hcard", "=", "array", "(", ")", ";", "foreach", "(", "$", "input", "[", "'items'", "]", "as", "$", "key", "=>", "$", "item", ")", "{", "if", "(", "self", "::", "...
Tries to normalize a set of items into a feed
[ "Tries", "to", "normalize", "a", "set", "of", "items", "into", "a", "feed" ]
722154e91fe47bca185256bd6388324de7bea012
https://github.com/dshanske/parse-this/blob/722154e91fe47bca185256bd6388324de7bea012/includes/class-parse-this-mf2.php#L610-L636
30,881
GrahamCampbell/Laravel-TestBench-Core
src/HelperTrait.php
HelperTrait.assertInArray
public static function assertInArray($needle, array $haystack, string $msg = '') { if ($msg === '') { $msg = "Expected the array to contain the element '$needle'."; } static::assertTrue(in_array($needle, $haystack, true), $msg); }
php
public static function assertInArray($needle, array $haystack, string $msg = '') { if ($msg === '') { $msg = "Expected the array to contain the element '$needle'."; } static::assertTrue(in_array($needle, $haystack, true), $msg); }
[ "public", "static", "function", "assertInArray", "(", "$", "needle", ",", "array", "$", "haystack", ",", "string", "$", "msg", "=", "''", ")", "{", "if", "(", "$", "msg", "===", "''", ")", "{", "$", "msg", "=", "\"Expected the array to contain the element ...
Assert that the element exists in the array. @param mixed $needle @param array $haystack @param string $msg @return void
[ "Assert", "that", "the", "element", "exists", "in", "the", "array", "." ]
138218735a65f4532d6c4242a44ffa6c591bca09
https://github.com/GrahamCampbell/Laravel-TestBench-Core/blob/138218735a65f4532d6c4242a44ffa6c591bca09/src/HelperTrait.php#L35-L42
30,882
GrahamCampbell/Laravel-TestBench-Core
src/HelperTrait.php
HelperTrait.assertMethodExists
public static function assertMethodExists(string $method, string $class, string $msg = '') { if ($msg === '') { $msg = "Expected the class '$class' to have method '$method'."; } static::assertTrue(method_exists($class, $method), $msg); }
php
public static function assertMethodExists(string $method, string $class, string $msg = '') { if ($msg === '') { $msg = "Expected the class '$class' to have method '$method'."; } static::assertTrue(method_exists($class, $method), $msg); }
[ "public", "static", "function", "assertMethodExists", "(", "string", "$", "method", ",", "string", "$", "class", ",", "string", "$", "msg", "=", "''", ")", "{", "if", "(", "$", "msg", "===", "''", ")", "{", "$", "msg", "=", "\"Expected the class '$class'...
Assert that the specified method exists on the class. @param string $method @param string $class @param string $msg @return void
[ "Assert", "that", "the", "specified", "method", "exists", "on", "the", "class", "." ]
138218735a65f4532d6c4242a44ffa6c591bca09
https://github.com/GrahamCampbell/Laravel-TestBench-Core/blob/138218735a65f4532d6c4242a44ffa6c591bca09/src/HelperTrait.php#L53-L60
30,883
GrahamCampbell/Laravel-TestBench-Core
src/HelperTrait.php
HelperTrait.assertInJson
public static function assertInJson(string $needle, array $haystack, string $msg = '') { if ($msg === '') { $msg = "Expected the array to contain the element '$needle'."; } $array = json_decode($needle, true); if (json_last_error() !== JSON_ERROR_NONE) { thr...
php
public static function assertInJson(string $needle, array $haystack, string $msg = '') { if ($msg === '') { $msg = "Expected the array to contain the element '$needle'."; } $array = json_decode($needle, true); if (json_last_error() !== JSON_ERROR_NONE) { thr...
[ "public", "static", "function", "assertInJson", "(", "string", "$", "needle", ",", "array", "$", "haystack", ",", "string", "$", "msg", "=", "''", ")", "{", "if", "(", "$", "msg", "===", "''", ")", "{", "$", "msg", "=", "\"Expected the array to contain t...
Assert that the element exists in the json. @param string $needle @param array $haystack @param string $msg @throws \InvalidArgumentException @return void
[ "Assert", "that", "the", "element", "exists", "in", "the", "json", "." ]
138218735a65f4532d6c4242a44ffa6c591bca09
https://github.com/GrahamCampbell/Laravel-TestBench-Core/blob/138218735a65f4532d6c4242a44ffa6c591bca09/src/HelperTrait.php#L73-L86
30,884
QuickenLoans/mcp-cache
src/Item/Item.php
Item.data
public function data(TimePoint $now = null) { if ($now && $this->isExpired($now)) { return null; } return $this->data; }
php
public function data(TimePoint $now = null) { if ($now && $this->isExpired($now)) { return null; } return $this->data; }
[ "public", "function", "data", "(", "TimePoint", "$", "now", "=", "null", ")", "{", "if", "(", "$", "now", "&&", "$", "this", "->", "isExpired", "(", "$", "now", ")", ")", "{", "return", "null", ";", "}", "return", "$", "this", "->", "data", ";", ...
If provided, the data will be checked for expiration. @param TimePoint|null $now @return mixed
[ "If", "provided", "the", "data", "will", "be", "checked", "for", "expiration", "." ]
2dba32705f85452cb9099e35e0241a6c7a98b717
https://github.com/QuickenLoans/mcp-cache/blob/2dba32705f85452cb9099e35e0241a6c7a98b717/src/Item/Item.php#L67-L74
30,885
GrahamCampbell/Laravel-TestBench-Core
src/MockeryTrait.php
MockeryTrait.tearDownMockery
public function tearDownMockery() { if (class_exists(Mockery::class, false)) { $container = Mockery::getContainer(); if ($container) { $this->addToAssertionCount($container->mockery_getExpectationCount()); } Mockery::close(); } }
php
public function tearDownMockery() { if (class_exists(Mockery::class, false)) { $container = Mockery::getContainer(); if ($container) { $this->addToAssertionCount($container->mockery_getExpectationCount()); } Mockery::close(); } }
[ "public", "function", "tearDownMockery", "(", ")", "{", "if", "(", "class_exists", "(", "Mockery", "::", "class", ",", "false", ")", ")", "{", "$", "container", "=", "Mockery", "::", "getContainer", "(", ")", ";", "if", "(", "$", "container", ")", "{",...
Tear down mockery. @after @return void
[ "Tear", "down", "mockery", "." ]
138218735a65f4532d6c4242a44ffa6c591bca09
https://github.com/GrahamCampbell/Laravel-TestBench-Core/blob/138218735a65f4532d6c4242a44ffa6c591bca09/src/MockeryTrait.php#L32-L43
30,886
dshanske/parse-this
includes/class-parse-this-api.php
Parse_This_API.debug
public static function debug() { ?> <div class="wrap"> <h2> <?php esc_html_e( 'Parse This Debugger', 'indieweb-post-kinds' ); ?> </h2> <p> <?php esc_html_e( 'Test the Parse Tools Debugger. You can report sites to the developer for possibly improvement in future', 'parse-this' ); ?> </p> <a...
php
public static function debug() { ?> <div class="wrap"> <h2> <?php esc_html_e( 'Parse This Debugger', 'indieweb-post-kinds' ); ?> </h2> <p> <?php esc_html_e( 'Test the Parse Tools Debugger. You can report sites to the developer for possibly improvement in future', 'parse-this' ); ?> </p> <a...
[ "public", "static", "function", "debug", "(", ")", "{", "?>\n\t\t\t\t<div class=\"wrap\">\n\t\t\t\t\t\t<h2> <?php", "esc_html_e", "(", "'Parse This Debugger'", ",", "'indieweb-post-kinds'", ")", ";", "?> </h2>\n\t\t\t\t\t\t<p> <?php", "esc_html_e", "(", "'Test the Parse Tools Deb...
Generate Debug Tool @access public
[ "Generate", "Debug", "Tool" ]
722154e91fe47bca185256bd6388324de7bea012
https://github.com/dshanske/parse-this/blob/722154e91fe47bca185256bd6388324de7bea012/includes/class-parse-this-api.php#L40-L70
30,887
bovigo/callmap
src/main/php/Invocations.php
Invocations.argumentName
public function argumentName(int $argumentPosition, string $suffix = ''): ?string { if (isset($this->paramNames[$argumentPosition])) { return '$' . $this->paramNames[$argumentPosition] . $suffix; } return null; }
php
public function argumentName(int $argumentPosition, string $suffix = ''): ?string { if (isset($this->paramNames[$argumentPosition])) { return '$' . $this->paramNames[$argumentPosition] . $suffix; } return null; }
[ "public", "function", "argumentName", "(", "int", "$", "argumentPosition", ",", "string", "$", "suffix", "=", "''", ")", ":", "?", "string", "{", "if", "(", "isset", "(", "$", "this", "->", "paramNames", "[", "$", "argumentPosition", "]", ")", ")", "{"...
returns name of argument at requested position Returns null if there is no argument at requested position or the name of that argument is unknown. @param int $argumentPosition @param string $suffix optional string to append after argument name @return string|null
[ "returns", "name", "of", "argument", "at", "requested", "position" ]
0dbf2c234469bf18f4cc06d31962b6141923754b
https://github.com/bovigo/callmap/blob/0dbf2c234469bf18f4cc06d31962b6141923754b/src/main/php/Invocations.php#L85-L92
30,888
bovigo/callmap
src/main/php/Invocations.php
Invocations.argumentsOf
public function argumentsOf(int $invocation = 1): array { if (isset($this->callHistory[$invocation - 1])) { return $this->callHistory[$invocation - 1]; } $totalInvocations = $this->count(); throw new MissingInvocation(sprintf( 'Missing invocation #%d for ...
php
public function argumentsOf(int $invocation = 1): array { if (isset($this->callHistory[$invocation - 1])) { return $this->callHistory[$invocation - 1]; } $totalInvocations = $this->count(); throw new MissingInvocation(sprintf( 'Missing invocation #%d for ...
[ "public", "function", "argumentsOf", "(", "int", "$", "invocation", "=", "1", ")", ":", "array", "{", "if", "(", "isset", "(", "$", "this", "->", "callHistory", "[", "$", "invocation", "-", "1", "]", ")", ")", "{", "return", "$", "this", "->", "cal...
returns the arguments received for a specific invocation @param int $invocation nth invocation to check, defaults to 1 aka first invocation @return mixed[] @throws \bovigo\callmap\MissingInvocation in case no such invocation was received
[ "returns", "the", "arguments", "received", "for", "a", "specific", "invocation" ]
0dbf2c234469bf18f4cc06d31962b6141923754b
https://github.com/bovigo/callmap/blob/0dbf2c234469bf18f4cc06d31962b6141923754b/src/main/php/Invocations.php#L101-L119
30,889
QuickenLoans/mcp-logger
src/Message/MessageFactory.php
MessageFactory.setDefaultProperty
public function setDefaultProperty(string $name, $value): void { $this->validateProperty($name, $value); $this->logProperties[$name] = $value; }
php
public function setDefaultProperty(string $name, $value): void { $this->validateProperty($name, $value); $this->logProperties[$name] = $value; }
[ "public", "function", "setDefaultProperty", "(", "string", "$", "name", ",", "$", "value", ")", ":", "void", "{", "$", "this", "->", "validateProperty", "(", "$", "name", ",", "$", "value", ")", ";", "$", "this", "->", "logProperties", "[", "$", "name"...
Set a property that will be attached to all log messages. @param string $name @param mixed $value @return void
[ "Set", "a", "property", "that", "will", "be", "attached", "to", "all", "log", "messages", "." ]
ec0960fc32de1a4c583b2447b99d0ef8c801f1ae
https://github.com/QuickenLoans/mcp-logger/blob/ec0960fc32de1a4c583b2447b99d0ef8c801f1ae/src/Message/MessageFactory.php#L118-L123
30,890
QuickenLoans/mcp-logger
src/Message/MessageFactory.php
MessageFactory.buildMessage
public function buildMessage($level, string $message, array $context = []): MessageInterface { $level = $this->validateSeverity($level); $data = [ MessageInterface::CONTEXT => [] ]; // Append message defaults to this payload $data = $this->consume($data, $this->l...
php
public function buildMessage($level, string $message, array $context = []): MessageInterface { $level = $this->validateSeverity($level); $data = [ MessageInterface::CONTEXT => [] ]; // Append message defaults to this payload $data = $this->consume($data, $this->l...
[ "public", "function", "buildMessage", "(", "$", "level", ",", "string", "$", "message", ",", "array", "$", "context", "=", "[", "]", ")", ":", "MessageInterface", "{", "$", "level", "=", "$", "this", "->", "validateSeverity", "(", "$", "level", ")", ";...
Sanitize and instantiate a Message @param mixed $level @param string $message @param array $context @return Message
[ "Sanitize", "and", "instantiate", "a", "Message" ]
ec0960fc32de1a4c583b2447b99d0ef8c801f1ae
https://github.com/QuickenLoans/mcp-logger/blob/ec0960fc32de1a4c583b2447b99d0ef8c801f1ae/src/Message/MessageFactory.php#L163-L177
30,891
QuickenLoans/mcp-logger
src/Message/MessageFactory.php
MessageFactory.consume
private function consume(array $data, array $context) { foreach ($context as $property => $value) { $sanitized = $this->validateValue($value); if ($sanitized === null) { continue; } if (in_array($property, [MessageInterface::SERVER_IP, Message...
php
private function consume(array $data, array $context) { foreach ($context as $property => $value) { $sanitized = $this->validateValue($value); if ($sanitized === null) { continue; } if (in_array($property, [MessageInterface::SERVER_IP, Message...
[ "private", "function", "consume", "(", "array", "$", "data", ",", "array", "$", "context", ")", "{", "foreach", "(", "$", "context", "as", "$", "property", "=>", "$", "value", ")", "{", "$", "sanitized", "=", "$", "this", "->", "validateValue", "(", ...
Parse the provided context data and add it to the message payload @param mixed[] $data @param mixed[] $context @return mixed[]
[ "Parse", "the", "provided", "context", "data", "and", "add", "it", "to", "the", "message", "payload" ]
ec0960fc32de1a4c583b2447b99d0ef8c801f1ae
https://github.com/QuickenLoans/mcp-logger/blob/ec0960fc32de1a4c583b2447b99d0ef8c801f1ae/src/Message/MessageFactory.php#L187-L213
30,892
QuickenLoans/mcp-logger
src/Transformer/QLLogSeverityTransformer.php
QLLogSeverityTransformer.convertLogLevelFromPSRToQL
private function convertLogLevelFromPSRToQL($severity) { // Equal mappings if ($severity === LogLevel::DEBUG) { return 'debug'; } elseif ($severity === LogLevel::INFO) { return 'info'; } elseif ($severity === LogLevel::WARNING) { return 'warn'; ...
php
private function convertLogLevelFromPSRToQL($severity) { // Equal mappings if ($severity === LogLevel::DEBUG) { return 'debug'; } elseif ($severity === LogLevel::INFO) { return 'info'; } elseif ($severity === LogLevel::WARNING) { return 'warn'; ...
[ "private", "function", "convertLogLevelFromPSRToQL", "(", "$", "severity", ")", "{", "// Equal mappings", "if", "(", "$", "severity", "===", "LogLevel", "::", "DEBUG", ")", "{", "return", "'debug'", ";", "}", "elseif", "(", "$", "severity", "===", "LogLevel", ...
Translate a PRS-3 log level to QL log level Not used: - 'audit' @param string $severity @return string
[ "Translate", "a", "PRS", "-", "3", "log", "level", "to", "QL", "log", "level" ]
ec0960fc32de1a4c583b2447b99d0ef8c801f1ae
https://github.com/QuickenLoans/mcp-logger/blob/ec0960fc32de1a4c583b2447b99d0ef8c801f1ae/src/Transformer/QLLogSeverityTransformer.php#L41-L73
30,893
bovigo/callmap
src/main/php/ClassProxyMethodHandler.php
ClassProxyMethodHandler.returns
public function returns(array $callMap): ClassProxy { foreach (array_keys($callMap) as $method) { if (!isset($this->_allowedMethods[$method]) || isset($this->_voidMethods[$method])) { throw new \InvalidArgumentException( $this->canNot('map', $method) ...
php
public function returns(array $callMap): ClassProxy { foreach (array_keys($callMap) as $method) { if (!isset($this->_allowedMethods[$method]) || isset($this->_voidMethods[$method])) { throw new \InvalidArgumentException( $this->canNot('map', $method) ...
[ "public", "function", "returns", "(", "array", "$", "callMap", ")", ":", "ClassProxy", "{", "foreach", "(", "array_keys", "(", "$", "callMap", ")", "as", "$", "method", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_allowedMethods", "[", ...
sets the call map with return values @api @since 3.2.0 @param array $callMap @return ClassProxy @throws \InvalidArgumentException in case any of the mapped methods does not exist or is not applicable
[ "sets", "the", "call", "map", "with", "return", "values" ]
0dbf2c234469bf18f4cc06d31962b6141923754b
https://github.com/bovigo/callmap/blob/0dbf2c234469bf18f4cc06d31962b6141923754b/src/main/php/ClassProxyMethodHandler.php#L56-L68
30,894
bovigo/callmap
src/main/php/ClassProxyMethodHandler.php
ClassProxyMethodHandler.handleMethodCall
protected function handleMethodCall(string $method, array $arguments, bool $shouldReturnSelf) { $invocation = $this->invocations($method)->recordCall($arguments); if (null !== $this->callMap && $this->callMap->hasResultFor($method, $invocation)) { return $this->callMap->resultFor($method...
php
protected function handleMethodCall(string $method, array $arguments, bool $shouldReturnSelf) { $invocation = $this->invocations($method)->recordCall($arguments); if (null !== $this->callMap && $this->callMap->hasResultFor($method, $invocation)) { return $this->callMap->resultFor($method...
[ "protected", "function", "handleMethodCall", "(", "string", "$", "method", ",", "array", "$", "arguments", ",", "bool", "$", "shouldReturnSelf", ")", "{", "$", "invocation", "=", "$", "this", "->", "invocations", "(", "$", "method", ")", "->", "recordCall", ...
handles actual method calls @param string $method actually called method @param mixed[] $arguments list of given arguments for methods @param bool $shouldReturnSelf whether the return value should be the instance itself @return mixed @throws \Exception
[ "handles", "actual", "method", "calls" ]
0dbf2c234469bf18f4cc06d31962b6141923754b
https://github.com/bovigo/callmap/blob/0dbf2c234469bf18f4cc06d31962b6141923754b/src/main/php/ClassProxyMethodHandler.php#L79-L99
30,895
bovigo/callmap
src/main/php/ClassProxyMethodHandler.php
ClassProxyMethodHandler.invocations
public function invocations(string $method): Invocations { if (empty($method)) { throw new \InvalidArgumentException( 'Please provide a method name to retrieve invocations for.' ); } if (!isset($this->_allowedMethods[$method])) { throw...
php
public function invocations(string $method): Invocations { if (empty($method)) { throw new \InvalidArgumentException( 'Please provide a method name to retrieve invocations for.' ); } if (!isset($this->_allowedMethods[$method])) { throw...
[ "public", "function", "invocations", "(", "string", "$", "method", ")", ":", "Invocations", "{", "if", "(", "empty", "(", "$", "method", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'Please provide a method name to retrieve invocations for....
returns recorded invocations for given method @param string $method @return Invocations @throws \InvalidArgumentException in case the method does not exist or is not applicable @since 3.1.0
[ "returns", "recorded", "invocations", "for", "given", "method" ]
0dbf2c234469bf18f4cc06d31962b6141923754b
https://github.com/bovigo/callmap/blob/0dbf2c234469bf18f4cc06d31962b6141923754b/src/main/php/ClassProxyMethodHandler.php#L109-L131
30,896
bovigo/callmap
src/main/php/ClassProxyMethodHandler.php
ClassProxyMethodHandler.canNot
private function canNot(string $message, string $invalidMethod): string { if (isset($this->_voidMethods[$invalidMethod])) { $reason = 'is declared as returning void.'; } elseif (method_exists($this, $invalidMethod)) { $reason = 'is not applicable for mapping.'; } else...
php
private function canNot(string $message, string $invalidMethod): string { if (isset($this->_voidMethods[$invalidMethod])) { $reason = 'is declared as returning void.'; } elseif (method_exists($this, $invalidMethod)) { $reason = 'is not applicable for mapping.'; } else...
[ "private", "function", "canNot", "(", "string", "$", "message", ",", "string", "$", "invalidMethod", ")", ":", "string", "{", "if", "(", "isset", "(", "$", "this", "->", "_voidMethods", "[", "$", "invalidMethod", "]", ")", ")", "{", "$", "reason", "=",...
creates complete error message that invalid method can not be used @param string $message @param string $invalidMethod
[ "creates", "complete", "error", "message", "that", "invalid", "method", "can", "not", "be", "used" ]
0dbf2c234469bf18f4cc06d31962b6141923754b
https://github.com/bovigo/callmap/blob/0dbf2c234469bf18f4cc06d31962b6141923754b/src/main/php/ClassProxyMethodHandler.php#L154-L170
30,897
dshanske/parse-this
includes/class-mf2-post.php
MF2_Post.get_mf2meta
private function get_mf2meta() { $meta = get_post_meta( $this->uid ); if ( ! $meta ) { return array(); } if ( isset( $meta['response'] ) ) { $response = maybe_unserialize( $meta['response'] ); // Retrieve from the old response array and store in new location. if ( ! empty( $response ) ) { $new =...
php
private function get_mf2meta() { $meta = get_post_meta( $this->uid ); if ( ! $meta ) { return array(); } if ( isset( $meta['response'] ) ) { $response = maybe_unserialize( $meta['response'] ); // Retrieve from the old response array and store in new location. if ( ! empty( $response ) ) { $new =...
[ "private", "function", "get_mf2meta", "(", ")", "{", "$", "meta", "=", "get_post_meta", "(", "$", "this", "->", "uid", ")", ";", "if", "(", "!", "$", "meta", ")", "{", "return", "array", "(", ")", ";", "}", "if", "(", "isset", "(", "$", "meta", ...
Sets an array with only the mf2 prefixed meta.
[ "Sets", "an", "array", "with", "only", "the", "mf2", "prefixed", "meta", "." ]
722154e91fe47bca185256bd6388324de7bea012
https://github.com/dshanske/parse-this/blob/722154e91fe47bca185256bd6388324de7bea012/includes/class-mf2-post.php#L221-L282
30,898
dshanske/parse-this
includes/class-mf2-post.php
MF2_Post.fetch
public function fetch( $property ) { // If the property is not set then exit if ( ! $property || ! $this->has_key( $property ) ) { return false; } $return = $this->get( $property ); if ( wp_is_numeric_array( $return ) ) { $return = array_shift( $return ); } // If it is in fact a string it is the pr...
php
public function fetch( $property ) { // If the property is not set then exit if ( ! $property || ! $this->has_key( $property ) ) { return false; } $return = $this->get( $property ); if ( wp_is_numeric_array( $return ) ) { $return = array_shift( $return ); } // If it is in fact a string it is the pr...
[ "public", "function", "fetch", "(", "$", "property", ")", "{", "// If the property is not set then exit", "if", "(", "!", "$", "property", "||", "!", "$", "this", "->", "has_key", "(", "$", "property", ")", ")", "{", "return", "false", ";", "}", "$", "re...
Also will update old posts with new settings
[ "Also", "will", "update", "old", "posts", "with", "new", "settings" ]
722154e91fe47bca185256bd6388324de7bea012
https://github.com/dshanske/parse-this/blob/722154e91fe47bca185256bd6388324de7bea012/includes/class-mf2-post.php#L487-L513
30,899
GrahamCampbell/Laravel-TestBench-Core
src/LaravelTrait.php
LaravelTrait.assertIsInjectable
public function assertIsInjectable(string $name) { $injectable = true; $message = "The class '$name' couldn't be automatically injected."; try { $class = $this->makeInjectableClass($name); $this->assertInstanceOf($name, $class->getInjectedObject()); } catch ...
php
public function assertIsInjectable(string $name) { $injectable = true; $message = "The class '$name' couldn't be automatically injected."; try { $class = $this->makeInjectableClass($name); $this->assertInstanceOf($name, $class->getInjectedObject()); } catch ...
[ "public", "function", "assertIsInjectable", "(", "string", "$", "name", ")", "{", "$", "injectable", "=", "true", ";", "$", "message", "=", "\"The class '$name' couldn't be automatically injected.\"", ";", "try", "{", "$", "class", "=", "$", "this", "->", "makeI...
Assert that a class can be automatically injected. @param string $name @return void
[ "Assert", "that", "a", "class", "can", "be", "automatically", "injected", "." ]
138218735a65f4532d6c4242a44ffa6c591bca09
https://github.com/GrahamCampbell/Laravel-TestBench-Core/blob/138218735a65f4532d6c4242a44ffa6c591bca09/src/LaravelTrait.php#L32-L49