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, $parameters) : sprintf("%s/?%s", $query, $parameters); return $query; }
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 API does still have the old error object structure. if (isset($processed->error_message)) { $errorMessage = $processed->error_message; } if (isset($processed->message)) { $errorMessage = $processed->message; } throw new \RuntimeException(sprintf("%s: %s", $errorMessage, $query)); } return $processed; }
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; if ($object instanceof ElggUser) { $access_id = ACCESS_FRIENDS; } else if ($object instanceof ElggGroup) { $access_id = $object->group_acl; } $ia = elgg_set_ignore_access(true); $object = new RiverObject(); $object->owner_guid = $river->subject_guid; $object->container_guid = $object->guid; $object->access_id = $access_id; $object->river_id = $river->id; $object->save(); elgg_set_ignore_access($ia); return $object; }
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 create duplicate // river objects $ia = elgg_set_ignore_access(true); $guid = InteractionsCache::getInstance()->getGuidFromRiverId($river->id); if (!$guid) { $object = InteractionsService::createActionableRiverObject($river); $guid = $object->guid; } elgg_set_ignore_access($ia); $object = get_entity($guid); } if ($object instanceof ElggEntity) { $object->setVolatileData('river_item', $river); } return $object; }
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, 'likes')) ? 'after' : 'before', ) ); return elgg_trigger_plugin_hook('get_stats', 'interactions', array('entity' => $entity), $stats); }
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') { $setting = 'time_created::desc'; } return $setting; }
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 == 'load_older') || ($order == 'time_created::desc' && $style == 'load_newer')) { // show last page $offset = $count - $limit; if ($offset < 0) { $offset = 0; } } else { // show first page $offset = 0; } return (int) $offset; }
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, $view) = explode(':', $key); if ($prefix !== 'stream_object') { continue; } $views[] = $view; } return $views; }
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); $options = array( 'type' => 'object', 'subtype' => RiverObject::class, 'container_guid' => $entity->guid, 'wheres' => array( "e.access_id != {$entity->access_id}" ), 'limit' => 0, ); $batch = new ElggBatch('elgg_get_entities', $options, null, 25, false); foreach ($batch as $river_object) { // Update comment access_id $river_object->access_id = $entity->access_id; $river_object->save(); } elgg_set_ignore_access($ia); }
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) { $this->attributes->addAttribute('href', $href); } elseif (function_exists('base_url')) { $this->attributes->addAttribute('href', base_url($href)); } return $this; }
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->hasChildNodes()) { if ( ! $this->hasTextContent()) { $output[] = PHP_EOL; } foreach ($this->childNodes as $childNode) { $output[] = $childNode . PHP_EOL; } } $output[] = $this->close(); return implode('', $output); }
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 $baseDir = \rtrim($namespace[1], DIRECTORY_SEPARATOR).'/'; //add namespace $this->prefixes[$prefix] = $baseDir; } }
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('\\', $arrayClass); // try to load a mapped file for the prefix and relative class if ($this->loadMappedFile($prefix, $relativeClass)) { return true; } } // never found a mapped file return false; }
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 relative class name, append with .php $file = $this->prefixes[$prefix].\str_replace('\\', '/', $relativeClass).'.php'; // if the mapped file exists, require it if (\file_exists($file)) { require $file; // yes, we're done return true; } //Unable to find class in file. return false; }
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, ButtonInterface::BUTTON_TYPE_SUCCESS, ButtonInterface::BUTTON_TYPE_WARNING, ]; }
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/landing'); $collection ->match('/account/login', Controller::INDEX . ':indexAction') ->method('POST') ->value('template', 'pages/landing'); $collection ->match('/account/create', Controller::ACCOUNT . ':indexAction') ->method('POST|GET') ->value('template', 'pages/registration'); $collection ->match('/game', Controller::INDEX . ':indexAction') ->method('GET') ->value('template', 'pages/landing'); $collection ->match('/cities',Controller::CITY.':listAction') ->method('GET') ->value('template','pages/game/cityList'); $collection ->match('/city/create',Controller::CITY.':createAction') ->method('GET') ->value('template','pages/game/newcity'); return $collection; }
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 $this->paragraphs->last(); }
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($spType)) { if (empty($uniqueKeys) && empty($primaryKeys)) { return null; } else { return $columns; } } if (!empty($primaryKeys)) { foreach ($columns as $column) { $check = StaticDataLayer::searchInRowSet('Column_name', $column['column_name'], $primaryKeys); if (isset($check)) { $resultColumns[] = $column; } } return $resultColumns; } else { if (!empty($uniqueKeys)) { reset($uniqueKeys); $first = key($uniqueKeys); if (count($uniqueKeys)>1) { $this->io->writeln(sprintf('Table <dbo>%s</dbo> has more than one unique key.', $this->tableName)); $array = []; foreach ($uniqueKeys as $column) { if (isset($array[$column['Key_name']])) { $array[$column['Key_name']] .= ','; $array[$column['Key_name']] .= $column['Column_name']; } else { $array[$column['Key_name']] = $column['Column_name']; } } $tableArray = []; foreach ($array as $key => $column) { $tableArray[] = [$key, $column]; } $table = new Table($this->output); $table->setHeaders(['Name', 'Keys']); $table->setRows($tableArray); $table->render(); $question = new Question(sprintf('What unique keys use in statement?(%s): ', $uniqueKeys[$first]['Key_name']), $uniqueKeys[$first]['Key_name']); $uniqueKeys = $this->helper->ask($this->input, $this->output, $question); $uniqueKeys = explode(',', $array[$uniqueKeys]); foreach ($uniqueKeys as $column) { $resultColumns[] = ['column_name' => $column]; } return $resultColumns; } else { foreach ($uniqueKeys as $column) { $resultColumns[] = ['column_name' => $column['Column_name']]; } return $resultColumns; } } else { return null; } } }
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 parameter', $padding); foreach ($columns as $column) { $this->codeStore->append(sprintf($format, $column['column_name']), false); } $this->codeStore->append(' */', false); }
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 ($first) { $format = sprintf(' in p_%%-%ds @%%s.%%s%%s@', $padding); $this->codeStore->appendToLastLine(strtolower(sprintf($format, $column['column_name'], $this->tableName, $column['column_name'], '%type'))); } else { $format = sprintf('%%%ds p_%%-%ds @%%s.%%s%%s@', $offset + 3, $padding); $this->codeStore->append(strtolower(sprintf($format, 'in', $column['column_name'], $this->tableName, $column['column_name'], '%type')), false); } if ($column!=end($columns)) { $this->codeStore->appendToLastLine(','); } else { $this->codeStore->appendToLastLine(' )'); } $first = false; } }
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->codeStore->append('-- type: none'); break; case 'SELECT': $this->codeStore->append('-- type: row1'); break; case 'INSERT': if ($flag) { $this->codeStore->append('-- type: singleton1'); } else { $this->codeStore->append('-- type: none'); } break; default: throw new FallenException("Unknown stored routine type '%s'", $this->spType); } }
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 objects $this->buildObjects(); //return required class return $this->cache[$class] ?? null; }
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] = []; } //get parameter from constructor //can return error when constructor not declared $parameters = (new ReflectionClass($class))->getConstructor()->getParameters(); //loop parameter foreach ($parameters as $param) { //check if argument is already stored $notAlreadyStored = !\in_array($param, $this->tree[$level][$class]); //if there is parameter with callable type if (\class_exists((string) $param->getType()) && $notAlreadyStored) { //push values in stack for simulate later recursive function $stack->push([$level, $class]); //store dependency $this->tree[$level][$class][] = $param; //update values for simulate recursive function $level++; $class = $param->getClass()->name; //return to main while continue 2; } if ($notAlreadyStored) { //store dependency $this->tree[$level][$class][] = $param; } } //if stack is empty break while end exit from function if ($stack->count() === 0) { break; } //get last value pushed into stack; list($level, $class) = $stack->pop(); } }
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 $object = $this->cache[$class] ?? null; //if object is not in cache and need arguments try to build if ($object === null && \count($arguments)) { //build arguments $args = $this->buildArguments($class, $arguments); //store object with dependencies in cache $this->cache[$class] = (new ReflectionClass($class))->newInstanceArgs($args); continue; } if ($object === null) { //store object in cache $this->cache[$class] = (new ReflectionClass($class))->newInstance(); } } } }
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 arguments $paramClass = $argValue->getClass()->name; $args[] = $this->cache[$paramClass]; continue; } $args[] = null; } //check if there is rules for this class if (isset($this->rules[$class])) { //merge arguments $args = \array_replace($args, $this->rules[$class]); } return $args; }
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) { $list = clone $list; $node->attributes->addAttributeClass('dropdown'); $list->toggle->tagName = 'a'; $list->toggle->attributes->remove('type'); $list->toggle->attributes->removeAttributeClass(['btn', 'btn-*']); $list->toggle->attributes->addAttribute('role', 'button'); $node->childNodes->push($list->toggle); $node->childNodes->push($list->menu); } else { $node->childNodes->push($list); } } else { if (is_numeric($list)) { $node->entity->setEntityName('list-' . $list); } else { $node->entity->setEntityName($list); } $node->textContent->push($list); } $node->attributes->addAttributeClass('nav-item'); $node->attributes->addAttribute('role', 'presentation'); $this->pushChildNode($node); return $this->childNodes->last(); }
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-target', '#' . $this->target); $indicator->attributes->addAttribute('data-slide-to', $slideNo); return $this->childNodes->last(); }
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 . '.record_left', 'ASC'); $this->qb->orderBy($this->table . '.record_ordering', 'ASC'); } elseif (property_exists($this, 'adjacency')) { $this->qb->orderBy($this->table . '.record_ordering', 'ASC'); } if ($result = $this->qb->from($this->table)->get()) { if ($result->count() > 0) { $this->result = new DataObjects\Result($result, $this); $this->result->setInfo($result->getInfo()); return $this->result; } } return false; }
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; $this->qb->page($page, $limit); return $this; }
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 . '.' . $field; } if ($result = $this->qb ->from($this->table) ->where($field, $criteria) ->get($limit)) { if ($result->count() > 0) { $this->result = new DataObjects\Result($result, $this); $this->result->setInfo($result->getInfo()); if ($this->result->count() == 1) { return $this->result->first(); } return $this->result; } } return false; }
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 = $this->qb ->from($this->table) ->get($limit)) { $this->result = new DataObjects\Result($result, $this); $this->result->setInfo($result->getInfo()); if ($limit == 1) { return $this->result->first(); } return $this->result; } return false; }
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->result = new DataObjects\Result($result, $this); $this->result->setInfo($result->getInfo()); return $this->result; } return false; }
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) ->whereNotIn($field, $notInCriteria) ->get()) { $this->result = new DataObjects\Result($result, $this); $this->result->setInfo($result->getInfo()); return $this->result; } return false; }
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 { $this->attributes->addAttribute('style', 'width: ' . $this->now . '%;'); } $this->label->textContent->push($this->now . ' ' . language()->getLine('Complete')); return $this; }
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 implode(" ", [$editButton, $deleteButton]); }
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->getButtonTwigExtension()->bootstrapButtonLinkFilter($but, ArrayHelper::get($args, "href", self::DEFAULT_HREF)); }
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()->bootstrapButtonLinkFilter($but, ArrayHelper::get($args, "href", self::DEFAULT_HREF)); }
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"]); $attributes = []; $attributes["class"] = ["alert", $class]; $attributes["class"][] = true === $dismissible ? "alert-dismissible" : null; $attributes["role"] = ["alert"]; $innerHTML = (true === $dismissible ? $button : "") . (null !== $content ? $content : ""); return static::coreHTMLElement("div", $innerHTML, $attributes); }
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->result = new ArrayIterator(); foreach ($result as $row) { $item = new SplArrayObject(); foreach ($fields as $field) { if ($row->offsetExists($field)) { $item[ $field ] = $row->offsetGet($field); } } $this->result[] = $item; } return $this->result; } return false; }
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->result = $result; } else { foreach ($result as $row) { $item = new SplArrayObject(); foreach ($fields as $field) { if ($row->offsetExists($field)) { $item[ $field ] = $row->offsetGet($field); } } $this->result[] = $item; } return $this->result; } } return false; }
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->storage as $row) { if ($row->offsetExists($field)) { if ($row->offsetGet($field) === $criteria) { $result[] = $row; $counter++; } } if (isset($limit)) { if ($counter == $limit) { break; } } } if ($result->count() > 0) { $this->result = $result; if ($result->count() == 1) { return $result->first(); } else { return $this->result; } } return false; }
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 FALSE if failed.
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[] = $row; $counter++; } } if (isset($limit)) { if ($counter == $limit) { break; } } } if ($result->count() > 0) { $this->result = $result; if ($result->count() == 1) { return $result->first(); } else { return $this->result; } } return false; }
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->offsetGet($field), $notInCriteria)) { $result[] = $row; $counter++; } } if (isset($limit)) { if ($counter == $limit) { break; } } } if ($result->count() > 0) { $this->result = $result; if ($result->count() == 1) { return $result->first(); } else { return $this->result; } } return false; }
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_SUCCESS); } }
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() ->where('posX = :posX AND posY = :posY') ->setParameters( array( ':posY' => $posY, ':posX' => $posX ) )->execute(); $row = $result->fetch(PDO::FETCH_OBJ); return (bool)$row; }
{@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_id = :user_id') ->setParameter(':user_id', $owner->getUserId())->execute(); $rows = $result->fetchAll(PDO::FETCH_OBJ); if (count($rows) < 0) { return $found; } foreach ($rows as $row) { $entity = $this->rowToEntity($row); $found[$entity->getCityId()] = $entity; $this->replace($entity); } return $found; }
{@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') ->where('posY = :posY') ->setParameters( array( ':posY' => $posY, ':posX' => $posX ) )->execute(); $row = $result->fetch(PDO::FETCH_OBJ); if (!$row) { return null; } $entity = $this->rowToEntity($row); $this->replace($entity); return $entity; }
{@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>" . $description . "</small>" : ""; $innerHTML = (null !== $content ? $content : "") . $secondary; return static::coreHTMLElement($element, $innerHTML, $attributes); }
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, "bootstrapDeletedFunction"], ["is_safe" => ["html"]]), new TwigFunction("bsDeleted", [$this, "bootstrapDeletedFunction"], ["is_safe" => ["html"]]), new TwigFunction("bootstrapHeading1", [$this, "bootstrapHeading1Function"], ["is_safe" => ["html"]]), new TwigFunction("bsHeading1", [$this, "bootstrapHeading1Function"], ["is_safe" => ["html"]]), new TwigFunction("bootstrapHeading2", [$this, "bootstrapHeading2Function"], ["is_safe" => ["html"]]), new TwigFunction("bsHeading2", [$this, "bootstrapHeading2Function"], ["is_safe" => ["html"]]), new TwigFunction("bootstrapHeading3", [$this, "bootstrapHeading3Function"], ["is_safe" => ["html"]]), new TwigFunction("bsHeading3", [$this, "bootstrapHeading3Function"], ["is_safe" => ["html"]]), new TwigFunction("bootstrapHeading4", [$this, "bootstrapHeading4Function"], ["is_safe" => ["html"]]), new TwigFunction("bsHeading4", [$this, "bootstrapHeading4Function"], ["is_safe" => ["html"]]), new TwigFunction("bootstrapHeading5", [$this, "bootstrapHeading5Function"], ["is_safe" => ["html"]]), new TwigFunction("bsHeading5", [$this, "bootstrapHeading5Function"], ["is_safe" => ["html"]]), new TwigFunction("bootstrapHeading6", [$this, "bootstrapHeading6Function"], ["is_safe" => ["html"]]), new TwigFunction("bsHeading6", [$this, "bootstrapHeading6Function"], ["is_safe" => ["html"]]), new TwigFunction("bootstrapInserted", [$this, "bootstrapInsertedFunction"], ["is_safe" => ["html"]]), new TwigFunction("bsInserted", [$this, "bootstrapInsertedFunction"], ["is_safe" => ["html"]]), new TwigFunction("bootstrapItalic", [$this, "bootstrapItalicFunction"], ["is_safe" => ["html"]]), new TwigFunction("bsItalic", [$this, "bootstrapItalicFunction"], ["is_safe" => ["html"]]), new TwigFunction("bootstrapMarked", [$this, "bootstrapMarkedFunction"], ["is_safe" => ["html"]]), new TwigFunction("bsMarked", [$this, "bootstrapMarkedFunction"], ["is_safe" => ["html"]]), new TwigFunction("bootstrapSmall", [$this, "bootstrapSmallFunction"], ["is_safe" => ["html"]]), new TwigFunction("bsSmall", [$this, "bootstrapSmallFunction"], ["is_safe" => ["html"]]), new TwigFunction("bootstrapStrikethrough", [$this, "bootstrapStrikethroughFunction"], ["is_safe" => ["html"]]), new TwigFunction("bsStrikethrough", [$this, "bootstrapStrikethroughFunction"], ["is_safe" => ["html"]]), new TwigFunction("bootstrapUnderlined", [$this, "bootstrapUnderlinedFunction"], ["is_safe" => ["html"]]), new TwigFunction("bsUnderlined", [$this, "bootstrapUnderlinedFunction"], ["is_safe" => ["html"]]), ]; }
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 as &$redirectUri) { $redirectUri = trim((string) $redirectUri); } } $client = new static(); $client->id = (string) Uuid::uuid4(); $client->name = $name; $client->redirectUris = $redirectUris ?? []; return $client; }
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($this->class)->findOneBy(array($elements[0] => $value)) : null; } }
@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->push($this->footer); } if ($this->responsive) { $this->attributes->addAttributeClass('table-responsive'); } return parent::render(); }
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('/self::\$/', '$this->', $source); // Replace static methods. $source = preg_replace('/(public|protected|private)\s+static(\s+)(function)/i', '${1}${2}${3}', $source); // Replace invocation of static methods. $source = preg_replace('/self::/', '$this->', $source); // Replace class name. if ($sourceClass!==null) { $source = preg_replace('/(class)(\s+)'.$sourceClass.'/', '${1}${2}'.$targetClass, $source); } return $source; }
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'); break; case '21:9': $this->attributes->addAttributeClass('embed-responsive-21by9'); break; case '16:9': $this->attributes->addAttributeClass('embed-responsive-16by9'); break; case '4:3': $this->attributes->addAttributeClass('embed-responsive-4by3'); break; } return $this; }
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) { if (is_file( $filePath = $configFilePath . ucfirst( strtolower(ENVIRONMENT) ) . DIRECTORY_SEPARATOR . $configFile . '.php' )) { include($filePath); } elseif (is_file($filePath = $configFilePath . DIRECTORY_SEPARATOR . $configFile . '.php')) { include($filePath); } } if (isset($$offset)) { if ( ! in_array($offset, $this->loaded)) { array_push($this->loaded, $offset); } $this->addItem($offset, $$offset); unset($$offset); if ($return) { return $this->getItem($offset); } return true; } return false; }
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); } return $this; }
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 (o2system()->__isset($property)) { $get[ $property ] = o2system()->__get($property); } elseif ($property === 'model') { $get[ $property ] = models('controller'); } elseif ($property === 'services' || $property === 'libraries') { $get[ $property ] = services(); } return $get[ $property ]; }
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->uploadedResult = $this->getUploader()->upload($source, $options); return $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::REGISTRATION] = $app->share(function () use ($app) { return new RegistrationUseCase( $app[Repository::USER], $app[Validator::REGISTRATION], $app[Service::PASSWORD_HASH]); }); $app[UseCase::LIST_DIRECTIONS] = $app->share(function() use($app){ return new ListDirectionsUseCase($app[Repository::DIRECTION]); }); }
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($icon, $href); $link->attributes->addAttributeClass('nav-link'); return $this->createList($link); }
Bullets::createBullet @param string $bullet @param string|null $href @return \O2System\Framework\Libraries\Ui\Contents\Lists\Item
entailment