sentence1 stringlengths 52 3.87M | sentence2 stringlengths 1 47.2k | label stringclasses 1
value |
|---|---|---|
public function hasRoleById(int $roleId): bool
{
if (isset($this->roles[$roleId])) {
return true;
}
return false;
} | Check if an user has a role, use role Id.
@param int $roleId
@return bool | entailment |
public function hasRoleByName(string $roleName): bool
{
if (\in_array($roleName, \array_column($this->roles, 'name'), true)) {
return true;
}
return false;
} | Check if an user has a role, use role name.
@param string $roleName
@return bool | entailment |
public function render(): string
{
$this->template->setData($this->data);
return $this->template->getOutput();
} | Render a template.
@return string | entailment |
public function update(SplSubject $subject)
{
if ($subject instanceof Model) {
$this->data = \array_merge($this->data, $subject->get());
}
} | Update Observer data.
@param SplSubject $subject | entailment |
public function createNestedObject($list = null)
{
$node = new Objects();
$node->tagName = 'div';
if ($list instanceof Objects) {
$node = $list;
} elseif ($list instanceof Element) {
$node->entity->setEntityName($list->entity->getEntityName());
$n... | Objects::createNestedObject
@param mixed $list
@return Objects | entailment |
public function render()
{
$output[] = $this->open();
if ($this->image instanceof Element) {
$this->image->attributes->addAttributeClass(['mr-3']);
if ($this->alignment === 'TOP') {
$this->image->attributes->addAttributeClass(['align-self-start']);
... | Objects::render
@return string | entailment |
public function optionUpdate($type = null)
{
if (in_array($type, ['modules', 'languages'])) {
switch ($type) {
case 'modules':
modules()->updateRegistry();
break;
case 'languages':
language()->updateRegi... | Registry::optionUpdate
@param string|null $type
@throws \Exception | entailment |
public function optionFlush($type = null)
{
if (in_array($type, ['modules', 'languages'])) {
switch ($type) {
case 'modules':
modules()->flushRegistry();
break;
case 'languages':
language()->flushRegistr... | Registry::optionFlush
@param string|null $type
@throws \Psr\Cache\InvalidArgumentException | entailment |
public function optionInfo()
{
$table = new Table();
$table
->addHeader('Metadata')
->addHeader('Total');
$table
->addRow()
->addColumn('Modules')
->addColumn(modules()->getTotalRegistry());
$table
->addRow()
... | Registry::optionInfo | entailment |
public function optionMetadata($type)
{
if (in_array($type, ['modules', 'languages'])) {
switch ($type) {
case 'modules':
$line = PHP_EOL . print_r(modules()->getRegistry(), true);
break;
case 'languages':
... | Registry::optionMetadata
@param string $type | entailment |
public static function createNewRefreshToken(
int $ttl,
TokenOwnerInterface $owner = null,
Client $client = null,
$scopes = null
): RefreshToken {
return static::createNew($ttl, $owner, $client, $scopes);
} | Create a new RefreshToken
@param string|string[]|Scope[]|null $scopes | entailment |
public function createLink($label, $href = null)
{
if ( ! $this->attributes->hasAttributeClass('lead')) {
$this->attributes->addAttributeClass('lead');
}
$link = new Link($label, $href);
$link->attributes->addAttributeClass(['btn', 'btn-primary', 'btn-lg']);
$thi... | Paragraph::createLink
@param string $label
@param string|null $href
@return Link | entailment |
public function subItem($item = [], $options = [])
{
$html = '<li>';
$html .= $this->Html->link($item['title'], $item['url']);
$html .= '</li>';
return $html;
} | item
Method to build an submenu item.
@param array $item The menu item.
@param array $options Options.
@return string | entailment |
public function prepare() {
$object_type = $this->getObjectType();
$object_link = elgg_view('output/url', array(
'text' => $this->object->getDisplayName(),
'href' => elgg_http_add_url_query_elements($this->object->getURL(), array(
'active_tab' => 'comments',
)),
));
if ($this->author->guid == $t... | Prepares notification elements
@return \stdClass | entailment |
public function getActionType() {
$comment_subtype = $this->comment->getSubtype();
$object_type = $this->object->getType();
$object_subtype = $this->object->getSubtype() ? : 'default';
$keys = [
"interactions:action:$comment_subtype:on:$object_type:$object_subtype",
"interactions:action:$comment_subtype:... | Prepare action type string (e.g. replied to)
@return string | entailment |
public function getObjectType() {
$type = $this->object->getType();
$subtype = $this->object->getSubtype() ? : 'default';
$keys = [
"interactions:$type:$subtype",
$this->object instanceof Comment ? "interactions:comment" : "interactions:post",
];
foreach ($keys as $key) {
if (elgg_language_key_exists... | Prepares object type string
@return string | entailment |
protected function getComment() {
$comment_body = elgg_view('output/longtext', array(
'value' => $this->comment->description,
));
// if (elgg_view_exists('output/linkify')) {
// $comment_body = elgg_view('output/linkify', array(
// 'value' => $comment_body
// ));
// }
$comment_body .= elgg_view('outpu... | Prepares comment body, including the text and attachment info
@return string | entailment |
public function render()
{
if ($this->hasParagraphs()) {
foreach ($this->paragraphs as $paragraph) {
$this->childNodes->push($paragraph);
}
}
return parent::render();
} | Body::render
@return string | entailment |
public function createButton($label, array $attributes = [], $contextualClass = Button::DEFAULT_CONTEXT)
{
$button = new Button($label, $attributes, $contextualClass);
if ( ! $this->buttons instanceof ArrayIterator) {
$this->buttons = new ArrayIterator();
}
$this->butto... | ButtonsCollectorTrait::createButton
@param string $label
@param array $attributes
@param string $contextualClass
@return Button | entailment |
public function addButton(Button $button)
{
if ( ! $this->buttons instanceof ArrayIterator) {
$this->buttons = new ArrayIterator();
}
$this->buttons->push($button);
return $this;
} | ButtonsCollectorTrait::addButton
@param \O2System\Framework\Libraries\Ui\Components\Button $button
@return static | entailment |
public function befriend(Model $recipient): bool
{
if ($this->isFriendsWith($recipient)) {
return true;
}
$friendship = (new Friend())->forceFill([
'recipient_id' => $recipient->id,
'recipient_type' => get_class($recipient),
'status' ... | @param Model $recipient
@return bool | entailment |
public function unfriend(Model $recipient): bool
{
if (!$this->isFriendsWith($recipient)) {
return false;
}
return (bool) $this->findFriendship($recipient)->delete();
} | @param Model $recipient
@return bool | entailment |
public function isFriendsWith(Model $recipient, $status = null): bool
{
$exists = $this->findFriendship($recipient);
if (!empty($status)) {
$exists = $exists->where('status', $status);
}
return (bool) $exists->count();
} | @param Model $recipient
@param null $status
@return mixed | entailment |
public function acceptFriendRequest(Model $recipient): bool
{
if (!$this->isFriendsWith($recipient)) {
return false;
}
return (bool) $this->findFriendship($recipient)->update([
'status' => Status::ACCEPTED,
]);
} | @param Model $recipient
@return bool | entailment |
public function denyFriendRequest(Model $recipient): bool
{
if (!$this->isFriendsWith($recipient)) {
return false;
}
return (bool) $this->findFriendship($recipient)->update([
'status' => Status::DENIED,
]);
} | @param Model $recipient
@return bool | entailment |
public function blockFriendRequest(Model $recipient): bool
{
if (!$this->isFriendsWith($recipient)) {
return false;
}
return (bool) $this->findFriendship($recipient)->update([
'status' => Status::BLOCKED,
]);
} | @param Model $recipient
@return bool | entailment |
public function unblockFriendRequest(Model $recipient): bool
{
if (!$this->isFriendsWith($recipient)) {
return false;
}
return (bool) $this->findFriendship($recipient)->update([
'status' => Status::PENDING,
]);
} | @param Model $recipient
@return bool | entailment |
public function getAllFriendships($limit = null, $offset = null): array
{
return $this->findFriendshipsByStatus(null, $limit, $offset);
} | @param null $limit
@param null $offset
@return array | entailment |
public function getPendingFriendships($limit = null, $offset = 0): array
{
return $this->findFriendshipsByStatus(Status::PENDING, $limit, $offset);
} | @param null $limit
@param int $offset
@return array | entailment |
public function getAcceptedFriendships($limit = null, $offset = 0): array
{
return $this->findFriendshipsByStatus(Status::ACCEPTED, $limit, $offset);
} | @param null $limit
@param int $offset
@return array | entailment |
public function getDeniedFriendships($limit = null, $offset = 0): array
{
return $this->findFriendshipsByStatus(Status::DENIED, $limit, $offset);
} | @param null $limit
@param int $offset
@return array | entailment |
public function getBlockedFriendships($limit = null, $offset = 0): array
{
return $this->findFriendshipsByStatus(Status::BLOCKED, $limit, $offset);
} | @param null $limit
@param int $offset
@return array | entailment |
public function hasBlocked(Model $recipient): bool
{
return $this->getFriendship($recipient)->status === Status::BLOCKED;
} | @param Model $recipient
@return bool | entailment |
public function isBlockedBy(Model $recipient): bool
{
$friendship = Friend::where(function ($query) use ($recipient) {
$query->where('sender_id', $this->id);
$query->where('sender_type', get_class($this));
$query->where('recipient_id', $recipient->id);
$query... | @param Model $recipient
@return bool | entailment |
private function findFriendship(Model $recipient): Builder
{
return Friend::where(function ($query) use ($recipient) {
$query->where('sender_id', $this->id);
$query->where('sender_type', get_class($this));
$query->where('recipient_id', $recipient->id);
$query... | @param Model $recipient
@return mixed | entailment |
private function findFriendshipsByStatus($status, $limit, $offset): array
{
$friendships = [];
$query = Friend::where(function ($query) use ($status) {
$query->where('sender_id', $this->id);
$query->where('sender_type', get_class($this));
if (!empty($status)) {
... | @param $status
@param $limit
@param $offset
@return array | entailment |
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->io = new StratumStyle($input, $output);
$command = $this->getApplication()->find('constants');
$ret = $command->execute($input, $output);
if ($ret!=0) return $ret;
$command = $this->getApplication()->find('lo... | Executes the actual PhpStratum program. Returns 0 is everything went fine. Otherwise, returns non-zero.
@param InputInterface $input An InputInterface instance
@param OutputInterface $output An OutputInterface instance
@return int | entailment |
protected static function parseProgressBar(ProgressBarInterface $progressBar, array $args) {
$progressBar->setAnimated(ArrayHelper::get($args, "animated", false));
$progressBar->setContent(ArrayHelper::get($args, "content"));
$progressBar->setMax(ArrayHelper::get($args, "max", 100));
$p... | Parses a progress bar.
@param ProgressBarInterface $progressBar The progress bar.
@param array $args The arguments.
@return ProgressBarInterface Returns the progress bar. | entailment |
public static function handleStream($segments) {
$page = array_shift($segments);
$guid = array_shift($segments);
switch ($page) {
case 'comments' :
$comment_guid = array_shift($segments);
set_input('entity_guid', $guid);
set_input('comment_guid', $comment_guid);
echo elgg_view_resource('int... | Handles interactions pages
Provides a uniform endpoint to retrieve comments/likes
stream/comments/<entity_guid>/[<comment_guid>]
stream/likes/<entity_guid>
stream/edit/<entity_guid>
@param array $segments URL segments
@return boolean | entailment |
public static function urlHandler($hook, $type, $url, $params) {
$entity = elgg_extract('entity', $params);
/* @var ElggEntity $entity */
if ($entity instanceof Comment) {
$container = $entity->getContainerEntity();
if ($container instanceof Comment) {
return $container->getURL();
}
return elgg_... | Handles entity URLs
@param string $hook "entity:url"
@param string $type "object"
@param string $url Current URL
@param array $params Hook params
@return string Filtered URL | entailment |
public static function iconUrlHandler($hook, $type, $url, $params) {
$entity = elgg_extract('entity', $params);
/* @var ElggEntity $entity */
if ($entity instanceof Comment) {
$owner = $entity->getOwnerEntity();
if (!$owner) {
return;
}
return $owner->getIconURL($params);
}
return $url;
} | Replaces comment icons
@param string $hook "entity:icon:url"
@param string $type "object"
@param string $url Current URL
@param array $params Hook params
@return string | entailment |
public function optionVersion()
{
if (property_exists($this, 'version')) {
if ( ! empty($this->version)) {
output()->write(
(new Format())
->setString($this->name . ' v' . $this->version . ' Copyright (c) 2011 - ' . date('Y') . ' Steeve... | App::optionVersion
@return void | entailment |
public function can($permission): bool
{
if ($permission instanceof Permission) {
return $this->canByObject($permission);
}
if (\is_int($permission)) {
return $this->canById($permission);
}
if (\is_string($permission)) {
return $this->can... | Check if authenticated user has a permission.
<pre><code class="php">$authorization = new Authorization($authentication, $permissionMapper);
//with this example, the class checks if the authenticated
//user has the permission with the permission object.
$permission = $permissionMapper->fetchById(1);
$authorization->c... | entailment |
public function handle(ServerRequestInterface $request)
{
// Try to get from cache
$cacheKey = 'o2output_' . underscore(server_request()->getUri()->getSegments()->getString());
$cacheHandle = cache()->getItemPool('default');
if (cache()->hasItemPool('output')) {
$cacheH... | Cache::handle
Handles a request and produces a response
May call other collaborating code to generate the response.
@param \O2System\Psr\Http\Message\ServerRequestInterface $request
@throws \Psr\Cache\InvalidArgumentException | entailment |
public function render()
{
if ($this->hasButtons()) {
foreach ($this->buttons as $button) {
$this->childNodes->push($button);
}
}
return parent::render();
} | Footer::render
@return string | entailment |
protected function bootstrapProgressBar(ProgressBarInterface $progressBar) {
$span = static::coreHTMLElement("span", $progressBar->getValue() . "%", ["class" => "sr-only"]);
$attributes = [];
$attributes["class"] = ["progress-bar", ProgressBarRenderer::renderType($progressBar)];
... | Displays a Bootstrap progress bar.
@param ProgressBarInterface $progressBar The progress bar.
@return string Returns the Bootstrap progress bar. | entailment |
public function getResult()
{
if ($this->map->currentModel->row instanceof Sql\DataObjects\Result\Row) {
$criteria = $this->map->currentModel->row->offsetGet($this->map->currentPrimaryKey);
$condition = [
$this->map->intermediaryTable . '.' . $this->map->intermediaryC... | HasManyThrough::getResult
@return array|bool|\O2System\Framework\Models\Sql\DataObjects\Result\Row | entailment |
public function render()
{
$output[] = $this->open();
if ($this->title instanceof Element) {
$this->title->attributes->addAttributeClass('card-title');
$output[] = $this->title;
}
if ($this->subTitle instanceof Element) {
$this->subTitle->attribu... | Overlay::render
@return string | entailment |
public function bootstrapGridFunction(array $args = []) {
$output = [];
$output[] = $this->bootstrapGridStackedFunction($args);
$output[] = $this->bootstrapGridOffsetFunction($args);
$output[] = $this->bootstrapGridPushFunction($args);
$output[] = $this->bootstrapGridPullFuncti... | Displays a Bootstrap grid.
@param array $args The arguments.
@return string Returns the Bootstrap grid. | entailment |
public function bootstrapGridOffsetFunction(array $args = []) {
return $this->bootstrapGrid(ArrayHelper::get($args, "lgOffset"), ArrayHelper::get($args, "mdOffset"), ArrayHelper::get($args, "smOffset"), ArrayHelper::get($args, "xsOffset"), ArrayHelper::get($args, "recopyOffset", false), "offset");
} | Displays a Bootstrap grid with offset.
@param array $args The arguments.
@return string Returns the Bootstrap grid with offset. | entailment |
public function bootstrapGridPullFunction(array $args = []) {
return $this->bootstrapGrid(ArrayHelper::get($args, "lgPull"), ArrayHelper::get($args, "mdPull"), ArrayHelper::get($args, "smPull"), ArrayHelper::get($args, "xsPull"), ArrayHelper::get($args, "recopyPull", false), "pull");
} | Displays a Bootstrap grid with pull.
@param array $args The arguments.
@return string Returns the Bootstrap grid with pull. | entailment |
public function bootstrapGridPushFunction(array $args = []) {
return $this->bootstrapGrid(ArrayHelper::get($args, "lgPush"), ArrayHelper::get($args, "mdPush"), ArrayHelper::get($args, "smPush"), ArrayHelper::get($args, "xsPush"), ArrayHelper::get($args, "recopyPush", false), "push");
} | Displays a Bootstrap grid with push.
@param array $args The arguments.
@return string Returns the Bootstrap grid with push. | entailment |
public function bootstrapGridStackedFunction(array $args = []) {
return $this->bootstrapGrid(ArrayHelper::get($args, "lg"), ArrayHelper::get($args, "md"), ArrayHelper::get($args, "sm"), ArrayHelper::get($args, "xs"), ArrayHelper::get($args, "recopy", false), "");
} | Displays a Bootstrap grid with stacked-to-horizontal.
@param array $args The arguments.
@return string Returns the Bootstrap grid with stacked-to-horizontal. | entailment |
public static function fromArray(array $options = []): self
{
return new self(
$options['authorization_code_ttl'] ?? 120,
$options['access_token_ttl'] ?? 3600,
$options['refresh_token_ttl'] ?? 86400,
$options['rotate_refresh_tokens'] ?? false,
$opt... | Set one or more configuration properties | entailment |
public function createCard($title, $paragraph = null)
{
$collapseId = dash($title);
$link = new Contents\Link($title, '#' . $collapseId);
$link->attributes->addAttribute('data-toggle', 'collapse');
$link->attributes->addAttribute('data-parent', '#' . $this->attributes->getAttributeId... | Accordion::createCard
@param string $title
@param string|null $paragraph
@return \O2System\Framework\Libraries\Ui\Components\Card | entailment |
public function execute()
{
parent::execute();
if (empty($this->optionFilename)) {
output()->write(
(new Format())
->setContextualClass(Format::DANGER)
->setString(language()->getLine('CLI_MAKE_COMMANDER_E_FILENAME'))
... | Commander::execute | entailment |
public function add(array $parameters)
{
if (!array_key_exists('name', $parameters) || !is_string($parameters['name'])) {
throw new \InvalidArgumentException('You need to provide the name of the SSH Key.');
}
if (!array_key_exists('ssh_pub_key', $parameters) || !is_string($param... | Adds a new public SSH key to your account.
The array requires name and ssh_pub_key keys.
@param array $parameters An array of parameters.
@return StdClass
@throws \InvalidArgumentException | entailment |
public function edit($sshKeyId, array $parameters)
{
if (!array_key_exists('ssh_pub_key', $parameters) || !is_string($parameters['ssh_pub_key'])) {
throw new \InvalidArgumentException('You need to provide the new public SSH Key.');
}
return $this->processQuery($this->buildQuery(... | Edits an existing public SSH key in your account.
The array requires ssh_pub_key key.
@param integer $sshKeyId The id of the SSH key.
@param array $parameters An array of parameters.
@return StdClass
@throws \InvalidArgumentException | entailment |
public function getColumn($index)
{
if (is_string($index) and in_array($index, $this->childNodesEntities)) {
if (false !== ($key = array_search($index, $this->childNodesEntities))) {
if ($this->childNodes->offsetExists($key)) {
$index = $key;
}... | Row::getColumn
@param string $index
@return \O2System\Framework\Libraries\Ui\Contents\Table\Column | entailment |
public function addColumn($column)
{
if ($column instanceof Element) {
if ($column->entity->getEntityName() === '') {
$column->entity->setEntityName('col-' . ($this->childNodes->count() + 1));
}
$this->pushColumnChildNodes($column);
}
ret... | Row::addColumn
@param Column $column
@return static | entailment |
protected function pushColumnChildNodes(Element $column)
{
if ( ! $this->hasItem($column->entity->getEntityName())) {
$this->childNodes[] = $column;
$this->childNodes->last();
$this->childNodesEntities[ $this->childNodes->key() ] = $column->entity->getEntityName();
... | Row::pushColumnChildNodes
@param \O2System\Framework\Libraries\Ui\Element $column | entailment |
public function hasItem($index)
{
if (is_string($index) and in_array($index, $this->childNodesEntities)) {
if (false !== ($key = array_search($index, $this->childNodesEntities))) {
if ($this->childNodes->offsetExists($key)) {
return true;
}
... | Row::hasItem
@param string $index
@return bool | entailment |
public function render()
{
$output[] = $this->open();
if ( ! empty($this->content)) {
$output[] = implode(PHP_EOL, $this->content);
}
if ($this->hasChildNodes()) {
if ($this->auto) {
$columns = $this->childNodes->count();
if... | Row::render
@return string | entailment |
public function index($code = 500)
{
$codeString = $code . '_' . error_code_string($code);
$viewFilePath = 'error-code';
if (is_dir(modules()->top()->getDir('Views/errors'))) {
$viewFilePath = 'errors/' . $viewFilePath;
}
if (presenter()->theme->use === true) {... | Error::index
@param int $code | entailment |
public function setParagraph($text)
{
$this->paragraph = new Paragraph();
$this->paragraph->entity->setEntityName('paragraph');
$this->paragraph->textContent->push($text);
return $this;
} | ParagraphSetterTrait::setParagraph
@param string $text
@return static | entailment |
public function setPhoto($src, $href = null)
{
if (isset($href)) {
$this->photo = new Link(new Image($src), $href);
} else {
$this->photo = new Image($src);
}
return $this;
} | Author::setPhoto
@param string $src
@param string|null $href
@return static | entailment |
public function setPerson($name, $href = null)
{
$this->person = new Element('strong', 'person');
if (isset($href)) {
$this->person->childNodes->push(new Link($name, $href));
} else {
$this->person->textContent->push($name);
}
return $this;
} | Author::setPerson
@param string $name
@param string|null $href
@return static | entailment |
public function setJobTitle($position)
{
$this->jobTitle = new Element('small', 'source');
$this->jobTitle->textContent->push($position);
return $this;
} | Author::setJobTitle
@param string $position
@return static | entailment |
public function setCompany($company, $href = null)
{
$this->company = new Element('small', 'source');
if (isset($href)) {
$this->company->childNodes->push(new Link($company, $href));
} else {
$this->company->textContent->push($company);
}
return $thi... | Author::setCompany
@param string $company
@param string|null $href
@return static | entailment |
public function render()
{
// Render Avatar
if ($this->photo instanceof \O2System\Html\Element) {
$avatar = new Element('div', 'avatar');
$avatar->attributes->addAttributeClass('card-avatar');
$avatar->childNodes->push($this->photo);
$this->childNodes-... | Author::render
@return string | entailment |
public function setTitle($text, $tagName = 'h4')
{
$this->title = new Element($tagName, 'title');
$this->title->entity->setEntityName($text);
$this->title->textContent->push($text);
return $this;
} | TitleSetterTrait::setTitle
@param string $text
@param string $tagName
@return static | entailment |
public function setSubTitle($text, $tagName = 'h6')
{
$this->subTitle = new Element($tagName, 'subTitle');
$this->subTitle->entity->setEntityName($text);
$this->subTitle->textContent->push($text);
return $this;
} | TittleSetterTrait::setSubTitle
@param string $text
@param string $tagName
@return static | entailment |
public function make($path, $name, array $options = [])
{
$options += ['middleware' => null, 'prefix' => null];
$parsedRoutes = $this->getParsedRoutes($options['middleware'], $options['prefix']);
$template = $this->file->get(__DIR__ . '/templates/Router.js');
$template = str_repla... | Compile routes template and generate
@param string $path
@param string $name
@param array $options
@return bool | entailment |
protected function getParsedRoutes($middleware = null, $prefix = null)
{
/** @var Collection $parsedRoutes */
$parsedRoutes = Collection::make($this->router->getRoutes()->getRoutes())
->map(function ($route) {
return $this->getRouteInformation($route);
})
... | Get parsed routes
@param string $middleware
@param string $prefix
@return array | entailment |
protected function getRouteInformation(Route $route)
{
if ($route->getName()) {
return [
'uri' => $route->uri(),
'name' => $route->getName(),
'middleware' => $route->middleware(),
];
}
return null;
} | Get the route information for a given route.
@param \Illuminate\Routing\Route $route
@return array|null | entailment |
public function optionName($name)
{
if (empty($this->optionPath)) {
$this->optionPath = PATH_RESOURCES . 'themes' . DIRECTORY_SEPARATOR;
}
$this->optionName = $name;
} | Theme::optionName
@param string $name | entailment |
public function execute()
{
parent::execute();
if (empty($this->optionName)) {
output()->write(
(new Format())
->setContextualClass(Format::DANGER)
->setString(language()->getLine('CLI_MAKE_THEME_E_NAME'))
->set... | Theme::execute | entailment |
private function bootstrapBreadcrumb(NavigationNode $node, $last) {
$attributes = true === $node->getActive() && true === $last ? ["class" => "active"] : [];
$content = $this->getTranslator()->trans($node->getId());
$innerHTML = true === $last ? $content : static::coreHTMLElement("a", $conte... | Displays a Bootstrap breadcrumb.
@param NavigationNode $node The node.
@param bool $last Last node ?.
@return string Returns the Bootstrap breadcrumb. | entailment |
protected function bootstrapBreadcrumbs(NavigationTree $tree) {
$attributes = [];
$attributes["class"] = ["breadcrumb"];
$innerHTML = [];
$nodes = NavigationTreeHelper::getBreadcrumbs($tree);
$count = count($nodes);
for ($i = 0; $i < $count; ++$i) {
$inne... | Displays a Bootstrap breadcrumbs.
@param NavigationTree $tree The tree.
@return string Returns the Bootstrap breadcrumbs. | entailment |
public function success(array $data = [], $status = 200, $code = 'success', array $headers = [], $options = 0)
{
return $this->respond($data, $status, $code, $headers, $options);
} | Respond with a success response.
@param array $data
@param int $status
@param string $code
@param array $headers
@param int $options
@return \Illuminate\Http\JsonResponse | entailment |
public function error(array $data = [], $status = 400, $code = 'error', array $headers = [], $options = 0)
{
return $this->respond($data, $status, $code, $headers, $options);
} | Respond with an error response.
@param array $data
@param int $status
@param string $code
@param array $headers
@param int $options
@return \Illuminate\Http\JsonResponse | entailment |
public function respond(array $data, $status = 200, $code, array $headers = [], $options = 0)
{
return $this->response->json(
array_merge(compact('status', 'code'), $data), $status, $headers, $options
);
} | Respond with a json response.
@param array $data
@param int $status
@param string $code
@param array $headers
@param int $options
@return \Illuminate\Http\JsonResponse | entailment |
public function createNav($type = Nav::HEADER_PILLS)
{
$nav = new Nav($type);
$this->childNodes->push($nav);
return $this->nav = $this->childNodes->last();
} | Header::createNav
@return Nav | entailment |
public function createOptions()
{
$nav = new Nav(Nav::HEADER_PILLS);
$nav->attributes->addAttributeClass('float-right');
$this->childNodes->push($nav);
return $this->options = $this->childNodes->last();
} | Header::createOptions
@return Nav | entailment |
public function numberFormat($decimals = 0, $thousandSeparator = '.', $decimalSeparator = ',')
{
$decimalSeparator = $thousandSeparator === '.' ? ',' : '.';
return number_format($this->amount, $decimals, $decimalSeparator, $thousandSeparator);
} | Money::numberFormat
@param int $decimals
@param string $thousandSeparator
@param string $decimalSeparator
@return string | entailment |
public function currencyFormat($locale = 'id_ID', $currency = 'IDR', $addSpace = true)
{
return currency_format($this->amount, $locale, $currency, $addSpace);
} | Money::currencyFormat
@param string $locale
@param string $currency
@param bool $addSpace
@return string | entailment |
public function replace($header)
{
foreach ($this as $index => $string) {
$this->dequeue();
}
return $this->prepend($header);
} | Title::replace
@param string $header
@return static | entailment |
public function createFormGroup(array $attributes = [])
{
$this->childNodes->push(new Group($attributes));
return $this->childNodes->last();
} | Grid::createFromGroup
@param array $attributes
@return \O2System\Framework\Libraries\Ui\Components\Form\Group | entailment |
public function displayNone($size = null)
{
if (empty($size)) {
$this->attributes->addAttributeClass('d-none');
} elseif (in_array($size, ['xs', 'sm', 'md', 'lg', 'xl'])) {
$this->attributes->addAttributeClass('d-' . $size . '-none');
}
return $this;
} | DisplayUtilitiesTrait::displayNone
@param string|null $size
@return static | entailment |
public function displayInline($size = null)
{
if (empty($size)) {
$this->attributes->addAttributeClass('d-inline');
} elseif (in_array($size, ['xs', 'sm', 'md', 'lg', 'xl'])) {
$this->attributes->addAttributeClass('d-' . $size . '-inline');
}
return $this;
... | DisplayUtilitiesTrait::displayInline
@param string|null $size
@return static | entailment |
public function displayInlineBlock($size = null)
{
if (empty($size)) {
$this->attributes->addAttributeClass('d-inline-block');
} elseif (in_array($size, ['xs', 'sm', 'md', 'lg', 'xl'])) {
$this->attributes->addAttributeClass('d-' . $size . '-inline-block');
}
... | DisplayUtilitiesTrait::displayInlineBlock
@param string|null $size
@return static | entailment |
public function displayBlock($size = null)
{
if (empty($size)) {
$this->attributes->addAttributeClass('d-block');
} elseif (in_array($size, ['xs', 'sm', 'md', 'lg', 'xl'])) {
$this->attributes->addAttributeClass('d-' . $size . '-block');
}
return $this;
} | DisplayUtilitiesTrait::displayBlock
@param string|null $size
@return static | entailment |
public function displayTable($size = null)
{
if (empty($size)) {
$this->attributes->addAttributeClass('d-table');
} elseif (in_array($size, ['xs', 'sm', 'md', 'lg', 'xl'])) {
$this->attributes->addAttributeClass('d-' . $size . '-table');
}
return $this;
} | DisplayUtilitiesTrait::displayTable
@param string|null $size
@return static | entailment |
public function displayTableCell($size = null)
{
if (empty($size)) {
$this->attributes->addAttributeClass('d-table-cell');
} elseif (in_array($size, ['xs', 'sm', 'md', 'lg', 'xl'])) {
$this->attributes->addAttributeClass('d-' . $size . '-table-cell');
}
retur... | DisplayUtilitiesTrait::displayTableCell
@param string|null $size
@return static | entailment |
public function displayFlex($size = null)
{
if (empty($size)) {
$this->attributes->addAttributeClass('d-flex');
} elseif (in_array($size, ['xs', 'sm', 'md', 'lg', 'xl'])) {
$this->attributes->addAttributeClass('d-' . $size . '-flex');
}
return $this;
} | DisplayUtilitiesTrait::displayFlex
@param string|null $size
@return static | entailment |
public function displayInlineFlex($size = null)
{
if (empty($size)) {
$this->attributes->addAttributeClass('d-inline-flex');
} elseif (in_array($size, ['xs', 'sm', 'md', 'lg', 'xl'])) {
$this->attributes->addAttributeClass('d-' . $size . '-inline-flex');
}
re... | DisplayUtilitiesTrait::displayInlineFlex
@param string|null $size
@return static | entailment |
protected function buildRecordsQuery($domain, $id = null, $action = null, array $parameters = array())
{
$parameters = http_build_query(array_merge($parameters, $this->credentials));
$query = sprintf("%s/%s/%s", $this->apiUrl, $domain, DomainsActions::ACTION_RECORDS);
$query = $id ? sprintf... | Builds the records API url according to the parameters.
@param integer|string $domain The id or the name of the domain.
@param integer $recordId The Id of the record to work with (optional).
@param string $action The action to perform (optional).
@param array $parameters An array of p... | entailment |
protected function checkParameters(array $parameters)
{
if (!array_key_exists('record_type', $parameters)) {
throw new \InvalidArgumentException('You need to provide the record_type.');
}
if (!in_array($parameters['record_type'], array('A', 'CNAME', 'NS', 'TXT', 'MX', 'SRV'))) {... | Check submitted parameters.
The array requires record_type and data keys:
- record_type can be only 'A', 'CNAME', 'NS', 'TXT', 'MX' or 'SRV'.
- data is a string, the value of the record.
Special cases:
- name is a required string if the record_type is 'A', 'CNAME', 'TXT' or 'SRV'.
- priority is an required integer if... | entailment |
public function newRecord($domain, array $parameters)
{
$this->checkParameters($parameters);
return $this->processQuery(
$this->buildRecordsQuery($domain, null, RecordsActions::ACTION_ADD, $parameters)
);
} | Adds a new record to a specific domain.
@param integer|string $domain The id or the name of the domain.
@param array $parameters An array of parameters.
@return StdClass | entailment |
public function editRecord($domain, $recordId, array $parameters)
{
$this->checkParameters($parameters);
return $this->processQuery(
$this->buildRecordsQuery($domain, $recordId, RecordsActions::ACTION_EDIT, $parameters)
);
} | Edits a record to a specific domain.
@param integer|string $domain The id or the name of the domain.
@param integer $recordId The id of the record.
@param array $parameters An array of parameters.
@return StdClass | entailment |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.