sentence1 stringlengths 52 3.87M | sentence2 stringlengths 1 47.2k | label stringclasses 1
value |
|---|---|---|
public function createRow()
{
$row = new Row();
$this->childNodes->push($row);
return $this->childNodes->last();
} | Body::createRow
@return Row | entailment |
public function createBlockquote($text = null)
{
$blockquote = new Blockquote();
if (isset($text)) {
$blockquote->setParagraph($text);
}
$this->childNodes->push($blockquote);
return $this->childNodes->last();
} | Body::createBlockquote
@param string|null $text
@return \O2System\Framework\Libraries\Ui\Components\Card\Body\Blockquote | entailment |
public function render()
{
if ($this->title instanceof Element) {
$this->title->attributes->addAttributeClass('card-title');
$this->childNodes->push($this->title);
}
if ($this->subTitle instanceof Element) {
$this->subTitle->attributes->addAttributeClass(... | Body::render
@return string | entailment |
public function render()
{
if ( ! $this->label->hasTextContent()) {
$this->input->attributes->addAttributeClass('position-static');
}
return parent::render();
} | Checkbox::render
@return string | entailment |
private function generateWrapperClass(): void
{
$this->io->title('Wrapper');
/** @var NameMangler $mangler */
$mangler = new $this->nameMangler();
$routines = $this->readRoutineMetadata();
if (!empty($routines))
{
// Sort routines by their wrapper method name.
$sorted_routines =... | Generates the wrapper class. | entailment |
private function readConfigurationFile(string $configFilename): void
{
// Read the configuration file.
$settings = parse_ini_file($configFilename, true);
// Set default values.
if (!isset($settings['wrapper']['lob_as_string']))
{
$settings['wrapper']['lob_as_string'] = false;
}
if ... | Reads parameters from the configuration file.
@param string $configFilename The filename of the configuration file. | entailment |
private function readRoutineMetadata(): array
{
$data = file_get_contents($this->metadataFilename);
$routines = (array)json_decode($data, true);
if (json_last_error()!=JSON_ERROR_NONE)
{
throw new RuntimeException("Error decoding JSON: '%s'.", json_last_error_msg());
}
return $routines... | Returns the metadata of stored routines.
@return array | entailment |
private function storeWrapperClass(): void
{
$code = $this->codeStore->getCode();
switch ($this->wrapperClassType)
{
case 'static':
// Nothing to do.
break;
case 'non static':
$code = NonStatic::nonStatic($code);
break;
default:
throw new Fallen... | Writes the wrapper class to the filesystem. | entailment |
private function writeClassHeader(): void
{
$p = strrpos($this->wrapperClassName, '\\');
if ($p!==false)
{
$namespace = ltrim(substr($this->wrapperClassName, 0, $p), '\\');
$class_name = substr($this->wrapperClassName, $p + 1);
}
else
{
$namespace = null;
$class_name ... | Generate a class header for stored routine wrapper. | entailment |
private function writeClassTrailer(): void
{
$this->codeStore->appendSeparator();
$this->codeStore->append('}');
$this->codeStore->append('');
$this->codeStore->appendSeparator();
} | Generate a class trailer for stored routine wrapper. | entailment |
private function writeRoutineFunction(array $routine, NameMangler $nameMangler): void
{
$wrapper = Wrapper::createRoutineWrapper($routine, $this->codeStore, $nameMangler, $this->lobAsString);
$wrapper->writeRoutineFunction();
$this->imports = array_merge($this->imports, $wrapper->getImports());
} | Generates a complete wrapper method for a stored routine.
@param array $routine The metadata of the stored routine.
@param NameMangler $nameMangler The mangler for wrapper and parameter names. | entailment |
public function createLink($label, $href = null)
{
$link = new Link($label, $href);
if ( ! $this->links instanceof ArrayIterator) {
$this->links = new ArrayIterator();
}
$this->links->push($link);
} | LinksCollectorTrait::createLink
@param string $label
@param string|null $href | entailment |
public function addLink(Link $link)
{
if ( ! $this->links instanceof ArrayIterator) {
$this->links = new ArrayIterator();
}
$this->links->push($link);
return $this;
} | LinksCollectorTrait
@param \O2System\Framework\Libraries\Ui\Contents\Link $link
@return static | entailment |
public function getAttemptsLeftWithSameUser(string $userName): int
{
$attemptsLeft = ((int) $this->maxAttemptsForUserName) - $this->enhancedAuthenticationMapper->fetchAttemptsWithSameUser($userName, $this->banTimeInSeconds);
return \max(0, $attemptsLeft);
} | Return how many attemps are left for incorrect password.
@param string $userName
@return int Number of attempts with same user. | entailment |
public function getAttemptsLeftWithSameSession(string $sessionId): int
{
$attemptsLeft = ((int) $this->maxAttemptsForSessionId) - $this->enhancedAuthenticationMapper->fetchAttemptsWithSameSession($sessionId, $this->banTimeInSeconds);
return \max(0, $attemptsLeft);
} | Return how many attemps are left for same session id.
@param string $sessionId
@return int Number of attempts with same session. | entailment |
public function getAttemptsLeftWithSameIp(string $ipAddress): int
{
$attemptsLeft = ((int) $this->maxAttemptsForIpAddress) - $this->enhancedAuthenticationMapper->fetchAttemptsWithSameIp($ipAddress, $this->banTimeInSeconds);
return \max(0, $attemptsLeft);
} | Return how many attemps are left for same ip.
@param string $ipAddress
@return int Number of attempts with same ip. | entailment |
public function logDebug()
{
if ($this->getVerbosity()>=OutputInterface::VERBOSITY_DEBUG)
{
$args = func_get_args();
$format = array_shift($args);
$this->writeln(vsprintf('<info>'.$format.'</info>', $args));
}
} | -------------------------------------------------------------------------------------------------------------------- | entailment |
public function logInfo()
{
if ($this->getVerbosity()>=OutputInterface::VERBOSITY_NORMAL)
{
$args = func_get_args();
$format = array_shift($args);
$this->writeln(vsprintf('<info>'.$format.'</info>', $args));
}
} | -------------------------------------------------------------------------------------------------------------------- | entailment |
public function logVerbose()
{
if ($this->getVerbosity()>=OutputInterface::VERBOSITY_VERBOSE)
{
$args = func_get_args();
$format = array_shift($args);
$this->writeln(vsprintf('<info>'.$format.'</info>', $args));
}
} | -------------------------------------------------------------------------------------------------------------------- | entailment |
public function logVeryVerbose()
{
if ($this->getVerbosity()>=OutputInterface::VERBOSITY_VERY_VERBOSE)
{
$args = func_get_args();
$format = array_shift($args);
$this->writeln(vsprintf('<info>'.$format.'</info>', $args));
}
} | -------------------------------------------------------------------------------------------------------------------- | entailment |
public function rebuildTree($idParent = 0, $left = 1, $depth = 0)
{
ini_set('xdebug.max_nesting_level', 10000);
ini_set('memory_limit', '-1');
if ($childs = $this->qb
->table($this->table)
->select('id')
->where($this->parentKey, $idParent)
->... | HierarchicalTrait::rebuildTree
@param int $idParent
@param int $left
@param int $depth
@return int | entailment |
public function getParents($id, $ordering = 'ASC')
{
if ($parents = $this->qb
->select($this->table . '.*')
->from($this->table)
->from($this->table . ' AS node')
->whereBetween('node.record_left', [$this->table . '.record_left', $this->table . '.record_right'... | HierarchicalTrait::getParents
@param int $id
@param string $ordering ASC|DESC
@return bool|\O2System\Framework\Models\Sql\DataObjects\Result | entailment |
public function getParent($idParent)
{
if ($parent = $this->qb
->select($this->table . '.*')
->from($this->table)
->where($this->primaryKey, $idParent)
->get(1)) {
if ($parent->count() == 1) {
return $parent->first();
}
... | HierarchicalTrait::getParent
@param int $idParent
@return bool|\O2System\Framework\Models\Sql\DataObjects\Result\Row | entailment |
public function getNumOfParent($id)
{
if ($parents = $this->qb
->table($this->table)
->select('id')
->where('id', $id)
->get()) {
return $parents->count();
}
return 0;
} | HierarchicalTrait::getNumOfParent
@param int $idParent
@return int | entailment |
public function hasParent($id, $direct = true)
{
if ($numOfParents = $this->getNumOfParent($idParent, $direct)) {
return (bool)($numOfParents == 0 ? false : true);
}
return false;
} | HierarchicalTrait::hasParent
@param int $id
@return bool | entailment |
public function hasParents($id)
{
if ($numOfParents = $this->getNumOfParents($id)) {
return (bool)($numOfParents == 0 ? false : true);
}
return false;
} | HierarchicalTrait::hasParents
@param int $id
@return bool | entailment |
public function getChilds($idParent, $ordering = 'ASC')
{
if ($childs = $this->qb
->select($this->table . '.*')
->from($this->table)
->from($this->table . ' AS node')
->whereBetween('node.record_left', [$this->table . '.record_left', $this->table . '.record_ri... | HierarchicalTrait::getChilds
@param int $idParent
@param string $ordering ASC|DESC
@return bool|\O2System\Framework\Models\Sql\DataObjects\Result | entailment |
public function getNumOfChilds($idParent, $direct = true)
{
if($childs = $this->getChilds($idParent)) {
return $childs->count();
}
return 0;
} | HierarchicalTrait::getNumOfChilds
@param int $idParent
@param bool $direct
@return int | entailment |
public function hasChilds($idParent)
{
if ($numOfChilds = $this->getNumOfChilds($idParent)) {
return (bool)($numOfChilds == 0 ? false : true);
}
return false;
} | HierarchicalTrait::hasChilds
@param int $idParent
@return bool | entailment |
public function load($widgetOffset)
{
$widgetDirectory = modules()->top()->getRealPath() . 'Widgets' . DIRECTORY_SEPARATOR . studlycase($widgetOffset) . DIRECTORY_SEPARATOR;
if (is_dir($widgetDirectory)) {
$widget = new DataStructures\Module\Widget($widgetDirectory);
$this->... | Widgets::load
@param string $widgetOffset
@return bool | entailment |
public function get($offset)
{
if (null !== ($widget = parent::get($offset))) {
$widgetViewFilePath = $widget->getRealPath() . 'Views' . DIRECTORY_SEPARATOR . $offset . '.phtml';
if (presenter()->theme->use === true) {
$widgetViewReplacementPath = str_replace(
... | Widgets::get
@param string $offset
@return string | entailment |
public function loadPluginConfiguration(): void
{
if ($this->compiler->getPlugin(CoreDecoratorPlugin::PLUGIN_NAME) === null) {
throw new InvalidStateException(sprintf('Plugin "%s" must be enabled', CoreDecoratorPlugin::class));
}
$builder = $this->getContainerBuilder();
$config = $this->getConfig();
$glo... | Register services | entailment |
public function getAccessToken(ServerRequestInterface $request, $scopes = [])
{
if (! $token = $this->extractAccessToken($request)) {
return null;
}
$token = $this->accessTokenService->getToken($token);
if ($token === null || ! $token->isValid($scopes)) {
th... | Get the access token
Note that this method will only match tokens that are not expired and match the given scopes (if any).
If no token is pass, this method will return null, but if a token is given does not exist (ie. has been
deleted) or is not valid, then it will trigger an exception
@link http://tools.ietf.org/... | entailment |
private function extractAccessToken(ServerRequestInterface $request)
{
// The preferred way is using Authorization header
if ($request->hasHeader('Authorization')) {
// Header value is expected to be "Bearer xxx"
$parts = explode(' ', $request->getHeaderLine('Authorization'))... | Extract the token either from Authorization header or query params
@return string|null | entailment |
public function handle(ServerRequestInterface $request)
{
if (services()->has('csrfProtection')) {
if (hash_equals(input()->server('REQUEST_METHOD'), 'POST')) {
if ( ! services()->get('csrfProtection')->verify()) {
output()->sendError(403, [
... | Csrf::handle
Handles a request and produces a response
May call other collaborating code to generate the response.
@param \O2System\Psr\Http\Message\ServerRequestInterface $request | entailment |
public function loadDir($dir)
{
$partialsFiles = scandir($dir);
$partialsFiles = array_slice($partialsFiles, 2);
foreach ($partialsFiles as $partialsFile) {
$partialsFilePath = $dir . $partialsFile;
if (is_file($partialsFilePath)) {
$this->loadFile(... | Partials::loadDir
@param string $dir | entailment |
public function loadFile($filePath)
{
if (strrpos($filePath, $this->extension) !== false) {
$fileKey = str_replace([$this->path, $this->extension, DIRECTORY_SEPARATOR], ['', '', '-'], $filePath);
$this->store(camelcase($fileKey), new SplFileInfo($filePath));
}
} | Partials::loadFile
@param string $filePath | entailment |
public function get($partial)
{
$partialContent = parent::get($partial);
if (is_file($partialContent)) {
parser()->loadFile($partialContent);
return parser()->parse();
} elseif (is_string($partialContent)) {
return $partialContent;
}
ret... | Partials::get
@param string $partial
@return false|mixed|string|null | entailment |
public static function renderType(ProgressBarInterface $progressBar) {
return null !== $progressBar->getType() ? $progressBar->getPrefix() . $progressBar->getType() : null;
} | Render a type.
@param ProgressBarInterface $progressBar The progress bar.
@return string|null Returns the rendered type. | entailment |
public function setTotal($total)
{
$this->total = (int)$total;
$this->setPages(ceil($total / $this->limit));
return $this;
} | Pagination::setTotal
@param int $total
@return static | entailment |
public function setLimit($limit)
{
$this->limit = (int)$limit;
if ($this->total > 0 && $this->limit > 0) {
$this->setPages(ceil($this->total / $limit));
}
return $this;
} | Pagination::setLimit
@param int $limit
@return static | entailment |
public function render()
{
// returning empty string if the num pages is zero
if ($this->pages == 0 || $this->pages == 1) {
return '';
}
$output[] = $this->open() . PHP_EOL;
$current = (int)input()->get('page');
$current = $current == 0 ? 1 : $current;
... | Pagination::render
@return string | entailment |
protected function pushChildNode(Element $node)
{
$node->attributes->addAttributeClass('page-item');
if ($node->childNodes->first() instanceof Link) {
$node->childNodes->first()->attributes->addAttributeClass('page-link');
}
parent::pushChildNode($node);
} | Pagination::pushChildNode
@param \O2System\Framework\Libraries\Ui\Element $node | entailment |
protected function returnStorageObject()
{
$driver = $this->driver;
$options = $this->options;
if (isset($this->supportedDriver[$driver])) {
$class = $this->supportedDriver[$driver];
return new $class($options);
}
throw new InvalidArgumentException(... | Return Storage Object.
@throws InvalidArgumentException If required driver is not supported
@return mixed | entailment |
public function createButton($label)
{
$node = new Button();
if ($label instanceof Button) {
$node = $label;
} elseif ($label instanceof Dropdown) {
$node = clone $label;
$node->attributes->removeAttributeClass('dropdown');
$node->attributes->... | Group::createButton
@param string $label
@return Button | entailment |
protected function bootstrapDropdownButton($content, $id, $expanded, $class) {
$classes = ButtonEnumerator::enumTypes();
$attributes = [];
$attributes["class"][] = "btn";
$attributes["class"][] = true === in_array($class, $classes) ? "btn-" . $class : "btn-default";
... | Displays a Bootstrap dropdown "Button".
@param string $content The content.
@param string $id The id.
@param bool $expanded Expanded ?
@param string $class The class.
@return string Returns the Bootstrap dropdown "Button". | entailment |
public function run(): void
{
//attach Oserver to Subjetc
$this->model->attach($this->view);
//run action before controller
$this->beforeAfterController('before');
$this->beforeAfterControllerAction('before');
//run controller
$this->runController();
... | Run mvc pattern.
@return void | entailment |
private function beforeAfterControllerAction(string $when): void
{
$method = $when.\ucfirst($this->routeAction);
if (\method_exists($this->controller, $method) && $method !== $when) {
\call_user_func([$this->controller, $method]);
}
} | Run action before or after controller action execution.
@param string $when
@return void | entailment |
private function beforeAfterController(string $when): void
{
if (\method_exists($this->controller, $when)) {
\call_user_func([$this->controller, $when]);
}
} | Run action before or after controller execution.
@param string $when
@return void | entailment |
private function runController(): void
{
//get route information
$action = $this->routeAction;
$param = $this->routeParam;
//action - call controller passing params
if (!empty($param)) {
\call_user_func_array([$this->controller, $action], $param);
ret... | Run controller.
@return void | entailment |
private function runView(): void
{
$action = ($this->routeAction) ? $this->routeAction : 'index';
\call_user_func([$this->view, $action]);
} | Run view.
@return void | entailment |
public function getMarkedQuery(string $style = 'error'): array
{
$query = trim($this->query); // MySQL ignores leading whitespace in queries.
$message = [];
if (strpos($query, PHP_EOL)!==false && $this->isQueryError())
{
// Query is a multi line query.
// The format of a 1064 message is... | Returns an array with the lines of the SQL statement. The line where the error occurred will be styled.
@param string $style The style for highlighting the line with error.
@return array The lines of the SQL statement. | entailment |
private function message(int $errno, string $error, string $query): string
{
$message = 'MySQL Error no: '.$errno."\n";
$message .= $error;
$message .= "\n";
$query = trim($query);
if (strpos($query, "\n")!==false)
{
// Query is a multi line query.
$message .= "\n";
// Prep... | Composes the exception message.
@param int $errno The error code value of the error ($mysqli->errno).
@param string $error Description of the error ($mysqli->error).
@param string $query The SQL query or method name.
@return string | entailment |
public function render()
{
$output[] = $this->left;
$output[] = $this->right;
return implode(PHP_EOL, $output);
} | Control::render
@return string | entailment |
public function route()
{
$segments = server_request()->getUri()->getSegments()->getParts();
if (false !== ($key = array_search('images', $segments))) {
$segments = array_slice($segments, $key);
} else {
array_shift($segments);
}
$this->imageFilePath... | Images::route | entailment |
protected function scale()
{
$config = config('image', true);
if ( ! empty($this->imageQuality)) {
$config->offsetSet('quality', intval($this->imageQuality));
}
if ($config->cached === true) {
if ($this->imageFilePath !== $this->imageNotFoundFilename) {
... | Images::scale
@throws \O2System\Spl\Exceptions\Runtime\FileNotFoundException | entailment |
protected function resize()
{
$config = config('image', true);
if ( ! empty($this->imageQuality)) {
$config->offsetSet('quality', intval($this->imageQuality));
}
if ($config->cached === true) {
if ($this->imageFilePath !== $this->imageNotFoundFilename) {
... | Images::resize
@throws \O2System\Spl\Exceptions\Runtime\FileNotFoundException | entailment |
protected function original()
{
$config = config('image', true);
if ( ! empty($this->imageQuality)) {
$config->offsetSet('quality', intval($this->imageQuality));
}
$manipulation = new Manipulation($config);
$manipulation->setImageFile($this->imageFilePath);
... | Images::original
@throws \O2System\Spl\Exceptions\Runtime\FileNotFoundException | entailment |
private function applyColor($label, $content, $color) {
$searches = ">" . $content;
$replaces = " style=\"background-color:" . $color . ";\"" . $searches;
return StringHelper::replace($label, [$searches], [$replaces]);
} | Apply the color.
@param string $label The label.
@param string $content The content.
@param string $color The color.
@return string Returns the label with applied color. | entailment |
public function bootstrapRoleLabelFunction(UserInterface $user = null, array $roleColors = [], array $roleTrans = []) {
if (null === $user) {
return "";
}
$output = [];
foreach ($user->getRoles() as $current) {
$role = true === $current instanceof Role ? $curr... | Display a Bootstrap role label.
@param UserInterface $user The user.
@param array $roleColors The role colors.
@param array $roleTrans The role translations.
@return string Returns the Bootstrap role label. | entailment |
protected function __reconstruct()
{
// Modules default app
if (null !== ($defaultApp = config('app'))) {
if (false !== ($defaultModule = modules()->getApp($defaultApp))) {
// Register Domain App Module Namespace
loader()->addNamespace($defaultModule->getN... | Framework::__reconstruct | entailment |
private function cliHandler()
{
// Instantiate CLI Router Service
$this->services->load(Kernel\Cli\Router::class);
if (profiler() !== false) {
profiler()->watch('Parse Router Request');
}
router()->parseRequest();
if ($commander = router()->getCommander(... | Framework::cliHandler
@return void
@throws \ReflectionException | entailment |
private function httpHandler()
{
if (config()->loadFile('view') === true) {
// Instantiate Http UserAgent Service
$this->services->load(Framework\Http\UserAgent::class, 'userAgent');
// Instantiate Http View Service
$this->services->load(Framework\Http\Parser... | Framework::httpHandler
@return void
@throws \ReflectionException | entailment |
public function get($property)
{
if (empty($get[ $property ])) {
if (services()->has($property)) {
return services()->get($property);
} elseif (array_key_exists($property, $this->validSubModels)) {
return $this->loadSubModel($property);
} e... | Model::get
@param string $property
@return mixed | entailment |
public static function createRoutineWrapper(array $routine,
PhpCodeStore $codeStore,
NameMangler $nameMangler,
bool $lobAsString): Wrapper
{
switch ($routine['designation'])
... | A factory for creating the appropriate object for generating a wrapper method for a stored routine.
@param array $routine The metadata of the stored routine.
@param PhpCodeStore $codeStore The code store for the generated code.
@param NameMangler $nameMangler The mangler for wrapper and parameter names.
... | entailment |
public function isBlobParameter(?array $parameters): bool
{
$hasBlob = false;
if ($parameters)
{
foreach ($parameters as $parameter_info)
{
$hasBlob = $hasBlob || DataTypeHelper::isBlobParameter($parameter_info['data_type']);
}
}
return $hasBlob;
} | Returns true if one of the parameters is a BLOB or CLOB.
@param array|null $parameters The parameters info (name, type, description).
@return bool | entailment |
public function writeRoutineFunction(): void
{
if (!$this->lobAsStringFlag && $this->isBlobParameter($this->routine['parameters']))
{
$this->writeRoutineFunctionWithLob();
}
else
{
$this->writeRoutineFunctionWithoutLob();
}
} | Generates a complete wrapper method. | entailment |
public function writeRoutineFunctionWithLob(): void
{
$wrapper_args = $this->getWrapperArgs();
$routine_args = $this->getRoutineArgs();
$method_name = $this->nameMangler->getMethodName($this->routine['routine_name']);
$bindings = '';
$nulls = '';
foreach ($this->routine['parameters'] as $... | Generates a complete wrapper method for a stored routine with a LOB parameter. | entailment |
public function writeRoutineFunctionWithoutLob(): void
{
$wrapperArgs = $this->getWrapperArgs();
$methodName = $this->nameMangler->getMethodName($this->routine['routine_name']);
$returnType = $this->getReturnTypeDeclaration();
$this->codeStore->appendSeparator();
$this->generatePhpDoc();
$t... | Returns a wrapper method for a stored routine without LOB parameters. | entailment |
protected function getRoutineArgs(): string
{
$ret = '';
foreach ($this->routine['parameters'] as $parameter_info)
{
$mangledName = $this->nameMangler->getParameterName($parameter_info['parameter_name']);
if ($ret) $ret .= ',';
$ret .= DataTypeHelper::escapePhpExpression($parameter_inf... | Returns code for the arguments for calling the stored routine in a wrapper method.
@return string | entailment |
protected function getWrapperArgs(): string
{
$ret = '';
if ($this->routine['designation']=='bulk')
{
$ret .= 'BulkHandler $bulkHandler';
}
foreach ($this->routine['parameters'] as $i => $parameter)
{
if ($ret!='') $ret .= ', ';
$dataType = DataTypeHelper::columnTypeToP... | Returns code for the parameters of the wrapper method for the stored routine.
@return string | entailment |
private function generatePhpDoc(): void
{
$this->codeStore->append('/**', false);
// Generate phpdoc with short description of routine wrapper.
$this->generatePhpDocSortDescription();
// Generate phpdoc with long description of routine wrapper.
$this->generatePhpDocLongDescription();
// Gen... | Generate php doc block in the data layer for stored routine. | entailment |
private function generatePhpDocBlockReturn(): void
{
$return = $this->getDocBlockReturnType();
if ($return!=='')
{
$this->codeStore->append(' *', false);
$this->codeStore->append(' * @return '.$return, false);
}
} | Generates the PHP doc block for the return type of the stored routine wrapper. | entailment |
private function generatePhpDocLongDescription(): void
{
if ($this->routine['phpdoc']['long_description']!=='')
{
$this->codeStore->append(' * '.$this->routine['phpdoc']['long_description'], false);
}
} | Generates the long description of stored routine wrapper. | entailment |
private function generatePhpDocParameters(): void
{
$parameters = [];
foreach ($this->routine['phpdoc']['parameters'] as $parameter)
{
$mangledName = $this->nameMangler->getParameterName($parameter['parameter_name']);
$parameters[] = ['php_name' => '$'.$mangledName,
... | Generates the doc block for parameters of stored routine wrapper. | entailment |
private function generatePhpDocSortDescription(): void
{
if ($this->routine['phpdoc']['sort_description']!=='')
{
$this->codeStore->append(' * '.$this->routine['phpdoc']['sort_description'], false);
}
} | Generates the sort description of stored routine wrapper. | entailment |
public function backgroundLight($gradient = false)
{
$this->textDark();
$this->attributes->addAttributeClass('bg-' . ($gradient === true ? 'gradient-' : '') . 'light');
return $this;
} | ColorUtilitiesTrait::backgroundLight
@param bool $gradient
@return static | entailment |
public function backgroundDark($gradient = false)
{
$this->textLight();
$this->attributes->addAttributeClass('bg-' . ($gradient === true ? 'gradient-' : '') . 'dark');
return $this;
} | ColorUtilitiesTrait::backgroundDark
@param bool $gradient
@return static | entailment |
public function setSegments($segments)
{
$this->segments = is_array($segments) ? implode('/', $segments) : $segments;
return $this;
} | Module::setSegments
@param array|string $segments
@return static | entailment |
public function setParentSegments($parentSegments)
{
$this->parentSegments = is_array($parentSegments) ? implode('/', $parentSegments) : $parentSegments;
return $this;
} | Module::setParentSegments
@param array|string $parentSegments
@return static | entailment |
public function setProperties(array $properties)
{
if (isset($properties[ 'presets' ])) {
$this->setPresets($properties[ 'presets' ]);
unset($properties[ 'presets' ]);
}
$this->properties = $properties;
return $this;
} | Module::setProperties
@param array $properties
@return static | entailment |
public function getThemes()
{
$directory = new SplDirectoryInfo($this->getResourcesDir() . 'themes' . DIRECTORY_SEPARATOR);
$themes = [];
foreach ($directory->getTree() as $themeName => $themeTree) {
if (($theme = $this->getTheme($themeName)) instanceof Module\Theme) {
... | Module::getThemes
@return array | entailment |
public function getResourcesDir($subDir = null)
{
$dirResources = PATH_RESOURCES;
$dirPath = str_replace(PATH_APP, '', $this->getRealPath());
$dirPathParts = explode(DIRECTORY_SEPARATOR, $dirPath);
if(count($dirPathParts)) {
$dirPathParts = array_map('dash', $dirPathPar... | Module::getResourcesDir
@param string|null $subDir
@return bool|string | entailment |
public function getTheme($theme, $failover = true)
{
$theme = dash($theme);
if ($failover === false) {
if (is_dir($themePath = $this->getResourcesDir('themes') . $theme . DIRECTORY_SEPARATOR)) {
$themeObject = new Module\Theme($themePath);
if ($themeObje... | Module::getTheme
@param string $theme
@param bool $failover
@return bool|Module\Theme | entailment |
public function getDir($subDir, $psrDir = false)
{
$subDir = $psrDir === true ? prepare_class_name($subDir) : $subDir;
$subDir = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $subDir);
if (is_dir($dirPath = $this->getRealPath() . $subDir)) {
return $dirPath . DIRECTORY_SEPARATOR... | Module::getDir
@param string $subDir
@param bool $psrDir
@return bool|string | entailment |
public function hasTheme($theme)
{
if (is_dir($this->getThemesDir() . $theme)) {
return true;
} else {
foreach (modules() as $module) {
if (in_array($module->getType(), ['KERNEL', 'FRAMEWORK'])) {
continue;
} elseif (is_dir(... | Module::hasTheme
@param string $theme
@return bool | entailment |
public function loadModel()
{
$modelClassName = $this->namespace . 'Models\Base';
if (class_exists($modelClassName)) {
models()->load($modelClassName, strtolower($this->type));
}
} | Module::loadModel | entailment |
public function setTooltip($text, $placement = 'right')
{
$placement = in_array($placement, ['top', 'bottom', 'left', 'right']) ? $placement : 'right';
$this->attributes->addAttribute('data-toggle', 'tooltip');
$this->attributes->addAttribute('data-placement', $placement);
$this->at... | TooltipSetterTrait::setTooltip
@param string $text
@param string $placement
@return static | entailment |
public function transform(ApiRequest $request, ApiResponse $response, array $context = []): ApiResponse
{
// Return immediately if context hasn't defined renderer
if (!isset($context['renderer'])) return $response;
// Fetch service
$service = $this->container->getByType($context['renderer'], false);
if (!$... | Encode given data for response
@param mixed[] $context | entailment |
public function load($id): AggregateRoot
{
$snapshot = $this->snapshotRepository->load($id);
if (null === $snapshot) {
return $this->eventSourcingRepository->load($id);
}
$aggregateRoot = $snapshot->getAggregateRoot();
$aggregateRoot->initializeState(
... | {@inheritdoc} | entailment |
public function save(AggregateRoot $aggregate)
{
$takeSnaphot = $this->trigger->shouldSnapshot($aggregate);
$this->eventSourcingRepository->save($aggregate);
if ($takeSnaphot) {
$this->snapshotRepository->save(
new Snapshot($aggregate)
);
}
... | {@inheritdoc} | entailment |
public static function matchPath(string $pattern, string $path, bool $isCaseSensitive = true): bool
{
// Explicitly exclude directory itself.
if ($path=='' && $pattern=='**/*')
{
return false;
}
$dirSep = preg_quote(DIRECTORY_SEPARATOR, '/');
$trailingDirSep = '(('.$dirSep.')?|(... | Tests whether or not a given path matches a given pattern.
(This method is heavily inspired by SelectorUtils::matchPath from phing.)
@param string $pattern The pattern to match against.
@param string $path The path to match.
@param bool $isCaseSensitive Whether or not matching should be performed... | entailment |
public function setFile($filePath)
{
if (is_file($filePath)) {
$this->file = new SplFileInfo($filePath);
if (file_exists(
$propertiesFilePath = $this->file->getPath() . DIRECTORY_SEPARATOR . str_replace(
'.phtml',
'.jso... | Page::setFile
@param $filePath
@return static | entailment |
public function setHeader($header)
{
$header = trim($header);
$header = language($header);
$this->store('header', $header);
presenter()->meta->title->append($header);
return $this;
} | Page::setHeader
@param string $header
@return static | entailment |
public function setTitle($title)
{
$title = trim($title);
$title = language($title);
$this->store('title', $title);
presenter()->meta->title->append($title);
return $this;
} | Page::setTitle
@param string $title
@return static | entailment |
public function create(array $parameters)
{
if (!array_key_exists('name', $parameters) || !is_string($parameters['name'])) {
throw new \InvalidArgumentException('A new droplet must have a string "name".');
}
if (!array_key_exists('size_id', $parameters) || !is_int($parameters['s... | Creates a new droplet.
The parameter should be an array with 4 required keys: name, sized_id, image_id and region_id.
The ssh_key_ids key is optional. If any, it should be a list of numbers comma separated.
@param array $parameters An array of parameters.
@return StdClass
@throws \InvalidArgumentException | entailment |
public function resize($dropletId, array $parameters)
{
if (!array_key_exists('size_id', $parameters) || !is_int($parameters['size_id'])) {
throw new \InvalidArgumentException('You need to provide an integer "size_id".');
}
return $this->processQuery($this->buildQuery($dropletId... | Resizes a specific droplet to a different size.
This will affect the number of processors and memory allocated to the droplet.
The size_id key is required.
@param integer $dropletId The id of the droplet.
@param array $parameters An array of parameters.
@return StdClass
@throws \InvalidArgumentException | entailment |
public function snapshot($dropletId, array $parameters = array())
{
return $this->processQuery($this->buildQuery($dropletId, DropletsActions::ACTION_SNAPSHOT, $parameters));
} | Takes a snapshot of the running droplet, which can later be restored or
used to create a new droplet from the same image.
Please be aware this may cause a reboot.
The name key is optional.
@param integer $dropletId The id of the droplet.
@param array $parameters An array of parameters (optional).
@return StdClass | entailment |
public function restore($dropletId, array $parameters)
{
if (!array_key_exists('image_id', $parameters) || !is_int($parameters['image_id'])) {
throw new \InvalidArgumentException('You need to provide the "image_id" to restore.');
}
return $this->processQuery($this->buildQuery($d... | Restores a droplet with a previous image or snapshot.
This will be a mirror copy of the image or snapshot to your droplet.
Be sure you have backed up any necessary information prior to restore.
The image_id is required.
@param integer $dropletId The id of the droplet.
@param array $parameters An array of parameters... | entailment |
public function rebuild($dropletId, array $parameters)
{
if (!array_key_exists('image_id', $parameters) || !is_int($parameters['image_id'])) {
throw new \InvalidArgumentException('You need to provide the "image_id" to rebuild.');
}
return $this->processQuery($this->buildQuery($d... | Reinstalls a droplet with a default image.
This is useful if you want to start again but retain the same IP address for your droplet.
The image_id is required.
@param integer $dropletId The id of the droplet.
@param array $parameters An array of parameters.
@return StdClass
@throws \InvalidArgumentException | entailment |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.