_id
stringlengths 2
7
| title
stringlengths 3
151
| partition
stringclasses 3
values | text
stringlengths 33
8k
| language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
q265300
|
Result.getSettingsAsArray
|
test
|
public function getSettingsAsArray($groups = null, $flag = null)
{
|
php
|
{
"resource": ""
}
|
q265301
|
Result.getCachableSettingsAsArray
|
test
|
public function getCachableSettingsAsArray($groups = null, $flag = null)
{
|
php
|
{
"resource": ""
}
|
q265302
|
Result.getFiltered
|
test
|
protected function getFiltered(array $all_settings = array(), $groups = null, $flag = null)
{
$settings = array();
foreach ($all_settings as $setting) {
if ($setting->matchesGroup($groups)
|
php
|
{
"resource": ""
}
|
q265303
|
Result.getFilteredAsArray
|
test
|
protected function getFilteredAsArray(array $all_settings, $groups = null, $flag = null)
{
$settings = array();
foreach ($all_settings as $setting) {
if ($setting->matchesGroup($groups) &&
|
php
|
{
"resource": ""
}
|
q265304
|
HTMLTree.render
|
test
|
public function render()
{
// preload images
$sHTML = "<script language=\"JavaScript\">\n".
" minus = new Image();\n minus.src = \"".Openbizx::$app->getImageUrl()."/minus.gif\";\n".
" plus = new Image();\n plus.src = \"".Openbizx::$app->getImageUrl()."/plus.gif\";\n".
"</script>\n";
|
php
|
{
"resource": ""
}
|
q265305
|
HTMLTree.renderNodeItems
|
test
|
protected function renderNodeItems(&$nodeItemArray)
{
$sHTML = "";
if (isset($nodeItemArray["ATTRIBUTES"]))
{
$sHTML .= $this->renderSingleNodeItem($nodeItemArray);
}
else
{
|
php
|
{
"resource": ""
}
|
q265306
|
HTMLTree.renderSingleNodeItem
|
test
|
protected function renderSingleNodeItem(&$nodeItem)
{
$url = $nodeItem["ATTRIBUTES"]["URL"];
$caption = $this->translate($nodeItem["ATTRIBUTES"]["CAPTION"]);
$target = $nodeItem["ATTRIBUTES"]["TARGET"];
//$img = $nodeItem["ATTRIBUTES"]["IMAGE"];
if ($nodeItem["NODE"]) {
$image = "<img src='" . Openbizx::$app->getImageUrl() . "/plus.gif' class='collapsed' onclick='mouseClickHandler(this)'>";
} else {
$image = "<img src='" . Openbizx::$app->getImageUrl() . "/topic.gif'>";
}
if ($target) {
if ($url) {
$sHTML .= "<li class='tree'>$image <a href=\"" . $url . "\" target='$target'>" . $caption . "</a>";
} else {
$sHTML .= "<li class='tree'>$image $caption";
}
} elseif ($url) {
$sHTML .= "<li class='tree'>$image
|
php
|
{
"resource": ""
}
|
q265307
|
BundlesAutoloader.run
|
test
|
protected function run()
{
if (! $this->bootstrapped) {
$this->autoloaderCollection = new JsonAutoloaderCollection($this->vendorDir, $this->searchFolders);
$this->retrieveInstalledBundles();
$this->install();
|
php
|
{
"resource": ""
}
|
q265308
|
BundlesAutoloader.register
|
test
|
protected function register($environment)
{
if (isset($this->environmentsBundles[$environment])) {
foreach ($this->environmentsBundles[$environment] as $bundle) {
$bundleClass = $bundle->getClass();
if (empty($this->instantiatedBundles) || !in_array($bundleClass, $this->instantiatedBundles)) {
if ( ! class_exists($bundleClass)) {
throw new InvalidAutoloaderException(sprintf("The bundle class %s does not exist. Check the bundle's autoload.json
|
php
|
{
"resource": ""
}
|
q265309
|
BundlesAutoloader.install
|
test
|
protected function install()
{
foreach ($this->autoloaderCollection as $dir => $jsonAutoloader) {
|
php
|
{
"resource": ""
}
|
q265310
|
Command.initialize
|
test
|
protected function initialize(InputInterface $input, OutputInterface $output)
{
parent::initialize($input, $output);
$this->input = $input;
$this->output = $output;
// prepend include_path if demanded
$path = $input->getOption('include-path');
if (!empty($path)) {
ini_set('include_path', $path . PATH_SEPARATOR . ini_get('include_path'));
}
// run given bootstrap file if necessary
$bootstrap_path = $input->getOption('bootstrap');
if (!empty($bootstrap_path)) {
if (!is_readable($bootstrap_path)) {
throw new \InvalidArgumentException('Bootstrap file "' . $bootstrap_path . '" is not readable.');
}
if ($this->input->getOption('verbose')) {
$output->writeln('<comment>Requiring boostrap file from "' . $bootstrap_path . '".</comment>');
}
require $bootstrap_path;
}
// we autoload classes from the current working directory or the specified autoload_dir
$autoload_dir = $input->getOption('autoload-dir');
if (!empty($autoload_dir)) {
if (!is_readable($autoload_dir)) {
throw new \InvalidArgumentException(
|
php
|
{
"resource": ""
}
|
q265311
|
Command.autoload
|
test
|
protected function autoload($class)
{
$class = str_replace('\\', DIRECTORY_SEPARATOR, $class);
$autoload_dir = $this->getInput()->getOption('autoload-dir');
if (empty($autoload_dir)) {
$autoload_dir = $this->getCurrentWorkingDirectory();
}
$file_path = $autoload_dir . DIRECTORY_SEPARATOR . $class . '.php';
if ($this->input->getOption('verbose')) {
$this->output->write('<info>Autoloading</info>: ');
}
if (is_readable($file_path)) {
if ($this->input->getOption('verbose')) {
$this->output->writeln($file_path);
|
php
|
{
"resource": ""
}
|
q265312
|
Helpers.load
|
test
|
public static function load($id): bool
{
$loaded = false;
if (isset(static::$files[$id])) {
$loaded = static::$files[$id] === true;
if (! $loaded) {
assert(file_exists(static::$files[$id]));
|
php
|
{
"resource": ""
}
|
q265313
|
Controller.forward
|
test
|
public function forward($route, array $attributes = [], array $query =
|
php
|
{
"resource": ""
}
|
q265314
|
ActiveField.glyphIcon
|
test
|
public function glyphIcon($glyphIcon)
{
if (empty($this->parts['{input}'])) {
throw new InternalErrorException('Firstly you must set field type!');
}
if (empty($glyphIcon) || !$this->_glyphIconAllowed) {
$this->parts['{glyphIcon}'] = '';
return $this;
|
php
|
{
"resource": ""
}
|
q265315
|
BizDataObj_Abstract.setQueryParameters
|
test
|
public function setQueryParameters($paramValues)
{
foreach ($paramValues as $param => $value)
|
php
|
{
"resource": ""
}
|
q265316
|
BizDataObj_Abstract.setLimit
|
test
|
public function setLimit($count, $offset = 0)
{
if ($count < 0) {
$count = 0;
}
if ($offset < 0) {
$offset = 0;
|
php
|
{
"resource": ""
}
|
q265317
|
BizDataObj_Abstract.getDBConnection
|
test
|
public function getDBConnection($type = 'default')
{
switch (strtolower($type)) {
case "default":
case "read":
if (isset($this->databaseAliasNameforRead)) {
$dbName = $this->databaseAliasNameforRead;
} else {
$dbName = $this->databaseAliasName;
}
break;
case "write":
|
php
|
{
"resource": ""
}
|
q265318
|
BizDataObj_Abstract.getProperty
|
test
|
public function getProperty($propertyName)
{
$ret = parent::getProperty($propertyName);
if ($ret)
return $ret;
if ($propertyName == "Table")
return $this->table;
if ($propertyName == "SearchRule")
return $this->searchRule;
// get control object if propertyName is "Field[fldname]"
$pos1 = strpos($propertyName, "[");
$pos2 = strpos($propertyName, "]");
if ($pos1 > 0 && $pos2 > $pos1) {
$propType = substr($propertyName, 0, $pos1);
$fieldName
|
php
|
{
"resource": ""
}
|
q265319
|
BizDataObj_Abstract.getRefObject
|
test
|
public function getRefObject($objName)
{
// see if there is such object in the ObjReferences
$objRef = $this->objReferences->get($objName);
if (!$objRef)
return null;
// apply association on the object
// $assc = $this->EvaluateExpression($objRef->association);
|
php
|
{
"resource": ""
}
|
q265320
|
BizDataObj_Abstract.setAssociation
|
test
|
protected function setAssociation($objRef, $asscObj)
{
$this->association["AsscObjName"] = $asscObj->objectName;
$this->association["Relationship"] = $objRef->relationship;
$this->association["Table"] = $objRef->table;
$this->association["Column"] = $objRef->column;
$this->association["FieldRef"] = $objRef->fieldRef;
$this->association["FieldRefVal"] = $asscObj->getFieldValue($objRef->fieldRef);
$this->association["CondColumn"] = $objRef->condColumn;
$this->association["CondValue"] = $objRef->condValue;
$this->association["Condition"] = $objRef->condition;
|
php
|
{
"resource": ""
}
|
q265321
|
DefaultReader.fromDocblock
|
test
|
protected function fromDocblock($docblock, array $context=array())
{
$annotations = $this->getParser()->parse($docblock);
$col = $this->getCollection();
$rv = array();
foreach ($annotations as $annot) {
list($name, $positional, $named) = $annot;
|
php
|
{
"resource": ""
}
|
q265322
|
SqliteConnection.fromMemory
|
test
|
public static function fromMemory(string $prefix = ''): SqliteConnection
{
$pdo = new \PDO('sqlite::memory:');
$pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
|
php
|
{
"resource": ""
}
|
q265323
|
SqliteConnection.fromFile
|
test
|
public static function fromFile(string $file, string $prefix = ''): SqliteConnection
{
$pdo = new \PDO('sqlite:' . $file);
$pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
|
php
|
{
"resource": ""
}
|
q265324
|
aModel.getField
|
test
|
protected function getField(string $f) : ?iField
{
$r = null;
if ($this->hasField($f)) {
$r =
|
php
|
{
"resource": ""
}
|
q265325
|
aModel.hasField
|
test
|
public function hasField(string $f) : bool
{
|
php
|
{
"resource": ""
}
|
q265326
|
aModel.getFieldNames
|
test
|
public function getFieldNames() : array
{
$r = [];
foreach ($this->fieldsCollection as
|
php
|
{
"resource": ""
}
|
q265327
|
aModel.getInitialDataModel
|
test
|
public function getInitialDataModel() : array
{
$r = [];
foreach ($this->fieldsCollection as
|
php
|
{
"resource": ""
}
|
q265328
|
ChildCrudController.authorizeIndex
|
test
|
protected function authorizeIndex(Request $request)
{
|
php
|
{
"resource": ""
}
|
q265329
|
ChildCrudController.authorizeCreate
|
test
|
protected function authorizeCreate(Request $request)
{
|
php
|
{
"resource": ""
}
|
q265330
|
Nestis.getNestedItem
|
test
|
public function getNestedItem($pattern, $object, $default = null)
{
$parts = explode("/", $pattern);
$lastObject = $object;
$nr = 0;
$totalParts = count($parts);
$item = null;
foreach ($parts as $part) {
$item = null;
$nr++;
$found = false;
if ($part == '') {
return $default;
}
try {
if (is_object($lastObject)) {
$mthd = 'get' . ucfirst($part);
$mthdIs = 'is' . ucfirst($part);
if (substr($part, 0, 2) == '::') {
$reflect = new \ReflectionObject($lastObject);
$props = $reflect->getStaticProperties();
$nm = substr($part, 2);
if (isset($props[$nm])) {
$prop = $reflect->getProperty($nm);
if ($prop->isPublic()) {
$item = $lastObject::$$nm;
}
}
} elseif (is_callable([$lastObject, $mthd])) {
$item = $lastObject->$mthd();
} elseif (is_callable([$lastObject, $mthdIs])) {
$item = $lastObject->$mthdIs();
} elseif (is_callable([$lastObject, $part])) {
$item = $lastObject->$part();
} else {
$reflect = new \ReflectionObject($lastObject);
|
php
|
{
"resource": ""
}
|
q265331
|
UserAgent.init
|
test
|
public function init()
{
$device = '';
$style = '';
if (!isset($_SERVER['HTTP_USER_AGENT'])) {
return;
}
if (stristr($_SERVER['HTTP_USER_AGENT'], 'ipad')) {
$device = "ipad";
$style = "touch";
} else if (stristr($_SERVER['HTTP_USER_AGENT'], 'iphone')
|| strstr($_SERVER['HTTP_USER_AGENT'], 'ipod')) {
$device = "iphone";
$style = "touch";
} else if (stristr($_SERVER['HTTP_USER_AGENT'], 'blackberry')) {
$device = "blackberry";
$style = "touch";
} else if (stristr($_SERVER['HTTP_USER_AGENT'],
|
php
|
{
"resource": ""
}
|
q265332
|
Config.getExportImplementor
|
test
|
public function getExportImplementor()
{
$export = new Parameters($this->config->get('export', array()));
|
php
|
{
"resource": ""
}
|
q265333
|
Config.getReportImplementor
|
test
|
public function getReportImplementor()
{
$report = new Parameters($this->config->get('report', array()));
|
php
|
{
"resource": ""
}
|
q265334
|
Config.getRunnerImplementor
|
test
|
public function getRunnerImplementor()
{
$runner = new Parameters($this->config->get('runner', array()));
|
php
|
{
"resource": ""
}
|
q265335
|
Config.getCacheImplementor
|
test
|
public function getCacheImplementor()
{
$cache = new Parameters($this->config->get('cache', array()));
|
php
|
{
"resource": ""
}
|
q265336
|
BizDataObj_SQLHelper.buildUpdateSQL
|
test
|
public function buildUpdateSQL($dataObj)
{
// generate column value pairs. ignore those whose inputValue=fieldValue
$sqlFlds = $dataObj->bizRecord->getToSaveFields('UPDATE');
$colval_pairs = null;
foreach ($sqlFlds as $field) {
$col = $field->column;
// ignore empty vallue for Date or Datetime
if (($field->value == "" && $field->oldValue == "") && ($field->type == "Date" || $field->type == "Datetime"))
continue;
if ($field->valueOnUpdate != "") // ignore ValueOnUpdate field first
continue;
if ($field->isLobField()) // take care of blob/clob type later
continue;
// ignore the column where old value is same as new value; set the column only if new value is diff than the old value
if ($field->oldValue == $field->value)
continue;
$_val = $field->getSqlValue();
$colval_pairs[$col] = $_val; //($_val===null || $_val === '') ? "''" : $_val;
}
if ($colval_pairs == null)
return false;
// take care value on update fields only
foreach ($sqlFlds as $field) {
$col = $field->column;
if ($field->valueOnUpdate != "") {
$_val = $field->getValueOnUpdate();
$colval_pairs[$col] = $_val; //($_val===null || $_val === '') ? "''" : $_val;
}
}
$db = $dataObj->getDBConnection('WRITE');
$sql = "";
foreach ($colval_pairs as $col => $val) {
//$queryString = QueryStringParam::formatQueryString("`$col`", "=", $val);
$queryString = "`$col`=" . $db->quote($val);
if ($sql != "") {
$sql .= ", $queryString";
} else {
$sql .= $queryString;
|
php
|
{
"resource": ""
}
|
q265337
|
BizDataObj_SQLHelper.buildDeleteSQL
|
test
|
public function buildDeleteSQL($dataObj)
{
$sql = "DELETE FROM `" . $dataObj->mainTableName . "`";
$whereStr = $dataObj->bizRecord->getKeySearchRule(false, true); // use cur value and column name
$sql .= " WHERE " . $whereStr;
// append DataPerm in the WHERE clause
if ($dataObj->dataPermControl == 'Y') {
$svcObj = Openbizx::getService(OPENBIZ_DATAPERM_SERVICE);
$hasOwnerField = $this->_hasOwnerField($dataObj);
|
php
|
{
"resource": ""
}
|
q265338
|
EditCombobox.getStyle
|
test
|
protected function getStyle()
{
$htmlClass = $this->cssClass ? "class='" . $this->cssClass . "' " : "class='editcombobox'";
/*
$width = $this->width ? $this->width : 146;
$this->widthInput = ($width-18).'px';
$this->width = $width.'px';
$style = "position: absolute; width: $this->width; z-index: 1; clip: rect(auto, auto, auto, $this->widthInput);";
*/
if ($this->style)
$style .= $this->style;
if (!isset($style) && !$htmlClass)
return null;
|
php
|
{
"resource": ""
}
|
q265339
|
DomElement.getChildNodes
|
test
|
public function getChildNodes()
{
$prefix = $this->ownerDocument->getDefaultNamespacePrefix();
if ($prefix) {
return $this->ownerDocument->getXpath()->query(sprintf('child::%s:*', $prefix), $this);
|
php
|
{
"resource": ""
}
|
q265340
|
DomElement.getAttributeValue
|
test
|
public function getAttributeValue($name, $default_value = null)
{
$value = parent::getAttribute($name);
if ($value === '') {
|
php
|
{
"resource": ""
}
|
q265341
|
DomElement.getAttributes
|
test
|
public function getAttributes()
{
$attributes = array();
foreach ($this->ownerDocument->getXpath()->query('@*', $this)
|
php
|
{
"resource": ""
}
|
q265342
|
DomElement.getChild
|
test
|
public function getChild($name)
{
$query = 'self::node()[count(child::*[local-name() = "%1$s" and namespace-uri() = "%2$s"]) = 1]/*' .
'[local-name() = "%1$s" and namespace-uri() = "%2$s"]';
$node = $this->ownerDocument->getXpath()->query(
|
php
|
{
"resource": ""
}
|
q265343
|
DomElement.getLiteralValue
|
test
|
protected function getLiteralValue($element)
{
$value = $element->getValue();
$trimmed_value = trim($value);
$preserve_whitespace = $element->getAttributeValue('space', 'default') === 'preserve';
$literalize_value = self::literalize($element->getAttributeValue('literalize')) !== false;
if ($literalize_value) {
if ($preserve_whitespace && ($trimmed_value === '' || $value !== $trimmed_value)) {
$value = $value;
} else {
|
php
|
{
"resource": ""
}
|
q265344
|
MenuComposer.cacheIfConfigured
|
test
|
private function cacheIfConfigured($closure)
{
if (config('menu.cache.enable')) {
$key = config('menu.cache.key');
$minutes = config('menu.cache.minutes');
return Cache::remember($key, $minutes,
|
php
|
{
"resource": ""
}
|
q265345
|
Middleware.handle
|
test
|
public function handle(array &$arguments, string $callType = Caller::TYPE_DEFAULT)
{
if ($this->isValid()) {
$this->callType = $callType;
$method = $this->getMethod();
|
php
|
{
"resource": ""
}
|
q265346
|
Middleware.isValid
|
test
|
public function isValid(string $method = null): bool
{
if ($method === null) {
|
php
|
{
"resource": ""
}
|
q265347
|
Middleware.isGetter
|
test
|
protected function isGetter(): bool
{
$isExternalObject = is_object($this->context) &&
|
php
|
{
"resource": ""
}
|
q265348
|
Middleware.isSetter
|
test
|
protected function isSetter(): bool
{
$isExternalObject = is_object($this->context) &&
|
php
|
{
"resource": ""
}
|
q265349
|
BaseConnector.prepareCall
|
test
|
public function prepareCall( Client $client = null ) {
// Set the default client:
$this->curlClient = null;
$client = null;
$this->log( 'prepare ' . __CLASS__ . ' GuzzleRequest: base_uri(' . $this->getBaseUri() . '), client(' . ( (bool) is_null( $client ) ) . '), timeout(' . $this->getCurlTimeout() . '), ', 'debug');
// Check if baseUri is set or that $client is set (make pass trough client available else set the client self)
if ( $this->getBaseUri() !== null && $client === null ) {
// Initialize the Client:
$this->curlClient = new Client( [
|
php
|
{
"resource": ""
}
|
q265350
|
BaseConnector.getResponse
|
test
|
public function getResponse( $type = self::RESPONSE_TYPE_JSON ) {
// Check if response is set
if ( $this->response === null ) {
return null;
}
try {
// Get the stream from the response getBody() method returns a stream instead of a string.
$stream = $this->response->getBody();
// Get the body from the stream.
$body = $stream->getContents();
if ( empty( $body ) ) {
return null;
}
switch ( $type ) {
default:
case self::RESPONSE_TYPE_JSON:
return $this->getResponseJSON( $body );
break;
case self::RESPONSE_TYPE_XML:
return (string) $body;
break;
|
php
|
{
"resource": ""
}
|
q265351
|
BaseConnector.getResponseJSON
|
test
|
private function getResponseJSON( $body ) {
try {
return json_decode( (string) $body, true );
}
catch ( \Exception $e ) {
|
php
|
{
"resource": ""
}
|
q265352
|
SessionContext.saveObjVar
|
test
|
public function saveObjVar($objName, $varName, &$value, $stateful = false)
{
if (preg_match('/\./si', $objName)) {
$objName = $this->getNamespace() . '#' . $objName;
}
if (!$stateful) {
|
php
|
{
"resource": ""
}
|
q265353
|
SessionContext.loadObjVar
|
test
|
public function loadObjVar($objName, $varName, &$value, $stateful = false)
{
//Openbizx::$app->getLog()->log(LOG_ALERT, __METHOD__, ' | name : ' . $varName . ' | value : ' . $value);
//Openbizx::$app->getClientProxy()->showClientAlert( __METHOD__ . ' | name : ' . $varName . ' | value : ' . $value);
if (preg_match('/\./si', $objName)) {
$objName = $this->getNamespace() . '#' . $objName;
}
if (!$stateful) {
if (!$this->_sessObjArr) {
return null;
}
|
php
|
{
"resource": ""
}
|
q265354
|
SessionContext.saveSessionObjects
|
test
|
public function saveSessionObjects()
{
// loop all objects (bizview, bizform, bizdataobj) collect their session vars
$allobjs = Openbizx::objectFactory()->getAllObjects();
foreach ($allobjs as $obj) {
if (method_exists($obj, "saveStatefullVars")) {
//after calling $obj->saveStatefullVars SessObjArr and StatefulSessObjArr are filled
$obj->saveStatefullVars($this);
}
// if previous view's object is used in current view, don't discard its session data
if ( isset($obj->objectName) && isset($this->_prevViewObjNames[$obj->objectName]) ) {
unset( $this->_prevViewObjNames[$obj->objectName] );
Openbizx::$app->getLog()->log( LOG_ERR, "SESSION", "unset " . $obj->objectName );
|
php
|
{
"resource": ""
}
|
q265355
|
SessionContext.clearSessionObjects
|
test
|
public function clearSessionObjects($keepObjects = false)
{
if ($keepObjects == false) {
unset($this->_sessObjArr);
$this->_sessObjArr = array();
} else { // add previous view's session object names in to a map
if (isset($this->_sessObjArr)) {
|
php
|
{
"resource": ""
}
|
q265356
|
SessionContext.saveJSONArray
|
test
|
public function saveJSONArray($jsonValue, $jsonName = NULL)
{
$jsonArray = json_decode($jsonValue);
if ((bool) $jsonName) { //If I want save all array in session I send the name of the array in session
$this->setVar($jsonName, $jsonArray);
} else {//I save each
|
php
|
{
"resource": ""
}
|
q265357
|
SessionContext.setViewHistory
|
test
|
public function setViewHistory($formName, $historyInfo)
{
$view = Openbizx::$app->getCurrentViewName();
$view_form = $formName; //$view."_".$formname;
if (!$historyInfo) {
|
php
|
{
"resource": ""
}
|
q265358
|
Timer.tic
|
test
|
public function tic($flag = self::RESET_COUNTER)
{
$this->start = microtime(true);
|
php
|
{
"resource": ""
}
|
q265359
|
Timer.toc
|
test
|
public function toc($message = '')
{
$this->stop = microtime(true);
++$this->count;
$this->elapsed = ($this->stop - $this->start ) * 1e6 - $this->calib;
|
php
|
{
"resource": ""
}
|
q265360
|
Timer.tac
|
test
|
public function tac($flag = self::ADD_LAP)
{
$this->stop = microtime(true);
if ($flag) {
$this->elapsed = ($this->stop - $this->start) * 1e6
- $this->calib;
} else {
|
php
|
{
"resource": ""
}
|
q265361
|
Timer.reset
|
test
|
public function reset()
{
$this->count = 0;
$this->elapsed =
|
php
|
{
"resource": ""
}
|
q265362
|
ExecutableCheck.validExecutable
|
test
|
public function validExecutable($value)
{
$val = trim($value);
if (empty($val)) {
throw new \InvalidArgumentException(
'Not a valid executable path. Please specify a command (like "ls") or a path (like "/usr/bin/ls").'
);
}
$executable = trim(shell_exec('which ' . $val));
if (!$executable) {
throw new \InvalidArgumentException('Could not find executable: ' . $val);
}
$command = $this->parameters->get('command', $this->getName());
$cli_option = $this->parameters->get('version_parameter', '--version');
$version_mask = $this->parameters->get('version_mask', '/Version/');
if ($version_mask) {
$version_info_raw = trim(shell_exec('cat /dev/null | ' . $executable . ' '
|
php
|
{
"resource": ""
}
|
q265363
|
FormHelper.getRedirectPage
|
test
|
public function getRedirectPage()
{
// get the control that issues the call
// __this is elementName:eventHandlerName
list($element, $eventHandler) = $this->getInvokingElement();
$eventHandlerName = $eventHandler->objectName;
$redirectPage = $element->getRedirectPage($eventHandlerName);
|
php
|
{
"resource": ""
}
|
q265364
|
FormHelper.processDataException
|
test
|
public function processDataException($e)
{
$errorMsg = $e->getMessage();
Openbizx::$app->getLog()->log(LOG_ERR, "DATAOBJ", "DataObj error = ".$errorMsg);
//Openbizx::$app->getClientProxy()->showClientAlert($errorMsg); //showErrorMessage($errorMsg);
|
php
|
{
"resource": ""
}
|
q265365
|
DynaView.processURL
|
test
|
protected function processURL()
{
// if url has form=...
$paramForm = isset($_GET['form']) ? $_GET['form'] : null;
$paramCForm = isset($_GET['cform']) ? $_GET['cform'] : null;
if (!$paramForm)
return;
// add the form in FormRefs
if ($paramForm)
{
if($this->isInFormRefLibs($paramForm))
{
$xmlArr["ATTRIBUTES"]["NAME"] = $paramForm;
$xmlArr["ATTRIBUTES"]["SUBFORMS"] = $paramCForm ? $paramCForm : "";
$formRef = new FormReference($xmlArr);
$this->formRefs->set($paramForm, $formRef);
if ($paramCForm)
{
if($this->isInFormRefLibs($paramCForm))
{
$xmlArr["ATTRIBUTES"]["NAME"] = $paramCForm;
$xmlArr["ATTRIBUTES"]["SUBFORMS"] = "";
$cformRef = new FormReference($xmlArr);
$this->formRefs->set($paramCForm, $cformRef);
}
|
php
|
{
"resource": ""
}
|
q265366
|
WebUtils.baseURI
|
test
|
public static function baseURI()
{
// Check if uri contains a query.
$uri = $_SERVER['REQUEST_URI'];
$qmIsHere
|
php
|
{
"resource": ""
}
|
q265367
|
ObjectRepository.validateIdentity
|
test
|
protected function validateIdentity($identity)
{
$credentialProperty = $this->options->getCredentialProperty();
$getter = 'get' . ucfirst($credentialProperty);
$documentCredential = null;
if (method_exists($identity, $getter)) {
$documentCredential = $identity->$getter();
} elseif (property_exists($identity, $credentialProperty)) {
$documentCredential = $identity->{$credentialProperty};
} else {
throw new Exception\UnexpectedValueException(
sprintf(
'Property (%s) in (%s) is not accessible. You should implement %s::%s()',
$credentialProperty,
get_class($identity),
get_class($identity),
$getter
)
);
}
$credentialValue = $this->credential;
$callable = $this->options->getCredentialCallable();
if ($callable) {
|
php
|
{
"resource": ""
}
|
q265368
|
ObjectRepository.setup
|
test
|
protected function setup()
{
if (null === $this->identity) {
throw new Exception\RuntimeException(
'A value for the identity was not provided prior to authentication with ObjectRepository '
. 'authentication adapter'
);
}
|
php
|
{
"resource": ""
}
|
q265369
|
SetsAttributes.setVisibleAttribute
|
test
|
protected function setVisibleAttribute(string $name, $value)
{
$method = "set" . ucfirst($name);
if (method_exists($this, $method)) {
$value = $this->$method($value);
} elseif (PublicReflection::hasAttribute(get_class($this), $name)) {
$value = $this->setAttribute($name, $value);
} elseif ($this->triggerUndefinedAttributeNotice) {
|
php
|
{
"resource": ""
}
|
q265370
|
EloquentBuilder.firstHumpArray
|
test
|
public function firstHumpArray(...$parameters){
$res = $this->firstHump(...$parameters);
if ($res instanceof EloquentModel){
|
php
|
{
"resource": ""
}
|
q265371
|
OptionElement.getFromList
|
test
|
public function getFromList(&$list, $selectFrom = null)
{
if (!$selectFrom) {
$selectFrom = $this->getSelectFrom();
}
if (!$selectFrom) {
return $this->getSQLFromList($list);
}
$this->getXMLFromList($list, $selectFrom);
if ($list != null)
|
php
|
{
"resource": ""
}
|
q265372
|
ConsoleMessageFormatter.format
|
test
|
public function format(IReport $report)
{
$output = '';
$format = $this->getParameters()->get('format', self::DEFAULT_FORMAT);
$results = $report->getResults();
foreach ($results as $result) {
$messages = $result->getMessages();
foreach ($messages as $message) {
switch($message->getSeverity()) {
case Message::SEVERITY_FATAL:
case Message::SEVERITY_ERROR:
$output .= sprintf(
$format,
$message->getGroup(),
$message->getName(),
'<error>' . $message->getText() . '</error>'
);
break;
case Message::SEVERITY_NOTICE:
case Message::SEVERITY_WARN:
$output .= sprintf(
$format,
$message->getGroup(),
$message->getName(),
'<comment>' . $message->getText() . '</comment>'
);
break;
case Message::SEVERITY_INFO:
$output .= sprintf(
|
php
|
{
"resource": ""
}
|
q265373
|
HasMiddleware.callMiddleware
|
test
|
protected function callMiddleware(
$middleware,
string $method = "",
array &$arguments = [],
string $type = Caller::TYPE_DEFAULT,
$result = null
) {
if (! $this->skipMiddleware) {
$result = $this->middlewareCaller($middleware, $result)
|
php
|
{
"resource": ""
}
|
q265374
|
HasMiddleware.callProxyGetters
|
test
|
protected function callProxyGetters(string $name, $result = null)
{
if ($this->getMiddlewareGroup(Caller::TYPE_GETTER)->isNotEmpty()) {
$middleware = $this->getMiddlewareGroup(Caller::TYPE_GETTER);
$arguments = [$name];
$result = $this->callMiddleware($middleware, "get", $arguments, Caller::TYPE_GETTER, $result);
|
php
|
{
"resource": ""
}
|
q265375
|
HasMiddleware.callProxyMethods
|
test
|
protected function callProxyMethods(string $name, array &$arguments, $result = null)
{
if ($this->getMiddlewareGroup(Caller::TYPE_CALLER)->isNotEmpty()) {
$middleware = $this->getMiddlewareGroup(Caller::TYPE_CALLER);
$result = $this->callMiddleware($middleware, $name, $arguments, Caller::TYPE_CALLER,
|
php
|
{
"resource": ""
}
|
q265376
|
HasMiddleware.callProxySetters
|
test
|
protected function callProxySetters(string $name, $value, $result = null)
{
$result = null;
if ($this->getMiddlewareGroup(Caller::TYPE_SETTER)->isNotEmpty()) {
$middleware = $this->getMiddlewareGroup(Caller::TYPE_SETTER);
$arguments = [$name, $value];
$result = $this->callMiddleware($middleware, "set", $arguments, Caller::TYPE_SETTER, $result);
|
php
|
{
"resource": ""
}
|
q265377
|
HasMiddleware.catchHaltedMiddleware
|
test
|
protected function catchHaltedMiddleware(bool $setting = null)
{
if ($setting === null) {
return $this->catchHaltExceptions;
|
php
|
{
"resource": ""
}
|
q265378
|
HasMiddleware.clearMiddleware
|
test
|
protected function clearMiddleware(string $group = null)
{
if ($group === null) {
$this->middleware = new Group;
} else {
|
php
|
{
"resource": ""
}
|
q265379
|
HasMiddleware.disableMiddleware
|
test
|
protected function disableMiddleware(string $key = '', string $group = null)
{
$middleware = $this->getMiddleware($key, $group);
|
php
|
{
"resource": ""
}
|
q265380
|
HasMiddleware.enableMiddleware
|
test
|
protected function enableMiddleware(string $key = '', string $group = null)
{
$middleware = $this->getMiddleware($key, $group);
|
php
|
{
"resource": ""
}
|
q265381
|
HasMiddleware.getMiddleware
|
test
|
protected function getMiddleware(string $key = "", string $group = null, $default =
|
php
|
{
"resource": ""
}
|
q265382
|
HasMiddleware.getMiddlewareGroup
|
test
|
protected function getMiddlewareGroup(string $id = Group::DEFAULT_ID): MiddlewareCollection
{
if (! isset($this->middleware[$id]) || $this->middleware[$id] instanceof MiddlewareCollection === false) {
|
php
|
{
"resource": ""
}
|
q265383
|
HasMiddleware.groupMiddleware
|
test
|
protected function groupMiddleware(string $name = null, Closure $closure = null)
{
if ($name === null) {
return $this->middlewareGroupId;
} else {
$previousGroup = $this->middlewareGroupId;
$this->middlewareGroupId = $name;
if
|
php
|
{
"resource": ""
}
|
q265384
|
HasMiddleware.hasMiddleware
|
test
|
protected function hasMiddleware(string $key, string $group = null): bool
{
|
php
|
{
"resource": ""
}
|
q265385
|
HasMiddleware.isMiddlewareDisabled
|
test
|
protected function isMiddlewareDisabled(string $key = '', string $group = null): bool
{
|
php
|
{
"resource": ""
}
|
q265386
|
HasMiddleware.isMiddlewareEnabled
|
test
|
protected function isMiddlewareEnabled(string $key = '', string $group = null): bool
{
|
php
|
{
"resource": ""
}
|
q265387
|
HasMiddleware.middleware
|
test
|
protected function middleware(string $key = null, string $group = Group::DEFAULT_ID)
{
$middleware = $this->middleMan->getGroup($group)->get($key);
if ($middleware) {
|
php
|
{
"resource": ""
}
|
q265388
|
HasMiddleware.middlewareCollection
|
test
|
protected function middlewareCollection(string $id = Group::DEFAULT_ID, $middleware = []): MiddlewareCollection
{
if (function_exists('collect_middleware')) {
return
|
php
|
{
"resource": ""
}
|
q265389
|
HasMiddleware.prependMiddleware
|
test
|
protected function prependMiddleware($middleware, string $key = "", string $group = null)
{
$middleware = $this->middlewareResolver()->resolveOrFail($middleware, $key);
|
php
|
{
"resource": ""
}
|
q265390
|
HasMiddleware.pushMiddleware
|
test
|
protected function pushMiddleware($middleware, string $key = "", string $group = null)
{
$middleware = $this->middlewareResolver()->resolveOrFail($middleware, $key);
|
php
|
{
"resource": ""
}
|
q265391
|
HasMiddleware.setMiddlewareContext
|
test
|
protected function setMiddlewareContext($context, MiddlewareCollection &$group = null)
{
if ($group === null) {
$group = $this->middleware;
}
if ($group) {
foreach ($group as &$value) {
if ($value instanceof MiddlewareCollection) {
|
php
|
{
"resource": ""
}
|
q265392
|
HasMiddleware.thenCallMiddleware
|
test
|
protected function thenCallMiddleware($middleware)
{
if (function_exists('call_middleware')) {
$this->result = call_middleware($middleware, $this->result);
} else {
|
php
|
{
"resource": ""
}
|
q265393
|
Cache.save
|
test
|
public function save()
{
$location = $this->location;
// no location given from commandline -> use config values or fallback to default location
if (empty($location)) {
$location = $this->parameters->get(
'write_location',
$this->parameters->get(
'location',
$this->getDefaultLocation()
)
);
}
$this->location = $location;
$data = array();
foreach ($this->settings as $setting) {
$data[] = $setting->toArray();
}
$flags = 0;
if ($this->parameters->get('pretty', true) &&
|
php
|
{
"resource": ""
}
|
q265394
|
TabView._getForms
|
test
|
private function _getForms($forms)
{
$recArr = array();
if (count($forms) == 0)
return $recArr;
foreach ($forms as $form) {
if (!is_null($form["ATTRIBUTES"]))
$recArr[] =
|
php
|
{
"resource": ""
}
|
q265395
|
JsonAutoloader.setup
|
test
|
protected function setup()
{
$autoloader = $this->decode($this->filename);
if (null === $autoloader) {
throw new InvalidJsonFormatException(sprintf('The json file %s is malformed. Please check the file syntax to fix the problem', $this->filename));
}
if (empty($autoloader["bundles"])) {
throw new InvalidJsonFormatException(sprintf('The json file %s requires the bundles section. Please add that section to fix the problem', $this->filename));
}
foreach ($autoloader["bundles"] as $bundleClass => $options) {
$environments = (isset($options["environments"])) ? $options["environments"] : 'all';
if (!is_array($environments)) $environments = array($environments);
$overrides = (isset($options["overrides"])) ? $options["overrides"] : array();
$bundle =
|
php
|
{
"resource": ""
}
|
q265396
|
TakeTransitionCommand.findTransition
|
test
|
protected function findTransition(Execution $execution)
{
$out = (array) $execution->getProcessModel()->findOutgoingTransitions($execution->getNode()->getId());
$trans = null;
if ($this->transitionId === null) {
if (count($out) != 1) {
throw new \RuntimeException(sprintf('No single outgoing transition found at node "%s"', $execution->getNode()->getId()));
|
php
|
{
"resource": ""
}
|
q265397
|
JqueryAjaxExtension.remoteCall
|
test
|
public function remoteCall($options = array())
{
return function ($options) {
$type = isset($options['type']) ? $options['type'] : "POST";
$dataType = isset($options['dataType']) ? $options['dataType'] : "html";
$js = "$.ajax({
url: '" . $options['url'] . "',
type: '" . $type . "',
dataType: '" . $dataType . "',";
if (isset($options['before'])) {
$before = str_replace('"', "'", $options['before']);
|
php
|
{
"resource": ""
}
|
q265398
|
JqueryAjaxExtension.submitCall
|
test
|
public function submitCall($options = array())
{
return function ($options) {
$type = isset($options['type']) ? $options['type'] : "POST";
$dataType = isset($options['dataType']) ? $options['dataType'] : "html";
$js = "$.ajax({
url: '" . $options['url'] . "',
type: '" . $type . "',
data: $(this.form.elements).serializeArray(),
dataType: '" . $dataType . "',";
if (isset($options['before'])) {
$before = str_replace('"', "'", $options['before']);
$js .= "beforeSend: function(){" . $before . "},";
}
$js .= "success: function( data ){";
|
php
|
{
"resource": ""
}
|
q265399
|
JqueryAjaxExtension.linkTag
|
test
|
public function linkTag($options = array())
{
$jsRequest = $this->remoteCall();
return function ($options) use($jsRequest)
{
$confirm = '';
if (isset($options['confirm']) && $options['confirm'] === true) {
$msg = "Are you sure you want to perform this action?";
if(isset($options['confirm_msg'])) {
$msg = htmlentities(str_replace("'", '"', $options['confirm_msg']), ENT_QUOTES);
}
$confirm
|
php
|
{
"resource": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.