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
partition
stringclasses
1 value
joomlatools/joomlatools-framework-activities
view/activities/json.php
ComActivitiesViewActivitiesJson.setRenderer
public function setRenderer($renderer) { if(!$renderer instanceof ComActivitiesActivityRendererInterface) { if(is_string($renderer) && strpos($renderer, '.') === false ) { $identifier = $this->getIdentifier()->toArray(); $identifier['path'] = array('template', 'helper'); $identifier['name'] = $renderer; $identifier = $this->getIdentifier($identifier); } else $identifier = $this->getIdentifier($renderer); $renderer = $identifier; } $this->_renderer = $renderer; return $this; }
php
public function setRenderer($renderer) { if(!$renderer instanceof ComActivitiesActivityRendererInterface) { if(is_string($renderer) && strpos($renderer, '.') === false ) { $identifier = $this->getIdentifier()->toArray(); $identifier['path'] = array('template', 'helper'); $identifier['name'] = $renderer; $identifier = $this->getIdentifier($identifier); } else $identifier = $this->getIdentifier($renderer); $renderer = $identifier; } $this->_renderer = $renderer; return $this; }
[ "public", "function", "setRenderer", "(", "$", "renderer", ")", "{", "if", "(", "!", "$", "renderer", "instanceof", "ComActivitiesActivityRendererInterface", ")", "{", "if", "(", "is_string", "(", "$", "renderer", ")", "&&", "strpos", "(", "$", "renderer", "...
Set the activity renderer. @param mixed $renderer An activity renderer instance, identifier object or string. @return ComActivitiesViewActivitiesJson
[ "Set", "the", "activity", "renderer", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/view/activities/json.php#L156-L176
train
joomlatools/joomlatools-framework-activities
view/activities/json.php
ComActivitiesViewActivitiesJson._getObjectData
protected function _getObjectData(ComActivitiesActivityObjectInterface $object) { $data = $object->toArray(); // Make sure we get fully qualified URLs. if ($url = $object->getUrl()) { $data['url'] = $this->_getUrl($url); } $attachments = array(); // Handle attachments recursively. foreach ($object->getAttachments() as $attachment) { $attachments[] = $this->_getObjectData($attachment); } $data['attachments'] = $attachments; // Convert date objects to date time strings. foreach (array('published', 'updated') as $property) { $method = 'get' . ucfirst($property); if ($date = $object->$method()) { $data[$property] = $date->format('M d Y H:i:s'); } } foreach ($object as $key => $value) { if ($value instanceof ComActivitiesActivityObjectInterface) { $data[$key] = $this->_getObjectData($value); } if ($value instanceof ComActivitiesActivityMedialinkInterface) { $data[$key] = $this->_getMedialinkData($value); } } return $this->_cleanupData($data); }
php
protected function _getObjectData(ComActivitiesActivityObjectInterface $object) { $data = $object->toArray(); // Make sure we get fully qualified URLs. if ($url = $object->getUrl()) { $data['url'] = $this->_getUrl($url); } $attachments = array(); // Handle attachments recursively. foreach ($object->getAttachments() as $attachment) { $attachments[] = $this->_getObjectData($attachment); } $data['attachments'] = $attachments; // Convert date objects to date time strings. foreach (array('published', 'updated') as $property) { $method = 'get' . ucfirst($property); if ($date = $object->$method()) { $data[$property] = $date->format('M d Y H:i:s'); } } foreach ($object as $key => $value) { if ($value instanceof ComActivitiesActivityObjectInterface) { $data[$key] = $this->_getObjectData($value); } if ($value instanceof ComActivitiesActivityMedialinkInterface) { $data[$key] = $this->_getMedialinkData($value); } } return $this->_cleanupData($data); }
[ "protected", "function", "_getObjectData", "(", "ComActivitiesActivityObjectInterface", "$", "object", ")", "{", "$", "data", "=", "$", "object", "->", "toArray", "(", ")", ";", "// Make sure we get fully qualified URLs.", "if", "(", "$", "url", "=", "$", "object"...
Activity object data getter. @param ComActivitiesActivityObjectInterface $object The activity object. @return array The object data.
[ "Activity", "object", "data", "getter", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/view/activities/json.php#L184-L224
train
joomlatools/joomlatools-framework-activities
view/activities/json.php
ComActivitiesViewActivitiesJson._getMedialinkData
protected function _getMedialinkData(ComActivitiesActivityMedialinkInterface $medialink) { $data = $medialink->toArray(); $data['url'] = $this->_getUrl($medialink->getUrl()); return $this->_cleanupData($data); }
php
protected function _getMedialinkData(ComActivitiesActivityMedialinkInterface $medialink) { $data = $medialink->toArray(); $data['url'] = $this->_getUrl($medialink->getUrl()); return $this->_cleanupData($data); }
[ "protected", "function", "_getMedialinkData", "(", "ComActivitiesActivityMedialinkInterface", "$", "medialink", ")", "{", "$", "data", "=", "$", "medialink", "->", "toArray", "(", ")", ";", "$", "data", "[", "'url'", "]", "=", "$", "this", "->", "_getUrl", "...
Activity medialink data getter. @param ComActivitiesActivityMedialinkInterface $medialink The medialink object. @return array The object data.
[ "Activity", "medialink", "data", "getter", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/view/activities/json.php#L232-L239
train
joomlatools/joomlatools-framework-activities
view/activities/json.php
ComActivitiesViewActivitiesJson._cleanupData
protected function _cleanupData(array $data = array()) { $clean = array(); foreach ($data as $key => $value) { if (!empty($value)) { $clean[$key] = $value; } } return $clean; }
php
protected function _cleanupData(array $data = array()) { $clean = array(); foreach ($data as $key => $value) { if (!empty($value)) { $clean[$key] = $value; } } return $clean; }
[ "protected", "function", "_cleanupData", "(", "array", "$", "data", "=", "array", "(", ")", ")", "{", "$", "clean", "=", "array", "(", ")", ";", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "!", "empty",...
Removes entries with empty values. @param array $data The data to cleanup. @return array The cleaned up data.
[ "Removes", "entries", "with", "empty", "values", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/view/activities/json.php#L247-L259
train
joomlatools/joomlatools-framework-activities
view/activities/json.php
ComActivitiesViewActivitiesJson._getUrl
protected function _getUrl(KHttpUrlInterface $url) { if (!$url->getHost() && !$url->getScheme()) { $url->setUrl($this->getUrl()->toString(KHttpUrl::AUTHORITY)); } return $url->toString(KHttpUrl::FULL, false); }
php
protected function _getUrl(KHttpUrlInterface $url) { if (!$url->getHost() && !$url->getScheme()) { $url->setUrl($this->getUrl()->toString(KHttpUrl::AUTHORITY)); } return $url->toString(KHttpUrl::FULL, false); }
[ "protected", "function", "_getUrl", "(", "KHttpUrlInterface", "$", "url", ")", "{", "if", "(", "!", "$", "url", "->", "getHost", "(", ")", "&&", "!", "$", "url", "->", "getScheme", "(", ")", ")", "{", "$", "url", "->", "setUrl", "(", "$", "this", ...
URL getter. Provides a fully qualified and un-escaped URL provided a URL object. @param KHttpUrlInterface $url The URL. @return string The fully qualified un-escaped URL.
[ "URL", "getter", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/view/activities/json.php#L269-L276
train
joomlatools/joomlatools-framework-activities
activity/object/object.php
ComActivitiesActivityObject.setObjectName
public function setObjectName($name) { if (!is_null($name)) { $name = (string) $name; } $this->objectName = $name; return $this; }
php
public function setObjectName($name) { if (!is_null($name)) { $name = (string) $name; } $this->objectName = $name; return $this; }
[ "public", "function", "setObjectName", "(", "$", "name", ")", "{", "if", "(", "!", "is_null", "(", "$", "name", ")", ")", "{", "$", "name", "=", "(", "string", ")", "$", "name", ";", "}", "$", "this", "->", "objectName", "=", "$", "name", ";", ...
Set the activity object name. @see ComActivitiesActivityObject::getObjectName @param string|null $name The activity object name. @return ComActivitiesActivityObject
[ "Set", "the", "activity", "object", "name", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/activity/object/object.php#L58-L66
train
joomlatools/joomlatools-framework-activities
activity/object/object.php
ComActivitiesActivityObject.setDisplayName
public function setDisplayName($name) { if (!is_null($name)) { $name = (string) $name; } $this->displayName = $name; return $this; }
php
public function setDisplayName($name) { if (!is_null($name)) { $name = (string) $name; } $this->displayName = $name; return $this; }
[ "public", "function", "setDisplayName", "(", "$", "name", ")", "{", "if", "(", "!", "is_null", "(", "$", "name", ")", ")", "{", "$", "name", "=", "(", "string", ")", "$", "name", ";", "}", "$", "this", "->", "displayName", "=", "$", "name", ";", ...
Set the display name. @link http://activitystrea.ms/specs/json/1.0/#object See displayName property. @param string|null $name The display name. @return ComActivitiesActivityObject
[ "Set", "the", "display", "name", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/activity/object/object.php#L88-L96
train
joomlatools/joomlatools-framework-activities
activity/object/object.php
ComActivitiesActivityObject.setAttachments
public function setAttachments(array $attachments, $merge = true) { if ($merge) { $this->attachments = array_merge($this->attachments, $attachments); } else { $this->attachments = $attachments; } return $this; }
php
public function setAttachments(array $attachments, $merge = true) { if ($merge) { $this->attachments = array_merge($this->attachments, $attachments); } else { $this->attachments = $attachments; } return $this; }
[ "public", "function", "setAttachments", "(", "array", "$", "attachments", ",", "$", "merge", "=", "true", ")", "{", "if", "(", "$", "merge", ")", "{", "$", "this", "->", "attachments", "=", "array_merge", "(", "$", "this", "->", "attachments", ",", "$"...
Set the attachments. @link http://activitystrea.ms/specs/json/1.0/#object See attachments property. @param array $attachments An array of {@link ComActivitiesActivityObjectInterface} objects. @param bool $merge Tells if attachments should be replaced or merged with current existing attachments. @return ComActivitiesActivityObject
[ "Set", "the", "attachments", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/activity/object/object.php#L120-L129
train
joomlatools/joomlatools-framework-activities
activity/object/object.php
ComActivitiesActivityObject.setAuthor
public function setAuthor($author) { if (!is_null($author) && !$author instanceof ComActivitiesActivityObjectInterface) { throw new InvalidArgumentException('Invalid author type.'); } $this->author = $author; return $this; }
php
public function setAuthor($author) { if (!is_null($author) && !$author instanceof ComActivitiesActivityObjectInterface) { throw new InvalidArgumentException('Invalid author type.'); } $this->author = $author; return $this; }
[ "public", "function", "setAuthor", "(", "$", "author", ")", "{", "if", "(", "!", "is_null", "(", "$", "author", ")", "&&", "!", "$", "author", "instanceof", "ComActivitiesActivityObjectInterface", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'In...
Set the author. @link http://activitystrea.ms/specs/json/1.0/#object See author property. @param ComActivitiesActivityObjectInterface|null $author The author. @return ComActivitiesActivityObject
[ "Set", "the", "author", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/activity/object/object.php#L151-L159
train
joomlatools/joomlatools-framework-activities
activity/object/object.php
ComActivitiesActivityObject.setContent
public function setContent($content) { if (!is_null($content)) { $content = (string) $content; } $this->content = $content; return $this; }
php
public function setContent($content) { if (!is_null($content)) { $content = (string) $content; } $this->content = $content; return $this; }
[ "public", "function", "setContent", "(", "$", "content", ")", "{", "if", "(", "!", "is_null", "(", "$", "content", ")", ")", "{", "$", "content", "=", "(", "string", ")", "$", "content", ";", "}", "$", "this", "->", "content", "=", "$", "content", ...
Set the content. @link http://activitystrea.ms/specs/json/1.0/#object See content property. @param string $content The content. @return ComActivitiesActivityObject
[ "Set", "the", "content", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/activity/object/object.php#L181-L189
train
joomlatools/joomlatools-framework-activities
activity/object/object.php
ComActivitiesActivityObject.setDownstreamDuplicates
public function setDownstreamDuplicates(array $duplicates, $merge = true) { if ($merge) { $this->downstreamDuplicates = array_merge($this->downstreamDuplicates, $duplicates); } else { $this->downstreamDuplicates = $duplicates; } return $this; }
php
public function setDownstreamDuplicates(array $duplicates, $merge = true) { if ($merge) { $this->downstreamDuplicates = array_merge($this->downstreamDuplicates, $duplicates); } else { $this->downstreamDuplicates = $duplicates; } return $this; }
[ "public", "function", "setDownstreamDuplicates", "(", "array", "$", "duplicates", ",", "$", "merge", "=", "true", ")", "{", "if", "(", "$", "merge", ")", "{", "$", "this", "->", "downstreamDuplicates", "=", "array_merge", "(", "$", "this", "->", "downstrea...
Set the downstream duplicates. @link http://activitystrea.ms/specs/json/1.0/#object See downstreamDuplicates property. @param array $duplicates An array of {@link ComActivitiesActivityObjectInterface} objects. @param bool $merge Tells if downstream duplicates should be replaced or merged with current existing downstream duplicates. @return ComActivitiesActivityObject
[ "Set", "the", "downstream", "duplicates", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/activity/object/object.php#L213-L222
train
joomlatools/joomlatools-framework-activities
activity/object/object.php
ComActivitiesActivityObject.setId
public function setId($id) { if (!is_null($id)) { $id = (string) $id; } $this->id = $id; return $this; }
php
public function setId($id) { if (!is_null($id)) { $id = (string) $id; } $this->id = $id; return $this; }
[ "public", "function", "setId", "(", "$", "id", ")", "{", "if", "(", "!", "is_null", "(", "$", "id", ")", ")", "{", "$", "id", "=", "(", "string", ")", "$", "id", ";", "}", "$", "this", "->", "id", "=", "$", "id", ";", "return", "$", "this",...
Set the Id. @link http://activitystrea.ms/specs/json/1.0/#object See id property. @param string|null $id The Id. @return ComActivitiesActivityObject
[ "Set", "the", "Id", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/activity/object/object.php#L244-L252
train
joomlatools/joomlatools-framework-activities
activity/object/object.php
ComActivitiesActivityObject.setUuid
public function setUuid($uuid) { if (!is_null($uuid)) { $uuid = (string) $uuid; } $this->uuid = $uuid; return $this; }
php
public function setUuid($uuid) { if (!is_null($uuid)) { $uuid = (string) $uuid; } $this->uuid = $uuid; return $this; }
[ "public", "function", "setUuid", "(", "$", "uuid", ")", "{", "if", "(", "!", "is_null", "(", "$", "uuid", ")", ")", "{", "$", "uuid", "=", "(", "string", ")", "$", "uuid", ";", "}", "$", "this", "->", "uuid", "=", "$", "uuid", ";", "return", ...
Set the Universally Unique Identifier. @param string|null $uuid The Universally Unique Identifier. @return ComActivitiesActivityObjectInterface
[ "Set", "the", "Universally", "Unique", "Identifier", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/activity/object/object.php#L271-L279
train
joomlatools/joomlatools-framework-activities
activity/object/object.php
ComActivitiesActivityObject.setImage
public function setImage($image) { if (!is_null($image) && !$image instanceof ComActivitiesActivityMedialinkInterface) { throw new InvalidArgumentException('Invalid image type.'); } $this->image = $image; return $this; }
php
public function setImage($image) { if (!is_null($image) && !$image instanceof ComActivitiesActivityMedialinkInterface) { throw new InvalidArgumentException('Invalid image type.'); } $this->image = $image; return $this; }
[ "public", "function", "setImage", "(", "$", "image", ")", "{", "if", "(", "!", "is_null", "(", "$", "image", ")", "&&", "!", "$", "image", "instanceof", "ComActivitiesActivityMedialinkInterface", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Inv...
Set the image. @link http://activitystrea.ms/specs/json/1.0/#object See image property. @param ComActivitiesActivityMedialinkInterface|null $image The image. @return ComActivitiesActivityObject
[ "Set", "the", "image", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/activity/object/object.php#L303-L311
train
joomlatools/joomlatools-framework-activities
activity/object/object.php
ComActivitiesActivityObject.setPublished
public function setPublished($date) { if (!is_null($date) && !$date instanceof KDate) { throw new InvalidArgumentException('Invalid date type.'); } $this->published = $date; return $this; }
php
public function setPublished($date) { if (!is_null($date) && !$date instanceof KDate) { throw new InvalidArgumentException('Invalid date type.'); } $this->published = $date; return $this; }
[ "public", "function", "setPublished", "(", "$", "date", ")", "{", "if", "(", "!", "is_null", "(", "$", "date", ")", "&&", "!", "$", "date", "instanceof", "KDate", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Invalid date type.'", ")", ";", ...
Set the published date. @link http://activitystrea.ms/specs/json/1.0/#object See published property. @param KDate $date The published date. @return ComActivitiesActivityObject
[ "Set", "the", "published", "date", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/activity/object/object.php#L363-L371
train
joomlatools/joomlatools-framework-activities
activity/object/object.php
ComActivitiesActivityObject.setSummary
public function setSummary($summary) { if (!is_null($summary)) { $summary = (string) $summary; } $this->summary = $summary; return $this; }
php
public function setSummary($summary) { if (!is_null($summary)) { $summary = (string) $summary; } $this->summary = $summary; return $this; }
[ "public", "function", "setSummary", "(", "$", "summary", ")", "{", "if", "(", "!", "is_null", "(", "$", "summary", ")", ")", "{", "$", "summary", "=", "(", "string", ")", "$", "summary", ";", "}", "$", "this", "->", "summary", "=", "$", "summary", ...
Set the summary. @link http://activitystrea.ms/specs/json/1.0/#object See summary property. @param mixed $summary The summary. @return ComActivitiesActivityObject
[ "Set", "the", "summary", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/activity/object/object.php#L393-L401
train
joomlatools/joomlatools-framework-activities
activity/object/object.php
ComActivitiesActivityObject.setUpdated
public function setUpdated($date) { if (!is_null($date) && !$date instanceof KDate) { throw new InvalidArgumentException('Invalid date type.'); } $this->updated = $date; return $this; }
php
public function setUpdated($date) { if (!is_null($date) && !$date instanceof KDate) { throw new InvalidArgumentException('Invalid date type.'); } $this->updated = $date; return $this; }
[ "public", "function", "setUpdated", "(", "$", "date", ")", "{", "if", "(", "!", "is_null", "(", "$", "date", ")", "&&", "!", "$", "date", "instanceof", "KDate", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'Invalid date type.'", ")", ";", ...
Set the updated date. @link http://activitystrea.ms/specs/json/1.0/#object See updated property. @param KDate|null $date The updated date. @return ComActivitiesActivityObject
[ "Set", "the", "updated", "date", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/activity/object/object.php#L423-L431
train
joomlatools/joomlatools-framework-activities
activity/object/object.php
ComActivitiesActivityObject.setUpstreamDuplicates
public function setUpstreamDuplicates(array $duplicates, $merge = true) { if ($merge) { $this->downstreamDuplicates = array_merge($this->downstreamDuplicates, $duplicates); } else { $this->upstreamDuplicates = $duplicates; } return $this; }
php
public function setUpstreamDuplicates(array $duplicates, $merge = true) { if ($merge) { $this->downstreamDuplicates = array_merge($this->downstreamDuplicates, $duplicates); } else { $this->upstreamDuplicates = $duplicates; } return $this; }
[ "public", "function", "setUpstreamDuplicates", "(", "array", "$", "duplicates", ",", "$", "merge", "=", "true", ")", "{", "if", "(", "$", "merge", ")", "{", "$", "this", "->", "downstreamDuplicates", "=", "array_merge", "(", "$", "this", "->", "downstreamD...
Set the upstream duplicates. @link http://activitystrea.ms/specs/json/1.0/#object See upstreamDuplicates property. @param array $duplicates An array of {@link ComActivitiesActivityObjectInterface} objects. @param bool $merge Tells if upstream duplicates should be replaced or merged with current existing upstream duplicates. @return ComActivitiesActivityObject
[ "Set", "the", "upstream", "duplicates", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/activity/object/object.php#L455-L464
train
joomlatools/joomlatools-framework-activities
activity/object/object.php
ComActivitiesActivityObject.setAttributes
public function setAttributes(array $attribs = array(), $merge = true) { if ($merge) { $this->attributes = array_merge($this->attributes, $attribs); } else { $this->attributes = $attribs; } return $this; }
php
public function setAttributes(array $attribs = array(), $merge = true) { if ($merge) { $this->attributes = array_merge($this->attributes, $attribs); } else { $this->attributes = $attribs; } return $this; }
[ "public", "function", "setAttributes", "(", "array", "$", "attribs", "=", "array", "(", ")", ",", "$", "merge", "=", "true", ")", "{", "if", "(", "$", "merge", ")", "{", "$", "this", "->", "attributes", "=", "array_merge", "(", "$", "this", "->", "...
Set the attributes. @param array $attributes The attributes. @param bool $merge Tells if attributes should be replaced or merged with current existing attributes. @return ComActivitiesActivityObject
[ "Set", "the", "attributes", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/activity/object/object.php#L513-L522
train
joomlatools/joomlatools-framework-activities
controller/activity.php
ComActivitiesControllerActivity.getRequest
public function getRequest() { $request = parent::getRequest(); // Force set the 'package' in the request $request->query->package = $this->getIdentifier()->package; return $request; }
php
public function getRequest() { $request = parent::getRequest(); // Force set the 'package' in the request $request->query->package = $this->getIdentifier()->package; return $request; }
[ "public", "function", "getRequest", "(", ")", "{", "$", "request", "=", "parent", "::", "getRequest", "(", ")", ";", "// Force set the 'package' in the request", "$", "request", "->", "query", "->", "package", "=", "$", "this", "->", "getIdentifier", "(", ")",...
Overridden for forcing the package model state.
[ "Overridden", "for", "forcing", "the", "package", "model", "state", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/controller/activity.php#L111-L119
train
joomlatools/joomlatools-framework-activities
controller/activity.php
ComActivitiesControllerActivity._beforeAdd
protected function _beforeAdd(KControllerContextInterface $context) { $context->request->data->ip = $this->getObject('request')->getAddress(); }
php
protected function _beforeAdd(KControllerContextInterface $context) { $context->request->data->ip = $this->getObject('request')->getAddress(); }
[ "protected", "function", "_beforeAdd", "(", "KControllerContextInterface", "$", "context", ")", "{", "$", "context", "->", "request", "->", "data", "->", "ip", "=", "$", "this", "->", "getObject", "(", "'request'", ")", "->", "getAddress", "(", ")", ";", "...
Set the IP address if we are adding a new activity. @param KControllerContextInterface $context A command context object. @return KModelEntityInterface
[ "Set", "the", "IP", "address", "if", "we", "are", "adding", "a", "new", "activity", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/controller/activity.php#L127-L130
train
netgen-layouts/content-browser-ezplatform
lib/Backend/EzTagsBackend.php
EzTagsBackend.buildLocation
private function buildLocation(): Location { $tag = $this->getRootTag(); $tagName = $this->translationHelper->getTranslatedByMethod( $tag, 'getKeyword' ); return new Location($tag, (string) $tagName); }
php
private function buildLocation(): Location { $tag = $this->getRootTag(); $tagName = $this->translationHelper->getTranslatedByMethod( $tag, 'getKeyword' ); return new Location($tag, (string) $tagName); }
[ "private", "function", "buildLocation", "(", ")", ":", "Location", "{", "$", "tag", "=", "$", "this", "->", "getRootTag", "(", ")", ";", "$", "tagName", "=", "$", "this", "->", "translationHelper", "->", "getTranslatedByMethod", "(", "$", "tag", ",", "'g...
Builds the location.
[ "Builds", "the", "location", "." ]
1f189f154933b92757d8072aea1ba95ac07c1167
https://github.com/netgen-layouts/content-browser-ezplatform/blob/1f189f154933b92757d8072aea1ba95ac07c1167/lib/Backend/EzTagsBackend.php#L167-L177
train
netgen-layouts/content-browser-ezplatform
lib/Backend/EzTagsBackend.php
EzTagsBackend.buildItem
private function buildItem(Tag $tag): Item { $tagName = $this->translationHelper->getTranslatedByMethod( $tag, 'getKeyword' ); return new Item($tag, (string) $tagName); }
php
private function buildItem(Tag $tag): Item { $tagName = $this->translationHelper->getTranslatedByMethod( $tag, 'getKeyword' ); return new Item($tag, (string) $tagName); }
[ "private", "function", "buildItem", "(", "Tag", "$", "tag", ")", ":", "Item", "{", "$", "tagName", "=", "$", "this", "->", "translationHelper", "->", "getTranslatedByMethod", "(", "$", "tag", ",", "'getKeyword'", ")", ";", "return", "new", "Item", "(", "...
Builds the item from provided tag.
[ "Builds", "the", "item", "from", "provided", "tag", "." ]
1f189f154933b92757d8072aea1ba95ac07c1167
https://github.com/netgen-layouts/content-browser-ezplatform/blob/1f189f154933b92757d8072aea1ba95ac07c1167/lib/Backend/EzTagsBackend.php#L182-L190
train
netgen-layouts/content-browser-ezplatform
lib/Backend/EzTagsBackend.php
EzTagsBackend.buildItems
private function buildItems(array $tags): array { return array_map( function (Tag $tag): Item { return $this->buildItem($tag); }, $tags ); }
php
private function buildItems(array $tags): array { return array_map( function (Tag $tag): Item { return $this->buildItem($tag); }, $tags ); }
[ "private", "function", "buildItems", "(", "array", "$", "tags", ")", ":", "array", "{", "return", "array_map", "(", "function", "(", "Tag", "$", "tag", ")", ":", "Item", "{", "return", "$", "this", "->", "buildItem", "(", "$", "tag", ")", ";", "}", ...
Builds the items from provided tags. @param \Netgen\TagsBundle\API\Repository\Values\Tags\Tag[] $tags @return \Netgen\ContentBrowser\Ez\Item\EzTags\Item[]
[ "Builds", "the", "items", "from", "provided", "tags", "." ]
1f189f154933b92757d8072aea1ba95ac07c1167
https://github.com/netgen-layouts/content-browser-ezplatform/blob/1f189f154933b92757d8072aea1ba95ac07c1167/lib/Backend/EzTagsBackend.php#L199-L207
train
joomlatools/joomlatools-framework-activities
controller/behavior/loggable.php
ComActivitiesControllerBehaviorLoggable.attachLogger
public function attachLogger($logger, $config = array()) { $identifier = $this->getIdentifier($logger); if (!$this->__queue->hasIdentifier($identifier)) { $logger = $this->getObject($identifier, $config); if (!($logger instanceof ComActivitiesActivityLoggerInterface)) { throw new UnexpectedValueException( "Logger $identifier does not implement ComActivitiesActivityLoggerInterface" ); } $this->__queue->enqueue($logger, self::PRIORITY_NORMAL); } return $this; }
php
public function attachLogger($logger, $config = array()) { $identifier = $this->getIdentifier($logger); if (!$this->__queue->hasIdentifier($identifier)) { $logger = $this->getObject($identifier, $config); if (!($logger instanceof ComActivitiesActivityLoggerInterface)) { throw new UnexpectedValueException( "Logger $identifier does not implement ComActivitiesActivityLoggerInterface" ); } $this->__queue->enqueue($logger, self::PRIORITY_NORMAL); } return $this; }
[ "public", "function", "attachLogger", "(", "$", "logger", ",", "$", "config", "=", "array", "(", ")", ")", "{", "$", "identifier", "=", "$", "this", "->", "getIdentifier", "(", "$", "logger", ")", ";", "if", "(", "!", "$", "this", "->", "__queue", ...
Attach a logger. @param mixed $logger An object that implements ObjectInterface, ObjectIdentifier object or valid identifier string. @param array $config An optional associative array of configuration settings. @throws UnexpectedValueException if the logger does not implement ComActivitiesActivityLoggerInterface. @return ComActivitiesControllerBehaviorLoggable
[ "Attach", "a", "logger", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/controller/behavior/loggable.php#L144-L163
train
joomlatools/joomlatools-framework-activities
controller/behavior/resourceable.php
ComActivitiesControllerBehaviorResourceable._getResource
protected function _getResource($entity) { $model = $this->_getController()->getModel(); $model->reset()->getState()->setValues(array( 'package' => $entity->package, 'name' => $entity->name, 'resource_id' => $entity->row )); return $model->fetch(); }
php
protected function _getResource($entity) { $model = $this->_getController()->getModel(); $model->reset()->getState()->setValues(array( 'package' => $entity->package, 'name' => $entity->name, 'resource_id' => $entity->row )); return $model->fetch(); }
[ "protected", "function", "_getResource", "(", "$", "entity", ")", "{", "$", "model", "=", "$", "this", "->", "_getController", "(", ")", "->", "getModel", "(", ")", ";", "$", "model", "->", "reset", "(", ")", "->", "getState", "(", ")", "->", "setVal...
Resource getter. @param KModelEntityInterface $entity The entity to get the resource from @return KModelEntityInterface|null The resource
[ "Resource", "getter", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/controller/behavior/resourceable.php#L81-L92
train
joomlatools/joomlatools-framework-activities
controller/behavior/resourceable.php
ComActivitiesControllerBehaviorResourceable._getData
protected function _getData(KModelEntityInterface $entity) { $data = array( 'package' => $entity->package, 'name' => $entity->name, 'resource_id' => $entity->row, 'title' => $entity->title ); if ($uuid = $entity->getActivityObject()->getUuid()) { $data['uuid'] = $uuid; } return $data; }
php
protected function _getData(KModelEntityInterface $entity) { $data = array( 'package' => $entity->package, 'name' => $entity->name, 'resource_id' => $entity->row, 'title' => $entity->title ); if ($uuid = $entity->getActivityObject()->getUuid()) { $data['uuid'] = $uuid; } return $data; }
[ "protected", "function", "_getData", "(", "KModelEntityInterface", "$", "entity", ")", "{", "$", "data", "=", "array", "(", "'package'", "=>", "$", "entity", "->", "package", ",", "'name'", "=>", "$", "entity", "->", "name", ",", "'resource_id'", "=>", "$"...
Entity data getter @param KModelEntityInterface $entity The entity to get data from @return array The entity data
[ "Entity", "data", "getter" ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/controller/behavior/resourceable.php#L101-L115
train
joomlatools/joomlatools-framework-activities
controller/behavior/resourceable.php
ComActivitiesControllerBehaviorResourceable._getController
protected function _getController() { if (!$this->_controller instanceof KControllerInterface) { $this->_controller = $this->getObject($this->_controller); } return $this->_controller; }
php
protected function _getController() { if (!$this->_controller instanceof KControllerInterface) { $this->_controller = $this->getObject($this->_controller); } return $this->_controller; }
[ "protected", "function", "_getController", "(", ")", "{", "if", "(", "!", "$", "this", "->", "_controller", "instanceof", "KControllerInterface", ")", "{", "$", "this", "->", "_controller", "=", "$", "this", "->", "getObject", "(", "$", "this", "->", "_con...
Resource controller getter. @return KControllerInterface The controller
[ "Resource", "controller", "getter", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/controller/behavior/resourceable.php#L122-L129
train
aviat4ion/Query
src/Drivers/AbstractDriver.php
AbstractDriver._loadSubClasses
protected function _loadSubClasses(): void { // Load the sql and util class for the driver $thisClass = \get_class($this); $nsArray = explode("\\", $thisClass); array_pop($nsArray); $driver = array_pop($nsArray); $sqlClass = __NAMESPACE__ . "\\{$driver}\\SQL"; $utilClass = __NAMESPACE__ . "\\{$driver}\\Util"; $this->sql = new $sqlClass(); $this->util = new $utilClass($this); }
php
protected function _loadSubClasses(): void { // Load the sql and util class for the driver $thisClass = \get_class($this); $nsArray = explode("\\", $thisClass); array_pop($nsArray); $driver = array_pop($nsArray); $sqlClass = __NAMESPACE__ . "\\{$driver}\\SQL"; $utilClass = __NAMESPACE__ . "\\{$driver}\\Util"; $this->sql = new $sqlClass(); $this->util = new $utilClass($this); }
[ "protected", "function", "_loadSubClasses", "(", ")", ":", "void", "{", "// Load the sql and util class for the driver", "$", "thisClass", "=", "\\", "get_class", "(", "$", "this", ")", ";", "$", "nsArray", "=", "explode", "(", "\"\\\\\"", ",", "$", "thisClass",...
Loads the subclasses for the driver @return void
[ "Loads", "the", "subclasses", "for", "the", "driver" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/Drivers/AbstractDriver.php#L100-L112
train
aviat4ion/Query
src/Drivers/AbstractDriver.php
AbstractDriver.prepareQuery
public function prepareQuery(string $sql, array $data): ?PDOStatement { // Prepare the sql, save the statement for easy access later $this->statement = $this->prepare($sql); // Bind the parameters foreach($data as $k => $value) { // Parameters are 1-based, the data is 0-based // So, if the key is numeric, add 1 if(is_numeric($k)) { $k++; } $this->statement->bindValue($k, $value); } return $this->statement; }
php
public function prepareQuery(string $sql, array $data): ?PDOStatement { // Prepare the sql, save the statement for easy access later $this->statement = $this->prepare($sql); // Bind the parameters foreach($data as $k => $value) { // Parameters are 1-based, the data is 0-based // So, if the key is numeric, add 1 if(is_numeric($k)) { $k++; } $this->statement->bindValue($k, $value); } return $this->statement; }
[ "public", "function", "prepareQuery", "(", "string", "$", "sql", ",", "array", "$", "data", ")", ":", "?", "PDOStatement", "{", "// Prepare the sql, save the statement for easy access later", "$", "this", "->", "statement", "=", "$", "this", "->", "prepare", "(", ...
Simplifies prepared statements for database queries @param string $sql @param array $data @return PDOStatement | FALSE @throws InvalidArgumentException
[ "Simplifies", "prepared", "statements", "for", "database", "queries" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/Drivers/AbstractDriver.php#L202-L220
train
aviat4ion/Query
src/Drivers/AbstractDriver.php
AbstractDriver.prepareExecute
public function prepareExecute(string $sql, array $params): ?PDOStatement { $this->statement = $this->prepareQuery($sql, $params); $this->statement->execute(); return $this->statement; }
php
public function prepareExecute(string $sql, array $params): ?PDOStatement { $this->statement = $this->prepareQuery($sql, $params); $this->statement->execute(); return $this->statement; }
[ "public", "function", "prepareExecute", "(", "string", "$", "sql", ",", "array", "$", "params", ")", ":", "?", "PDOStatement", "{", "$", "this", "->", "statement", "=", "$", "this", "->", "prepareQuery", "(", "$", "sql", ",", "$", "params", ")", ";", ...
Create and execute a prepared statement with the provided parameters @param string $sql @param array $params @throws InvalidArgumentException @return PDOStatement
[ "Create", "and", "execute", "a", "prepared", "statement", "with", "the", "provided", "parameters" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/Drivers/AbstractDriver.php#L230-L236
train
aviat4ion/Query
src/Drivers/AbstractDriver.php
AbstractDriver.prefixTable
public function prefixTable(string $table): string { // Add the prefix to the table name // before quoting it if ( ! empty($this->tablePrefix)) { // Split identifier by period, will split into: // database.schema.table OR // schema.table OR // database.table OR // table $identifiers = explode('.', $table); $segments = count($identifiers); // Quote the last item, and add the database prefix $identifiers[$segments - 1] = $this->_prefix(end($identifiers)); // Rejoin $table = implode('.', $identifiers); } return $table; }
php
public function prefixTable(string $table): string { // Add the prefix to the table name // before quoting it if ( ! empty($this->tablePrefix)) { // Split identifier by period, will split into: // database.schema.table OR // schema.table OR // database.table OR // table $identifiers = explode('.', $table); $segments = count($identifiers); // Quote the last item, and add the database prefix $identifiers[$segments - 1] = $this->_prefix(end($identifiers)); // Rejoin $table = implode('.', $identifiers); } return $table; }
[ "public", "function", "prefixTable", "(", "string", "$", "table", ")", ":", "string", "{", "// Add the prefix to the table name", "// before quoting it", "if", "(", "!", "empty", "(", "$", "this", "->", "tablePrefix", ")", ")", "{", "// Split identifier by period, w...
Prefixes a table if it is not already prefixed @param string $table @return string
[ "Prefixes", "a", "table", "if", "it", "is", "not", "already", "prefixed" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/Drivers/AbstractDriver.php#L254-L276
train
aviat4ion/Query
src/Drivers/AbstractDriver.php
AbstractDriver.quoteTable
public function quoteTable($table): string { $table = $this->prefixTable($table); // Finally, quote the table return $this->quoteIdent($table); }
php
public function quoteTable($table): string { $table = $this->prefixTable($table); // Finally, quote the table return $this->quoteIdent($table); }
[ "public", "function", "quoteTable", "(", "$", "table", ")", ":", "string", "{", "$", "table", "=", "$", "this", "->", "prefixTable", "(", "$", "table", ")", ";", "// Finally, quote the table", "return", "$", "this", "->", "quoteIdent", "(", "$", "table", ...
Quote database table name, and set prefix @param string $table @return string
[ "Quote", "database", "table", "name", "and", "set", "prefix" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/Drivers/AbstractDriver.php#L284-L290
train
aviat4ion/Query
src/Drivers/AbstractDriver.php
AbstractDriver.quoteIdent
public function quoteIdent($identifier) { if (\is_array($identifier)) { return array_map([$this, __METHOD__], $identifier); } // Handle comma-separated identifiers if (strpos($identifier, ',') !== FALSE) { $parts = array_map('mb_trim', explode(',', $identifier)); $parts = array_map([$this, __METHOD__], $parts); $identifier = implode(',', $parts); } // Split each identifier by the period $hiers = explode('.', $identifier); $hiers = array_map('mb_trim', $hiers); // Re-compile the string $raw = implode('.', array_map([$this, '_quote'], $hiers)); // Fix functions $funcs = []; preg_match_all("#{$this->escapeCharOpen}([a-zA-Z0-9_]+(\((.*?)\))){$this->escapeCharClose}#iu", $raw, $funcs, PREG_SET_ORDER); foreach($funcs as $f) { // Unquote the function $raw = str_replace($f[0], $f[1], $raw); // Quote the inside identifiers $raw = str_replace($f[3], $this->quoteIdent($f[3]), $raw); } return $raw; }
php
public function quoteIdent($identifier) { if (\is_array($identifier)) { return array_map([$this, __METHOD__], $identifier); } // Handle comma-separated identifiers if (strpos($identifier, ',') !== FALSE) { $parts = array_map('mb_trim', explode(',', $identifier)); $parts = array_map([$this, __METHOD__], $parts); $identifier = implode(',', $parts); } // Split each identifier by the period $hiers = explode('.', $identifier); $hiers = array_map('mb_trim', $hiers); // Re-compile the string $raw = implode('.', array_map([$this, '_quote'], $hiers)); // Fix functions $funcs = []; preg_match_all("#{$this->escapeCharOpen}([a-zA-Z0-9_]+(\((.*?)\))){$this->escapeCharClose}#iu", $raw, $funcs, PREG_SET_ORDER); foreach($funcs as $f) { // Unquote the function $raw = str_replace($f[0], $f[1], $raw); // Quote the inside identifiers $raw = str_replace($f[3], $this->quoteIdent($f[3]), $raw); } return $raw; }
[ "public", "function", "quoteIdent", "(", "$", "identifier", ")", "{", "if", "(", "\\", "is_array", "(", "$", "identifier", ")", ")", "{", "return", "array_map", "(", "[", "$", "this", ",", "__METHOD__", "]", ",", "$", "identifier", ")", ";", "}", "//...
Surrounds the string with the databases identifier escape characters @param mixed $identifier @return string|array
[ "Surrounds", "the", "string", "with", "the", "databases", "identifier", "escape", "characters" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/Drivers/AbstractDriver.php#L298-L333
train
aviat4ion/Query
src/Drivers/AbstractDriver.php
AbstractDriver.getColumns
public function getColumns($table): ?array { return $this->driverQuery($this->getSql()->columnList($this->prefixTable($table)), FALSE); }
php
public function getColumns($table): ?array { return $this->driverQuery($this->getSql()->columnList($this->prefixTable($table)), FALSE); }
[ "public", "function", "getColumns", "(", "$", "table", ")", ":", "?", "array", "{", "return", "$", "this", "->", "driverQuery", "(", "$", "this", "->", "getSql", "(", ")", "->", "columnList", "(", "$", "this", "->", "prefixTable", "(", "$", "table", ...
Retrieve column information for the current database table @param string $table @return array
[ "Retrieve", "column", "information", "for", "the", "current", "database", "table" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/Drivers/AbstractDriver.php#L436-L439
train
aviat4ion/Query
src/Drivers/AbstractDriver.php
AbstractDriver.getIndexes
public function getIndexes($table): ?array { return $this->driverQuery($this->getSql()->indexList($this->prefixTable($table)), FALSE); }
php
public function getIndexes($table): ?array { return $this->driverQuery($this->getSql()->indexList($this->prefixTable($table)), FALSE); }
[ "public", "function", "getIndexes", "(", "$", "table", ")", ":", "?", "array", "{", "return", "$", "this", "->", "driverQuery", "(", "$", "this", "->", "getSql", "(", ")", "->", "indexList", "(", "$", "this", "->", "prefixTable", "(", "$", "table", "...
Retrieve indexes for the table @param string $table @return array
[ "Retrieve", "indexes", "for", "the", "table" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/Drivers/AbstractDriver.php#L458-L461
train
aviat4ion/Query
src/Drivers/AbstractDriver.php
AbstractDriver.driverQuery
public function driverQuery($query, $filteredIndex=TRUE): ?array { // Call the appropriate method, if it exists if (\is_string($query) && method_exists($this->sql, $query)) { $query = $this->getSql()->$query(); } // Return if the values are returned instead of a query, // or if the query doesn't apply to the driver if ( ! \is_string($query)) { return $query; } // Run the query! $res = $this->query($query); $flag = $filteredIndex ? PDO::FETCH_NUM : PDO::FETCH_ASSOC; $all = $res->fetchAll($flag); return $filteredIndex ? \dbFilter($all, 0) : $all; }
php
public function driverQuery($query, $filteredIndex=TRUE): ?array { // Call the appropriate method, if it exists if (\is_string($query) && method_exists($this->sql, $query)) { $query = $this->getSql()->$query(); } // Return if the values are returned instead of a query, // or if the query doesn't apply to the driver if ( ! \is_string($query)) { return $query; } // Run the query! $res = $this->query($query); $flag = $filteredIndex ? PDO::FETCH_NUM : PDO::FETCH_ASSOC; $all = $res->fetchAll($flag); return $filteredIndex ? \dbFilter($all, 0) : $all; }
[ "public", "function", "driverQuery", "(", "$", "query", ",", "$", "filteredIndex", "=", "TRUE", ")", ":", "?", "array", "{", "// Call the appropriate method, if it exists", "if", "(", "\\", "is_string", "(", "$", "query", ")", "&&", "method_exists", "(", "$", ...
Method to simplify retrieving db results for meta-data queries @param string|array|null $query @param bool $filteredIndex @return array|null
[ "Method", "to", "simplify", "retrieving", "db", "results", "for", "meta", "-", "data", "queries" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/Drivers/AbstractDriver.php#L480-L502
train
aviat4ion/Query
src/Drivers/AbstractDriver.php
AbstractDriver.numRows
public function numRows(): ?int { $regex = '/^SELECT\s+(?:ALL\s+|DISTINCT\s+)?(?:.*?)\s+FROM\s+(.*)$/i'; $output = []; if (preg_match($regex, $this->lastQuery, $output) > 0) { $stmt = $this->query("SELECT COUNT(*) FROM {$output[1]}"); return (int) $stmt->fetchColumn(); } return NULL; }
php
public function numRows(): ?int { $regex = '/^SELECT\s+(?:ALL\s+|DISTINCT\s+)?(?:.*?)\s+FROM\s+(.*)$/i'; $output = []; if (preg_match($regex, $this->lastQuery, $output) > 0) { $stmt = $this->query("SELECT COUNT(*) FROM {$output[1]}"); return (int) $stmt->fetchColumn(); } return NULL; }
[ "public", "function", "numRows", "(", ")", ":", "?", "int", "{", "$", "regex", "=", "'/^SELECT\\s+(?:ALL\\s+|DISTINCT\\s+)?(?:.*?)\\s+FROM\\s+(.*)$/i'", ";", "$", "output", "=", "[", "]", ";", "if", "(", "preg_match", "(", "$", "regex", ",", "$", "this", "->...
Return the number of rows returned for a SELECT query @see http://us3.php.net/manual/en/pdostatement.rowcount.php#87110 @return int|null
[ "Return", "the", "number", "of", "rows", "returned", "for", "a", "SELECT", "query" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/Drivers/AbstractDriver.php#L510-L522
train
aviat4ion/Query
src/Drivers/AbstractDriver.php
AbstractDriver.truncate
public function truncate(string $table): PDOStatement { $sql = $this->hasTruncate ? 'TRUNCATE TABLE ' : 'DELETE FROM '; $sql .= $this->quoteTable($table); $this->statement = $this->query($sql); return $this->statement; }
php
public function truncate(string $table): PDOStatement { $sql = $this->hasTruncate ? 'TRUNCATE TABLE ' : 'DELETE FROM '; $sql .= $this->quoteTable($table); $this->statement = $this->query($sql); return $this->statement; }
[ "public", "function", "truncate", "(", "string", "$", "table", ")", ":", "PDOStatement", "{", "$", "sql", "=", "$", "this", "->", "hasTruncate", "?", "'TRUNCATE TABLE '", ":", "'DELETE FROM '", ";", "$", "sql", ".=", "$", "this", "->", "quoteTable", "(", ...
Empty the passed table @param string $table @return PDOStatement
[ "Empty", "the", "passed", "table" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/Drivers/AbstractDriver.php#L581-L591
train
aviat4ion/Query
src/Drivers/AbstractDriver.php
AbstractDriver._quote
public function _quote($str) { // Check that the current value is a string, // and is not already quoted before quoting // that value, otherwise, return the original value return ( \is_string($str) && strpos($str, $this->escapeCharOpen) !== 0 && strrpos($str, $this->escapeCharClose) !== 0 ) ? "{$this->escapeCharOpen}{$str}{$this->escapeCharClose}" : $str; }
php
public function _quote($str) { // Check that the current value is a string, // and is not already quoted before quoting // that value, otherwise, return the original value return ( \is_string($str) && strpos($str, $this->escapeCharOpen) !== 0 && strrpos($str, $this->escapeCharClose) !== 0 ) ? "{$this->escapeCharOpen}{$str}{$this->escapeCharClose}" : $str; }
[ "public", "function", "_quote", "(", "$", "str", ")", "{", "// Check that the current value is a string,", "// and is not already quoted before quoting", "// that value, otherwise, return the original value", "return", "(", "\\", "is_string", "(", "$", "str", ")", "&&", "strp...
Helper method for quote_ident @param mixed $str @return mixed
[ "Helper", "method", "for", "quote_ident" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/Drivers/AbstractDriver.php#L599-L612
train
aviat4ion/Query
src/Drivers/AbstractDriver.php
AbstractDriver._prefix
protected function _prefix(string $str): string { // Don't prefix an already prefixed table if (strpos($str, $this->tablePrefix) !== FALSE) { return $str; } return $this->tablePrefix . $str; }
php
protected function _prefix(string $str): string { // Don't prefix an already prefixed table if (strpos($str, $this->tablePrefix) !== FALSE) { return $str; } return $this->tablePrefix . $str; }
[ "protected", "function", "_prefix", "(", "string", "$", "str", ")", ":", "string", "{", "// Don't prefix an already prefixed table", "if", "(", "strpos", "(", "$", "str", ",", "$", "this", "->", "tablePrefix", ")", "!==", "FALSE", ")", "{", "return", "$", ...
Sets the table prefix on the passed string @param string $str @return string
[ "Sets", "the", "table", "prefix", "on", "the", "passed", "string" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/Drivers/AbstractDriver.php#L620-L629
train
aviat4ion/Query
RoboFile.php
RoboFile.analyze
public function analyze() { $this->prepare(); $this->lint(); $this->phploc(TRUE); $this->phpcs(TRUE); $this->dependencyReport(); $this->phpcpdReport(); }
php
public function analyze() { $this->prepare(); $this->lint(); $this->phploc(TRUE); $this->phpcs(TRUE); $this->dependencyReport(); $this->phpcpdReport(); }
[ "public", "function", "analyze", "(", ")", "{", "$", "this", "->", "prepare", "(", ")", ";", "$", "this", "->", "lint", "(", ")", ";", "$", "this", "->", "phploc", "(", "TRUE", ")", ";", "$", "this", "->", "phpcs", "(", "TRUE", ")", ";", "$", ...
Do static analysis tasks
[ "Do", "static", "analysis", "tasks" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/RoboFile.php#L54-L62
train
aviat4ion/Query
RoboFile.php
RoboFile.phploc
public function phploc($report = FALSE) { // Command for generating reports $report_cmd_parts = [ 'vendor/bin/phploc', '--count-tests', '--log-csv=build/logs/phploc.csv', '--log-xml=build/logs/phploc.xml', 'src', 'tests' ]; // Command for generating direct output $normal_cmd_parts = [ 'vendor/bin/phploc', '--count-tests', 'src', 'tests' ]; $cmd_parts = ($report) ? $report_cmd_parts : $normal_cmd_parts; $this->_run($cmd_parts); }
php
public function phploc($report = FALSE) { // Command for generating reports $report_cmd_parts = [ 'vendor/bin/phploc', '--count-tests', '--log-csv=build/logs/phploc.csv', '--log-xml=build/logs/phploc.xml', 'src', 'tests' ]; // Command for generating direct output $normal_cmd_parts = [ 'vendor/bin/phploc', '--count-tests', 'src', 'tests' ]; $cmd_parts = ($report) ? $report_cmd_parts : $normal_cmd_parts; $this->_run($cmd_parts); }
[ "public", "function", "phploc", "(", "$", "report", "=", "FALSE", ")", "{", "// Command for generating reports", "$", "report_cmd_parts", "=", "[", "'vendor/bin/phploc'", ",", "'--count-tests'", ",", "'--log-csv=build/logs/phploc.csv'", ",", "'--log-xml=build/logs/phploc.xm...
Run the phploc tool @param bool $report - if true, generates reports instead of direct output
[ "Run", "the", "phploc", "tool" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/RoboFile.php#L153-L176
train
aviat4ion/Query
RoboFile.php
RoboFile.watch
public function watch() { $this->taskWatch() ->monitor('composer.json', function() { $this->taskComposerUpdate()->run(); }) ->monitor('src', function () { $this->taskExec('test')->run(); }) ->monitor('tests', function () { $this->taskExec('test')->run(); }) ->run(); }
php
public function watch() { $this->taskWatch() ->monitor('composer.json', function() { $this->taskComposerUpdate()->run(); }) ->monitor('src', function () { $this->taskExec('test')->run(); }) ->monitor('tests', function () { $this->taskExec('test')->run(); }) ->run(); }
[ "public", "function", "watch", "(", ")", "{", "$", "this", "->", "taskWatch", "(", ")", "->", "monitor", "(", "'composer.json'", ",", "function", "(", ")", "{", "$", "this", "->", "taskComposerUpdate", "(", ")", "->", "run", "(", ")", ";", "}", ")", ...
Watches for file updates, and automatically runs appropriate actions
[ "Watches", "for", "file", "updates", "and", "automatically", "runs", "appropriate", "actions" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/RoboFile.php#L201-L214
train
aviat4ion/Query
RoboFile.php
RoboFile.getAllSourceFiles
protected function getAllSourceFiles() { $files = array_merge( glob_recursive('build/*.php'), glob_recursive('src/*.php'), glob_recursive('tests/*.php'), glob('*.php') ); sort($files); return $files; }
php
protected function getAllSourceFiles() { $files = array_merge( glob_recursive('build/*.php'), glob_recursive('src/*.php'), glob_recursive('tests/*.php'), glob('*.php') ); sort($files); return $files; }
[ "protected", "function", "getAllSourceFiles", "(", ")", "{", "$", "files", "=", "array_merge", "(", "glob_recursive", "(", "'build/*.php'", ")", ",", "glob_recursive", "(", "'src/*.php'", ")", ",", "glob_recursive", "(", "'tests/*.php'", ")", ",", "glob", "(", ...
Get the total list of source files, including tests @return array
[ "Get", "the", "total", "list", "of", "source", "files", "including", "tests" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/RoboFile.php#L236-L248
train
aviat4ion/Query
RoboFile.php
RoboFile.parallelLint
protected function parallelLint(array $chunk) { $task = $this->taskParallelExec() ->timeout(5) ->printed(FALSE); foreach($chunk as $file) { $task = $task->process("php -l {$file}"); } $task->run(); }
php
protected function parallelLint(array $chunk) { $task = $this->taskParallelExec() ->timeout(5) ->printed(FALSE); foreach($chunk as $file) { $task = $task->process("php -l {$file}"); } $task->run(); }
[ "protected", "function", "parallelLint", "(", "array", "$", "chunk", ")", "{", "$", "task", "=", "$", "this", "->", "taskParallelExec", "(", ")", "->", "timeout", "(", "5", ")", "->", "printed", "(", "FALSE", ")", ";", "foreach", "(", "$", "chunk", "...
Run php's linter in one parallel task for the passed chunk @param array $chunk
[ "Run", "php", "s", "linter", "in", "one", "parallel", "task", "for", "the", "passed", "chunk" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/RoboFile.php#L255-L267
train
aviat4ion/Query
src/Drivers/Sqlite/Driver.php
Driver.getTables
public function getTables(): array { $sql = $this->sql->tableList(); $res = $this->query($sql); return dbFilter($res->fetchAll(PDO::FETCH_ASSOC), 'name'); }
php
public function getTables(): array { $sql = $this->sql->tableList(); $res = $this->query($sql); return dbFilter($res->fetchAll(PDO::FETCH_ASSOC), 'name'); }
[ "public", "function", "getTables", "(", ")", ":", "array", "{", "$", "sql", "=", "$", "this", "->", "sql", "->", "tableList", "(", ")", ";", "$", "res", "=", "$", "this", "->", "query", "(", "$", "sql", ")", ";", "return", "dbFilter", "(", "$", ...
List tables for the current database @return mixed
[ "List", "tables", "for", "the", "current", "database" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/Drivers/Sqlite/Driver.php#L55-L60
train
aviat4ion/Query
src/Drivers/Sqlite/Driver.php
Driver.getFks
public function getFks($table): array { $returnRows = []; foreach(parent::getFks($table) as $row) { $returnRows[] = [ 'child_column' => $row['from'], 'parent_table' => $row['table'], 'parent_column' => $row['to'], 'update' => $row['on_update'], 'delete' => $row['on_delete'] ]; } return $returnRows; }
php
public function getFks($table): array { $returnRows = []; foreach(parent::getFks($table) as $row) { $returnRows[] = [ 'child_column' => $row['from'], 'parent_table' => $row['table'], 'parent_column' => $row['to'], 'update' => $row['on_update'], 'delete' => $row['on_delete'] ]; } return $returnRows; }
[ "public", "function", "getFks", "(", "$", "table", ")", ":", "array", "{", "$", "returnRows", "=", "[", "]", ";", "foreach", "(", "parent", "::", "getFks", "(", "$", "table", ")", "as", "$", "row", ")", "{", "$", "returnRows", "[", "]", "=", "[",...
Retrieve foreign keys for the table @param string $table @return array
[ "Retrieve", "foreign", "keys", "for", "the", "table" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/Drivers/Sqlite/Driver.php#L68-L84
train
joomlatools/joomlatools-framework-activities
model/behavior/searchable.php
ComActivitiesModelBehaviorSearchable._afterReset
protected function _afterReset(KModelContextInterface $context) { $reset_columns = false; if ($context->modified) { if (in_array('search', $context->modified->toArray())) { $reset_columns = true; } } else $reset_columns = true; if ($reset_columns && ($key = array_search('ip', $this->_columns))) { unset($this->_columns[$key]); } }
php
protected function _afterReset(KModelContextInterface $context) { $reset_columns = false; if ($context->modified) { if (in_array('search', $context->modified->toArray())) { $reset_columns = true; } } else $reset_columns = true; if ($reset_columns && ($key = array_search('ip', $this->_columns))) { unset($this->_columns[$key]); } }
[ "protected", "function", "_afterReset", "(", "KModelContextInterface", "$", "context", ")", "{", "$", "reset_columns", "=", "false", ";", "if", "(", "$", "context", "->", "modified", ")", "{", "if", "(", "in_array", "(", "'search'", ",", "$", "context", "-...
Resets the columns property by making sure that ip if removed when the state gets reset.
[ "Resets", "the", "columns", "property", "by", "making", "sure", "that", "ip", "if", "removed", "when", "the", "state", "gets", "reset", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/model/behavior/searchable.php#L50-L65
train
wpsharks/css-minifier
src/includes/classes/Core.php
Core.selfMin
protected function selfMin() { if (!$this->css) { return $this->css; } $static = &static::$static[__FUNCTION__.'_map']; if (!isset($static['replace'], $static['with'], $static['colors'])) { $de_spacifiables = array( '{', '}', '!=', '|=', '^=', '$=', '*=', '~=', '=', '~', ';', ',', '>', ); $de_spacifiables = array_map( function ($string) { return preg_quote($string, '/'); }, $de_spacifiables ); $de_spacifiables = implode('|', $de_spacifiables); $static['replace'] = array( 'comments' => '/\/\*.*?\*\//s', 'line_breaks' => '/['."\r\n".']+/', 'extra_spaces' => '/\s{2,}/', 'de_spacifiables' => '/ *('.$de_spacifiables.') */', 'unnecessary_;s' => '/;\}/', ); $static['with'] = array('', ' ', ' ', '${1}', '}'); $static['colors'] = '/(?P<context>[:,\h]+#)(?P<hex>[a-z0-9]{6})/i'; } $this->css = preg_replace($static['replace'], $static['with'], $this->css); $this->css = preg_replace_callback($static['colors'], array($this, 'selfMaybeCompressCssColorCb'), $this->css); $this->css = trim($this->css); return $this->css; }
php
protected function selfMin() { if (!$this->css) { return $this->css; } $static = &static::$static[__FUNCTION__.'_map']; if (!isset($static['replace'], $static['with'], $static['colors'])) { $de_spacifiables = array( '{', '}', '!=', '|=', '^=', '$=', '*=', '~=', '=', '~', ';', ',', '>', ); $de_spacifiables = array_map( function ($string) { return preg_quote($string, '/'); }, $de_spacifiables ); $de_spacifiables = implode('|', $de_spacifiables); $static['replace'] = array( 'comments' => '/\/\*.*?\*\//s', 'line_breaks' => '/['."\r\n".']+/', 'extra_spaces' => '/\s{2,}/', 'de_spacifiables' => '/ *('.$de_spacifiables.') */', 'unnecessary_;s' => '/;\}/', ); $static['with'] = array('', ' ', ' ', '${1}', '}'); $static['colors'] = '/(?P<context>[:,\h]+#)(?P<hex>[a-z0-9]{6})/i'; } $this->css = preg_replace($static['replace'], $static['with'], $this->css); $this->css = preg_replace_callback($static['colors'], array($this, 'selfMaybeCompressCssColorCb'), $this->css); $this->css = trim($this->css); return $this->css; }
[ "protected", "function", "selfMin", "(", ")", "{", "if", "(", "!", "$", "this", "->", "css", ")", "{", "return", "$", "this", "->", "css", ";", "}", "$", "static", "=", "&", "static", "::", "$", "static", "[", "__FUNCTION__", ".", "'_map'", "]", ...
Self minifier. @since 15xxxx Adding SCSS compiler. @return string Output (minified) CSS.
[ "Self", "minifier", "." ]
f70806d752ba262fbcfdab21ae850fe490a51816
https://github.com/wpsharks/css-minifier/blob/f70806d752ba262fbcfdab21ae850fe490a51816/src/includes/classes/Core.php#L77-L123
train
wpsharks/css-minifier
src/includes/classes/Core.php
Core.selfMaybeCompressCssColorCb
protected function selfMaybeCompressCssColorCb(array $m) { $m['hex'] = strtoupper($m['hex']); // Convert to uppercase for easy comparison. if ($m['hex'][0] === $m['hex'][1] && $m['hex'][2] === $m['hex'][3] && $m['hex'][4] === $m['hex'][5]) { return $m['context'].$m['hex'][0].$m['hex'][2].$m['hex'][4]; } return $m[0]; }
php
protected function selfMaybeCompressCssColorCb(array $m) { $m['hex'] = strtoupper($m['hex']); // Convert to uppercase for easy comparison. if ($m['hex'][0] === $m['hex'][1] && $m['hex'][2] === $m['hex'][3] && $m['hex'][4] === $m['hex'][5]) { return $m['context'].$m['hex'][0].$m['hex'][2].$m['hex'][4]; } return $m[0]; }
[ "protected", "function", "selfMaybeCompressCssColorCb", "(", "array", "$", "m", ")", "{", "$", "m", "[", "'hex'", "]", "=", "strtoupper", "(", "$", "m", "[", "'hex'", "]", ")", ";", "// Convert to uppercase for easy comparison.", "if", "(", "$", "m", "[", ...
Compresses HEX color codes. @since 140417 Initial release. @param array $m Regular expression matches. @return string Full match with compressed HEX color code.
[ "Compresses", "HEX", "color", "codes", "." ]
f70806d752ba262fbcfdab21ae850fe490a51816
https://github.com/wpsharks/css-minifier/blob/f70806d752ba262fbcfdab21ae850fe490a51816/src/includes/classes/Core.php#L134-L142
train
joomlatools/joomlatools-framework-activities
activity/translator/translator.php
ComActivitiesActivityTranslator.translateActivityFormat
public function translateActivityFormat(ComActivitiesActivityInterface $activity) { $tokens = $this->getActivityTokens($activity); $format = $activity->getActivityFormat(); $parameters = array(); foreach ($tokens as $key => $value) { if ($value instanceof ComActivitiesActivityObjectInterface && $value->getObjectName()) { $value = $value->getObjectName(); } if (is_scalar($value)) { $parameters[$key] = $value; } } $formats = array(); for ($i = 0; $i < 2; $i++) { $catalogue = $this->getCatalogue(); if ($length = $catalogue->getConfig()->key_length) { $catalogue->getConfig()->key_length = false; } $formats[] = $this->translate($this->_getOverride($format, $parameters), array()); if ($length) { $catalogue->getConfig()->key_length = $length; } if ($i == 0 && isset($this->_locales[$formats[0]])) { break; // Format already localized, no need to compare } else { $this->_switchCatalogues(); } } if (count($formats) > 1) { list($format, $decorator_format) = $formats; $this->_locales[$format] = ($format == $decorator_format) ? $this->getLocaleFallback() : $this->getLocale(); } else $format = $formats[0]; // Set the activity locale. $activity->setLocale($this->_locales[$format]); return $format; }
php
public function translateActivityFormat(ComActivitiesActivityInterface $activity) { $tokens = $this->getActivityTokens($activity); $format = $activity->getActivityFormat(); $parameters = array(); foreach ($tokens as $key => $value) { if ($value instanceof ComActivitiesActivityObjectInterface && $value->getObjectName()) { $value = $value->getObjectName(); } if (is_scalar($value)) { $parameters[$key] = $value; } } $formats = array(); for ($i = 0; $i < 2; $i++) { $catalogue = $this->getCatalogue(); if ($length = $catalogue->getConfig()->key_length) { $catalogue->getConfig()->key_length = false; } $formats[] = $this->translate($this->_getOverride($format, $parameters), array()); if ($length) { $catalogue->getConfig()->key_length = $length; } if ($i == 0 && isset($this->_locales[$formats[0]])) { break; // Format already localized, no need to compare } else { $this->_switchCatalogues(); } } if (count($formats) > 1) { list($format, $decorator_format) = $formats; $this->_locales[$format] = ($format == $decorator_format) ? $this->getLocaleFallback() : $this->getLocale(); } else $format = $formats[0]; // Set the activity locale. $activity->setLocale($this->_locales[$format]); return $format; }
[ "public", "function", "translateActivityFormat", "(", "ComActivitiesActivityInterface", "$", "activity", ")", "{", "$", "tokens", "=", "$", "this", "->", "getActivityTokens", "(", "$", "activity", ")", ";", "$", "format", "=", "$", "activity", "->", "getActivity...
Translates an activity format. @param string $string The activity format to translate. @return string The translated activity format.
[ "Translates", "an", "activity", "format", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/activity/translator/translator.php#L252-L304
train
joomlatools/joomlatools-framework-activities
activity/translator/translator.php
ComActivitiesActivityTranslator.translateActivityToken
public function translateActivityToken($token, ComActivitiesActivityInterface $activity) { if (is_string($token)) { $tokens = $this->getActivityTokens($activity); if (isset($tokens[$token])) { $token = $tokens[$token]; } } if (!$token instanceof ComActivitiesActivityObjectInterface) { throw new RuntimeException('Invalid token'); } $result = $token->getDisplayName(); if ($token->isTranslatable()) { if ($activity->getLocale() == $this->getLocaleFallback()) { // Use decorator catalogue instead $this->_switchCatalogues(); $result = $this->translate($result); $this->_switchCatalogues(); } else $result = $this->translate($result); } return $result; }
php
public function translateActivityToken($token, ComActivitiesActivityInterface $activity) { if (is_string($token)) { $tokens = $this->getActivityTokens($activity); if (isset($tokens[$token])) { $token = $tokens[$token]; } } if (!$token instanceof ComActivitiesActivityObjectInterface) { throw new RuntimeException('Invalid token'); } $result = $token->getDisplayName(); if ($token->isTranslatable()) { if ($activity->getLocale() == $this->getLocaleFallback()) { // Use decorator catalogue instead $this->_switchCatalogues(); $result = $this->translate($result); $this->_switchCatalogues(); } else $result = $this->translate($result); } return $result; }
[ "public", "function", "translateActivityToken", "(", "$", "token", ",", "ComActivitiesActivityInterface", "$", "activity", ")", "{", "if", "(", "is_string", "(", "$", "token", ")", ")", "{", "$", "tokens", "=", "$", "this", "->", "getActivityTokens", "(", "$...
Translates an activity token. @param string|ComActivitiesActivityObjectInterface $token The activity token. @param ComActivitiesActivityInterface $activity The activity object. @return string The translated token.
[ "Translates", "an", "activity", "token", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/activity/translator/translator.php#L313-L342
train
joomlatools/joomlatools-framework-activities
activity/translator/translator.php
ComActivitiesActivityTranslator._getFallbackCatalogue
protected function _getFallbackCatalogue() { if (!$this->_fallback_catalogue instanceof KTranslatorCatalogueInterface) { $this->_setFallbackCatalogue($this->getObject($this->_fallback_catalogue)); } return $this->_fallback_catalogue; }
php
protected function _getFallbackCatalogue() { if (!$this->_fallback_catalogue instanceof KTranslatorCatalogueInterface) { $this->_setFallbackCatalogue($this->getObject($this->_fallback_catalogue)); } return $this->_fallback_catalogue; }
[ "protected", "function", "_getFallbackCatalogue", "(", ")", "{", "if", "(", "!", "$", "this", "->", "_fallback_catalogue", "instanceof", "KTranslatorCatalogueInterface", ")", "{", "$", "this", "->", "_setFallbackCatalogue", "(", "$", "this", "->", "getObject", "("...
Decorator catalogue getter. @return KTranslatorCatalogueInterface The decorator catalogue.
[ "Decorator", "catalogue", "getter", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/activity/translator/translator.php#L361-L368
train
joomlatools/joomlatools-framework-activities
activity/translator/translator.php
ComActivitiesActivityTranslator._getOverride
protected function _getOverride($format, $parameters = array()) { $override = $format; $locale = $this->getLocale(); if (!isset($this->_overrides[$locale])) { $this->_overrides[$locale] = array(); } if ($parameters) { $key = $this->_getOverrideKey($format, $parameters); if (!isset($this->_overrides[$locale][$key])) { foreach ($this->_getOverrides($format, $parameters) as $candidate) { // Check if the override is translatable. if ($this->isTranslatable($candidate)) { $override = $candidate; break; } } $this->_overrides[$locale][$key] = $override; } else $override = $this->_overrides[$locale][$key]; } return $override; }
php
protected function _getOverride($format, $parameters = array()) { $override = $format; $locale = $this->getLocale(); if (!isset($this->_overrides[$locale])) { $this->_overrides[$locale] = array(); } if ($parameters) { $key = $this->_getOverrideKey($format, $parameters); if (!isset($this->_overrides[$locale][$key])) { foreach ($this->_getOverrides($format, $parameters) as $candidate) { // Check if the override is translatable. if ($this->isTranslatable($candidate)) { $override = $candidate; break; } } $this->_overrides[$locale][$key] = $override; } else $override = $this->_overrides[$locale][$key]; } return $override; }
[ "protected", "function", "_getOverride", "(", "$", "format", ",", "$", "parameters", "=", "array", "(", ")", ")", "{", "$", "override", "=", "$", "format", ";", "$", "locale", "=", "$", "this", "->", "getLocale", "(", ")", ";", "if", "(", "!", "iss...
Get an activity format override. @param string $format The activity format. @param array $parameters Associative array containing parameters. @return string The activity format override. If an override was not found, the original activity format is returned instead.
[ "Get", "an", "activity", "format", "override", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/activity/translator/translator.php#L378-L410
train
joomlatools/joomlatools-framework-activities
activity/translator/translator.php
ComActivitiesActivityTranslator._getOverrideKey
protected function _getOverrideKey($format, $parameters = array()) { $result = $format; foreach ($parameters as $key => $value) { $result = str_replace(sprintf('{%s}', $key), $value, $result); } return $result; }
php
protected function _getOverrideKey($format, $parameters = array()) { $result = $format; foreach ($parameters as $key => $value) { $result = str_replace(sprintf('{%s}', $key), $value, $result); } return $result; }
[ "protected", "function", "_getOverrideKey", "(", "$", "format", ",", "$", "parameters", "=", "array", "(", ")", ")", "{", "$", "result", "=", "$", "format", ";", "foreach", "(", "$", "parameters", "as", "$", "key", "=>", "$", "value", ")", "{", "$", ...
Get an activity format override key. @param string $format The activity format. @param array $parameters Associative array containing parameters. @return string The activity format override key.
[ "Get", "an", "activity", "format", "override", "key", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/activity/translator/translator.php#L419-L428
train
joomlatools/joomlatools-framework-activities
activity/translator/translator.php
ComActivitiesActivityTranslator._getOverrides
protected function _getOverrides($format, $parameters = array()) { $overrides = array(); if (!empty($parameters)) { // Get the power set of the set of parameters and construct a list of string overrides from it. foreach ($this->_getPowerSet(array_keys($parameters)) as $subset) { $override = $format; foreach ($subset as $key) { $override = str_replace(sprintf('{%s}', $key), $parameters[$key], $override); } $overrides[] = $override; } } return $overrides; }
php
protected function _getOverrides($format, $parameters = array()) { $overrides = array(); if (!empty($parameters)) { // Get the power set of the set of parameters and construct a list of string overrides from it. foreach ($this->_getPowerSet(array_keys($parameters)) as $subset) { $override = $format; foreach ($subset as $key) { $override = str_replace(sprintf('{%s}', $key), $parameters[$key], $override); } $overrides[] = $override; } } return $overrides; }
[ "protected", "function", "_getOverrides", "(", "$", "format", ",", "$", "parameters", "=", "array", "(", ")", ")", "{", "$", "overrides", "=", "array", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "parameters", ")", ")", "{", "// Get the power set...
Returns a list of activity format overrides. @param string $format The activity format. @param array $parameters Associative array containing parameters. @return array A list of activity format overrides.
[ "Returns", "a", "list", "of", "activity", "format", "overrides", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/activity/translator/translator.php#L437-L457
train
joomlatools/joomlatools-framework-activities
activity/translator/translator.php
ComActivitiesActivityTranslator._getPowerSet
protected function _getPowerSet(array $set = array(), $min_length = 1) { $elements = count($set); $size = pow(2, $elements); $members = array(); for ($i = 0; $i < $size; $i++) { $b = sprintf("%0" . $elements . "b", $i); $member = array(); for ($j = 0; $j < $elements; $j++) { if ($b{$j} == '1') $member[] = $set[$j]; } if (count($member) >= $min_length) { if (!isset($members[count($member)])) { $members[count($member)] = array(); } // Group members by number of elements they contain. $members[count($member)][] = $member; } } // Sort members by number of elements (key value). ksort($members, SORT_NUMERIC); $power = array(); // We want members with greater amount of elements first. foreach (array_reverse($members) as $subsets) { $power = array_merge($power, $subsets); } return $power; }
php
protected function _getPowerSet(array $set = array(), $min_length = 1) { $elements = count($set); $size = pow(2, $elements); $members = array(); for ($i = 0; $i < $size; $i++) { $b = sprintf("%0" . $elements . "b", $i); $member = array(); for ($j = 0; $j < $elements; $j++) { if ($b{$j} == '1') $member[] = $set[$j]; } if (count($member) >= $min_length) { if (!isset($members[count($member)])) { $members[count($member)] = array(); } // Group members by number of elements they contain. $members[count($member)][] = $member; } } // Sort members by number of elements (key value). ksort($members, SORT_NUMERIC); $power = array(); // We want members with greater amount of elements first. foreach (array_reverse($members) as $subsets) { $power = array_merge($power, $subsets); } return $power; }
[ "protected", "function", "_getPowerSet", "(", "array", "$", "set", "=", "array", "(", ")", ",", "$", "min_length", "=", "1", ")", "{", "$", "elements", "=", "count", "(", "$", "set", ")", ";", "$", "size", "=", "pow", "(", "2", ",", "$", "element...
Returns the power set of a set represented by the elements contained in an array. For convenience, the elements are ordered from size (subsets with more elements first). @param array $set The set to get the power set from. @param int $min_length The minimum amount of elements that a subset from the power set may contain. @return array The power set represented by an array of arrays containing elements from the provided set.
[ "Returns", "the", "power", "set", "of", "a", "set", "represented", "by", "the", "elements", "contained", "in", "an", "array", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/activity/translator/translator.php#L468-L504
train
joomlatools/joomlatools-framework-activities
activity/translator/translator.php
ComActivitiesActivityTranslator._switchCatalogues
protected function _switchCatalogues() { // Switch Catalogues $catalogue = $this->_getFallbackCatalogue(); $this->_setFallbackCatalogue($this->getCatalogue()); $this->setCatalogue($catalogue); return $this; }
php
protected function _switchCatalogues() { // Switch Catalogues $catalogue = $this->_getFallbackCatalogue(); $this->_setFallbackCatalogue($this->getCatalogue()); $this->setCatalogue($catalogue); return $this; }
[ "protected", "function", "_switchCatalogues", "(", ")", "{", "// Switch Catalogues", "$", "catalogue", "=", "$", "this", "->", "_getFallbackCatalogue", "(", ")", ";", "$", "this", "->", "_setFallbackCatalogue", "(", "$", "this", "->", "getCatalogue", "(", ")", ...
Switch translator catalogues. The translator and fallback catalogues are switched. @return ComActivitiesActivityTranslatorInterface
[ "Switch", "translator", "catalogues", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/activity/translator/translator.php#L552-L560
train
joomlatools/joomlatools-framework-activities
model/entity/activity.php
ComActivitiesModelEntityActivity.getTranslator
public function getTranslator() { if (!$this->_translator instanceof ComActivitiesActivityTranslatorInterface) { $translator = $this->getObject('translator'); if (!$translator instanceof ComActivitiesActivityTranslatorInterface) { $translator = $translator->decorate($this->_translator); $this->getObject('manager')->setObject('translator', $translator); } $this->setTranslator($translator); } return $this->_translator; }
php
public function getTranslator() { if (!$this->_translator instanceof ComActivitiesActivityTranslatorInterface) { $translator = $this->getObject('translator'); if (!$translator instanceof ComActivitiesActivityTranslatorInterface) { $translator = $translator->decorate($this->_translator); $this->getObject('manager')->setObject('translator', $translator); } $this->setTranslator($translator); } return $this->_translator; }
[ "public", "function", "getTranslator", "(", ")", "{", "if", "(", "!", "$", "this", "->", "_translator", "instanceof", "ComActivitiesActivityTranslatorInterface", ")", "{", "$", "translator", "=", "$", "this", "->", "getObject", "(", "'translator'", ")", ";", "...
Set the activity translator. @param ComActivitiesActivityTranslatorInterface $translator @return ComActivitiesActivityInterface
[ "Set", "the", "activity", "translator", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/model/entity/activity.php#L361-L376
train
joomlatools/joomlatools-framework-activities
model/entity/activity.php
ComActivitiesModelEntityActivity._getObjects
protected function _getObjects(array $labels = array()) { $objects = array(); foreach ($labels as $label) { $method = 'getActivity' . ucfirst($label); if (method_exists($this, $method)) { $object = $this->$method(); if ($object instanceof ComActivitiesActivityObjectInterface) { $objects[$label] = $object; } } } return $objects; }
php
protected function _getObjects(array $labels = array()) { $objects = array(); foreach ($labels as $label) { $method = 'getActivity' . ucfirst($label); if (method_exists($this, $method)) { $object = $this->$method(); if ($object instanceof ComActivitiesActivityObjectInterface) { $objects[$label] = $object; } } } return $objects; }
[ "protected", "function", "_getObjects", "(", "array", "$", "labels", "=", "array", "(", ")", ")", "{", "$", "objects", "=", "array", "(", ")", ";", "foreach", "(", "$", "labels", "as", "$", "label", ")", "{", "$", "method", "=", "'getActivity'", ".",...
Returns a list of activity objects provided their labels. @param array $labels The object labels. @return array An array containing ComActivitiesActivityObjectInterface objects.
[ "Returns", "a", "list", "of", "activity", "objects", "provided", "their", "labels", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/model/entity/activity.php#L496-L515
train
joomlatools/joomlatools-framework-activities
model/entity/activity.php
ComActivitiesModelEntityActivity._getObject
protected function _getObject($config = array()) { $config = new KObjectConfig($config); $config->append(array( 'attributes' => array(), 'translate' => true )); // Process all object sub-properties. foreach ($config as $key => $value) { if ($value instanceof KObjectConfig && $value->object === true) { $config->{$key} = $this->_getObject($value); } } if ($config->objectName && !$config->displayName) { $config->displayName = $config->objectName; } if (is_string($config->url)) { $config->url = $this->_getRoute($config->url); } // Make object non-linkable and set it as deleted if related entity is not found. if ($config->find && !$this->_findObject($config->find)) { $config->url = null; $config->deleted = true; } if ($config->image instanceof KObjectConfig) { if (is_string($config->image->url)) { $config->image->url = $this->_getRoute($config->image->url); } $config->image = $this->getObject('com:activities.activity.medialink', array('data' => $config->image)); } // Cleanup config. foreach (array('find', 'object') as $property) { unset($config->$property); } return $this->getObject('com:activities.activity.object', array('data' => $config)); }
php
protected function _getObject($config = array()) { $config = new KObjectConfig($config); $config->append(array( 'attributes' => array(), 'translate' => true )); // Process all object sub-properties. foreach ($config as $key => $value) { if ($value instanceof KObjectConfig && $value->object === true) { $config->{$key} = $this->_getObject($value); } } if ($config->objectName && !$config->displayName) { $config->displayName = $config->objectName; } if (is_string($config->url)) { $config->url = $this->_getRoute($config->url); } // Make object non-linkable and set it as deleted if related entity is not found. if ($config->find && !$this->_findObject($config->find)) { $config->url = null; $config->deleted = true; } if ($config->image instanceof KObjectConfig) { if (is_string($config->image->url)) { $config->image->url = $this->_getRoute($config->image->url); } $config->image = $this->getObject('com:activities.activity.medialink', array('data' => $config->image)); } // Cleanup config. foreach (array('find', 'object') as $property) { unset($config->$property); } return $this->getObject('com:activities.activity.object', array('data' => $config)); }
[ "protected", "function", "_getObject", "(", "$", "config", "=", "array", "(", ")", ")", "{", "$", "config", "=", "new", "KObjectConfig", "(", "$", "config", ")", ";", "$", "config", "->", "append", "(", "array", "(", "'attributes'", "=>", "array", "(",...
Get an activity object @param array $config An optional configuration array. The configuration array may contain activity object data as defined by ComActivitiesActivityObjectInterface. Additionally the following parameters may be passed in the configuration array: <br><br> - find (string): the label of an object to look for. If not found the object being created is set as deleted (with its deleted property set to true) and non-linkable (with its url property set to null). A call to a _findActivity{Label} method will be attempted for determining if an object with label as defined by {Label} exists. See {@link _findActivityActor()} as an example. <br><br> - translate (bool): translates displayName property if set to true. - object (bool): the configuration array may contain arrays which represent configurations for stacked activity objects. For them to be considered as object configurations, an object property with its value set to true must be included in the configuration array. @return ComActivitiesActivityObject The activity object.
[ "Get", "an", "activity", "object" ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/model/entity/activity.php#L537-L584
train
joomlatools/joomlatools-framework-activities
model/entity/activity.php
ComActivitiesModelEntityActivity._getConfig
protected function _getConfig($object) { $config = new KObjectConfig(); $method = '_' . strtolower($object) . 'Config'; // Call config setter if any. if (method_exists($this, $method)) { $this->$method($config); } return $config; }
php
protected function _getConfig($object) { $config = new KObjectConfig(); $method = '_' . strtolower($object) . 'Config'; // Call config setter if any. if (method_exists($this, $method)) { $this->$method($config); } return $config; }
[ "protected", "function", "_getConfig", "(", "$", "object", ")", "{", "$", "config", "=", "new", "KObjectConfig", "(", ")", ";", "$", "method", "=", "'_'", ".", "strtolower", "(", "$", "object", ")", ".", "'Config'", ";", "// Call config setter if any.", "i...
Get an activity object config. @param string $object The object name. @return KObjectConfig
[ "Get", "an", "activity", "object", "config", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/model/entity/activity.php#L592-L604
train
joomlatools/joomlatools-framework-activities
model/entity/activity.php
ComActivitiesModelEntityActivity._actorConfig
protected function _actorConfig(KObjectConfig $config) { $objectName = $this->getAuthor()->getName(); $translate = false; if (!$this->created_by) { $objectName = 'Guest user'; $translate = true; } elseif (!$this->_findActivityActor()) { $objectName = 'Deleted user'; $translate = true; } $config->append(array( 'type' => array('objectName' => 'user', 'object' => true), 'id' => $this->created_by, 'url' => 'option=com_users&task=user.edit&id=' . $this->created_by, 'objectName' => $objectName, 'translate' => $translate, 'find' => 'actor' )); }
php
protected function _actorConfig(KObjectConfig $config) { $objectName = $this->getAuthor()->getName(); $translate = false; if (!$this->created_by) { $objectName = 'Guest user'; $translate = true; } elseif (!$this->_findActivityActor()) { $objectName = 'Deleted user'; $translate = true; } $config->append(array( 'type' => array('objectName' => 'user', 'object' => true), 'id' => $this->created_by, 'url' => 'option=com_users&task=user.edit&id=' . $this->created_by, 'objectName' => $objectName, 'translate' => $translate, 'find' => 'actor' )); }
[ "protected", "function", "_actorConfig", "(", "KObjectConfig", "$", "config", ")", "{", "$", "objectName", "=", "$", "this", "->", "getAuthor", "(", ")", "->", "getName", "(", ")", ";", "$", "translate", "=", "false", ";", "if", "(", "!", "$", "this", ...
Set the actor config. @param KObjectConfig $config The actor config. @return KObjectConfig
[ "Set", "the", "actor", "config", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/model/entity/activity.php#L612-L636
train
joomlatools/joomlatools-framework-activities
model/entity/activity.php
ComActivitiesModelEntityActivity._objectConfig
protected function _objectConfig(KObjectConfig $config) { $config->append(array( 'id' => $this->row, 'objectName' => $this->title, 'type' => array('objectName' => $this->name, 'object' => true), 'url' => 'option=com_' . $this->package . '&view=' . $this->name . '&id=' . $this->row, 'attributes' => array('class' => array('object')), 'find' => 'object', 'translate' => false )); }
php
protected function _objectConfig(KObjectConfig $config) { $config->append(array( 'id' => $this->row, 'objectName' => $this->title, 'type' => array('objectName' => $this->name, 'object' => true), 'url' => 'option=com_' . $this->package . '&view=' . $this->name . '&id=' . $this->row, 'attributes' => array('class' => array('object')), 'find' => 'object', 'translate' => false )); }
[ "protected", "function", "_objectConfig", "(", "KObjectConfig", "$", "config", ")", "{", "$", "config", "->", "append", "(", "array", "(", "'id'", "=>", "$", "this", "->", "row", ",", "'objectName'", "=>", "$", "this", "->", "title", ",", "'type'", "=>",...
Set the object config. @param KObjectConfig $config The object config.
[ "Set", "the", "object", "config", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/model/entity/activity.php#L643-L654
train
joomlatools/joomlatools-framework-activities
model/entity/activity.php
ComActivitiesModelEntityActivity._findObject
protected function _findObject($label) { $result = false; $signature = null; $method = sprintf('_get%sSignature', ucfirst($label)); if (method_exists($this, $method)) { $signature = $this->$method(); } if (is_null($signature) || !isset(self::$_find_results[$signature])) { $method = '_findActivity' . ucfirst($label); if (method_exists($this, $method)) { $result = (bool) $this->$method(); } if ($signature) { self::$_find_results[$signature] = $result; } } else $result = self::$_find_results[$signature]; return $result; }
php
protected function _findObject($label) { $result = false; $signature = null; $method = sprintf('_get%sSignature', ucfirst($label)); if (method_exists($this, $method)) { $signature = $this->$method(); } if (is_null($signature) || !isset(self::$_find_results[$signature])) { $method = '_findActivity' . ucfirst($label); if (method_exists($this, $method)) { $result = (bool) $this->$method(); } if ($signature) { self::$_find_results[$signature] = $result; } } else $result = self::$_find_results[$signature]; return $result; }
[ "protected", "function", "_findObject", "(", "$", "label", ")", "{", "$", "result", "=", "false", ";", "$", "signature", "=", "null", ";", "$", "method", "=", "sprintf", "(", "'_get%sSignature'", ",", "ucfirst", "(", "$", "label", ")", ")", ";", "if", ...
Find an activity object. @param string $label The object label. @return bool True if found, false otherwise.
[ "Find", "an", "activity", "object", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/model/entity/activity.php#L712-L738
train
joomlatools/joomlatools-framework-activities
model/entity/activity.php
ComActivitiesModelEntityActivity._findActivityObject
protected function _findActivityObject() { $db = $this->getTable()->getAdapter(); $table = $this->_object_table; $column = $this->_object_column; $query = $this->getObject('lib:database.query.select'); $query->columns('COUNT(*)')->table($table)->where($column . ' = :value') ->bind(array('value' => $this->row)); // Need to catch exceptions here as table may not longer exist. try { $result = $db->select($query, KDatabase::FETCH_FIELD); } catch (Exception $e) { $result = 0; } return $result; }
php
protected function _findActivityObject() { $db = $this->getTable()->getAdapter(); $table = $this->_object_table; $column = $this->_object_column; $query = $this->getObject('lib:database.query.select'); $query->columns('COUNT(*)')->table($table)->where($column . ' = :value') ->bind(array('value' => $this->row)); // Need to catch exceptions here as table may not longer exist. try { $result = $db->select($query, KDatabase::FETCH_FIELD); } catch (Exception $e) { $result = 0; } return $result; }
[ "protected", "function", "_findActivityObject", "(", ")", "{", "$", "db", "=", "$", "this", "->", "getTable", "(", ")", "->", "getAdapter", "(", ")", ";", "$", "table", "=", "$", "this", "->", "_object_table", ";", "$", "column", "=", "$", "this", "-...
Finds the activity object. This method may be overridden for activities persisting objects on storage systems other than local database tables. @return boolean True if found, false otherwise.
[ "Finds", "the", "activity", "object", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/model/entity/activity.php#L748-L766
train
joomlatools/joomlatools-framework-activities
model/entity/activity.php
ComActivitiesModelEntityActivity._findActivityActor
protected function _findActivityActor() { $user = $this->getObject('user.provider')->fetch($this->created_by); return is_null($user) ? false : true; }
php
protected function _findActivityActor() { $user = $this->getObject('user.provider')->fetch($this->created_by); return is_null($user) ? false : true; }
[ "protected", "function", "_findActivityActor", "(", ")", "{", "$", "user", "=", "$", "this", "->", "getObject", "(", "'user.provider'", ")", "->", "fetch", "(", "$", "this", "->", "created_by", ")", ";", "return", "is_null", "(", "$", "user", ")", "?", ...
Finds the activity actor. @return boolean True if found, false otherwise.
[ "Finds", "the", "activity", "actor", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/model/entity/activity.php#L773-L778
train
aviat4ion/Query
src/QueryParser.php
QueryParser.parseJoin
public function parseJoin(string $sql): array { // Get sql clause components preg_match_all('`'.$this->matchPatterns['function'].'`', $sql, $this->matches['functions'], PREG_SET_ORDER); preg_match_all('`'.$this->matchPatterns['identifier'].'`', $sql, $this->matches['identifiers'], PREG_SET_ORDER); preg_match_all('`'.$this->matchPatterns['operator'].'`', $sql, $this->matches['operators'], PREG_SET_ORDER); // Get everything at once for ordering $fullPattern = '`'.$this->matchPatterns['function'].'+|'.$this->matchPatterns['identifier'].'|('.$this->matchPatterns['operator'].')+`i'; preg_match_all($fullPattern, $sql, $this->matches['combined'], PREG_SET_ORDER); // Go through the matches, and get the most relevant matches $this->matches = array_map([$this, 'filterArray'], $this->matches); return $this->matches; }
php
public function parseJoin(string $sql): array { // Get sql clause components preg_match_all('`'.$this->matchPatterns['function'].'`', $sql, $this->matches['functions'], PREG_SET_ORDER); preg_match_all('`'.$this->matchPatterns['identifier'].'`', $sql, $this->matches['identifiers'], PREG_SET_ORDER); preg_match_all('`'.$this->matchPatterns['operator'].'`', $sql, $this->matches['operators'], PREG_SET_ORDER); // Get everything at once for ordering $fullPattern = '`'.$this->matchPatterns['function'].'+|'.$this->matchPatterns['identifier'].'|('.$this->matchPatterns['operator'].')+`i'; preg_match_all($fullPattern, $sql, $this->matches['combined'], PREG_SET_ORDER); // Go through the matches, and get the most relevant matches $this->matches = array_map([$this, 'filterArray'], $this->matches); return $this->matches; }
[ "public", "function", "parseJoin", "(", "string", "$", "sql", ")", ":", "array", "{", "// Get sql clause components", "preg_match_all", "(", "'`'", ".", "$", "this", "->", "matchPatterns", "[", "'function'", "]", ".", "'`'", ",", "$", "sql", ",", "$", "thi...
Parser method for setting the parse string @param string $sql @return array
[ "Parser", "method", "for", "setting", "the", "parse", "string" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryParser.php#L70-L85
train
aviat4ion/Query
src/QueryParser.php
QueryParser.compileJoin
public function compileJoin(string $condition): string { $parts = $this->parseJoin($condition); $count = count($parts['identifiers']); // Go through and quote the identifiers for($i=0; $i <= $count; $i++) { if (in_array($parts['combined'][$i], $parts['identifiers']) && ! is_numeric($parts['combined'][$i])) { $parts['combined'][$i] = $this->db->quoteIdent($parts['combined'][$i]); } } return implode('', $parts['combined']); }
php
public function compileJoin(string $condition): string { $parts = $this->parseJoin($condition); $count = count($parts['identifiers']); // Go through and quote the identifiers for($i=0; $i <= $count; $i++) { if (in_array($parts['combined'][$i], $parts['identifiers']) && ! is_numeric($parts['combined'][$i])) { $parts['combined'][$i] = $this->db->quoteIdent($parts['combined'][$i]); } } return implode('', $parts['combined']); }
[ "public", "function", "compileJoin", "(", "string", "$", "condition", ")", ":", "string", "{", "$", "parts", "=", "$", "this", "->", "parseJoin", "(", "$", "condition", ")", ";", "$", "count", "=", "count", "(", "$", "parts", "[", "'identifiers'", "]",...
Compiles a join condition after parsing @param string $condition @return string
[ "Compiles", "a", "join", "condition", "after", "parsing" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryParser.php#L93-L108
train
aviat4ion/Query
src/QueryParser.php
QueryParser.filterArray
protected function filterArray(array $array): array { $newArray = []; foreach($array as $row) { $newArray[] = (is_array($row)) ? $row[0] : $row; } return $newArray; }
php
protected function filterArray(array $array): array { $newArray = []; foreach($array as $row) { $newArray[] = (is_array($row)) ? $row[0] : $row; } return $newArray; }
[ "protected", "function", "filterArray", "(", "array", "$", "array", ")", ":", "array", "{", "$", "newArray", "=", "[", "]", ";", "foreach", "(", "$", "array", "as", "$", "row", ")", "{", "$", "newArray", "[", "]", "=", "(", "is_array", "(", "$", ...
Returns a more useful match array @param array $array @return array
[ "Returns", "a", "more", "useful", "match", "array" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryParser.php#L116-L126
train
joomlatools/joomlatools-framework-activities
controller/behavior/purgeable.php
ComActivitiesControllerBehaviorPurgeable._actionPurge
protected function _actionPurge(KControllerContextInterface $context) { $model = $this->getModel(); $state = $model->getState(); $query = $this->getObject('lib:database.query.delete'); $query->table(array($model->getTable()->getName())); if ($state->end_date && $state->end_date != '0000-00-00') { $end_date = $this->getObject('lib:date', array('date' => $state->end_date)); $end = $end_date->format('Y-m-d'); $query->where('DATE(created_on) <= :end')->bind(array('end' => $end)); } if (!$this->getModel()->getTable()->getAdapter()->execute($query)) { throw new KControllerExceptionActionFailed('Delete Action Failed'); } else { $context->getResponse()->setStatus(KHttpResponse::NO_CONTENT); } }
php
protected function _actionPurge(KControllerContextInterface $context) { $model = $this->getModel(); $state = $model->getState(); $query = $this->getObject('lib:database.query.delete'); $query->table(array($model->getTable()->getName())); if ($state->end_date && $state->end_date != '0000-00-00') { $end_date = $this->getObject('lib:date', array('date' => $state->end_date)); $end = $end_date->format('Y-m-d'); $query->where('DATE(created_on) <= :end')->bind(array('end' => $end)); } if (!$this->getModel()->getTable()->getAdapter()->execute($query)) { throw new KControllerExceptionActionFailed('Delete Action Failed'); } else { $context->getResponse()->setStatus(KHttpResponse::NO_CONTENT); } }
[ "protected", "function", "_actionPurge", "(", "KControllerContextInterface", "$", "context", ")", "{", "$", "model", "=", "$", "this", "->", "getModel", "(", ")", ";", "$", "state", "=", "$", "model", "->", "getState", "(", ")", ";", "$", "query", "=", ...
Purge action. Deletes activities given a date range. @param KControllerContextInterface $context A command context object. @throws KControllerExceptionActionFailed If the activities cannot be purged. @return KModelEntityInterface
[ "Purge", "action", "." ]
701abf6186729f62643bc834055cdebc08c25c21
https://github.com/joomlatools/joomlatools-framework-activities/blob/701abf6186729f62643bc834055cdebc08c25c21/controller/behavior/purgeable.php#L29-L50
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder.select
public function select(string $fields): QueryBuilderInterface { // Split fields by comma $fieldsArray = explode(',', $fields); $fieldsArray = array_map('mb_trim', $fieldsArray); // Split on 'As' foreach ($fieldsArray as $key => $field) { if (stripos($field, 'as') !== FALSE) { $fieldsArray[$key] = preg_split('` as `i', $field); $fieldsArray[$key] = array_map('mb_trim', $fieldsArray[$key]); } } // Quote the identifiers $safeArray = $this->driver->quoteIdent($fieldsArray); unset($fieldsArray); // Join the strings back together for($i = 0, $c = count($safeArray); $i < $c; $i++) { if (\is_array($safeArray[$i])) { $safeArray[$i] = implode(' AS ', $safeArray[$i]); } } $this->state->appendSelectString(implode(', ', $safeArray)); return $this; }
php
public function select(string $fields): QueryBuilderInterface { // Split fields by comma $fieldsArray = explode(',', $fields); $fieldsArray = array_map('mb_trim', $fieldsArray); // Split on 'As' foreach ($fieldsArray as $key => $field) { if (stripos($field, 'as') !== FALSE) { $fieldsArray[$key] = preg_split('` as `i', $field); $fieldsArray[$key] = array_map('mb_trim', $fieldsArray[$key]); } } // Quote the identifiers $safeArray = $this->driver->quoteIdent($fieldsArray); unset($fieldsArray); // Join the strings back together for($i = 0, $c = count($safeArray); $i < $c; $i++) { if (\is_array($safeArray[$i])) { $safeArray[$i] = implode(' AS ', $safeArray[$i]); } } $this->state->appendSelectString(implode(', ', $safeArray)); return $this; }
[ "public", "function", "select", "(", "string", "$", "fields", ")", ":", "QueryBuilderInterface", "{", "// Split fields by comma", "$", "fieldsArray", "=", "explode", "(", "','", ",", "$", "fields", ")", ";", "$", "fieldsArray", "=", "array_map", "(", "'mb_trim...
Specifies rows to select in a query @param string $fields @return QueryBuilderInterface
[ "Specifies", "rows", "to", "select", "in", "a", "query" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L121-L154
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder.selectMax
public function selectMax(string $field, $as=FALSE): QueryBuilderInterface { // Create the select string $this->state->appendSelectString(' MAX'.$this->_select($field, $as)); return $this; }
php
public function selectMax(string $field, $as=FALSE): QueryBuilderInterface { // Create the select string $this->state->appendSelectString(' MAX'.$this->_select($field, $as)); return $this; }
[ "public", "function", "selectMax", "(", "string", "$", "field", ",", "$", "as", "=", "FALSE", ")", ":", "QueryBuilderInterface", "{", "// Create the select string", "$", "this", "->", "state", "->", "appendSelectString", "(", "' MAX'", ".", "$", "this", "->", ...
Selects the maximum value of a field from a query @param string $field @param string|bool $as @return QueryBuilderInterface
[ "Selects", "the", "maximum", "value", "of", "a", "field", "from", "a", "query" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L163-L168
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder.from
public function from(string $tblname): QueryBuilderInterface { // Split identifiers on spaces $identArray = explode(' ', \mb_trim($tblname)); $identArray = array_map('\\mb_trim', $identArray); // Quote the identifiers $identArray[0] = $this->driver->quoteTable($identArray[0]); $identArray = $this->driver->quoteIdent($identArray); // Paste it back together $this->state->setFromString(implode(' ', $identArray)); return $this; }
php
public function from(string $tblname): QueryBuilderInterface { // Split identifiers on spaces $identArray = explode(' ', \mb_trim($tblname)); $identArray = array_map('\\mb_trim', $identArray); // Quote the identifiers $identArray[0] = $this->driver->quoteTable($identArray[0]); $identArray = $this->driver->quoteIdent($identArray); // Paste it back together $this->state->setFromString(implode(' ', $identArray)); return $this; }
[ "public", "function", "from", "(", "string", "$", "tblname", ")", ":", "QueryBuilderInterface", "{", "// Split identifiers on spaces", "$", "identArray", "=", "explode", "(", "' '", ",", "\\", "mb_trim", "(", "$", "tblname", ")", ")", ";", "$", "identArray", ...
Specify the database table to select from @param string $tblname @return QueryBuilderInterface
[ "Specify", "the", "database", "table", "to", "select", "from" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L241-L255
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder.like
public function like(string $field, $val, string $pos='both'): QueryBuilderInterface { return $this->_like($field, $val, $pos); }
php
public function like(string $field, $val, string $pos='both'): QueryBuilderInterface { return $this->_like($field, $val, $pos); }
[ "public", "function", "like", "(", "string", "$", "field", ",", "$", "val", ",", "string", "$", "pos", "=", "'both'", ")", ":", "QueryBuilderInterface", "{", "return", "$", "this", "->", "_like", "(", "$", "field", ",", "$", "val", ",", "$", "pos", ...
Creates a Like clause in the sql statement @param string $field @param mixed $val @param string $pos @return QueryBuilderInterface
[ "Creates", "a", "Like", "clause", "in", "the", "sql", "statement" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L269-L272
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder.orLike
public function orLike(string $field, $val, string $pos='both'): QueryBuilderInterface { return $this->_like($field, $val, $pos, 'LIKE', 'OR'); }
php
public function orLike(string $field, $val, string $pos='both'): QueryBuilderInterface { return $this->_like($field, $val, $pos, 'LIKE', 'OR'); }
[ "public", "function", "orLike", "(", "string", "$", "field", ",", "$", "val", ",", "string", "$", "pos", "=", "'both'", ")", ":", "QueryBuilderInterface", "{", "return", "$", "this", "->", "_like", "(", "$", "field", ",", "$", "val", ",", "$", "pos",...
Generates an OR Like clause @param string $field @param mixed $val @param string $pos @return QueryBuilderInterface
[ "Generates", "an", "OR", "Like", "clause" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L282-L285
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder.notLike
public function notLike(string $field, $val, string $pos='both'): QueryBuilderInterface { return $this->_like($field, $val, $pos, 'NOT LIKE'); }
php
public function notLike(string $field, $val, string $pos='both'): QueryBuilderInterface { return $this->_like($field, $val, $pos, 'NOT LIKE'); }
[ "public", "function", "notLike", "(", "string", "$", "field", ",", "$", "val", ",", "string", "$", "pos", "=", "'both'", ")", ":", "QueryBuilderInterface", "{", "return", "$", "this", "->", "_like", "(", "$", "field", ",", "$", "val", ",", "$", "pos"...
Generates a NOT LIKE clause @param string $field @param mixed $val @param string $pos @return QueryBuilderInterface
[ "Generates", "a", "NOT", "LIKE", "clause" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L295-L298
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder.orNotLike
public function orNotLike(string $field, $val, string $pos='both'): QueryBuilderInterface { return $this->_like($field, $val, $pos, 'NOT LIKE', 'OR'); }
php
public function orNotLike(string $field, $val, string $pos='both'): QueryBuilderInterface { return $this->_like($field, $val, $pos, 'NOT LIKE', 'OR'); }
[ "public", "function", "orNotLike", "(", "string", "$", "field", ",", "$", "val", ",", "string", "$", "pos", "=", "'both'", ")", ":", "QueryBuilderInterface", "{", "return", "$", "this", "->", "_like", "(", "$", "field", ",", "$", "val", ",", "$", "po...
Generates a OR NOT LIKE clause @param string $field @param mixed $val @param string $pos @return QueryBuilderInterface
[ "Generates", "a", "OR", "NOT", "LIKE", "clause" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L308-L311
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder.join
public function join(string $table, string $condition, string $type=''): QueryBuilderInterface { // Prefix and quote table name $table = explode(' ', mb_trim($table)); $table[0] = $this->driver->quoteTable($table[0]); $table = $this->driver->quoteIdent($table); $table = implode(' ', $table); // Parse out the join condition $parsedCondition = $this->parser->compileJoin($condition); $condition = $table . ' ON ' . $parsedCondition; $this->state->appendMap("\n" . strtoupper($type) . ' JOIN ', $condition, 'join'); return $this; }
php
public function join(string $table, string $condition, string $type=''): QueryBuilderInterface { // Prefix and quote table name $table = explode(' ', mb_trim($table)); $table[0] = $this->driver->quoteTable($table[0]); $table = $this->driver->quoteIdent($table); $table = implode(' ', $table); // Parse out the join condition $parsedCondition = $this->parser->compileJoin($condition); $condition = $table . ' ON ' . $parsedCondition; $this->state->appendMap("\n" . strtoupper($type) . ' JOIN ', $condition, 'join'); return $this; }
[ "public", "function", "join", "(", "string", "$", "table", ",", "string", "$", "condition", ",", "string", "$", "type", "=", "''", ")", ":", "QueryBuilderInterface", "{", "// Prefix and quote table name", "$", "table", "=", "explode", "(", "' '", ",", "mb_tr...
Creates a join phrase in a compiled query @param string $table @param string $condition @param string $type @return QueryBuilderInterface
[ "Creates", "a", "join", "phrase", "in", "a", "compiled", "query" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L471-L486
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder.limit
public function limit(int $limit, $offset=FALSE): QueryBuilderInterface { $this->state->setLimit($limit); $this->state->setOffset($offset); return $this; }
php
public function limit(int $limit, $offset=FALSE): QueryBuilderInterface { $this->state->setLimit($limit); $this->state->setOffset($offset); return $this; }
[ "public", "function", "limit", "(", "int", "$", "limit", ",", "$", "offset", "=", "FALSE", ")", ":", "QueryBuilderInterface", "{", "$", "this", "->", "state", "->", "setLimit", "(", "$", "limit", ")", ";", "$", "this", "->", "state", "->", "setOffset",...
Set a limit on the current sql statement @param int $limit @param int|bool $offset @return QueryBuilderInterface
[ "Set", "a", "limit", "on", "the", "current", "sql", "statement" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L559-L565
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder.groupStart
public function groupStart(): QueryBuilderInterface { $conj = empty($this->state->getQueryMap()) ? ' WHERE ' : ' '; $this->state->appendMap($conj, '(', 'group_start'); return $this; }
php
public function groupStart(): QueryBuilderInterface { $conj = empty($this->state->getQueryMap()) ? ' WHERE ' : ' '; $this->state->appendMap($conj, '(', 'group_start'); return $this; }
[ "public", "function", "groupStart", "(", ")", ":", "QueryBuilderInterface", "{", "$", "conj", "=", "empty", "(", "$", "this", "->", "state", "->", "getQueryMap", "(", ")", ")", "?", "' WHERE '", ":", "' '", ";", "$", "this", "->", "state", "->", "appen...
Adds a paren to the current query for query grouping @return QueryBuilderInterface
[ "Adds", "a", "paren", "to", "the", "current", "query", "for", "query", "grouping" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L576-L583
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder.notGroupStart
public function notGroupStart(): QueryBuilderInterface { $conj = empty($this->state->getQueryMap()) ? ' WHERE ' : ' AND '; $this->state->appendMap($conj, ' NOT (', 'group_start'); return $this; }
php
public function notGroupStart(): QueryBuilderInterface { $conj = empty($this->state->getQueryMap()) ? ' WHERE ' : ' AND '; $this->state->appendMap($conj, ' NOT (', 'group_start'); return $this; }
[ "public", "function", "notGroupStart", "(", ")", ":", "QueryBuilderInterface", "{", "$", "conj", "=", "empty", "(", "$", "this", "->", "state", "->", "getQueryMap", "(", ")", ")", "?", "' WHERE '", ":", "' AND '", ";", "$", "this", "->", "state", "->", ...
Adds a paren to the current query for query grouping, prefixed with 'NOT' @return QueryBuilderInterface
[ "Adds", "a", "paren", "to", "the", "current", "query", "for", "query", "grouping", "prefixed", "with", "NOT" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L591-L598
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder.countAll
public function countAll(string $table): int { $sql = 'SELECT * FROM '.$this->driver->quoteTable($table); $res = $this->driver->query($sql); return (int) count($res->fetchAll()); }
php
public function countAll(string $table): int { $sql = 'SELECT * FROM '.$this->driver->quoteTable($table); $res = $this->driver->query($sql); return (int) count($res->fetchAll()); }
[ "public", "function", "countAll", "(", "string", "$", "table", ")", ":", "int", "{", "$", "sql", "=", "'SELECT * FROM '", ".", "$", "this", "->", "driver", "->", "quoteTable", "(", "$", "table", ")", ";", "$", "res", "=", "$", "this", "->", "driver",...
Retrieve the number of rows in the selected table @param string $table @return int
[ "Retrieve", "the", "number", "of", "rows", "in", "the", "selected", "table" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L692-L697
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder.insert
public function insert(string $table, $data=[]): ?PDOStatement { if ( ! empty($data)) { $this->set($data); } return $this->_run('insert', $table); }
php
public function insert(string $table, $data=[]): ?PDOStatement { if ( ! empty($data)) { $this->set($data); } return $this->_run('insert', $table); }
[ "public", "function", "insert", "(", "string", "$", "table", ",", "$", "data", "=", "[", "]", ")", ":", "?", "PDOStatement", "{", "if", "(", "!", "empty", "(", "$", "data", ")", ")", "{", "$", "this", "->", "set", "(", "$", "data", ")", ";", ...
Creates an insert clause, and executes it @param string $table @param mixed $data @return PDOStatement
[ "Creates", "an", "insert", "clause", "and", "executes", "it" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L728-L736
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder.insertBatch
public function insertBatch(string $table, $data=[]): ?PDOStatement { // Get the generated values and sql string [$sql, $data] = $this->driver->insertBatch($table, $data); return $sql !== NULL ? $this->_run('', $table, $sql, $data) : NULL; }
php
public function insertBatch(string $table, $data=[]): ?PDOStatement { // Get the generated values and sql string [$sql, $data] = $this->driver->insertBatch($table, $data); return $sql !== NULL ? $this->_run('', $table, $sql, $data) : NULL; }
[ "public", "function", "insertBatch", "(", "string", "$", "table", ",", "$", "data", "=", "[", "]", ")", ":", "?", "PDOStatement", "{", "// Get the generated values and sql string", "[", "$", "sql", ",", "$", "data", "]", "=", "$", "this", "->", "driver", ...
Creates and executes a batch insertion query @param string $table @param array $data @return PDOStatement
[ "Creates", "and", "executes", "a", "batch", "insertion", "query" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L745-L753
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder.updateBatch
public function updateBatch(string $table, $data, $where): ?PDOStatement { // Get the generated values and sql string list($sql, $data) = $this->driver->updateBatch($table, $data, $where); return $sql !== NULL ? $this->_run('', $table, $sql, $data) : NULL; }
php
public function updateBatch(string $table, $data, $where): ?PDOStatement { // Get the generated values and sql string list($sql, $data) = $this->driver->updateBatch($table, $data, $where); return $sql !== NULL ? $this->_run('', $table, $sql, $data) : NULL; }
[ "public", "function", "updateBatch", "(", "string", "$", "table", ",", "$", "data", ",", "$", "where", ")", ":", "?", "PDOStatement", "{", "// Get the generated values and sql string", "list", "(", "$", "sql", ",", "$", "data", ")", "=", "$", "this", "->",...
Creates a batch update, and executes it. Returns the number of affected rows @param string $table @param array|object $data @param string $where @return PDOStatement|null
[ "Creates", "a", "batch", "update", "and", "executes", "it", ".", "Returns", "the", "number", "of", "affected", "rows" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L781-L789
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder.delete
public function delete(string $table, $where=''): ?PDOStatement { // Set the where clause if ( ! empty($where)) { $this->where($where); } return $this->_run('delete', $table); }
php
public function delete(string $table, $where=''): ?PDOStatement { // Set the where clause if ( ! empty($where)) { $this->where($where); } return $this->_run('delete', $table); }
[ "public", "function", "delete", "(", "string", "$", "table", ",", "$", "where", "=", "''", ")", ":", "?", "PDOStatement", "{", "// Set the where clause", "if", "(", "!", "empty", "(", "$", "where", ")", ")", "{", "$", "this", "->", "where", "(", "$",...
Deletes data from a table @param string $table @param mixed $where @return PDOStatement
[ "Deletes", "data", "from", "a", "table" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L815-L824
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder.getCompiledSelect
public function getCompiledSelect(string $table='', bool $reset=TRUE): string { // Set the table if ( ! empty($table)) { $this->from($table); } return $this->_getCompile('select', $table, $reset); }
php
public function getCompiledSelect(string $table='', bool $reset=TRUE): string { // Set the table if ( ! empty($table)) { $this->from($table); } return $this->_getCompile('select', $table, $reset); }
[ "public", "function", "getCompiledSelect", "(", "string", "$", "table", "=", "''", ",", "bool", "$", "reset", "=", "TRUE", ")", ":", "string", "{", "// Set the table", "if", "(", "!", "empty", "(", "$", "table", ")", ")", "{", "$", "this", "->", "fro...
Returns the generated 'select' sql query @param string $table @param bool $reset @return string
[ "Returns", "the", "generated", "select", "sql", "query" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L837-L846
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder.getCompiledInsert
public function getCompiledInsert(string $table, bool $reset=TRUE): string { return $this->_getCompile('insert', $table, $reset); }
php
public function getCompiledInsert(string $table, bool $reset=TRUE): string { return $this->_getCompile('insert', $table, $reset); }
[ "public", "function", "getCompiledInsert", "(", "string", "$", "table", ",", "bool", "$", "reset", "=", "TRUE", ")", ":", "string", "{", "return", "$", "this", "->", "_getCompile", "(", "'insert'", ",", "$", "table", ",", "$", "reset", ")", ";", "}" ]
Returns the generated 'insert' sql query @param string $table @param bool $reset @return string
[ "Returns", "the", "generated", "insert", "sql", "query" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L855-L858
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder.getCompiledUpdate
public function getCompiledUpdate(string $table='', bool $reset=TRUE): string { return $this->_getCompile('update', $table, $reset); }
php
public function getCompiledUpdate(string $table='', bool $reset=TRUE): string { return $this->_getCompile('update', $table, $reset); }
[ "public", "function", "getCompiledUpdate", "(", "string", "$", "table", "=", "''", ",", "bool", "$", "reset", "=", "TRUE", ")", ":", "string", "{", "return", "$", "this", "->", "_getCompile", "(", "'update'", ",", "$", "table", ",", "$", "reset", ")", ...
Returns the generated 'update' sql query @param string $table @param bool $reset @return string
[ "Returns", "the", "generated", "update", "sql", "query" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L867-L870
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder.getCompiledDelete
public function getCompiledDelete(string $table='', bool $reset=TRUE): string { return $this->_getCompile('delete', $table, $reset); }
php
public function getCompiledDelete(string $table='', bool $reset=TRUE): string { return $this->_getCompile('delete', $table, $reset); }
[ "public", "function", "getCompiledDelete", "(", "string", "$", "table", "=", "''", ",", "bool", "$", "reset", "=", "TRUE", ")", ":", "string", "{", "return", "$", "this", "->", "_getCompile", "(", "'delete'", ",", "$", "table", ",", "$", "reset", ")", ...
Returns the generated 'delete' sql query @param string $table @param bool $reset @return string
[ "Returns", "the", "generated", "delete", "sql", "query" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L879-L882
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder._select
protected function _select(string $field, $as = FALSE): string { // Escape the identifiers $field = $this->driver->quoteIdent($field); if ( ! \is_string($as)) { return $field; } $as = $this->driver->quoteIdent($as); return "({$field}) AS {$as} "; }
php
protected function _select(string $field, $as = FALSE): string { // Escape the identifiers $field = $this->driver->quoteIdent($field); if ( ! \is_string($as)) { return $field; } $as = $this->driver->quoteIdent($as); return "({$field}) AS {$as} "; }
[ "protected", "function", "_select", "(", "string", "$", "field", ",", "$", "as", "=", "FALSE", ")", ":", "string", "{", "// Escape the identifiers", "$", "field", "=", "$", "this", "->", "driver", "->", "quoteIdent", "(", "$", "field", ")", ";", "if", ...
Method to simplify select_ methods @param string $field @param string|bool $as @return string
[ "Method", "to", "simplify", "select_", "methods" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L906-L918
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder._getCompile
protected function _getCompile(string $type, string $table, bool $reset): string { $sql = $this->_compile($type, $table); // Reset the query builder for the next query if ($reset) { $this->resetQuery(); } return $sql; }
php
protected function _getCompile(string $type, string $table, bool $reset): string { $sql = $this->_compile($type, $table); // Reset the query builder for the next query if ($reset) { $this->resetQuery(); } return $sql; }
[ "protected", "function", "_getCompile", "(", "string", "$", "type", ",", "string", "$", "table", ",", "bool", "$", "reset", ")", ":", "string", "{", "$", "sql", "=", "$", "this", "->", "_compile", "(", "$", "type", ",", "$", "table", ")", ";", "// ...
Helper function for returning sql strings @param string $type @param string $table @param bool $reset @return string
[ "Helper", "function", "for", "returning", "sql", "strings" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L928-L939
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder._like
protected function _like(string $field, $val, string $pos, string $like='LIKE', string $conj='AND'): self { $field = $this->driver->quoteIdent($field); // Add the like string into the order map $like = $field. " {$like} ?"; if ($pos === 'before') { $val = "%{$val}"; } elseif ($pos === 'after') { $val = "{$val}%"; } else { $val = "%{$val}%"; } $conj = empty($this->state->getQueryMap()) ? ' WHERE ' : " {$conj} "; $this->state->appendMap($conj, $like, 'like'); // Add to the values array $this->state->appendWhereValues($val); return $this; }
php
protected function _like(string $field, $val, string $pos, string $like='LIKE', string $conj='AND'): self { $field = $this->driver->quoteIdent($field); // Add the like string into the order map $like = $field. " {$like} ?"; if ($pos === 'before') { $val = "%{$val}"; } elseif ($pos === 'after') { $val = "{$val}%"; } else { $val = "%{$val}%"; } $conj = empty($this->state->getQueryMap()) ? ' WHERE ' : " {$conj} "; $this->state->appendMap($conj, $like, 'like'); // Add to the values array $this->state->appendWhereValues($val); return $this; }
[ "protected", "function", "_like", "(", "string", "$", "field", ",", "$", "val", ",", "string", "$", "pos", ",", "string", "$", "like", "=", "'LIKE'", ",", "string", "$", "conj", "=", "'AND'", ")", ":", "self", "{", "$", "field", "=", "$", "this", ...
Simplify 'like' methods @param string $field @param mixed $val @param string $pos @param string $like @param string $conj @return self
[ "Simplify", "like", "methods" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L951-L978
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder._having
protected function _having($key, $values=[], string $conj='AND'): self { $where = $this->_where($key, $values); // Create key/value placeholders foreach($where as $f => $val) { // Split each key by spaces, in case there // is an operator such as >, <, !=, etc. $fArray = explode(' ', trim($f)); $item = $this->driver->quoteIdent($fArray[0]); // Simple key value, or an operator $item .= (count($fArray) === 1) ? '=?' : " {$fArray[1]} ?"; // Put in the having map $this->state->appendHavingMap([ 'conjunction' => empty($this->state->getHavingMap()) ? ' HAVING ' : " {$conj} ", 'string' => $item ]); } return $this; }
php
protected function _having($key, $values=[], string $conj='AND'): self { $where = $this->_where($key, $values); // Create key/value placeholders foreach($where as $f => $val) { // Split each key by spaces, in case there // is an operator such as >, <, !=, etc. $fArray = explode(' ', trim($f)); $item = $this->driver->quoteIdent($fArray[0]); // Simple key value, or an operator $item .= (count($fArray) === 1) ? '=?' : " {$fArray[1]} ?"; // Put in the having map $this->state->appendHavingMap([ 'conjunction' => empty($this->state->getHavingMap()) ? ' HAVING ' : " {$conj} ", 'string' => $item ]); } return $this; }
[ "protected", "function", "_having", "(", "$", "key", ",", "$", "values", "=", "[", "]", ",", "string", "$", "conj", "=", "'AND'", ")", ":", "self", "{", "$", "where", "=", "$", "this", "->", "_where", "(", "$", "key", ",", "$", "values", ")", "...
Simplify building having clauses @param mixed $key @param mixed $values @param string $conj @return self
[ "Simplify", "building", "having", "clauses" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L988-L1014
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder._whereString
protected function _whereString($key, $values=[], string $defaultConj='AND'): self { // Create key/value placeholders foreach($this->_where($key, $values) as $f => $val) { $queryMap = $this->state->getQueryMap(); // Split each key by spaces, in case there // is an operator such as >, <, !=, etc. $fArray = explode(' ', trim($f)); $item = $this->driver->quoteIdent($fArray[0]); // Simple key value, or an operator $item .= (count($fArray) === 1) ? '=?' : " {$fArray[1]} ?"; $lastItem = end($queryMap); // Determine the correct conjunction $conjunctionList = array_column($queryMap, 'conjunction'); if (empty($queryMap) || ( ! \regexInArray($conjunctionList, "/^ ?\n?WHERE/i"))) { $conj = "\nWHERE "; } elseif ($lastItem['type'] === 'group_start') { $conj = ''; } else { $conj = " {$defaultConj} "; } $this->state->appendMap($conj, $item, 'where'); } return $this; }
php
protected function _whereString($key, $values=[], string $defaultConj='AND'): self { // Create key/value placeholders foreach($this->_where($key, $values) as $f => $val) { $queryMap = $this->state->getQueryMap(); // Split each key by spaces, in case there // is an operator such as >, <, !=, etc. $fArray = explode(' ', trim($f)); $item = $this->driver->quoteIdent($fArray[0]); // Simple key value, or an operator $item .= (count($fArray) === 1) ? '=?' : " {$fArray[1]} ?"; $lastItem = end($queryMap); // Determine the correct conjunction $conjunctionList = array_column($queryMap, 'conjunction'); if (empty($queryMap) || ( ! \regexInArray($conjunctionList, "/^ ?\n?WHERE/i"))) { $conj = "\nWHERE "; } elseif ($lastItem['type'] === 'group_start') { $conj = ''; } else { $conj = " {$defaultConj} "; } $this->state->appendMap($conj, $item, 'where'); } return $this; }
[ "protected", "function", "_whereString", "(", "$", "key", ",", "$", "values", "=", "[", "]", ",", "string", "$", "defaultConj", "=", "'AND'", ")", ":", "self", "{", "// Create key/value placeholders", "foreach", "(", "$", "this", "->", "_where", "(", "$", ...
Simplify generating where string @param mixed $key @param mixed $values @param string $defaultConj @return self
[ "Simplify", "generating", "where", "string" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L1054-L1090
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder._whereIn
protected function _whereIn($key, $val=[], string $in='IN', string $conj='AND'): self { $key = $this->driver->quoteIdent($key); $params = array_fill(0, count($val), '?'); $this->state->appendWhereValues($val); $conjunction = empty($this->state->getQueryMap()) ? ' WHERE ' : " {$conj} "; $str = $key . " {$in} (".implode(',', $params).') '; $this->state->appendMap($conjunction, $str, 'where_in'); return $this; }
php
protected function _whereIn($key, $val=[], string $in='IN', string $conj='AND'): self { $key = $this->driver->quoteIdent($key); $params = array_fill(0, count($val), '?'); $this->state->appendWhereValues($val); $conjunction = empty($this->state->getQueryMap()) ? ' WHERE ' : " {$conj} "; $str = $key . " {$in} (".implode(',', $params).') '; $this->state->appendMap($conjunction, $str, 'where_in'); return $this; }
[ "protected", "function", "_whereIn", "(", "$", "key", ",", "$", "val", "=", "[", "]", ",", "string", "$", "in", "=", "'IN'", ",", "string", "$", "conj", "=", "'AND'", ")", ":", "self", "{", "$", "key", "=", "$", "this", "->", "driver", "->", "q...
Simplify where_in methods @param mixed $key @param mixed $val @param string $in - The (not) in fragment @param string $conj - The where in conjunction @return self
[ "Simplify", "where_in", "methods" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L1101-L1113
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder._run
protected function _run(string $type, string $table, string $sql=NULL, array $vals=NULL, bool $reset=TRUE): PDOStatement { if ($sql === NULL) { $sql = $this->_compile($type, $table); } if ($vals === NULL) { $vals = array_merge($this->state->getValues(), $this->state->getWhereValues()); } $startTime = microtime(TRUE); $res = empty($vals) ? $this->driver->query($sql) : $this->driver->prepareExecute($sql, $vals); $endTime = microtime(TRUE); $totalTime = number_format($endTime - $startTime, 5); // Add this query to the list of executed queries $this->_appendQuery($vals, $sql, (int) $totalTime); // Reset class state for next query if ($reset) { $this->resetQuery(); } return $res; }
php
protected function _run(string $type, string $table, string $sql=NULL, array $vals=NULL, bool $reset=TRUE): PDOStatement { if ($sql === NULL) { $sql = $this->_compile($type, $table); } if ($vals === NULL) { $vals = array_merge($this->state->getValues(), $this->state->getWhereValues()); } $startTime = microtime(TRUE); $res = empty($vals) ? $this->driver->query($sql) : $this->driver->prepareExecute($sql, $vals); $endTime = microtime(TRUE); $totalTime = number_format($endTime - $startTime, 5); // Add this query to the list of executed queries $this->_appendQuery($vals, $sql, (int) $totalTime); // Reset class state for next query if ($reset) { $this->resetQuery(); } return $res; }
[ "protected", "function", "_run", "(", "string", "$", "type", ",", "string", "$", "table", ",", "string", "$", "sql", "=", "NULL", ",", "array", "$", "vals", "=", "NULL", ",", "bool", "$", "reset", "=", "TRUE", ")", ":", "PDOStatement", "{", "if", "...
Executes the compiled query @param string $type @param string $table @param string $sql @param array|null $vals @param boolean $reset @return PDOStatement
[ "Executes", "the", "compiled", "query" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L1125-L1156
train
aviat4ion/Query
src/QueryBuilder.php
QueryBuilder._appendQuery
protected function _appendQuery(array $vals = NULL, string $sql, int $totalTime) { $evals = \is_array($vals) ? $vals : []; $esql = str_replace('?', "%s", $sql); // Quote string values foreach($evals as &$v) { $v = ( ! is_numeric($v)) ? htmlentities($this->driver->quote($v), ENT_NOQUOTES, 'utf-8') : $v; } // Add the query onto the array of values to pass // as arguments to sprintf array_unshift($evals, $esql); // Add the interpreted query to the list of executed queries $this->queries[] = [ 'time' => $totalTime, 'sql' => sprintf(...$evals) ]; $this->queries['total_time'] += $totalTime; // Set the last query to get rowcounts properly $this->driver->setLastQuery($sql); }
php
protected function _appendQuery(array $vals = NULL, string $sql, int $totalTime) { $evals = \is_array($vals) ? $vals : []; $esql = str_replace('?', "%s", $sql); // Quote string values foreach($evals as &$v) { $v = ( ! is_numeric($v)) ? htmlentities($this->driver->quote($v), ENT_NOQUOTES, 'utf-8') : $v; } // Add the query onto the array of values to pass // as arguments to sprintf array_unshift($evals, $esql); // Add the interpreted query to the list of executed queries $this->queries[] = [ 'time' => $totalTime, 'sql' => sprintf(...$evals) ]; $this->queries['total_time'] += $totalTime; // Set the last query to get rowcounts properly $this->driver->setLastQuery($sql); }
[ "protected", "function", "_appendQuery", "(", "array", "$", "vals", "=", "NULL", ",", "string", "$", "sql", ",", "int", "$", "totalTime", ")", "{", "$", "evals", "=", "\\", "is_array", "(", "$", "vals", ")", "?", "$", "vals", ":", "[", "]", ";", ...
Convert the prepared statement into readable sql @param array $vals @param string $sql @param int $totalTime @return void
[ "Convert", "the", "prepared", "statement", "into", "readable", "sql" ]
172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650
https://github.com/aviat4ion/Query/blob/172eb3f6ebdfb7295b42e32cc74bf37c3ebd7650/src/QueryBuilder.php#L1166-L1193
train