_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q260600 | Obj.read | test | public static function read($object, $property, $default = null)
{
if (is_null($object)) {
return self::value($default);
}
if (isset($object->$property) || property_exists($object, $property)) {
return $object->$property;
}
return self::value($defaul... | php | {
"resource": ""
} |
q260601 | Obj.fetch | test | public static function fetch($object, $property, $default = null)
{
if (is_null($object)) {
return self::value($default);
}
return isset($object->$property) ? $object->$property : self::value($default);
} | php | {
"resource": ""
} |
q260602 | Obj.get | test | public static function get($target, $key, $default = null)
{
if (is_null($key) || !is_object($target)) {
return self::value($default);
}
if (!is_array($key)) {
if (isset($target->{$key}) || property_exists($target, $key)) {
return $target->{$key};
... | php | {
"resource": ""
} |
q260603 | Obj.set | test | public static function set(&$target, $key, $value, $overwrite = true)
{
if (is_null($key)) {
return $target;
}
if (!is_array($key)) {
if (isset($target->{$key}) || property_exists($target, $key)) {
if ($overwrite) {
$target->{$key}... | php | {
"resource": ""
} |
q260604 | Handler.register | test | public static function register()
{
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
self::handleError($errno, $errstr, $errfile, $errline);
});
set_exception_handler(function ($e) {
self::handleException($e);
});
register_shutdown_fu... | php | {
"resource": ""
} |
q260605 | Handler.handleError | test | public static function handleError($errno, $errstr, $errfile, $errline)
{
if (!($errno & error_reporting())) {
return;
}
static::handle(Error::fromError($errno, $errstr, $errfile, $errline));
} | php | {
"resource": ""
} |
q260606 | Handler.handle | test | public static function handle(Error $error)
{
foreach (self::$writers as $class => $writer) {
if (is_null($writer)) {
self::$writers[$class] = $writer = new $class();
}
$writer->handle($error);
}
} | php | {
"resource": ""
} |
q260607 | Migrator.resolve | test | public function resolve($file)
{
$class = Str::studly(implode('_', array_slice(explode('_', $file), 4)));
if (!class_exists($class)) {
$className = str_replace('.', '\\', $this->getRepository()->getGroup());
$class = $className.'\\Database\\Migrations\\'.$class;
}
... | php | {
"resource": ""
} |
q260608 | LevelAwareLogger.shouldLog | test | protected function shouldLog($level)
{
if ($this->levels === ['*'] || $this->levels === ['all']) {
return true;
}
return in_array($level, $this->levels);
} | php | {
"resource": ""
} |
q260609 | LevelAwareLogger.useFiles | test | public function useFiles($path, $level = 'debug')
{
if ($this->logger instanceof Log) {
$this->logger->useFiles($path, $level);
}
} | php | {
"resource": ""
} |
q260610 | LevelAwareLogger.useDailyFiles | test | public function useDailyFiles($path, $days = 0, $level = 'debug')
{
if ($this->logger instanceof Log) {
$this->logger->useDailyFiles($path, $days, $level);
}
} | php | {
"resource": ""
} |
q260611 | LoggerServiceProvider.registerLogger | test | protected function registerLogger()
{
$this->app->singleton('logger', function (Container $app) {
$loggers = [];
foreach ($app->config->get('logger.loggers', []) as $logger => $levels) {
$loggers[] = new LevelAwareLogger($app->make($logger), (array) $levels);
... | php | {
"resource": ""
} |
q260612 | SQL.setUp | test | public function setUp($options = [])
{
$this->setupProperty($options, 'dbType', 'DB_TYPE');
$this->setupProperty($options, 'server', 'DB_HOST');
$this->setupProperty($options, 'username', 'DB_USERNAME');
$this->setupProperty($options, 'password', 'DB_PASSWORD');
$this->setupP... | php | {
"resource": ""
} |
q260613 | SQL.logSqlError | test | public function logSqlError($ignoreErrors = false)
{
if (!$this->result && !$ignoreErrors) {
$queryRaw = $this->lastQuery;
$callerBackTrace = debug_backtrace();
$callerBackTrace = $callerBackTrace[2];
$caller = $callerBackTrace['function'].'()'... | php | {
"resource": ""
} |
q260614 | UlTag.& | test | public function &addItemSmart($pageItem, $properties = [])
{
if (is_array($pageItem)) {
foreach ($pageItem as $item) {
$this->addItemSmart($item);
}
$itemAdded = &$this->lastItem;
} else {
if (isset($pageItem->tagType) && $pageItem->tag... | php | {
"resource": ""
} |
q260615 | Properties.getProperty | test | public function getProperty($property, $default = null)
{
if (!$property) return $default;
$value = isset($this->properties[$property]) ? $this->properties[$property] : $default;
// If the attribute exists within the cast array, we will convert it to
// an appropriate native PHP ty... | php | {
"resource": ""
} |
q260616 | Properties.setProperty | test | public function setProperty($property, $value)
{
$this->properties[$property] = ($this->hasCast($property)) ? $this->castSetProperty($property, $value) : $value;
return $this;
} | php | {
"resource": ""
} |
q260617 | Properties.setProperties | test | public function setProperties(array $properties, $sync = false)
{
$this->properties = [];
foreach ($properties as $property => $value) {
$setMethod = 'set' . ucfirst($property);
if (method_exists($this, $setMethod)) {
$this->$setMethod($value);
} ... | php | {
"resource": ""
} |
q260618 | Properties.getOriginal | test | public function getOriginal($property = null, $default = null)
{
if (is_null($property)) return $this->original;
return isset($this->original[$property]) ? $this->original[$property] : $default;
} | php | {
"resource": ""
} |
q260619 | Properties.hasCast | test | public function hasCast($property, $types = null)
{
if (array_key_exists($property, $this->casts)) {
return $types ? in_array($this->getCastType($property), (array)$types, true) : true;
}
return false;
} | php | {
"resource": ""
} |
q260620 | Properties.getDirty | test | public function getDirty()
{
$dirty = [];
foreach ($this->properties as $property => $value) {
if (!array_key_exists($property, $this->original)) {
$dirty[$property] = $value;
} elseif ($value !== $this->original[$property] &&
!$this->original... | php | {
"resource": ""
} |
q260621 | Navbar.navBarHeader | test | public static function navBarHeader($handle, $brand)
{
$navstyle = '.navbar-'.$handle.'-collapse';
$nbhc['button'] = new \Ease\Html\ButtonTag([new \Ease\Html\Span(
_('Switch navigation'), ['class' => 'sr-only']), new \Ease\Html\Span(
null, ['class' => 'icon-bar'... | php | {
"resource": ""
} |
q260622 | Navbar.& | test | public function &addDropDownSubmenu($name, $items)
{
$dropdown = $this->addItem(new \Ease\Html\UlTag(null,
['class' => 'dropdown-menu', 'role' => 'menu']));
if (count($items)) {
foreach ($items as $item) {
$this->addMenuItem($item);
}
}... | php | {
"resource": ""
} |
q260623 | ButtonGroup.addButton | test | public function addButton($content, $type = 'default', $properties = [])
{
if (isset($properties['class'])) {
$properties['class'] = 'btn btn-'.$type.' '.$properties['class'];
} else {
$properties['class'] = 'btn btn-'.$type;
}
$button = new \Ease\Html\ButtonT... | php | {
"resource": ""
} |
q260624 | ToStd.flush | test | public function flush($caller = null)
{
$flushed = 0;
if (count($this->statusMessages)) {
foreach ($this->statusMessages as $type => $messages) {
foreach ($messages as $messageID => $message) {
if (!isset($this->flushed[$type][$messageID])) {
... | php | {
"resource": ""
} |
q260625 | WebPage.& | test | public function &addItem($item, $pageItemName = null)
{
$added = $this->body->addItem($item, $pageItemName);
return $added;
} | php | {
"resource": ""
} |
q260626 | WebPage.addCSS | test | public function addCSS($css)
{
if (is_array($css)) {
$css = key($css).'{'.current($css).'}';
}
$this->easeShared->cascadeStyles[md5($css)] = $css;
return true;
} | php | {
"resource": ""
} |
q260627 | User.getGravatar | test | public static function getGravatar(
$email, $size = 80, $default = 'mm', $maxRating = 'g'
)
{
$url = 'http://www.gravatar.com/avatar/';
$url .= md5(strtolower(trim($email)));
$url .= "?s=$size&d=$default&r=$maxRating";
return $url;
} | php | {
"resource": ""
} |
q260628 | Page.offsetSet | test | public function offsetSet($key, $value)
{
if (is_null($key)) {
$this->content[] = $value;
} else {
$this->content[$key] = $value;
}
} | php | {
"resource": ""
} |
q260629 | Shared.& | test | public static function &db($pdo = null)
{
$shared = self::instanced();
if (is_object($pdo)) {
$shared->dbLink = &$pdo;
}
if (!is_object($shared->dbLink)) {
$shared->dbLink = self::db(SQL\PDO::singleton(is_array($pdo) ? $pdo : [
]));
}
... | php | {
"resource": ""
} |
q260630 | Shared.& | test | public static function &locale($locale = null)
{
$shared = self::instanced();
if (is_object($locale)) {
$shared->locale = &$locale;
}
if (!is_object($shared->locale)) {
$shared->locale = Locale::singleton();
}
return $shared->locale;
} | php | {
"resource": ""
} |
q260631 | Shared.addUrlParams | test | public static function addUrlParams($url, $addParams, $override = false)
{
$urlParts = parse_url($url);
$urlFinal = '';
if (array_key_exists('scheme', $urlParts)) {
$urlFinal .= $urlParts['scheme'].'://'.$urlParts['host'];
}
if (array_key_exists('port', $urlParts)... | php | {
"resource": ""
} |
q260632 | Shared.linkify | test | public static function linkify($value, $protocols = array('http', 'mail'),
array $attributes = array())
{
// Link attributes
$attr = '';
foreach ($attributes as $key => $val) {
$attr = ' '.$key.'="'.htmlentities($val).'"';
}
$li... | php | {
"resource": ""
} |
q260633 | TableTag.& | test | public function &addRowFooterColumns($columns = null, $properties = [])
{
$tableRow = $this->tFoot->addItem(new TrTag());
if (is_array($columns)) {
foreach ($columns as $column) {
if (is_object($column) && method_exists($column, 'getTagType') && $column->getTagType()
... | php | {
"resource": ""
} |
q260634 | Page.includeCss | test | public function includeCss($cssFile, $fwPrefix = false, $media = 'screen')
{
return \Ease\Shared::webPage()->includeCss($cssFile, $fwPrefix, $media);
} | php | {
"resource": ""
} |
q260635 | Page.phpSelf | test | public static function phpSelf($dropqs = true)
{
$url = null;
if (php_sapi_name() != 'cli') {
$schema = 'http';
if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on')) {
$schema .= 's';
}
$url = sprintf('%s://%s%s', $schema, $_SER... | php | {
"resource": ""
} |
q260636 | NetLicensingCurl.buildPostData | test | public function buildPostData($data)
{
$this->data = $data;
$query = parent::buildPostData($data);
foreach ($data as $key => $value) {
if (is_array($value)) $query = preg_replace('/&' . $key . '%5B%5D=/simU', '&' . $key . '=', $query);
}
$this->query = $query;
... | php | {
"resource": ""
} |
q260637 | Locale.availble | test | public function availble()
{
$locales = [];
$d = dir(self::$i18n);
while (false !== ($entry = $d->read())) {
if (($entry[0] != '.') && file_exists(self::$i18n.'/'.$entry.'/LC_MESSAGES/'.self::$textDomain.'.mo')) {
$locales[$entry] = _(self::$alllngs[$entry... | php | {
"resource": ""
} |
q260638 | Locale.langToLocale | test | public static function langToLocale($lang)
{
$defaultLocale = 'C';
$langs = [];
foreach (self::$alllngs as $langCode => $language) {
$langs[$langCode] = [strstr($langCode, '_') ? substr($langCode, 0,
strpos($langCode, '_')) : $langCode, $language];
... | php | {
"resource": ""
} |
q260639 | Locale.useLocale | test | public static function useLocale($localeCode)
{
\setlocale(LC_ALL, $localeCode);
\bind_textdomain_codeset(self::$textDomain, 'UTF-8');
\putenv("LC_ALL=$localeCode");
if (file_exists(self::$i18n)) {
\bindtextdomain(self::$textDomain, self::$i18n);
}
\textdo... | php | {
"resource": ""
} |
q260640 | Molecule.setupProperty | test | public function setupProperty($options, $name, $constant = null)
{
if (isset($options[$name])) {
$this->$name = $options[$name];
} else {
if (is_null($this->$name) && !empty($constant) && defined($constant)) {
$this->$name = constant($constant);
}
... | php | {
"resource": ""
} |
q260641 | Molecule.getStatusMessages | test | public function getStatusMessages($clean = false)
{
$messages = $this->easeShared->getStatusMessages();
if ($clean) {
$this->easeShared->cleanMessages();
}
return $messages;
} | php | {
"resource": ""
} |
q260642 | UtilityService.listCountries | test | public static function listCountries(Context $context, $filter = null)
{
$queryParams = (!is_null($filter)) ? [Constants::FILTER => $filter] : [];
$response = NetLicensingService::getInstance()
->get($context, Constants::UTILITY_ENDPOINT_PATH . '/' . Constants::UTILITY_ENDPOINT_PATH_COU... | php | {
"resource": ""
} |
q260643 | ListGroup.& | test | public function &addItemSmart($pageItem, $properties = [])
{
$item = parent::addItemSmart($pageItem, $properties);
$item->addTagClass('list-group-item');
return $item;
} | php | {
"resource": ""
} |
q260644 | LabelTag.setObjectName | test | public function setObjectName($objectName = null)
{
if (is_null($objectName)) {
$objectName = get_class($this).'@'.$this->getTagProperty('for');
}
return parent::setObjectName($objectName);
} | php | {
"resource": ""
} |
q260645 | ToConsole.set | test | public static function set($str, $color)
{
$color_attrs = explode("+", $color);
$ansi_str = "";
foreach ($color_attrs as $attr) {
$ansi_str .= "\033[".self::$ANSI_CODES[$attr]."m";
}
$ansi_str .= $str."\033[".self::$ANSI_CODES["off"]."m";
return $ansi_s... | php | {
"resource": ""
} |
q260646 | ToConsole.getTypeColor | test | public static function getTypeColor($type)
{
switch ($type) {
case 'mail': // Envelope
$color = 'blue';
break;
case 'warning': // Vykřičník v trojůhelníku
$color = 'yellow';
break... | php | {
"resource": ""
} |
q260647 | NetLicensingService.get | test | public function get(Context $context, $urlTemplate, array $queryParams = [])
{
return $this->request($context, 'get', $urlTemplate, $queryParams);
} | php | {
"resource": ""
} |
q260648 | NetLicensingService.post | test | public function post(Context $context, $urlTemplate, array $queryParams = [])
{
return $this->request($context, 'post', $urlTemplate, $queryParams);
} | php | {
"resource": ""
} |
q260649 | NetLicensingService.delete | test | public function delete(Context $context, $urlTemplate, array $queryParams = [])
{
return $this->request($context, 'delete', $urlTemplate, $queryParams);
} | php | {
"resource": ""
} |
q260650 | Sand.getMyKey | test | public function getMyKey($data = null)
{
$key = null;
if (is_null($data)) {
$data = $this->getData();
}
if (isset($data) && isset($data[$this->keyColumn])) {
$key = $data[$this->keyColumn];
}
return $key;
} | php | {
"resource": ""
} |
q260651 | Sand.unsetDataValue | test | public function unsetDataValue($columnName)
{
if (array_key_exists($columnName, $this->data)) {
unset($this->data[$columnName]);
return true;
}
return false;
} | php | {
"resource": ""
} |
q260652 | Sand.reindexArrayBy | test | public static function reindexArrayBy($data, $indexBy = null)
{
$reindexedData = [];
foreach ($data as $dataID => $data) {
if (array_key_exists($indexBy, $data)) {
$reindexedData[$data[$indexBy]] = $data;
} else {
throw new \Exception(sprintf(... | php | {
"resource": ""
} |
q260653 | Container.draw | test | public function draw()
{
foreach ($this->pageParts as $part) {
if (is_object($part)) {
if (method_exists($part, 'drawIfNotDrawn')) {
$part->drawIfNotDrawn();
} else {
$part->draw();
}
} else {
... | php | {
"resource": ""
} |
q260654 | NetLicensingDemo.setUpContext | test | public function setUpContext()
{
return $this->context = (new \NetLicensing\Context())
->setBaseUrl(self::BASE_URL)
->setSecurityMode(self::SECURITY_MODE)
->setUsername(self::USERNAME)
->setPassword(self::PASSWORD);
} | php | {
"resource": ""
} |
q260655 | Mailer.getItemsCount | test | public function getItemsCount($object = null)
{
if (is_null($object)) {
$object = $this->htmlBody;
}
return parent::getItemsCount($object);
} | php | {
"resource": ""
} |
q260656 | Mailer.isEmpty | test | public function isEmpty($element = null)
{
if (is_null($element)) {
$element = $this->htmlBody;
}
return parent::isEmpty($element);
} | php | {
"resource": ""
} |
q260657 | PDO.addSlashes | test | public function addSlashes($text)
{
if (isset($this->sqlLink) && method_exists($this->sqlLink,
'real_escape_string')) {
$slashed = $this->sqlLink->real_escape_string($text);
} else {
$slashed = addslashes($text);
}
return $slashed;
} | php | {
"resource": ""
} |
q260658 | PDO.connect | test | public function connect()
{
if (is_null($this->dbType)) {
$result = null;
} else {
switch ($this->dbType) {
case 'mysql':
$this->sqlLink = new \PDO($this->dbType.':dbname='.$this->database.';host='.$this->server.';port='.$this->port.';chars... | php | {
"resource": ""
} |
q260659 | PDO.arrayToInsert | test | public function arrayToInsert($data)
{
$cc = $this->getColumnComma();
$set = ' ';
if ($this->dbType == 'mysql') {
$set = ' SET ';
}
return $this->exeQuery('INSERT INTO '.$cc.$this->myTable.$cc.$set.$this->arrayToQuery($data));
} | php | {
"resource": ""
} |
q260660 | PDO.prepSelect | test | public function prepSelect($data, $ldiv = 'AND')
{
$operator = null;
$conditions = [];
$conditionsII = [];
foreach ($data as $column => $value) {
if (is_integer($column)) {
$conditionsII[] = $value;
continue;
}
... | php | {
"resource": ""
} |
q260661 | PDO.useObject | test | public function useObject($object)
{
$this->setKeyColumn($object->getKeyColumn());
$this->setTableName($object->getMyTable());
} | php | {
"resource": ""
} |
q260662 | Carousel.addSlide | test | public function addSlide($slide, $capHeading = '', $caption = '',
$default = false)
{
$item = new \Ease\Html\DivTag($slide, ['class' => 'item']);
if ($default) {
$item->addTagClass('active');
}
if ($capHeading || $caption) {
$cpt ... | php | {
"resource": ""
} |
q260663 | Carousel.finalize | test | public function finalize()
{
Part::twBootstrapize();
if (is_null($this->active) && $this->getItemsCount() ) { //We need one slide active
$this->indicators->getFirstPart()->setTagClass('active');
$this->inner->getFirstPart()->addTagClass('active');
}
$this->inn... | php | {
"resource": ""
} |
q260664 | Regent.addToLog | test | public function addToLog($caller, $message, $type = 'info')
{
foreach ($this->loggers as $logger) {
$logger->addToLog($caller, $message, $type);
}
} | php | {
"resource": ""
} |
q260665 | Regent.addStatusObject | test | public function addStatusObject(Message $message, $type = 'info')
{
$this->addToLog($message->caller, $message->body, $message->type);
\Ease\Shared::instanced()->addStatusMessage($message->body,
$message->type);
return parent::addStatusMessage($message->body, $message->type);
... | php | {
"resource": ""
} |
q260666 | Tag.getTagName | test | public function getTagName()
{
$tagName = null;
if ($this->setName === true) {
if (isset($this->tagProperties['name'])) {
$tagName = $this->tagProperties['name'];
}
} else {
$tagName = $this->tagName;
}
return $tagName;
... | php | {
"resource": ""
} |
q260667 | Tag.getTagProperty | test | public function getTagProperty($propertyName)
{
$property = null;
if (isset($this->tagProperties[$propertyName])) {
$property = $this->tagProperties[$propertyName];
}
return $property;
} | php | {
"resource": ""
} |
q260668 | Modal.finalize | test | public function finalize()
{
Part::twBootstrapize();
$modalDialog = $this->addItem(new \Ease\Html\DivTag(null,
['class' => 'modal-dialog', 'role' => 'document']));
$modalContent = $modalDialog->addItem(new \Ease\Html\DivTag(null,
['class' => 'modal-content'])... | php | {
"resource": ""
} |
q260669 | CommandRunner.cloneEarlyRunner | test | public function cloneEarlyRunner()
{
$ret = clone $this;
$ret->nextRun = time();
$this->once = true;
//\mdebug('Cloned early runner for process [%d]', $this->currentPid);
return $ret;
} | php | {
"resource": ""
} |
q260670 | Tabs.& | test | public function &addAjaxTab($tabName, $tabUrl, $active = false)
{
$this->tabs[$tabName] = ['ajax' => $tabUrl];
if ($active) {
$this->activeTab = $tabName;
}
\Ease\Shared::webPage()->addJavaScript('
$(\'#'.$this->getTagID().' a\').click(function (e) {
e.preventDefault();
... | php | {
"resource": ""
} |
q260671 | Debug.trace | test | protected function trace($data)
{
if ($this->_debug) {
//Open the tags and output request specific items
if ($data->getType() == "request") {
print '<table style="border-style: solid; border-width: 1px; border-color: #b1b1b1; margin: 5px"><tr><td style="vertical-alig... | php | {
"resource": ""
} |
q260672 | AObservable.attach | test | public function attach($events, IObserver $observer)
{
if (is_array($events)) {
foreach ($events as $event) {
$this->doAttach($event, $observer);
}
} elseif (is_string($events)) {
$this->doAttach($events, $observer);
} else {
th... | php | {
"resource": ""
} |
q260673 | AObservable.doAttach | test | protected function doAttach($event, IObserver $observer)
{
if (!array_key_exists($event, $this->_observers)) {
$this->_observers[$event] = array();
}
if (in_array($observer, $this->_observers[$event], true)) {
return;
}
array_push($this->_observers[$... | php | {
"resource": ""
} |
q260674 | AObservable.detach | test | public function detach($event, IObserver $observer)
{
if (!isset($this->_observers[$event])) {
return;
}
foreach ($this->_observers[$event] as $key=> $attachedObserver) {
if ($attachedObserver === $observer) {
array_splice($this->_observers[$event], $... | php | {
"resource": ""
} |
q260675 | AObservable.detachAllEventsForObserver | test | public function detachAllEventsForObserver(IObserver $observerToRemove)
{
foreach ($this->_observers as $event => $observers) {
foreach ($observers as $position => $observer) {
if ($observer === $observerToRemove) {
array_splice($this->_observers[$event], $po... | php | {
"resource": ""
} |
q260676 | Toolbox.validatePod | test | public function validatePod($pod)
{
if ($pod instanceof AModel) {
$pod = $pod->getPod();
}
if ($pod->compareToolbox($this)) {
return true;
} else {
throw new ToolboxException("The pod/model does not belong to this toolbox.");
}
} | php | {
"resource": ""
} |
q260677 | Toolbox.getConnection | test | public function getConnection()
{
if (!$this->_connection) {
$options = array(
// server endpoint to connect to
ConnectionOptions::OPTION_ENDPOINT => $this->_endpoint,
// authorization type to use (currently supported: 'Basic')
... | php | {
"resource": ""
} |
q260678 | Toolbox.getDriver | test | public function getDriver()
{
if (!$this->_driver) {
if ($this->_graph) {
$this->_driver = $this->getGraphHandler();
} else {
$this->_driver = $this->getDocumentHandler();
}
}
return $this->_driver;
} | php | {
"resource": ""
} |
q260679 | Toolbox.generateBindingParameter | test | public function generateBindingParameter($parameter, $userParameters)
{
$userParameters = array_keys($userParameters);
while (in_array($parameter, $userParameters)) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyz';
for ($i = 0; $i < 7; $i++) {
$parame... | php | {
"resource": ""
} |
q260680 | Toolbox.normaliseDriverExceptions | test | public function normaliseDriverExceptions(\Exception $exception)
{
if ($exception instanceof \triagens\ArangoDb\ServerException) {
return array('message' => $exception->getServerMessage(), 'code' => $exception->getServerCode());
} else {
return array('message' => $exception->... | php | {
"resource": ""
} |
q260681 | DatabaseManager.createDatabase | test | public function createDatabase($name)
{
try {
Database::create($this->getConnection(), $name);
return true;
} catch (\Exception $e) {
$normalised = $this->_toolbox->normaliseDriverExceptions($e);
throw new DatabaseManagerException($normalised['messag... | php | {
"resource": ""
} |
q260682 | DatabaseManager.deleteDatabase | test | public function deleteDatabase($name)
{
try {
Database::delete($this->getConnection(), $name);
return true;
} catch (\Exception $e) {
$normalised = $this->_toolbox->normaliseDriverExceptions($e);
throw new DatabaseManagerException($normalised['message... | php | {
"resource": ""
} |
q260683 | DatabaseManager.getDatabaseInfo | test | public function getDatabaseInfo($name)
{
try {
$connection = $this->getConnection($name);
$info = Database::getInfo($connection);
$result = array();
$result['id'] = $info['result']['id'];
$result['name'] = $info['result']['name'];
$r... | php | {
"resource": ""
} |
q260684 | DatabaseManager.listDatabases | test | public function listDatabases()
{
try {
$connection = $this->getConnection();
$result = Database::listDatabases($connection);
if (empty($result['result'])) {
return array();
} else {
return $result['result'];
}
... | php | {
"resource": ""
} |
q260685 | DatabaseManager.getConnection | test | private function getConnection($database = '_system')
{
$connection = clone $this->_toolbox->getConnection();
$connection->setDatabase($database);
return $connection;
} | php | {
"resource": ""
} |
q260686 | Client.useConnection | test | public function useConnection($name)
{
if (!array_key_exists($name, $this->_toolboxes)) {
throw new ClientException("The connection ($name) you are trying to use is not registered with the client.");
}
$this->_currentConnection = $name;
} | php | {
"resource": ""
} |
q260687 | Client.getToolbox | test | public function getToolbox($name = 'default')
{
if (!array_key_exists($name, $this->_toolboxes)) {
throw new ClientException("The toolbox for connection ($name) does not exist! Is the connection added to the client?");
}
return $this->_toolboxes[$name];
} | php | {
"resource": ""
} |
q260688 | Client.setModelFormatter | test | public function setModelFormatter(IModelFormatter $formatter)
{
$this->_modelFormatter = $formatter;
foreach ($this->_toolboxes as $toolbox) {
$toolbox->setModelFormatter($formatter);
}
} | php | {
"resource": ""
} |
q260689 | Client.load | test | public function load($collection, $id)
{
return $this->getToolbox($this->_currentConnection)->getPodManager()->load($collection, $id);
} | php | {
"resource": ""
} |
q260690 | Client.createGraph | test | public function createGraph($name)
{
$toolbox = $this->getToolbox($this->_currentConnection);
$toolbox->getGraphManager()->createGraph($name);
$this->addConnection($name, $toolbox->getEndpoint(), array('username' => $toolbox->getUsername(), 'password' => $toolbox->getPassword(), 'graph' => $... | php | {
"resource": ""
} |
q260691 | Client.renameCollection | test | public function renameCollection($collection, $newName)
{
return $this->getToolbox($this->_currentConnection)->getCollectionManager()->renameCollection($collection, $newName);
} | php | {
"resource": ""
} |
q260692 | Client.getIndexInfo | test | public function getIndexInfo($collection, $indexId)
{
return $this->getToolbox($this->_currentConnection)->getCollectionManager()->getIndexInfo($collection, $indexId);
} | php | {
"resource": ""
} |
q260693 | PodManager.load | test | public function load($type, $id)
{
$driver = $this->_toolbox->getDriver();
try {
if ($this->_toolbox->isGraph()) {
switch (strtolower($type)) {
case "vertex":
if ($this->hasTransaction()) {
$this-... | php | {
"resource": ""
} |
q260694 | PodManager.processStoreResult | test | public function processStoreResult($pod, $revision, $id = null)
{
$pod->setSaved();
$pod->setRevision($revision);
if ($id && $pod->getId() === null) {
$pod->setId($id);
}
//Signal here
$this->notify("after_store", $pod);
return $pod->getKey();
... | php | {
"resource": ""
} |
q260695 | PodManager.convertToPods | test | public function convertToPods($type, array $documents)
{
$result = array();
foreach ($documents as $document) {
if ($document instanceof \triagens\ArangoDb\Document) {
$model = $this->convertDriverDocumentToPod($document);
$result[$document->getInternal... | php | {
"resource": ""
} |
q260696 | PodManager.convertArrayToPod | test | public function convertArrayToPod($type, array $data)
{
$model = $this->dispense($type);
$pod = $model->getPod();
$pod->loadFromArray($data);
//Signal here
$this->notify("after_open", $model->getPod());
return $model;
} | php | {
"resource": ""
} |
q260697 | PodManager.convertDriverDocumentToPod | test | public function convertDriverDocumentToPod(\triagens\ArangoDb\Document $driverDocument)
{
switch ($driverDocument) {
case $driverDocument instanceof \triagens\ArangoDb\Vertex:
$model = $this->dispense("vertex");
break;
case $driverDocument instanceof ... | php | {
"resource": ""
} |
q260698 | PodManager.createVertex | test | private function createVertex(array $data = array(), $new = true)
{
$vertex = new Vertex($this->_toolbox, $data, $new);
$this->attachEventsToPod($vertex);
return $this->setupModel($vertex, $vertex);
} | php | {
"resource": ""
} |
q260699 | PodManager.createEdge | test | private function createEdge(array $data = array(), $new = true)
{
$edge = new Edge($this->_toolbox, $data, $new);
$this->attachEventsToPod($edge);
return $this->setupModel($edge, $edge);
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.