sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
public function destroyRecord($domain, $recordId) { return $this->processQuery($this->buildRecordsQuery($domain, $recordId, RecordsActions::ACTION_DESTROY)); }
Deletes the specified domain record. @param integer|string $domain The id or the name of the domain. @param integer $recordId The id of the record. @return StdClass
entailment
protected function buildQuery($id = null, $action = null, array $parameters = array()) { $parameters = http_build_query(array_merge($parameters, $this->credentials)); $query = $id ? sprintf("%s/%s", $this->apiUrl, $id) : $this->apiUrl; $query = $action ? sprintf("%s/%s/?%s", $query, $action...
Builds the API url according to the parameters. @param integer $id The Id of the element to work with (optional). @param string $action The action to perform (optional). @param array $parameters An array of parameters (optional). @return string The built API url.
entailment
protected function processQuery($query) { if (null === $processed = json_decode($this->adapter->getContent($query))) { throw new \RuntimeException(sprintf("Impossible to process this query: %s", $query)); } if ('ERROR' === $processed->status) { // it looks that the A...
Processes the query. @param string $query The query to process. @return StdClass @throws \RuntimeException
entailment
public static function deleteRiverObject($event, $type, $river) { $ia = elgg_set_ignore_access(true); $guid = InteractionsCache::getInstance()->getGuidFromRiverId($river->id); if ($guid) { $object = get_entity($guid); if ($object) { $object->delete(); } } elgg_set_ignore_access($ia); }
Deletes a commentable object associated with river items whose object is not ElggObject @param string $event "delete:after" @param string $type "river" @param ElggRiverItem $river River item @return true
entailment
public static function createActionableRiverObject(ElggRiverItem $river) { if (!$river instanceof ElggRiverItem) { return false; } $object = $river->getObjectEntity(); $views = self::getActionableViews(); if (!in_array($river->view, $views)) { return $object; } $access_id = $object->access_id; ...
Creates an object associated with a river item for commenting and other purposes This is a workaround for river items that do not have an object or have an object that is group or user @param ElggRiverItem $river River item @return RiverObject|false
entailment
public static function getRiverObject(ElggRiverItem $river) { if (!$river instanceof ElggRiverItem) { return false; } $object = $river->getObjectEntity(); $views = self::getActionableViews(); if (in_array($river->view, $views)) { // wrapping this in ignore access so that we do not accidentally crea...
Get an actionable object associated with the river item This could be a river object entity or a special entity that was created for this river item @param ElggRiverItem $river River item @return ElggObject|false
entailment
public static function getStats($entity) { if (!$entity instanceof ElggEntity) { return array(); } $stats = array( 'comments' => array( 'count' => $entity->countComments() ), 'likes' => array( 'count' => $entity->countAnnotations('likes'), 'state' => (elgg_annotation_exists($entity->guid...
Get interaction statistics @param ElggEntity $entity Entity @return array
entailment
public static function getLinkedEntityName($entity) { if (elgg_instanceof($entity)) { return elgg_view('output/url', array( 'text' => $entity->getDisplayName(), 'href' => $entity->getURL(), 'is_trusted' => true, )); } return ''; }
Get entity URL wrapped in an <a></a> tag @return string
entailment
public static function getCommentsSort() { $user_setting = elgg_get_plugin_user_setting('comments_order', 0, 'hypeInteractions'); $setting = $user_setting ?: elgg_get_plugin_setting('comments_order', 'hypeInteractions'); if ($setting == 'asc') { $setting = 'time_created::asc'; } else if ($setting == 'desc') ...
Get configured comments order @return string
entailment
public static function getLimit($partial = true) { if ($partial) { $limit = elgg_get_plugin_setting('comments_limit', 'hypeInteractions'); return $limit ?: 3; } else { $limit = elgg_get_plugin_setting('comments_load_limit', 'hypeInteractions'); return min(max((int) $limit, 20), 200); } }
Get number of comments to show @param string $partial Partial or full view @return string
entailment
public static function calculateOffset($count, $limit, $comment = null) { $order = self::getCommentsSort(); $style = self::getLoadStyle(); if ($comment instanceof Comment) { $thread = new Thread($comment); $offset = $thread->getOffset($limit, $order); } else if (($order == 'time_created::asc' && $style ...
Calculate offset till the page that contains the comment @param int $count Number of comments in the list @param int $limit Number of comments to display @param Comment $comment Comment entity @return int
entailment
public static function getActionableViews() { static $views; if (isset($views)) { return $views; } $views = []; $plugin = elgg_get_plugin_from_id('hypeInteractions'); $settings = $plugin->getAllSettings(); foreach ($settings as $key => $value) { if (!$value) { continue; } list ($prefix, ...
Get views, which custom threads should be created for @return array
entailment
public static function syncRiverObjectAccess($event, $type, $entity) { if (!$entity instanceof \ElggObject) { // keep user and group entries as is return; } // need to override access in case comments ended up with ACCESS_PRIVATE // and to ensure write permissions $ia = elgg_set_ignore_access(true); ...
Update river object access to match that of the container @param string $event 'update:after' @param string $type 'all' @param ElggEntity $entity The updated entity @return bool
entailment
public function setAttributeHref($href) { if (strpos($href, 'http') !== false) { $this->attributes->addAttribute('href', $href); } elseif (strpos($href, 'javascript') !== false) { $this->attributes->addAttribute('href', $href); } elseif (strpos($href, '#') !== false) ...
Link::setAttributeHref @param string $href @return static
entailment
public function render() { $output[] = $this->open(); if ($this->hasIcon()) { $output[] = $this->icon; } if ($this->hasTextContent()) { $output[] = PHP_EOL . implode('', $this->textContent->getArrayCopy()) . PHP_EOL; } if ($this->hasChildNod...
Link::render @return string
entailment
public function addNamespaces(array $namespaces): void { //loop for add single namespace foreach ($namespaces as $namespace) { // normalize namespace prefix $prefix = \trim($namespace[0], '\\'); // normalize the base directory with a trailing separator ...
Adds a base directory for a namespace prefix, accept an array of namespaces Utilize this for prevente multiple addNamespace() calls. @param array $namespaces The namespace prefix array. @return void
entailment
public function loadClass(string $class): bool { $arrayClass = \explode('\\', $class); $arrayPrefix = []; while (\count($arrayClass)) { $arrayPrefix[] = \array_shift($arrayClass); $prefix = \implode('\\', $arrayPrefix); $relativeClass = \implode('\\', $...
Loads the class file for a given class name. @param string $class The fully-qualified class name. @return bool True on success, false on failure.
entailment
private function loadMappedFile(string $prefix, string $relativeClass): bool { // are there any base directories for this namespace prefix? if (empty($this->prefixes[$prefix])) { return false; } // replace namespace separators with directory separators // in the ...
Load the mapped file for a namespace prefix and relative class. @param string $prefix The namespace prefix. @param string $relativeClass The relative class name. @return bool Boolean false there are any base directories for namespace prefix or file, true on success.
entailment
public static function enumTypes() { return [ ButtonInterface::BUTTON_TYPE_DANGER, ButtonInterface::BUTTON_TYPE_DEFAULT, ButtonInterface::BUTTON_TYPE_INFO, ButtonInterface::BUTTON_TYPE_LINK, ButtonInterface::BUTTON_TYPE_PRIMARY, ButtonInter...
Enumerates the types. @return array Returns the types enumeration.
entailment
public function connect(Application $app) { /** * @var ControllerCollection $collection */ $collection = $app['controllers_factory']; $collection ->match('/', Controller::INDEX . ':indexAction') ->method('GET') ->value('template', 'pages/...
Returns routes to connect to the given application. @param Application $app An Application instance @return ControllerCollection A ControllerCollection instance
entailment
public function createParagraph($text) { $paragraph = new Paragraph(); $paragraph->textContent->push($text); if ( ! $this->paragraphs instanceof ArrayIterator) { $this->paragraphs = new ArrayIterator(); } $this->paragraphs->push($paragraph); return $thi...
ParagraphsCollectorTrait::createParagraph @param string $text @return Paragraph
entailment
public function addParagraph(Paragraph $paragraph) { $paragraph->tagName = 'p'; if ( ! $this->paragraphs instanceof ArrayIterator) { $this->paragraphs = new ArrayIterator(); } $this->paragraphs->push($paragraph); return $this; }
ParagraphsCollectorTrait::addParagraph @param \O2System\Framework\Libraries\Ui\Contents\Paragraph $paragraph @return static
entailment
protected function checkUniqueKeys(array $columns, ?string $spType = null): ?array { $primaryKeys = MetadataDataLayer::getTablePrimaryKeys($this->dataSchema, $this->tableName); $uniqueKeys = MetadataDataLayer::getTableUniqueKeys($this->dataSchema, $this->tableName); $resultColumns = []; if (!isset(...
Generate main part with name and params. @param array[] $columns Columns from table. @param string|null $spType Stored procedure type {insert|update|delete|select}. @return array|null
entailment
protected function generateDocBlock(array $columns): void { $this->codeStore->append('/**'); $this->codeStore->append(' * @todo describe routine', false); $this->codeStore->append(' * ', false); $padding = $this->getMaxColumnLength($columns); $format = sprintf(' * @param p_%%-%ds @todo describe ...
Generates the doc block for the stored routine. @param array[] $columns Columns from table.
entailment
protected function generateMainPart(array $columns): void { $this->codeStore->append(sprintf('create procedure %s(', $this->spName)); $padding = $this->getMaxColumnLength($columns); $offset = mb_strlen($this->codeStore->getLastLine()); $first = true; foreach ($columns as $column) { if...
Generates the function name and parameters of the stored routine. @param array[] $columns Columns from table.
entailment
protected function getMaxColumnLength(array $columns): int { $length = 0; foreach ($columns as $column) { $length = max(mb_strlen($column['column_name']), $length); } return $length; }
Returns the length the longest column name of a table. @param array[] $columns The metadata of the columns of the table. @return int
entailment
protected function modifiesPart(bool $flag): void { if ($this->spType!=='SELECT') { $this->codeStore->append('modifies sql data'); } else { $this->codeStore->append('reads sql data'); } switch ($this->spType) { case 'UPDATE': case 'DELETE': $this->codeS...
Generates the modifies/reads sql data and designation type comment of the stored routine. @param bool $flag Set or no type.
entailment
public function get($id) { if (isset($this->cache[$id])) { return $this->cache[$id]; } throw new NotFoundException('No entry was found for this identifier.'); }
Finds an entry of the container by its identifier and returns it. @param string $id Identifier of the entry to look for. @throws NotFoundException No entry was found for **this** identifier. @return mixed Entry.
entailment
public function delete(string $id): bool { if (\array_key_exists($id, $this->cache)) { //delete value unset($this->cache[$id]); //return function result return true; } return false; }
Delete value from container. @param string $id
entailment
public function resolve(string $class, array $rules = []) { //reset tree; $this->tree = []; //merge rules passed as parameter with general rules $this->rules = \array_merge($this->rules, $rules); //build dependency tree $this->buildTree($class); //build obj...
Resolve dependencies for given class. @param string $class An existing class. @param array $rules Custom rules. @return object|null Instance of resolved class
entailment
private function buildTree(string $class): void { $level = 0; $stack = new SplStack(); while (true) { //initialize array if not already initialized if (empty($this->tree[$level][$class])) { $this->tree[$level][$class] = []; } ...
Create a dependencies map for a class. @param string $class @return void
entailment
private function buildObjects(): void { //deep dependency level, start to array end for not use array_reverse for ($i = \count($this->tree) - 1; $i >= 0; $i--) { //class foreach ($this->tree[$i] as $class => $arguments) { //try to find object in class ...
Build objects from dependencyTree. @return void
entailment
private function buildArguments(string $class, array $dependency): array { //initialize arguments array $args = []; //argument required from class foreach ($dependency as $argValue) { if (\class_exists((string) $argValue->getType())) { //add to array of a...
Build dependency for a object. @param string $class @param array $dependency @return array
entailment
public function createLink($label, $href = null) { $link = new Link($label, $href); $link->attributes->addAttributeClass('nav-link'); return $this->createList($link); }
Base::createLink @param string $label @param string|null $href @return Item
entailment
public function createList($list = null) { $node = new Item(); if ($list instanceof Item) { $node = $list; } elseif ($list instanceof Element) { $node->entity->setEntityName($list->entity->getEntityName()); if ($list instanceof Dropdown) { ...
Base::createList @param Item|Element|Dropdown|string $list @return Item
entailment
public function createSlide() { $this->childNodes->push(new Slide()); $slideNo = $this->childNodes->key(); $indicator = $this->indicators->childNodes->createNode('li'); $indicator->entity->setEntityName('indicator-' . $slideNo); $indicator->attributes->addAttribute('data-tar...
Slides::createSlide @return Slide
entailment
public function all($fields = null, $limit = null) { if (isset($fields)) { $this->qb->select($fields); } if (isset($limit)) { $this->qb->limit($limit); } if (property_exists($this, 'hierarchical')) { $this->qb->orderBy($this->table . '.re...
FinderTrait::all @param array|string|null $fields @param int|null $limit @return bool|\O2System\Framework\Models\Sql\DataObjects\Result
entailment
public function allWithPaging($fields = null, $limit = null) { return $this->withPaging(null, $limit)->all($fields, $limit); }
FinderTrait::allWithPaging @param array|string|null $fields @param int|null $limit @return bool|\O2System\Framework\Models\Sql\DataObjects\Result
entailment
public function withPaging($page = null, $limit = null) { $getPage = $this->input->get('page'); $getLimit = $this->input->get('limit'); $page = empty($page) ? (empty($getPage) ? 1 : $getPage) : $page; $limit = empty($limit) ? (empty($getLimit) ? 10 : $getLimit) : $limit; $t...
FinderTrait::withPaging @param int|null $page @param int|null $limit @return bool|\O2System\Framework\Models\Sql\DataObjects\Result
entailment
public function find($criteria, $field = null, $limit = null) { if (is_array($criteria)) { return $this->findIn($criteria, $field); } $field = isset($field) ? $field : $this->primaryKey; if (strpos($field, '.') === false) { $field = $this->table . '.' . $fiel...
FinderTrait::find @param mixed $criteria @param string|null $field @param int|null $limit @return bool|mixed|\O2System\Framework\Models\Sql\DataObjects\Result
entailment
public function findWhere(array $conditions, $limit = null) { foreach ($conditions as $field => $criteria) { if (strpos($field, '.') === false) { $field = $this->table . '.' . $field; } $this->qb->where($field, $criteria); } if ($result = ...
FinderTrait::findWhere @param array $conditions @param int|null $limit @return bool|mixed|\O2System\Framework\Models\Sql\DataObjects\Result
entailment
public function findIn(array $inCriteria, $field = null) { $field = isset($field) ? $field : $this->primaryKey; $field = $this->table . '.' . $field; if ($result = $this->qb ->from($this->table) ->whereIn($field, $inCriteria) ->get()) { $this-...
FinderTrait::findIn @param array $inCriteria @param string|null $field @return bool|\O2System\Framework\Models\Sql\DataObjects\Result
entailment
public function findNotIn(array $notInCriteria, $field = null) { $field = isset($field) ? $field : $this->primaryKey; if (strpos($field, '.') === false) { $field = $this->table . '.' . $field; } if ($result = $this->qb ->from($this->table) ->where...
FinderTrait::findNotIn @param array $notInCriteria @param string|null $field @return bool|\O2System\Framework\Models\Sql\DataObjects\Result
entailment
public function setClass($iconClass) { $this->attributes->removeAttributeClass(['fa', 'fa-*']); $this->attributes->addAttributeClass($iconClass); return $this; }
Icon::setClass @param string $iconClass @return static
entailment
public function setNow($number) { $this->now = (int)$number; $this->attributes->addAttribute('aria-valuenow', $this->now); if ($this->now < 10) { $this->attributes->addAttribute('style', 'min-width: ' . 3 . 'em; width: ' . $this->now . '%;'); } else { ...
Bar::setNow @param int $number @return static
entailment
public function setMin($number) { $this->min = (int)$number; $this->attributes->addAttribute('aria-valuemin', $this->min); return $this; }
Bar::setMin @param int $number @return static
entailment
public function setMax($number) { $this->max = (int)$number; $this->attributes->addAttribute('aria-valuemax', $this->max); return $this; }
Bar::setMax @param int $number @return static
entailment
public function render() { $output[] = $this->open(); if ($this->withLabel) { $output[] = $this->now . '%'; } else { $output[] = $this->label; } $output[] = $this->close(); return implode(PHP_EOL, $output); }
Bar::render @return string
entailment
public function bootstrapRowButtonDefaultFunction(array $args = []) { $editButton = $this->bootstrapRowButtonEditFunction(["href" => ArrayHelper::get($args, "edit_href")]); $deleteButton = $this->bootstrapRowButtonDeleteFunction(["href" => ArrayHelper::get($args, "delete_href")]); return imp...
Displays a Bootstrap row button "default". @param array $args The arguments. @return string Returns the Bootstrap form button "Default".
entailment
public function bootstrapRowButtonDeleteFunction(array $args = []) { $txt = $this->getTranslator()->trans("label.delete", [], "WBWBootstrapBundle"); $but = $this->getButtonTwigExtension()->bootstrapButtonDangerFunction(["title" => $txt, "icon" => "g:trash"]); return $this->getButtonTwigExtensi...
Displays a Bootstrap row button "delete". @param array $args The arguments. @return string Returns the Bootstrap row button "Delete".
entailment
public function bootstrapRowButtonEditFunction(array $args = []) { $txt = $this->getTranslator()->trans("label.edit", [], "WBWBootstrapBundle"); $but = $this->getButtonTwigExtension()->bootstrapButtonDefaultFunction(["title" => $txt, "icon" => "g:pencil"]); return $this->getButtonTwigExtension...
Displays a Bootstrap row button "edit". @param array $args The arguments. @return string Returns the Bootstrap row button "Edit".
entailment
protected function bootstrapAlert($content, $dismissible, $class) { $span = static::coreHTMLElement("span", "&times;", ["aria-hidden" => "true"]); $button = static::coreHTMLElement("button", $span, ["class" => "close", "type" => "button", "data-dismiss" => "alert", "aria-label" => "Close"]); ...
Displays a Bootstrap alert. @param string $content The content. @param bool $dismissible Dismissible ? @param string $class The class. @return string Returns the Bootstrap alert.
entailment
public function all($fields = null, $limit = null) { $result = $this->storage; if (isset($limit)) { $result = array_slice($this->storage, $limit); } if (empty($fields)) { return $this->result = new ArrayIterator($result); } else { $this->...
FinderTrait::all @param array|null $fields @param int|null $limit @return bool|DataObjects\Result
entailment
public function page($fields = null, $page = 1, $entries = 5) { $chunks = array_chunk($this->storage, $entries); $offset = $page - 1; if (isset($chunks[ $offset ])) { $result = new ArrayIterator($chunks[ $offset ]); if (empty($fields)) { return $this...
FinderTrait::page Find record by page. @param array|null $fields @param int $page @param int $entries @return bool|ArrayIterator
entailment
public function find($criteria, $field = null, $limit = null) { if (is_array($criteria)) { return $this->findIn($criteria, $field); } $field = isset($field) ? $field : $this->primaryKey; $result = new ArrayIterator(); $counter = 0; foreach ($this->stora...
FinderTrait::find Find single or many record base on criteria by specific field @param string $criteria Criteria value @param string|null $field Table column field name | set to primary key by default @param int|null $limit @return DataObjects\Result|DataObjects\Result\Row|bool Returns FAL...
entailment
public function findWhere(array $conditions, $limit = null) { $result = new ArrayIterator(); $counter = 0; foreach ($this->storage as $row) { foreach ($conditions as $field => $criteria) { if ($row->offsetGet($field) === $criteria) { $result[]...
FinderTrait::findWhere Find single record based on certain conditions @param array $conditions List of conditions with criteria @param int|null $limit @return DataObjects\Result|bool Returns FALSE if failed.
entailment
public function findNotIn(array $notInCriteria, $field = null) { $field = isset($field) ? $field : $this->primaryKey; $result = new ArrayIterator(); $counter = 0; foreach ($this->storage as $row) { if ($row->offsetExists($field)) { if ( ! in_array($row->...
FinderTrait::findNotIn Find many records not within criteria on specific field @param array $notInCriteria List of criteria @param string $field Table column field name | set to primary key by default @return DataObjects\Result|bool Returns FALSE if failed.
entailment
public function index() { if($javascript = file_get_contents(PATH_PUBLIC . 'assets/sw.js')) { $javascript = str_replace(['{{$theme}}', '{{ $theme }}'], 'default', $javascript); header("Content-type: application/x-javascript"); echo $javascript; exit(EXIT_SUC...
ServiceWorker::index
entailment
public function add(CityEntity $city) { $id = $city->getCityId(); $this->cities[$id] = $city; parent::markAdded($id); }
{@inheritDoc}
entailment
public function cityExistsAt($posY, $posX) { $posY = (int)$posY; $posX = (int)$posX; foreach ($this->cities as $city) { if ($city->getPosX() === $posX && $city->getPosY() === $posY) { return true; } } $result = $this->getQueryBuilder() ...
{@inheritDoc}
entailment
public function create($id, $name, $y, $x) { return new CityEntity($id, $name, $y, $x); }
{@inheritDoc}
entailment
public function findAllByOwner(UserEntity $owner) { $found = array(); foreach ($this->cities as $city) { if ($city->getOwner() === $owner) { $found[$city->getCityId()] = $city; } } $result = $this->getQueryBuilder() ->where('u.user...
{@inheritDoc}
entailment
public function findByLocation($posY, $posX) { foreach ($this->cities as $city) { if ($city->getPosX() === $posX && $city->getPosY() === $posY) { return $city; } } $result = $this->getQueryBuilder() ->where('posX = :posX') ->whe...
{@inheritDoc}
entailment
public function replace(CityEntity $city) { $id = $city->getCityId(); $this->cities[$id] = $city; parent::markModified($id); }
{@inheritDoc}
entailment
public function findSelectedByUsername($username) { foreach ($this->cities as $city) { if ($city->getOwner()->getUsername() === $username && $city->isSelected()) { return $city; } } return null; }
{@inheritDoc}
entailment
protected function bootstrapHeading($size, $content, $description, $class) { $sizes = [1, 2, 3, 4, 5, 6]; $attributes = []; $attributes["class"] = [$class]; $element = "h" . (true === in_array($size, $sizes) ? $size : 1); $secondary = null !== $description ? " <small>" . $d...
Displays a Bootstrap heading. @param int $size The size. @param string $content The content. @param string $description The description. @param string $class The class. @return string Returns the Bootstrap heading.
entailment
public function bootstrapHeading1Function(array $args = []) { return $this->bootstrapHeading(1, ArrayHelper::get($args, "content"), ArrayHelper::get($args, "description"), ArrayHelper::get($args, "class")); }
Displays a Boostrap heading 1. @param array $args The arguments. @return string Returns the Bootstrap heading 1.
entailment
public function bootstrapHeading2Function(array $args = []) { return $this->bootstrapHeading(2, ArrayHelper::get($args, "content"), ArrayHelper::get($args, "description"), ArrayHelper::get($args, "class")); }
Displays a Bootstrap heading 2. @param array $args The arguments. @return string Returns the Bootstrap heading 2.
entailment
public function bootstrapHeading3Function(array $args = []) { return $this->bootstrapHeading(3, ArrayHelper::get($args, "content"), ArrayHelper::get($args, "description"), ArrayHelper::get($args, "class")); }
Displays a Bootstrap heading 3. @param array $args The arguments. @return string Returns the Bootstrap heading 3.
entailment
public function bootstrapHeading4Function(array $args = []) { return $this->bootstrapHeading(4, ArrayHelper::get($args, "content"), ArrayHelper::get($args, "description"), ArrayHelper::get($args, "class")); }
Displays a Bootstrap heading 4. @param array $args The arguments. @return string Returns the Bootstrap heading 4.
entailment
public function bootstrapHeading5Function(array $args = []) { return $this->bootstrapHeading(5, ArrayHelper::get($args, "content"), ArrayHelper::get($args, "description"), ArrayHelper::get($args, "class")); }
Displays a heading 5. @param array $args The arguments. @return string Returns the Bootstrap heading 5.
entailment
public function bootstrapHeading6Function(array $args = []) { return $this->bootstrapHeading(6, ArrayHelper::get($args, "content"), ArrayHelper::get($args, "description"), ArrayHelper::get($args, "class")); }
Displays a Bootstrap heading 6. @param array $args The arguments. @return string Returns the Bootstrap heading 6.
entailment
public function getFunctions() { return [ new TwigFunction("bootstrapBold", [$this, "bootstrapBoldFunction"], ["is_safe" => ["html"]]), new TwigFunction("bsBold", [$this, "bootstrapBoldFunction"], ["is_safe" => ["html"]]), new TwigFunction("bootstrapDeleted", [$this, "bootst...
Get the Twig functions. @return TwigFunction[] Returns the Twig functions.
entailment
public function template($filename, array $vars = []) { if ($view = view()->load($filename, $vars, true)) { $this->body($view); } return $this; }
Email::template @param string $filename @param array $vars @return static
entailment
public function send() { $spool = new Spool(new Config($this->config)); if ($spool->send($this)) { return true; } $this->setErrors($spool->getErrors()); return false; }
Email::send @return bool
entailment
public function register(Application $app) { $this->loadConfigurations($app); $this->registerServices($app); $this->registerEventListener($app); }
Registers services on the given app. This method should only be used to configure services and parameters. It should not get services. @param Application $app An Application instance
entailment
public static function createNewClient(string $name, $redirectUris = null): Client { if (isset($redirectUris) && is_string($redirectUris)) { $redirectUris = explode(' ', $redirectUris); } if (isset($redirectUris) && is_array($redirectUris)) { foreach ($redirectUris a...
Create a new Client @param string|string[]|null $redirectUris Client allowed redirect direct url's
entailment
public function generateSecret() { $secret = bin2hex(random_bytes(20)); $this->secret = password_hash($secret, PASSWORD_DEFAULT); return $secret; }
Creates a strong, unique secret and crypt it on the model @return string Secret not encrypted
entailment
public function transform($value) { if (null === $value) { return array(); } if($this->identifier){ return $this->identifier->getValue($value); } return $value->getId(); }
@param object|null $value The selected entity object @return mixed The value by which we are selecting
entailment
public function reverseTransform($value) { if (null === $this->identifier) { return $value ? $this->manager->getRepository($this->class)->find($value) : null; } else { $elements = $this->identifier->getElements(); return $value ? $this->manager->getRepository($thi...
@param mixed $value The value by which we are selecting @return object|null The resulting object
entailment
public function render() { if ($this->header->hasChildNodes()) { $this->childNodes->push($this->header); } if ($this->body->hasChildNodes()) { $this->childNodes->push($this->body); } if ($this->footer->hasChildNodes()) { $this->childNodes...
Table::render @return string
entailment
public function getRiverItem() { if (isset($this->_river_item)) { return $this->_river_item; } $id = $this->river_id; $items = elgg_get_river(array( 'ids' => $id, 'limit' => 1, )); $this->_river_item = (is_array($items) && count($items)) ? $items[0] : false; return $this->_river_item; }
Get river item @return ElggRiverItem|false
entailment
public function getDisplayName() { $item = $this->getRiverItem(); if (!$item) { return elgg_echo('interactions:river_object:title'); } $subject = $item->getSubjectEntity(); return elgg_echo('interactions:river_object:title_subject', [$subject->getDisplayName()]); }
{@inheritdoc}
entailment
public static function nonStatic(string $source, ?string $sourceClass = null, ?string $targetClass = null): string { // Replace static fields. $source = preg_replace('/(public|protected|private)\s+static(\s+)\$/i', '${1}${2}$', $source); // Replace usage of static fields. $source = preg_replace('/sel...
Returns the code for a non static class based on a static class. @param string $source The source code of the static class. @param string|null $sourceClass The name of the static class. @param string|null $targetClass The name og the non static class. @return string
entailment
public function setPopover($title, $content) { $this->attributes->addAttribute('data-toggle', 'popover'); $this->attributes->addAttribute('title', $title); $this->attributes->addAttribute('data-content', $content); return $this; }
PopoverSetterTrait::setPopover @param string $title @param string $content @return static
entailment
public function embedResponsive($ratio = null) { $this->attributes->addAttributeClass('embed-responsive'); $ratio = empty($ratio) ? '1:1' : $ratio; switch ($ratio) { default: case '1:1': $this->attributes->addAttributeClass('embed-responsive-1by1'); ...
Element::embedResponsive @param null $ratio @return static
entailment
public function screenReaderOnly($screenReaderOnly = false) { $this->attributes->addAttributeClass('sr-only'); if ($screenReaderOnly) { $this->attributes->addAttributeClass('sr-only-focusable'); } return $this; }
Element::screenReaderOnly @param bool $screenReaderOnly @return static
entailment
public function createImage($src, $alt = null) { $this->childNodes->push(new Image($src, $alt)); return $this->childNodes->last(); }
Slide::createImage @param string $src @param string|null $alt @return mixed
entailment
public function setSecureUrl($url) { if (strpos($url, 'https://') !== false) { if (filter_var($url, FILTER_VALIDATE_URL)) { $this->setObject('secure_url', $url); } } return $this; }
------------------------------------------------------------------------
entailment
public function loadFile($offset, $return = false) { $basename = pathinfo($offset, PATHINFO_BASENAME); $filename = studlycase($basename); $configFile = str_replace($basename, $filename, $offset); $offset = camelcase($basename); foreach ($this->filePaths as $configFilePath) ...
Config::loadFile @param string $offset @param bool $return @return mixed
entailment
public function &getItem($offset) { $item = parent::offsetGet($offset); if (is_array($item)) { if (is_string(key($item))) { $item = new SplArrayObject($item); } } return $item; }
Config::getItem Gets config item. @param string $offset @return mixed|\O2System\Spl\DataStructures\SplArrayObject
entailment
public function reload() { if(count($this->loaded)) { foreach($this->loaded as $filename) { $this->loadFile($filename); } } }
Config::reload
entailment
public function addBar($now = 0, $min = 0, $max = 100, $contextualClass = 'primary') { if ($now instanceof Bar) { $this->bars->push($now); } elseif (is_numeric($now)) { $bar = new Bar($now, $min, $max, $contextualClass); $this->bars->push($bar); } ...
Progress::addBar @param int $now @param int $min @param int $max @param string $contextualClass @return static
entailment
public function render() { $output[] = $this->open(); foreach ($this->bars as $bar) { $output[] = $bar->render(); } $output[] = $this->close(); return implode(PHP_EOL, $output); }
Progress::render @return string
entailment
public function &__get($property) { $get[ $property ] = false; // CodeIgniter property aliasing if ($property === 'load') { $property = 'loader'; } if (services()->has($property)) { $get[ $property ] = services()->get($property); } elseif (o2...
Controller::__get Magic method __get. @param string $property @return mixed
entailment
public function upload($source, $publicId, $tags = array()) { $defaults = array( 'public_id' => null, 'tags' => array() ); $options = array_merge($defaults, array( 'public_id' => $publicId, 'tags' => $tags )); $this-...
Upload image to cloud. @param mixed $source @param string $publicId @param array $tags @return CloudinaryWrapper
entailment
public function show($publicId, $options = array()) { $defaults = $this->config->get('cloudinary::scaling'); $options = array_merge($defaults, $options); return $this->getCloudinary()->cloudinary_url($publicId, $options); }
Display image. @param string $publicId @param array $options @return string
entailment
public function register(Application $app) { $app[UseCase::LOGIN] = $app->share(function () use ($app) { return new LoginUseCase( $app[Repository::USER], $app[Validator::LOGIN], $app[Service::PASSWORD_HASH]); }); $app[UseCase::REGIS...
Registers services on the given app. This method should only be used to configure services and parameters. It should not get services.
entailment
public function index() { if($this->presenter->page->file instanceof SplFileInfo) { $this->view->page(presenter()->page->file->getRealPath()); } }
Pages::index @return void
entailment
public function createBullet($bullet, $href = null) { if (strpos($bullet, 'http') || is_file($bullet)) { $icon = new Image($bullet); } else { $icon = new Element('i', 'bullet'); $icon->attributes->addAttributeClass($bullet); } $link = new Link($ic...
Bullets::createBullet @param string $bullet @param string|null $href @return \O2System\Framework\Libraries\Ui\Contents\Lists\Item
entailment