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()); $node->childNodes->push($list); } else { $node->entity->setEntityName('media-nested-' . ($this->childNodes->count() + 1)); if (isset($list)) { $node->entity->setEntityName($list); $node->textContent->push($list); } } $this->childNodes->push($node); return $this->childNodes->last(); }
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']); } elseif ($this->alignment === 'MIDDLE') { $this->image->attributes->addAttributeClass(['align-self-center']); } elseif ($this->alignment === 'BOTTOM') { $this->image->attributes->addAttributeClass(['align-self-end']); } $output[] = $this->image; } if ($this->paragraph instanceof Element) { $this->body->childNodes->prepend($this->paragraph); } if ($this->hasChildNodes()) { foreach ($this->childNodes as $childNode) { $this->body->childNodes->push($childNode); } } if ($this->heading instanceof Element) { $this->heading->tagName = 'h4'; $this->heading->attributes->addAttributeClass(['mt-0']); $this->body->childNodes->prepend($this->heading); } $output[] = $this->body; $output[] = $this->close(); return implode(PHP_EOL, $output); }
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()->updateRegistry(); break; } } else { modules()->updateRegistry(); language()->updateRegistry(); } exit(EXIT_SUCCESS); }
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()->flushRegistry(); break; } } else { modules()->flushRegistry(); language()->flushRegistry(); } exit(EXIT_SUCCESS); }
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() ->addColumn('Language') ->addColumn(language()->getTotalRegistry()); output()->write( (new Format()) ->setString($table->render()) ->setNewLinesBefore(1) ->setNewLinesAfter(2) ); exit(EXIT_SUCCESS); }
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': $line = PHP_EOL . print_r(language()->getRegistry(), true); break; } if (isset($line)) { output()->write($line); exit(EXIT_SUCCESS); } } }
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']); $this->childNodes->push($link); return $this->childNodes->last(); }
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 == $this->object->owner_guid) { $object_summary_title = elgg_echo('interactions:ownership:own', array($object_type), $this->language); } else if ($this->recipient->guid == $this->object->owner_guid) { $object_summary_title = elgg_echo('interactions:ownership:your', array($object_type), $this->language); } else { $object_owner = $this->object->getOwnerEntity() ? : elgg_get_site_entity(); $object_summary_title = elgg_echo('interactions:ownership:owner', array($object_owner->getDisplayName(), $object_type), $this->language); } if ($this->object instanceof Comment) { $object_full_title = $object_summary_title; } else { $object_full_title = $object_summary_title . ' ' . $object_link; } if ($this->root->guid !== $this->object->guid) { $root_link = elgg_view('output/url', array( 'text' => $this->root->getDisplayName(), 'href' => elgg_http_add_url_query_elements($this->root->getURL(), array( 'active_tab' => 'comments', )), )); $object_full_title .= ' ' . elgg_echo('interactions:comment:in_thread', array($root_link)); } $author_link = elgg_view('output/url', array( 'text' => $this->author->name, 'href' => $this->author->getURL(), )); $object_summary_link = elgg_view('output/url', array( 'text' => $object_summary_title, 'href' => elgg_http_add_url_query_elements($this->object->getURL(), array( 'active_tab' => 'comments', )), )); $action_type = $this->getActionType(); $notification = new \stdClass(); $notification->summary = elgg_echo('interactions:response:email:subject', array( $author_link, $action_type, $object_summary_link ), $this->language); $notification->subject = strip_tags($notification->summary); $notification->body = elgg_echo('interactions:response:email:body', array( $author_link, $action_type, $object_full_title, $this->getComment(), $this->comment->getURL(), $this->root->getURL(), $this->author->getDisplayName(), $this->author->getURL(), ), $this->language); return $notification; }
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:on:$object_type", "interactions:action:$comment_subtype", ]; foreach ($keys as $key) { if (elgg_language_key_exists($key)) { return elgg_echo($key, array(), $this->language); } } return elgg_echo('interactions:action:comment', $this->language); }
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($key, $this->language)) { return elgg_echo($key, array(), $this->language); } } return elgg_echo('interactions:post', $this->language); }
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('output/attached', array( 'entity' => $this->comment, )); $attachments = $this->comment->getAttachments(array('limit' => 0)); if ($attachments && count($attachments)) { $attachments = array_map(__NAMESPACE__ . '\\get_linked_entity_name', $attachments); $attachments_text = implode(', ', array_filter($attachments)); if ($attachments_text) { $comment_body .= elgg_echo('interactions:attachments:labelled', array($attachments_text)); } } return strip_tags($comment_body, '<p><strong><em><span><ul><li><ol><blockquote><img><a>'); }
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->buttons->push($button); return $this->buttons->last(); }
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' => Status::PENDING, ]); return (bool) $this->friends()->save($friendship); }
@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->where('recipient_type', get_class($recipient)); })->first(); return $friendship ? ($friendship->status === Status::BLOCKED) : false; }
@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->where('recipient_type', get_class($recipient)); })->orWhere(function ($query) use ($recipient) { $query->where('sender_id', $recipient->id); $query->where('sender_type', get_class($recipient)); $query->where('recipient_id', $this->id); $query->where('recipient_type', get_class($this)); }); }
@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)) { $query->where('status', $status); } })->orWhere(function ($query) use ($status) { $query->where('recipient_id', $this->id); $query->where('recipient_type', get_class($this)); if (!empty($status)) { $query->where('status', $status); } }); if (!empty($limit)) { $query->take($limit); } if (!empty($offset)) { $query->skip($offset); } foreach ($query->get() as $friendship) { $friendships[] = $this->getFriendship($this->find( ($friendship->sender_id == $this->id) ? $friendship->recipient_id : $friendship->sender_id )); } return $friendships; }
@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('loader'); $ret = $command->execute($input, $output); if ($ret!=0) return $ret; $command = $this->getApplication()->find('wrapper'); $ret = $command->execute($input, $output); $this->io->writeln(''); return $ret; }
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)); $progressBar->setMin(ArrayHelper::get($args, "min", 0)); $progressBar->setStriped(ArrayHelper::get($args, "striped", false)); $progressBar->setValue(ArrayHelper::get($args, "value", 50)); return $progressBar; }
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('interactions/comments', [ 'guid' => $guid, 'comment_guid' => $comment_guid ]); return true; case 'likes' : set_input('guid', $guid); echo elgg_view_resource('interactions/likes', [ 'guid' => $guid, ]); return true; case 'edit' : set_input('guid', $guid); echo elgg_view_resource('interactions/edit', [ 'guid' => $guid, ]); return true; case 'view' : set_input('guid', $guid); echo elgg_view_resource('interactions/view', [ 'guid' => $guid, ]); return true; } return false; }
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_normalize_url(implode('/', array( 'stream', 'comments', $entity->container_guid, $entity->guid, ))) . "#elgg-object-$entity->guid"; } else if ($entity instanceof RiverObject) { return elgg_normalize_url(implode('/', array( 'stream', 'view', $entity->guid ))); } return $url; }
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 Andrian Salim') ->setNewLinesAfter(1) ); output()->write( (new Format()) ->setIndent(2) ->setString('this framework is trademark of Steeve Andrian Salim') ->setNewLinesAfter(1) ); } } }
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->canByName($permission); } return false; }
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->can($permission); //with this example, the class checks if the authenticated //user has the permission with the permission id 1. $authorization->can(1); //with this example, the class checks if the authenticated //user has the permission 'see users'. $authorization->can('see users'); </code></pre> @param mixed $permission @return bool
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')) { $cacheHandle = cache()->getItemPool('output'); } if ($cacheHandle instanceof \Psr\Cache\CacheItemPoolInterface) { if ($cacheHandle->hasItem($cacheKey)) { output() ->setContentType('text/html') ->send($cacheHandle->getItem($cacheKey)->get()); } } }
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)]; $attributes["class"][] = ProgressBarRenderer::renderStriped($progressBar); $attributes["class"][] = ProgressBarRenderer::renderAnimated($progressBar); $attributes["style"] = ProgressBarRenderer::renderStyle($progressBar); $attributes["role"] = "progressbar"; $attributes["aria-valuenow"] = $progressBar->getValue(); $attributes["aria-valuemin"] = $progressBar->getMin(); $attributes["aria-valuemax"] = $progressBar->getMax() . "%"; $innerHTML = ProgressBarRenderer::renderContent($progressBar, $span); $div = static::coreHTMLElement("div", $innerHTML, $attributes); return static::coreHTMLElement("div", $div, ["class" => "progress"]); }
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->intermediaryCurrentForeignKey => $criteria, ]; $this->map->intermediaryModel->qb ->select([ $this->map->referenceTable . '.*', ]) ->from($this->map->intermediaryTable) ->join($this->map->referenceTable, implode(' = ', [ $this->map->referenceTable . '.' . $this->map->referencePrimaryKey, $this->map->intermediaryTable . '.' . $this->map->intermediaryReferenceForeignKey, ])); if ($result = $this->map->intermediaryModel->findWhere($condition)) { return $result; } } return false; }
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->attributes->addAttributeClass('card-subtitle'); $output[] = $this->subTitle; } if ($this->paragraphs instanceof ArrayIterator) { if ($this->paragraphs->count()) { foreach ($this->paragraphs as $paragraph) { $paragraph->attributes->addAttributeClass('card-text'); $output[] = $paragraph; } } } if ($this->hasTextContent()) { $output[] = implode('', $this->textContent); } if ($this->hasChildNodes()) { $output[] = implode(PHP_EOL, $this->childNodes); } $output[] = $this->close(); return implode(PHP_EOL, $output); }
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->bootstrapGridPullFunction($args); return trim(implode(" ", $output)); }
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, $options['revoke_rotated_refresh_tokens'] ?? true, $options['owner_callable'] ?? null, $options['grants'] ?? [], $options['owner_request_attribute'] ?? 'owner', $options['token_request_attribute'] ?? 'oauth_token' ); }
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()); $card = new Card(); $card->header->attributes->addAttribute('role', 'tab'); $card->header->childNodes->push($link); $block = $card->createBlock(); $block->attributes->setAttributeId($collapseId); if (isset($paragraph)) { $block->setParagraph($paragraph); } if ($this->childNodes->count() > 0) { $card->hide(); } $this->childNodes->push($card); return $this->childNodes->last(); }
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')) ->setNewLinesAfter(1) ); exit(EXIT_ERROR); } if (strpos($this->optionPath, 'Commanders') === false) { $filePath = $this->optionPath . 'Commanders' . DIRECTORY_SEPARATOR . $this->optionFilename; } else { $filePath = $this->optionPath . $this->optionFilename; } $fileDirectory = dirname($filePath) . DIRECTORY_SEPARATOR; if ( ! is_dir($fileDirectory)) { mkdir($fileDirectory, 0777, true); } if (is_file($filePath)) { output()->write( (new Format()) ->setContextualClass(Format::DANGER) ->setString(language()->getLine('CLI_MAKE_COMMANDER_E_EXISTS', [$filePath])) ->setNewLinesAfter(1) ); exit(EXIT_ERROR); } $className = prepare_class_name(pathinfo($filePath, PATHINFO_FILENAME)); @list($namespaceDirectory, $subNamespace) = explode('Commanders', dirname($filePath)); $classNamespace = loader()->getDirNamespace( $namespaceDirectory ) . 'Commanders' . (empty($subNamespace) ? null : str_replace( '/', '\\', $subNamespace )) . '\\'; $vars[ 'CREATE_DATETIME' ] = date('d/m/Y H:m'); $vars[ 'NAMESPACE' ] = trim($classNamespace, '\\'); $vars[ 'PACKAGE' ] = '\\' . trim($classNamespace, '\\'); $vars[ 'CLASS' ] = $className; $vars[ 'FILEPATH' ] = $filePath; $phpTemplate = <<<PHPTEMPLATE <?php /** * Created by O2System Framework File Generator. * DateTime: CREATE_DATETIME */ // ------------------------------------------------------------------------ namespace NAMESPACE; // ------------------------------------------------------------------------ use O2System\Framework\Http\Commander; /** * Class CLASS * * @package PACKAGE */ class CLASS extends Commander { /** * CLASS::index */ public function index() { // TODO: Change the autogenerated stub } } PHPTEMPLATE; $fileContent = str_replace(array_keys($vars), array_values($vars), $phpTemplate); file_put_contents($filePath, $fileContent); if (is_file($filePath)) { output()->write( (new Format()) ->setContextualClass(Format::SUCCESS) ->setString(language()->getLine('CLI_MAKE_COMMANDER_S_MAKE', [$filePath])) ->setNewLinesAfter(1) ); exit(EXIT_SUCCESS); } }
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($parameters['ssh_pub_key'])) { throw new \InvalidArgumentException('You need to provide the SSH key.'); } return $this->processQuery($this->buildQuery(null, SSHKeysActions::ACTION_ADD, $parameters)); }
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($sshKeyId, SSHKeysActions::ACTION_EDIT, $parameters)); }
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; } } } return $this->childNodes->offsetGet($index); }
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); } return $this; }
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; } } } return false; }
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 ($columns > 2) { $extraSmallColumn = @round(12 / ($columns - 2)); $smallColumn = @round(12 / ($columns - 1)); } $mediumColumn = round(12 / ($columns)); $largeColumn = round(12 / ($columns)); } foreach ($this->childNodes as $childNode) { if ($this->auto) { if (isset($extraSmallColumn)) { $childNode->attributes->addAttributeClass('col-xs-' . $extraSmallColumn); } if (isset($smallColumn)) { $childNode->attributes->addAttributeClass('col-sm-' . $smallColumn); } $childNode->attributes->addAttributeClass('col-md-' . $mediumColumn); $childNode->attributes->addAttributeClass('col-lg-' . $largeColumn); } $output[] = $childNode->render() . PHP_EOL; } } $output[] = $this->close(); return implode(PHP_EOL, $output); }
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) { presenter()->theme->setLayout('error'); if (false !== ($layout = presenter()->theme->active->getLayout())) { if ($layout->getFilename() === 'theme') { presenter()->theme->set(false); } } } view($viewFilePath, [ 'code' => $code, 'title' => language()->getLine($codeString . '_TITLE'), 'message' => language()->getLine($codeString . '_MESSAGE'), ]); }
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 $this; }
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->push($avatar); } // Render Profile $profile = new Element('div', 'profile'); $profile->attributes->addAttributeClass('card-profile'); $profile->childNodes->push($this->person); if ($this->jobTitle instanceof \O2System\Html\Element && $this->company instanceof \O2System\Html\Element) { $middot = new Element('span', 'middot'); $middot->textContent->push(' &mdash; '); $this->person->childNodes->push($middot); $this->person->childNodes->push($this->jobTitle); $profile->childNodes->push(new Element('br', 'breakline')); $profile->childNodes->push($this->company); } else { // Render Profile Job Title if ($this->jobTitle instanceof \O2System\Html\Element) { $profile->childNodes->push(new Element('br', 'breakline')); $profile->childNodes->push($this->jobTitle); } // Render Profile Company if ($this->company instanceof \O2System\Html\Element) { $profile->childNodes->push(new Element('br', 'breakline')); $profile->childNodes->push($this->company); } } $this->childNodes->push($profile); // Render clearfix $clearfix = new Element('div', 'clearfix'); $clearfix->clearfix(); $this->childNodes->push($clearfix); return parent::render(); }
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_replace("routes: null,", 'routes: ' . json_encode($parsedRoutes) . ',', $template); $template = str_replace("'Router'", "'" . $options['object'] . "'", $template); if ($this->file->isWritable($path)) { $filename = $path . '/' . $name; return $this->file->put($filename, $template) !== false; } return false; }
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); }) ->filter(); if ($middleware) { $parsedRoutes = $parsedRoutes->filter(function($routeInfo) use ($middleware) { return in_array($middleware, $routeInfo['middleware']); }); } $parsedRoutes = $parsedRoutes->map(function($routeInfo){ unset($routeInfo['middleware']); return $routeInfo; }); if ($prefix) { $parsedRoutes = $parsedRoutes->map(function ($routeInfo) use ($prefix) { $routeInfo['uri'] = $prefix . $routeInfo['uri']; return $routeInfo; }); } return $parsedRoutes->values()->all(); }
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')) ->setNewLinesAfter(1) ); exit(EXIT_ERROR); } $themePath = $this->optionPath . dash($this->optionName) . DIRECTORY_SEPARATOR; if ( ! is_dir($themePath)) { mkdir($themePath, 0777, true); } else { output()->write( (new Format()) ->setContextualClass(Format::DANGER) ->setString(language()->getLine('CLI_MAKE_THEME_E_EXISTS', [$themePath])) ->setNewLinesAfter(1) ); exit(EXIT_ERROR); } // Make default structure mkdir($themePath . 'assets' . DIRECTORY_SEPARATOR, 0777, true); foreach (['css', 'js', 'img', 'fonts', 'media', 'packages'] as $assetsDir) { mkdir($themePath . 'assets' . DIRECTORY_SEPARATOR . $assetsDir . DIRECTORY_SEPARATOR, 0777, true); } mkdir($themePath . 'partials' . DIRECTORY_SEPARATOR, 0777, true); $jsonProperties[ 'name' ] = readable( $this->optionName, true ); $jsonProperties[ 'created' ] = date('d M Y'); file_put_contents($themePath . 'theme.json', json_encode($jsonProperties, JSON_PRETTY_PRINT)); $themeTemplate = <<<THEME <!DOCTYPE html> <html> <head> {{@assets->head}} </head> <body class="multipurpose"> <div id="page-content" class="page-content"> {{@partials->content}} </div> {{@assets->body}} </body> </html> THEME; file_put_contents($themePath . 'theme.phtml', str_replace('@', '$', $themeTemplate)); if (is_dir($themePath)) { output()->write( (new Format()) ->setContextualClass(Format::SUCCESS) ->setString(language()->getLine('CLI_MAKE_THEME_S_MAKE', [$themePath])) ->setNewLinesAfter(1) ); exit(EXIT_SUCCESS); } }
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", $content, ["href" => $node->getUri()]); return static::coreHTMLElement("li", $innerHTML, $attributes); }
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) { $innerHTML[] = $this->bootstrapBreadcrumb($nodes[$i], $count === $i + 1); } return static::coreHTMLElement("ol", "\n" . implode("\n", $innerHTML) . "\n", $attributes); }
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'); } return $this; }
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'); } return $this; }
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'); } return $this; }
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("%s/%s", $query, $id) : $query; $query = $action ? sprintf("%s/%s/?%s", $query, $action, $parameters) : sprintf("%s/?%s", $query, $parameters); return $query; }
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 parameters (optional). @return string The built API url.
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'))) { throw new \InvalidArgumentException('The record_type can only be A, CNAME, NS, TXT, MX or SRV'); } if (!array_key_exists('data', $parameters) || !is_string($parameters['data'])) { throw new \InvalidArgumentException('You need to provide the data value of the record.'); } if (in_array($parameters['record_type'], array('A', 'CNAME', 'TXT', 'SRV'))) { if (!array_key_exists('name', $parameters) || !is_string($parameters['name'])) { throw new \InvalidArgumentException('You need to provide the name string if the record_type is A, CNAME, TXT or SRV.'); } } if (in_array($parameters['record_type'], array('SRV', 'MX'))) { if (!array_key_exists('priority', $parameters) || !is_int($parameters['priority'])) { throw new \InvalidArgumentException('You need to provide the priority integer if the record_type is SRV or MX.'); } } if ('SRV' === $parameters['record_type']) { if (!array_key_exists('port', $parameters) || !is_int($parameters['port'])) { throw new \InvalidArgumentException('You need to provide the port integer if the record_type is SRV.'); } } if ('SRV' === $parameters['record_type']) { if (!array_key_exists('weight', $parameters) || !is_int($parameters['weight'])) { throw new \InvalidArgumentException('You need to provide the weight integer if the record_type is 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 the record_type is 'SRV' or 'MX'. - port is an required integer if the record_type is 'SRV'. - weight is an required integer if the record_type is 'SRV'. @param array $parameters An array of parameters. @throws \InvalidArgumentException
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