_id
stringlengths 2
7
| title
stringlengths 3
151
| partition
stringclasses 3
values | text
stringlengths 83
13k
| language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
q264800 | Execution.setSyncState | test | public function setSyncState($state)
{
switch ((int) $state) {
case self::SYNC_STATE_MODIFIED:
case self::SYNC_STATE_NO_CHANGE:
case self::SYNC_STATE_REMOVED:
// OK
break;
default:
throw new \InvalidArgumentException(sprintf('Invalid sync state: %s', $state));
}
$this->syncState = (int) $state;
} | php | {
"resource": ""
} |
q264801 | Execution.collectSyncData | test | public function collectSyncData()
{
$data = [
'id' => $this->id,
'parentId' => ($this->parentExecution === null) ? null : $this->parentExecution->getId(),
'processId' => $this->getRootExecution()->getId(),
'modelId' => $this->model->getId(),
'state' => $this->state,
'depth' => $this->getExecutionDepth(),
'timestamp' => $this->timestamp,
'variables' => $this->variables,
'transition' => ($this->transition === null) ? null : (string) $this->transition->getId(),
'node' => ($this->node === null) ? null : (string) $this->node->getId()
];
return $data;
} | php | {
"resource": ""
} |
q264802 | Execution.getExpressionContext | test | public function getExpressionContext()
{
$access = new ExecutionAccess($this);
$this->engine->notify(new CreateExpressionContextEvent($access));
return $this->engine->getExpressionContextFactory()->createContext($access);
} | php | {
"resource": ""
} |
q264803 | Execution.terminate | test | public function terminate($triggerExecution = true)
{
if ($this->hasState(self::STATE_TERMINATE)) {
return;
}
$this->state |= self::STATE_TERMINATE;
$this->syncState = self::SYNC_STATE_REMOVED;
$this->engine->debug('Terminate {execution}', [
'execution' => (string) $this
]);
foreach ($this->childExecutions as $execution) {
$execution->terminate(false);
}
if ($triggerExecution) {
$this->timestamp = microtime(true);
}
if ($this->parentExecution === null) {
$this->engine->notify(new EndProcessEvent($this->node, $this));
} else {
$this->parentExecution->childExecutionTerminated($this, $triggerExecution);
}
} | php | {
"resource": ""
} |
q264804 | Execution.registerChildExecution | test | public function registerChildExecution(Execution $execution)
{
$execution->parentExecution = $this;
if (!in_array($execution, $this->childExecutions, true)) {
$this->childExecutions[] = $execution;
}
$this->markModified();
return $execution;
} | php | {
"resource": ""
} |
q264805 | Execution.childExecutionTerminated | test | protected function childExecutionTerminated(Execution $execution, $triggerExecution = true)
{
$removed = false;
$scope = $execution->isScope() || !$execution->isConcurrent();
foreach ($this->childExecutions as $index => $exec) {
if ($exec === $execution) {
unset($this->childExecutions[$index]);
$removed = true;
break;
}
}
if (empty($this->childExecutions) && $scope && $removed && $triggerExecution) {
if ($this->isWaiting()) {
$this->signal(null, [], [
'executionId' => $execution->getId()
]);
} else {
$this->takeAll(null, [
$this
]);
}
}
} | php | {
"resource": ""
} |
q264806 | Execution.setScope | test | public function setScope($scope)
{
$this->setState(self::STATE_SCOPE, $scope);
if (!$scope) {
$this->variables = [];
}
$this->markModified();
} | php | {
"resource": ""
} |
q264807 | Execution.createExecution | test | public function createExecution($concurrent = true)
{
$execution = new static(UUID::createRandom(), $this->engine, $this->model, $this);
$execution->setNode($this->node);
if ($concurrent) {
$execution->state |= self::STATE_CONCURRENT;
}
$this->engine->registerExecution($execution);
$this->engine->debug(sprintf('Created %s{execution} from {parent}', $concurrent ? 'concurrent ' : ''), [
'execution' => (string) $execution,
'parent' => (string) $this
]);
return $execution;
} | php | {
"resource": ""
} |
q264808 | Execution.createNestedExecution | test | public function createNestedExecution(ProcessModel $model, Node $startNode, $isScope = true, $isScopeRoot = false)
{
$execution = new static(UUID::createRandom(), $this->engine, $model, $this);
$execution->setNode($startNode);
$execution->setState(self::STATE_SCOPE, $isScope);
$execution->setState(self::STATE_SCOPE_ROOT, $isScopeRoot);
$this->engine->registerExecution($execution);
$this->engine->debug('Created nested {execution} from {parent}', [
'execution' => (string) $execution,
'parent' => (string) $this
]);
return $execution;
} | php | {
"resource": ""
} |
q264809 | Execution.findChildExecutions | test | public function findChildExecutions(Node $node = null)
{
if ($node === null) {
return $this->childExecutions;
}
return array_filter($this->childExecutions, function (Execution $execution) use ($node) {
return $execution->getNode() === $node;
});
} | php | {
"resource": ""
} |
q264810 | Execution.computeVariables | test | protected function computeVariables()
{
if ($this->isScopeRoot()) {
return $this->variables;
}
if ($this->isScope()) {
return array_merge($this->parentExecution->computeVariables(), $this->variables);
}
return $this->parentExecution->computeVariables();
} | php | {
"resource": ""
} |
q264811 | Execution.getVariable | test | public function getVariable($name)
{
$vars = $this->computeVariables();
if (array_key_exists($name, $vars)) {
return $vars[$name];
}
if (func_num_args() > 1) {
return func_get_arg(1);
}
throw new \OutOfBoundsException(sprintf('Variable "%s" neighter set nor inherited in scope %s', $name, $this));
} | php | {
"resource": ""
} |
q264812 | Execution.getVariableLocal | test | public function getVariableLocal($name)
{
$vars = $this->getScope()->variables;
if (array_key_exists($name, $vars)) {
return $vars[$name];
}
if (func_num_args() > 1) {
return func_get_arg(1);
}
throw new \OutOfBoundsException(sprintf('Variable "%s" not found in scope %s', $name, $this));
} | php | {
"resource": ""
} |
q264813 | Execution.setVariable | test | public function setVariable($name, $value)
{
if ($value === null) {
return $this->removeVariable($name);
}
return $this->getScopeRoot()->setVariableLocal($name, $value);
} | php | {
"resource": ""
} |
q264814 | Execution.setVariableLocal | test | public function setVariableLocal($name, $value)
{
if (!$this->isScope()) {
return $this->getScope()->setVariableLocal($name, $value);
}
if ($value === null) {
unset($this->variables[(string) $name]);
} else {
$this->variables[(string) $name] = $value;
}
$this->markModified();
} | php | {
"resource": ""
} |
q264815 | Execution.removeVariable | test | public function removeVariable($name)
{
$exec = $this;
while ($exec !== null) {
if ($exec->isScope()) {
$exec->removeVariableLocal($name);
}
if ($exec->isScopeRoot()) {
break;
}
$exec = $exec->getParentExecution();
}
} | php | {
"resource": ""
} |
q264816 | Execution.removeVariableLocal | test | public function removeVariableLocal($name)
{
if (!$this->isScope()) {
return $this->getScope()->removeVariableLocal($name);
}
unset($this->variables[(string) $name]);
$this->markModified();
} | php | {
"resource": ""
} |
q264817 | Execution.execute | test | public function execute(Node $node)
{
if ($this->isTerminated()) {
throw new \RuntimeException(sprintf('%s is terminated', $this));
}
$this->engine->pushCommand($this->engine->createExecuteNodeCommand($this, $node));
} | php | {
"resource": ""
} |
q264818 | Execution.waitForSignal | test | public function waitForSignal()
{
if ($this->isTerminated()) {
throw new \RuntimeException(sprintf('Terminated %s cannot enter wait state', $this));
}
$this->timestamp = microtime(true);
$this->setState(self::STATE_WAIT, true);
$this->engine->debug('{execution} entered wait state', [
'execution' => (string) $this
]);
$this->markModified();
} | php | {
"resource": ""
} |
q264819 | Execution.signal | test | public function signal($signal = null, array $variables = [], array $delegation = [])
{
if ($this->isTerminated()) {
throw new \RuntimeException(sprintf('Cannot signal terminated %s', $this));
}
if (!$this->isWaiting()) {
throw new \RuntimeException(sprintf('%s is not in a wait state', $this));
}
$this->engine->pushCommand($this->engine->createSignalExecutionCommand($this, $signal, $variables, $delegation));
} | php | {
"resource": ""
} |
q264820 | Execution.take | test | public function take($transition = null)
{
if ($this->isTerminated()) {
throw new \RuntimeException(sprintf('Cannot take transition in terminated %s', $this));
}
if ($transition !== null && !$transition instanceof Transition) {
$transition = $this->model->findTransition($transition);
}
$this->engine->pushCommand($this->engine->createTakeTransitionCommand($this, $transition));
} | php | {
"resource": ""
} |
q264821 | Execution.introduceConcurrentRoot | test | public function introduceConcurrentRoot($active = false)
{
$this->engine->debug('Introducing concurrent root into {execution}', [
'execution' => (string) $this
]);
$parent = $this->parentExecution;
$root = new static(UUID::createRandom(), $this->engine, $this->model, $parent);
$root->setActive($active);
$root->variables = $this->variables;
$root->setState(self::STATE_SCOPE, $this->isScope());
if ($parent !== null) {
foreach ($parent->childExecutions as $index => $exec) {
if ($exec === $this) {
unset($parent->childExecutions[$index]);
}
}
}
$this->setParentExecution($root);
$this->setState(self::STATE_CONCURRENT, true);
$this->setState(self::STATE_SCOPE, false);
$this->variables = [];
$this->markModified();
$this->engine->registerExecution($root);
return $root;
} | php | {
"resource": ""
} |
q264822 | Resource.loadMessage | test | public static function loadMessage($messageFile, $packageName = "")
{
if (isset($messageFile) && $messageFile != "") {
// message file location order
// 1. OPENBIZ_APP_MESSAGE_PATH."/".$messageFile
// 2. OPENBIZ_APP_MODULE_PATH . "/$moduleName/message/" . $messageFile;
// 3. CORE_OPENBIZ_APP_MODULE_PATH . "/$moduleName/message/" . $messageFile;
// OPENBIZ_APP_PATH / OPENBIZ_APP_MESSAGE_PATH : OPENBIZ_APP_PATH / messages
if (is_file(OPENBIZ_APP_MESSAGE_PATH . "/" . $messageFile)) {
return parse_ini_file(OPENBIZ_APP_MESSAGE_PATH . "/" . $messageFile);
} else if (is_file(OPENBIZ_APP_MODULE_PATH . "/" . $messageFile)) {
return parse_ini_file(OPENBIZ_APP_MODULE_PATH . "/" . $messageFile);
} else {
if (isset($packageName) && $packageName != "") {
$dirs = explode('.', $packageName);
$moduleName = $dirs[0];
$msgFile = OPENBIZ_APP_MODULE_PATH . "/$moduleName/message/" . $messageFile;
if (is_file($msgFile)) {
return parse_ini_file($msgFile);
} else {
$errmsg = self::getMessage("SYS_ERROR_INVALID_MSGFILE", array($msgFile));
trigger_error($errmsg, E_USER_ERROR);
}
} else {
$errmsg = self::getMessage("SYS_ERROR_INVALID_MSGFILE", array(OPENBIZ_APP_MESSAGE_PATH . "/" . $messageFile));
trigger_error($errmsg, E_USER_ERROR);
}
}
}
return null;
} | php | {
"resource": ""
} |
q264823 | Resource.getMessage | test | public static function getMessage($msgId, $params = array())
{
$message = constant($msgId);
if (isset($message)) {
$message = I18n::t($message, $msgId, 'system');
$result = vsprintf($message, $params);
}
return $result;
} | php | {
"resource": ""
} |
q264824 | Resource.getZendTemplate | test | public static function getZendTemplate()
{
$view = new \Zend_View();
if (defined('SMARTY_TPL_PATH')) {
$view->setScriptPath(SMARTY_TPL_PATH);
}
$theme = Resource::getCurrentTheme();
// load the config file which has the images and css url defined
$view->app_url = OPENBIZ_APP_URL;
$view->app_index = OPENBIZ_APP_INDEX_URL;
$view->js_url = OPENBIZ_JS_URL;
$view->css_url = OPENBIZ_THEME_URL . "/" . $theme . "/css";
$view->resource_url = OPENBIZ_RESOURCE_URL;
$view->theme_js_url = OPENBIZ_THEME_URL . "/" . $theme . "/js";
$view->theme_url = OPENBIZ_THEME_URL . "/" . $theme;
$view->image_url = OPENBIZ_THEME_URL . "/" . $theme . "/images";
$view->lang = strtolower(I18n::getCurrentLangCode());
return $view;
} | php | {
"resource": ""
} |
q264825 | Validator.readableDirectory | test | public static function readableDirectory($value)
{
if (empty($value)) {
throw new \InvalidArgumentException("Empty path given.");
}
if (!is_dir($value)) {
throw new \InvalidArgumentException("Given path is not a regular directory.");
}
if (!is_readable($value)) {
throw new \InvalidArgumentException("Given directory is not readable.");
}
return $value;
} | php | {
"resource": ""
} |
q264826 | Validator.writableDirectory | test | public static function writableDirectory($value)
{
if (empty($value)) {
throw new \InvalidArgumentException("Empty path given.");
}
if (!is_dir($value)) {
throw new \InvalidArgumentException("Given path is not a regular directory.");
}
if (!is_writable($value)) {
throw new \InvalidArgumentException("Given directory is not writable.");
}
return $value;
} | php | {
"resource": ""
} |
q264827 | Validator.writableFile | test | public static function writableFile($value)
{
if (empty($value)) {
throw new \InvalidArgumentException("Empty file path given.");
}
if (!is_file($value)) {
throw new \InvalidArgumentException("Given file path is not a regular file.");
}
if (!is_writable($value)) {
throw new \InvalidArgumentException("Given file is not writable.");
}
return $value;
} | php | {
"resource": ""
} |
q264828 | Validator.readableFile | test | public static function readableFile($value)
{
if (empty($value)) {
throw new \InvalidArgumentException("Empty file path given.");
}
if (!is_file($value)) {
throw new \InvalidArgumentException("Given file path is not a regular file.");
}
if (!is_readable($value)) {
throw new \InvalidArgumentException("Given file is not readable.");
}
return $value;
} | php | {
"resource": ""
} |
q264829 | Validator.validEmail | test | public static function validEmail($value)
{
if (is_object($value) || empty($value)) {
throw new \InvalidArgumentException("Empty email given.");
}
if (!filter_var((string)$value, FILTER_VALIDATE_EMAIL)) {
throw new \InvalidArgumentException("Invalid email address given.");
}
return $value;
} | php | {
"resource": ""
} |
q264830 | Validator.validIp | test | public static function validIp($value)
{
if (empty($value)) {
throw new \InvalidArgumentException("Empty IP address given.");
}
if (!filter_var($value, FILTER_VALIDATE_IP)) {
throw new \InvalidArgumentException("Invalid IP address given.");
}
return $value;
} | php | {
"resource": ""
} |
q264831 | Validator.validIpv4 | test | public static function validIpv4($value)
{
if (empty($value)) {
throw new \InvalidArgumentException("Empty IPv4 address given.");
}
if (!filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
throw new \InvalidArgumentException("Invalid IPv4 address given.");
}
return $value;
} | php | {
"resource": ""
} |
q264832 | Validator.validIpv4NotReserved | test | public static function validIpv4NotReserved($value)
{
if (empty($value)) {
throw new \InvalidArgumentException("Empty IPv4 address given.");
}
if (!filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE)) {
throw new \InvalidArgumentException(
"Invalid IPv4 address given. Reserved ranges like 240.0.0.0/4 are disallowed."
);
}
return $value;
} | php | {
"resource": ""
} |
q264833 | Validator.validIpv6 | test | public static function validIpv6($value)
{
if (empty($value)) {
throw new \InvalidArgumentException("Empty IPv6 address given.");
}
if (!filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
throw new \InvalidArgumentException("Invalid IPv6 address given.");
}
return $value;
} | php | {
"resource": ""
} |
q264834 | ContentElementController.initializeView | test | protected function initializeView(ViewInterface $view) {
$configurationManager = $this->objectManager->get(ConfigurationManager::class);
$data = $configurationManager->getContentObject()->data;
$this->view->assign('data', $data);
} | php | {
"resource": ""
} |
q264835 | PublicReflection.hasAttribute | test | public static function hasAttribute(string $className, string $name): bool
{
return in_array($name, static::attributes($className));
} | php | {
"resource": ""
} |
q264836 | PublicReflection.hasMethod | test | public static function hasMethod(string $className, string $name): bool
{
return in_array($name, static::methods($className));
} | php | {
"resource": ""
} |
q264837 | PublicReflection.getMethodParameters | test | public static function getMethodParameters($instance, string $method)
{
try {
if (! is_callable([$instance, $method])) {
return false;
}
$reflection = static::getReflectionMethod($instance, $method);
if ($reflection instanceof ReflectionMethod === false) {
return false;
}
$params = [];
foreach ($reflection->getParameters() as $param) {
$params[$param->getName()] = $param->isDefaultValueAvailable() ? $param->getDefaultValue() : null;
}
return $params;
} catch (ReflectionException $e) {}
} | php | {
"resource": ""
} |
q264838 | PublicReflection.getReflectionMethod | test | public static function getReflectionMethod($object, string $method)
{
assert(is_object($object));
if (method_exists($object, $method)) {
return new ReflectionMethod($object, $method);
}
// if method does not exist, but it is callable, that means it has a magic caller.
if (! is_callable([$object, $method])) {
return false;
}
// it is not easy to detect each implementation of __call or __callStatic automatically.
foreach (static::$customReflections as $className => $callback) {
if (is_a($object, $className)) {
return $callback($object, $method);
break;
}
}
return false;
} | php | {
"resource": ""
} |
q264839 | ArrayObject.toArray | test | public function toArray(array $fields = [], array $expand = [], $recursive = true)
{
$array = [];
foreach ($this->data as $key => $value) {
if ($recursive && is_array($value)) {
$array[$key] = (new ArrayObject($value))->toArray([], [], $recursive);
} else {
$array[$key] = $value;
}
}
return $array;
} | php | {
"resource": ""
} |
q264840 | AllMySmsProvider.getResponse | test | public function getResponse($recipient, $message)
{
$message = json_encode(array(
'message' => urlencode($message),
'sms' => array($recipient)
));
$fields = array(
'clientcode' => urlencode($this->login),
'passcode' => urlencode($this->password),
'smsData' => urlencode($message),
);
$fieldsString = '';
foreach($fields as $key => $value) {
$fieldsString .= $key.'='.$value.'&';
}
rtrim($fieldsString, '&');
$response = $this->httpClient->post('http://api.msinnovations.com/http/sendSms_v8.php', array(
'body' => $fieldsString
));
return $response->json();
} | php | {
"resource": ""
} |
q264841 | ConsoleErrorRenderer.getBlankLine | test | private function getBlankLine(int $count = null):string
{
$out = "";
for ($i = 0; $i < ($count ?: 1); $i++) {
$out .= $this->getLine('');
}
return $out;
} | php | {
"resource": ""
} |
q264842 | ConsoleErrorRenderer.countTermCols | test | private function countTermCols():int
{
if (!$this->termCols) {
if (!($this->termCols = (int)exec('tput cols'))) {
$this->termCols = 80;
}
}
return $this->termCols;
} | php | {
"resource": ""
} |
q264843 | ConsoleErrorRenderer.getErrorBlock | test | private function getErrorBlock(\Throwable $exception, ?int $linePadding = null):string
{
// Renders the message
$out = $this->getLine(get_class($exception), self::STYLE_BOLD | self::STYLE_ITALIC, $linePadding)
.$this->getLine($exception->getMessage(), null, $linePadding);
// Renders the position
if ($this->options & self::OPT_RENDER_LOCATION) {
$out .= $this->getLine($exception->getFile().':'.$exception->getLine(),
self::STYLE_ITALIC, $linePadding)
.$this->getBlankLine();
}
// Renders the backtrace
if ($this->options & self::OPT_RENDER_BACKTRACE) {
$out .= $this->getLine("Backtrace",
self::STYLE_BOLD | self::STYLE_ITALIC,$linePadding + 2)
.$this->getLine($exception->getTraceAsString(),
self::STYLE_ITALIC, $linePadding + 2);
}
return $out;
} | php | {
"resource": ""
} |
q264844 | ConsoleErrorRenderer.getLine | test | private function getLine(string $content, int $styles = null, int $paddingLength = null):string
{
$termCols = $this->countTermCols();
// title lines
if ($styles & self::STYLE_TITLE || $styles & self::STYLE_SUBTITLE) {
$styles |= self::STYLE_BOLD | self::STYLE_CENTER;
$titleSide = str_pad("", $styles & self::STYLE_TITLE ? 4 : 2, "-");
$content = ($titleSide ? "$titleSide " : "").strtoupper($content).($titleSide ? " $titleSide" : "");
}
// centering
if ($styles & self::STYLE_CENTER && strlen($content) < $termCols) {
$leftPadding = ceil(($termCols - strlen($content)) / 2) + strlen($content);
$content = str_pad(str_pad($content, $leftPadding, " ", STR_PAD_LEFT),
$termCols, " ");
}
// adding padding
$paddedContent = "";
$paddingLength = $paddingLength === null ? 2 : $paddingLength + 2;
$padding = str_pad("", $paddingLength, " ");
$availableCols = $termCols - $paddingLength * 2;
// processing the content by line
foreach (explode("\n", $content) as $contentLine) {
$paddedLine = "";
// processing the content word by word
foreach (explode(" ", $contentLine) as $word) {
if (strlen("$paddedLine $word") >= $availableCols) {
$paddedContent .= (!empty($paddedContent) ? "\n" : "")
.$padding
.str_pad($paddedLine, $availableCols, " ")
.$padding;
$paddedLine = "";
}
$paddedLine .= "$word ";
}
if (!empty($paddedLine)) {
$paddedContent .= (!empty($paddedContent) ? "\n" : "")
.$padding
.str_pad($paddedLine, $availableCols, " ")
.$padding;
}
}
// applying colors
if ($this->options & self::OPT_COLORS && $this->termColor instanceof Color) {
$paddedContent = $this->termColor->bg('red', $this->termColor->apply('white', $paddedContent));
if ($styles & self::STYLE_BOLD) {
$paddedContent = $this->termColor->apply('bold', $paddedContent);
}
if ($styles & self::STYLE_ITALIC) {
$paddedContent = $this->termColor->apply('italic', $paddedContent);
}
}
return "$paddedContent\n";
} | php | {
"resource": ""
} |
q264845 | Arrays.slice | test | public static function slice(array &$array, int $position, $insert): void
{
if (isset($array[$position])) {
array_splice($array, $position, 0, [$insert]);
} else {
$array[$position] = $insert;
}
} | php | {
"resource": ""
} |
q264846 | ValidatorService.setRules | test | protected function setRules($ruleAr)
{
v::with('Amcms\\Services\\ValidatorRules\\');
$vObj = v::initValidator();
if (!is_array($ruleAr)) {
return $vObj;
}
foreach ($ruleAr as $ruleStr) {
$data = explode(':', trim($ruleStr));
switch ($data[0]) {
case 'required':
$vObj->notEmpty();
break;
case 'email':
$vObj->email();
break;
default:
break;
}
}
return $vObj;
} | php | {
"resource": ""
} |
q264847 | PasswordGrant.completeFlow | test | public function completeFlow(ClientEntity $client)
{
$username = $this->server->getRequestHandler()->getParam('username');
if (is_null($username)) {
throw new Exception\InvalidRequestException('username');
}
$password = $this->server->getRequestHandler()->getParam('password');
if (is_null($password)) {
throw new Exception\InvalidRequestException('password');
}
// Check if user's username and password are correct
$userId = call_user_func($this->getVerifyCredentialsCallback(), $username, $password);
if ($userId === false) {
throw new Exception\InvalidCredentialsException();
}
// Validate any scopes that are in the request
$scopeParam = $this->server->getRequestHandler()->getParam('scope');
$scopes = $this->validateScopes($scopeParam, $client);
// Create a new session
$session = new SessionEntity($this->server);
$session->setOwner('user', $userId);
$session->associateClient($client);
// Generate an access token
$accessToken = new AccessTokenEntity($this->server);
$accessToken->setId();
$accessToken->setExpireTime($this->getAccessTokenTTL() + time());
// Associate scopes with the session and access token
foreach ($scopes as $scope) {
$session->associateScope($scope);
}
foreach ($session->getScopes() as $scope) {
$accessToken->associateScope($scope);
}
$this->server->getTokenType()->setSession($session);
$this->server->getTokenType()->setParam('access_token', $accessToken->getId());
$this->server->getTokenType()->setParam('expires_in', $this->getAccessTokenTTL());
// Associate a refresh token if set
if ($this->server->hasGrantType('refresh_token')) {
$refreshToken = new RefreshTokenEntity($this->server);
$refreshToken->setId();
$refreshToken->setExpireTime($this->server->getGrantType('refresh_token')->getRefreshTokenTTL() + time());
$this->server->getTokenType()->setParam('refresh_token', $refreshToken->getId());
}
// Save everything
$session->save();
$accessToken->setSession($session);
$accessToken->save();
if ($this->server->hasGrantType('refresh_token')) {
$refreshToken->setAccessToken($accessToken);
$refreshToken->save();
}
return $this->server->getTokenType()->generateResponse();
} | php | {
"resource": ""
} |
q264848 | ObjectFactory.getObject | test | public function getObject($objectName, $new = 0)
{
if (isset($this->_objectsMap[$objectName]) && $new == 0) {
return $this->_objectsMap[$objectName];
}
$obj = $this->constructObject($objectName);
if (!$obj) {
return null;
}
// save object to cache
$this->_objectsMap[$objectName] = $obj;
if ($new != 1) {
if (method_exists($obj, "loadStatefullVars")) {
$obj->loadStatefullVars(Openbizx::$app->getSessionContext());
}
}
return $obj;
} | php | {
"resource": ""
} |
q264849 | ObjectFactory.createObject | test | public function createObject($objName, &$xmlArr = null)
{
$obj = $this->constructObject($objName, $xmlArr);
return $obj;
} | php | {
"resource": ""
} |
q264850 | ObjectFactory.register | test | public function register($prefix, $path, $ext=null) {
$this->_prefix = $prefix;
$this->_path = $path;
if ($ext == null) {
$this->_ext[] = array('xml');
} else if (is_array($ext)) {
$this->_ext[] = $ext;
} else if (is_string($ext)) {
$ext[] = array($ext);
}
} | php | {
"resource": ""
} |
q264851 | Users.Authenticate | test | public function Authenticate($code, $scope = null)
{
if (!empty($code)) {
$this->AddParams(array(
'code' => $code,
'client_secret' => $this->config['client_secret'],
'grant_type' => 'authorization_code',
'redirect_uri' => $this->config['redirect_uri']
));
return $this->Post($this->config['oauth_token_uri']);
}
} | php | {
"resource": ""
} |
q264852 | Users.Feed | test | public function Feed(Array $params = array())
{
if (!empty($params))
$this->AddParams($params);
return $this->Get($this->buildUrl('self/feed/'));
} | php | {
"resource": ""
} |
q264853 | Users.Liked | test | public function Liked(Array $params = array())
{
if (!empty($params))
$this->AddParams($params);
return $this->Get($this->buildUrl('self/media/liked/'));
} | php | {
"resource": ""
} |
q264854 | Users.SetRelationship | test | protected function SetRelationship($user_id, $action)
{
$this->AddParam('action', $action);
return $this->Post($this->buildUrl($user_id . '/relationship'));
} | php | {
"resource": ""
} |
q264855 | CDatabaseModel.setProperties | test | public function setProperties($properties){
// Update object with incoming values, if any
if(!empty($properties)){
foreach($properties as $key => $val){
$this->$key = $val;
}
}
} | php | {
"resource": ""
} |
q264856 | CDatabaseModel.findAll | test | public function findAll($page = 1, $perPage = 0)
{
$this->db->select()
->from($this->getSource());
if(is_numeric($perPage) && $perPage > 0){
$this->db->limit($perPage);
if(is_numeric($page) && $page > 1){
$offset = $this->paging->getOffset($page, $perPage);
$this->db->offset($offset);
}
}
$this->db->execute();
$this->db->setFetchModeClass(__CLASS__);
return $this->db->fetchAll();
} | php | {
"resource": ""
} |
q264857 | CDatabaseModel.countAll | test | public function countAll(){
$this->db->select('COUNT(id) as countRows')
->from($this->getSource());
$this->db->execute();
$this->db->setFetchModeClass(__CLASS__);
$row = $this->db->fetchOne();
return $row->countRows;
} | php | {
"resource": ""
} |
q264858 | CDatabaseModel.find | test | public function find($id = 0){
$this->db->select()
->from($this->getSource())
->where("id = ?");
$this->db->execute([$id]);
return $this->db->fetchInto($this);
} | php | {
"resource": ""
} |
q264859 | CDatabaseModel.create | test | public function create($values = []){
$keys = array_keys($values);
$values = array_values($values);
$this->db->insert(
$this->getSource(),
$keys
);
$res = $this->db->execute($values);
$this->id = $this->db->lastInsertId();
return $res;
} | php | {
"resource": ""
} |
q264860 | CDatabaseModel.query | test | public function query($columns = "*"){
$this->db->select($columns)
->from($this->getSource());
return $this;
} | php | {
"resource": ""
} |
q264861 | CDatabaseModel.execute | test | public function execute($params = []){
$this->db->execute($this->db->getSQL(), $params);
$this->db->setFetchModeClass(__CLASS__);
return $this->db->fetchAll();
} | php | {
"resource": ""
} |
q264862 | Fluent.canProceed | test | protected function canProceed($name, $args)
{
$condition = $this->condition;
return $condition instanceof \Closure
? $condition($this, $name, ...$args)
: $condition;
} | php | {
"resource": ""
} |
q264863 | SubheadlineLinkViewHelper.createLink | test | protected function createLink($content, $href = '#', $title = null) {
$content = (string) $content;
$href = (string) $href;
$title = (string) $title;
if (empty($title)) {
$title = $content;
}
$link = GeneralUtility::makeInstance('TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder');
$link->setTagName('a');
$link->addAttribute('href', $href);
$link->addAttribute('title', $title);
$link->setContent($content);
return $link;
} | php | {
"resource": ""
} |
q264864 | PickerForm.pickToParent | test | public function pickToParent($recId=null)
{
if ($recId==null || $recId=='')
$recId = Openbizx::$app->getClientProxy()->getFormInputs('_selectedId');
$selIds = Openbizx::$app->getClientProxy()->getFormInputs('row_selections', false);
if ($selIds == null)
$selIds[] = $recId;
// if no parent elem or picker map, call AddToParent
if (!$this->parentFormElemName)
{
$this->addToParent($selIds);
}
// if has parent elem and picker map, call JoinToParent
if ($this->parentFormElemName && $this->pickerMap)
{
$this->joinToParent($selIds);
}
} | php | {
"resource": ""
} |
q264865 | PickerForm._parsePickerMap | test | protected function _parsePickerMap($pickerMap)
{
$returnList = array();
$pickerList = explode(",", $pickerMap);
foreach ($pickerList as $pair)
{
$controlMap = explode(":", $pair);
$controlMap[0] = trim($controlMap[0]);
$controlMap[1] = trim($controlMap[1]);
$returnList[] = $controlMap;
}
return $returnList;
} | php | {
"resource": ""
} |
q264866 | ReflectionClass.convertArrayOfReflectionToSelf | test | private function convertArrayOfReflectionToSelf(array $reflectionClasses): array
{
$return = [];
foreach ($reflectionClasses as $key => $reflectionClass) {
$return[$key] = self::constructFromReflectionClass($reflectionClass);
}
return $return;
} | php | {
"resource": ""
} |
q264867 | BizRecord._initSetup | test | private function _initSetup()
{
unset($this->columnFieldMap);
$this->columnFieldMap = array();
unset($this->keyFieldColumnMap);
$this->keyFieldColumnMap = array();
$i = 0;
// generate column index if the column is one of the basetable (column!="")
foreach ($this->varValue as $key => $field) { // $key is fieldname, $field is fieldobj
////////////////////////////////////////////////////////////////////
// TODO: join fields and nonjoin fields may have same column name
////////////////////////////////////////////////////////////////////
if (isset($field->column) && !isset($field->join) ) { // ignore the joined field column
$this->columnFieldMap[$field->column] = $key;
}
if (isset($field->column) || isset($field->sqlExpression)) {
$field->index = $i++;
}
}
// create key field column map to support composite key
if (isset($this->varValue["Id"]) && $this->varValue["Id"]->column) {
$keycols = explode(",", $this->varValue["Id"]->column);
foreach ($keycols as $col) {
$field = $this->getFieldByColumn($col); // main table
$this->keyFieldColumnMap[$field] = $col;
}
}
} | php | {
"resource": ""
} |
q264868 | BizRecord.getFieldByColumn | test | public function getFieldByColumn($column, $table = null)
{
// TODO: 2 columns can have the same name in case of joined fields
if (isset($this->columnFieldMap[$column])) {
return $this->columnFieldMap[$column];
}
return null;
} | php | {
"resource": ""
} |
q264869 | BizRecord.getKeySearchRule | test | public function getKeySearchRule($isUseOldValue = false, $isUseColumnName = false)
{
$keyFields = $this->getKeyFields();
$retStr = "";
foreach ($keyFields as $fieldName => $fieldObj) {
if ($retStr != "")
$retStr .= " AND ";
$lhs = $isUseColumnName ? $fieldObj->column : "[$fieldName]";
$rhs = $isUseOldValue ? $fieldObj->oldValue : $fieldObj->value;
if ($rhs == "")
$retStr .= "(" . $lhs . "='" . $rhs . "' or " . $lhs . " is null)";
else
$retStr .= $lhs . "='" . $rhs . "'";
}
return $retStr;
} | php | {
"resource": ""
} |
q264870 | BizRecord.setRecordArr | test | public function setRecordArr($recArr)
{
if (!$recArr) {
return;
}
foreach ($this->varValue as $key => $field) {
if ( isset($recArr[$key]) ) {
$recArr[$key] = $field->setValue($recArr[$key]);
}
}
} | php | {
"resource": ""
} |
q264871 | BizRecord.saveOldRecord | test | final public function saveOldRecord(&$inputArr)
{
if (!$inputArr)
return;
foreach ($inputArr as $key => $value) {
$bizField = $this->varValue[$key];
if (!$bizField)
continue;
$bizField->saveOldValue($value);
}
} | php | {
"resource": ""
} |
q264872 | BizRecord.getRecordArr | test | final public function getRecordArr($sqlArr = null)
{
if ($sqlArr) {
$this->_setSqlRecord($sqlArr);
}
$recArr = array();
foreach ($this->varValue as $key => $field) {
if ($field->encrypted == 'Y') {
$svcobj = Openbizx::getService(CRYPT_SERVICE);
$value = $svcobj->decrypt($field->getValue());
$recArr[$key] = $value;
} else {
$recArr[$key] = $field->getValue();
}
}
return $recArr;
} | php | {
"resource": ""
} |
q264873 | BizRecord.convertSqlArrToRecArr | test | public function convertSqlArrToRecArr($sqlArr)
{
$recArr = array();
/* @var $field BizField */
foreach ($this->varValue as $key => $field) {
if ($field->column || $field->sqlExpression) {
$recArr[$key] = $sqlArr[$field->index];
} else {
$recArr[$key] = "";
}
}
return $recArr;
} | php | {
"resource": ""
} |
q264874 | BizRecord._setSqlRecord | test | private function _setSqlRecord($sqlArr)
{
foreach ($this->varValue as $key => $field) {
if ($field->column || $field->sqlExpression) {
$field->setValue($sqlArr[$field->index]);
}
}
if (isset($this->varValue["Id"]))
$this->varValue["Id"]->setValue($this->getKeyValue());
} | php | {
"resource": ""
} |
q264875 | BizRecord.getJoinInputRecord | test | public function getJoinInputRecord($join)
{
$inputFields = $this->inputFields; // Added by Jixian on 2009-02-15 for implement onSaveDataObj
$recArr = array();
foreach ($this->varValue as $key => $value) {
// do not consider joined columns
// Added by Jixian on 2009-02-15 for implement onSaveDataObj
/*
* It's the time to consider about joined columns
*/
$field = $value;
if ($field->join == $join) {
$recArr[$key] = $value;
}
}
return $recArr;
} | php | {
"resource": ""
} |
q264876 | BizRecord.getJoinSearchRule | test | public function getJoinSearchRule($tableJoin, $isUseOldValue = false)
{
$joinFieldName = $this->getFieldByColumn($tableJoin->columnRef, $tableJoin->table);
$joinField = $this->varValue[$joinFieldName];
$rhs = $isUseOldValue ? $joinField->oldValue : $joinField->value;
$retStr = $tableJoin->column . "='" . $rhs . "'";
return $retStr;
} | php | {
"resource": ""
} |
q264877 | CoreRequest.getMethod | test | public function getMethod(): string
{
if (isset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']))
{
return strtoupper($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']);
}
if (isset($_SERVER['REQUEST_METHOD']))
{
return strtoupper($_SERVER['REQUEST_METHOD']);
}
return 'GET';
} | php | {
"resource": ""
} |
q264878 | CoreRequest.getRequestUri | test | public function getRequestUri(): string
{
if (isset($_SERVER['REQUEST_URI']))
{
$requestUri = $_SERVER['REQUEST_URI'];
if ($requestUri!=='' && $requestUri[0]!=='/')
{
$requestUri = preg_replace('/^(http|https):\/\/[^\/]+/i', '', $requestUri);
}
return $requestUri;
}
throw new \LogicException('Unable to resolve requested URI');
} | php | {
"resource": ""
} |
q264879 | AbstractFactory.getOptions | test | public function getOptions(ServiceLocatorInterface $sl, $key, $name = null)
{
if ($name === null) {
$name = $this->getName();
}
$options = $sl->get('Configuration');
$options = $options['doctrine'];
if ($mappingType = $this->getMappingType()) {
$options = $options[$mappingType];
}
$options = isset($options[$key][$name]) ? $options[$key][$name] : null;
if (null === $options) {
throw new RuntimeException(
sprintf(
'Options with name "%s" could not be found in "doctrine.%s".',
$name,
$key
)
);
}
$optionsClass = $this->getOptionsClass();
return new $optionsClass($options);
} | php | {
"resource": ""
} |
q264880 | Singleton.make | test | public function make()
{
if( !$this->instance ){
$this->instance = call_user_func($this->builder);
}
return $this->instance;
} | php | {
"resource": ""
} |
q264881 | AuthorizationServer.issueAccessToken | test | public function issueAccessToken()
{
$grantType = $this->requestHandler->getParam('grant_type');
if (is_null($grantType)) {
throw new Exception\InvalidRequestException('grant_type');
}
// Ensure grant type is one that is recognised and is enabled
if (!in_array($grantType, array_keys($this->grantTypes))) {
throw new Exception\UnsupportedGrantTypeException($grantType);
}
// Complete the flow
return $this->getGrantType($grantType)->grant();
} | php | {
"resource": ""
} |
q264882 | ShellSettingsWriter.format | test | public function format(IReport $report)
{
$output = '';
$params = $this->getParameters();
$file = $params->get('location', 'environaut-config.sh');
$groups = $params->get('groups');
if (is_writable($file)) {
$output .= '<comment>Overwriting</comment> ';
} else {
$output .= 'Writing ';
}
if (empty($groups)) {
$output .= 'all groups ';
} else {
$output .= 'group(s) "' . implode(', ', $groups) . '" ';
}
$output .= 'to file "<comment>' . $file . '</comment>"...';
$default_template = <<<EOT
%settings\$s
EOT;
$template = $params->get('template', $default_template);
$all_settings = $report->getSettingsAsArray($groups);
$grouped_settings = array();
$content = '';
foreach ($all_settings as $setting) {
$name = $this->makeShellVariableName($setting['name'], $setting['group']);
$value = $this->mapValue($setting['value']);
$content .= $name . "='" . $value ."'\n";
}
$content = self::vksprintf($template, array('settings' => $content));
$ok = file_put_contents($file, $content, LOCK_EX);
if ($ok !== false) {
$output .= '<info>ok</info>.';
} else {
$output .= '<error>FAILED</error>.';
}
return $output;
} | php | {
"resource": ""
} |
q264883 | BaseJson.decode | test | public function decode($file)
{
$contents = $this->getFileContents($file);
$result = array();
if ($contents != "") {
$result = json_decode($contents, true);
}
return $result;
} | php | {
"resource": ""
} |
q264884 | TOTPValidator.validate | test | public function validate($totp, $key, $stamp = null)
{
if ($stamp === null) {
$stamp = $this->timeManager->getCurrentStamp();
}
if (!preg_match('/^[0-9]{6}$/', $totp)) {
return false;
}
$totp = intval($totp);
// Search the stamp corresponding to the totp provided
for ($st = $stamp - $this->window; $st <= $stamp + $this->window; ++$st) {
if (($res = TOTPGenerator::generate($st, $key)) == $totp) {
return $st;
}
}
return false;
} | php | {
"resource": ""
} |
q264885 | CommentController.actionIndex | test | public function actionIndex()
{
Url::remember('', 'actions-redirect');
$searchModel = new CommentSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
} | php | {
"resource": ""
} |
q264886 | EditForm._doUpdate | test | protected function _doUpdate($inputRecord, $currentRecord)
{
$dataRec = new DataRecord($currentRecord, $this->getDataObj());
foreach ($inputRecord as $k => $v){
$dataRec[$k] = $v; // or $dataRec->$k = $v;
}
try
{
$dataRec->save();
}
catch (Openbizx\Validation\Exception $e)
{
$errElements = $this->getErrorElements($e->errors);
if(count($e->errors)==count($errElements)){
$this->formHelper->processFormObjError($errElements);
}else{
$errmsg = implode("<br />",$e->errors);
Openbizx::$app->getClientProxy()->showErrorMessage($errmsg);
}
return false;
}
catch (Openbizx\Data\Exception $e)
{
$this->processDataException($e);
return false;
}
$this->activeRecord = null;
$this->getActiveRecord($dataRec["Id"]);
//$this->runEventLog();
return true;
} | php | {
"resource": ""
} |
q264887 | ModxController.execute | test | public function execute($request, $response, $args)
{
$this->request = $request;
$this->response = $response;
// dd($request);
// dd($this->modx->db);
// URL to resource ID
$this->resourceId = $this->dispatchRoute();
if (!$this->resourceId) {
return null;
}
// пока нет БД и кода, всегда возвращаем null
return null;
} | php | {
"resource": ""
} |
q264888 | InvalidArgumentException.implode | test | protected function implode(array $list, string $conjunction = "or")
{
$last = array_pop($list) ?: "null";
if ($list) {
$glue = count($list) > 1 ? ", " : " ";
return implode($glue, $list) . ', ' .$conjunction . ' ' . $last;
}
return $last;
} | php | {
"resource": ""
} |
q264889 | excelService.renderCSV | test | function renderCSV ($objName)
{
$this->render($objName, ",", "csv");
//Log This Export
Openbizx::$app->getLog()->log(LOG_INFO, "ExcelService", "Export CSV file.");
} | php | {
"resource": ""
} |
q264890 | excelService.render | test | protected function render($objName, $separator=",", $ext="csv")
{
ob_end_clean();
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: filename=" . $objName."_".date('Y-m-d') . "." . $ext);
header("Content-Transfer-Encoding: binary");
$dataTable = $this->getDataTable($objName);
foreach ($dataTable as $row)
{
$line = "";
foreach ($row as $cell) {
$txt = $this->strip_cell($cell);
//if (!empty($txt))
//Changed condition from empty()to is_null() to allow null fields from being truncated out when csv generated (cyril ogana 2011-11-11)
//TODO: Need to add condition to leave out fields which have no column name e.g. the first field which has rowcheckboxes?
if (!is_null($txt))
$line .= "\"" . $txt . "\"$separator";
}
$line = rtrim($line, $separator);
$line = iconv("UTF-8","GB2312//IGNORE",$line);
echo rtrim($line) . "\n";
}
} | php | {
"resource": ""
} |
q264891 | excelService.getDataTable | test | protected function getDataTable($objName)
{
/* @var $formObj EasyForm */
$formObj = Openbizx::getObject($objName); // get the existing EasyForm|BizForm object
// if BizForm, call BizForm::renderTable
if ($formObj instanceof BizForm)
{
$dataTable = $formObj->renderTable();
}
// if EasyForm, call EasyForm->DataPanel::renderTable
if ($formObj instanceof EasyForm)
{
$recordSet = $formObj->fetchDataSet();
$dataSet = $formObj->dataPanel->renderTable($recordSet);
foreach ($dataSet['elems'] as $elem)
{
$labelRow[] = $elem['label'];
}
$dataTable = array_merge(array($labelRow), $dataSet['data']);
}
return $dataTable;
} | php | {
"resource": ""
} |
q264892 | BizDataObj_Lite.loadStatefullVars | test | public function loadStatefullVars($sessionContext)
{
if ($this->stateless == "Y")
return;
$sessionContext->loadObjVar($this->objectName, "RecordId", $this->recordId);
$sessionContext->loadObjVar($this->objectName, "SearchRule", $this->searchRule);
$sessionContext->loadObjVar($this->objectName, "SortRule", $this->sortRule);
$sessionContext->loadObjVar($this->objectName, "OtherSqlRule", $this->otherSQLRule);
$sessionContext->loadObjVar($this->objectName, "Association", $this->association);
} | php | {
"resource": ""
} |
q264893 | BizDataObj_Lite.getProperty | test | public function getProperty($propertyName)
{
$ret = parent::getProperty($propertyName);
if ($ret !== null)
return $ret;
// get control object if propertyName is "Control[ctrlname]"
$pos1 = strpos($propertyName, "[");
$pos2 = strpos($propertyName, "]");
if ($pos1 > 0 && $pos2 > $pos1) {
$propType = substr($propertyName, 0, $pos1);
$fieldName = substr($propertyName, $pos1 + 1, $pos2 - $pos1 - 1);
/* if ($propType == "param") { // get parameter
return $this->parameters->get($ctrlname);
} */
return $this->getField($fieldName);
}
} | php | {
"resource": ""
} |
q264894 | BizDataObj_Lite.getActiveRecord | test | public function getActiveRecord()
{
if ($this->recordId == null || $this->recordId == "") {
return null;
}
if ($this->currentRecord == null) {
// query on $recordId
$records = $this->directFetch("[Id]='" . $this->recordId . "'", 1);
if (count($records) == 1) {
$this->currentRecord = $records[0];
$this->recordId = $this->currentRecord["Id"];
} else {
$this->currentRecord = null;
}
}
return $this->currentRecord;
} | php | {
"resource": ""
} |
q264895 | BizDataObj_Lite.setActiveRecordId | test | public function setActiveRecordId($recordId)
{
if ($this->recordId != $recordId) {
$this->recordId = $recordId;
$this->currentRecord = null;
}
} | php | {
"resource": ""
} |
q264896 | BizDataObj_Lite.fetch | test | public function fetch()
{
$dataSet = new DataSet($this);
$this->_fetch4countQuery = null;
$resultSet = $this->_run_search($this->queryLimit); // regular search or page search
if ($resultSet !== null) {
$i = 0;
while ($recArray = $this->_fetch_record($resultSet)) {
$dataSet[$i++] = $recArray;
}
} else {
return null;
}
return $dataSet;
} | php | {
"resource": ""
} |
q264897 | BizDataObj_Lite.directFetch | test | public function directFetch($searchRule = "", $count = -1, $offset = 0, $sortRule = "")
{
//Openbizx::$app->getClientProxy()->showClientAlert(__METHOD__ .'-'. __LINE__ . ' msg: $searchRule : '.$searchRule);
$curRecord = $this->currentRecord;
$recId = $this->recordId;
$this->currentRecord = null;
$oldSearchRule = $this->searchRule;
$this->clearSearchRule();
$this->setSearchRule($searchRule);
$oldSortRule = $this->sortRule;
$this->clearSortRule();
if ($sortRule) {
$this->setSortRule($sortRule);
} else {
$this->setSortRule($this->sortRule);
}
$limit = ($count == -1) ? null : array('count' => $count, 'offset' => $offset);
$dataSet = new DataSet($this);
$resultSet = $this->_run_search($limit);
if ($resultSet !== null) {
$i = 0;
while ($recArray = $this->_fetch_record($resultSet)) {
$dataSet[$i++] = $recArray;
}
}
$this->sortRule = $oldSortRule;
$this->searchRule = $oldSearchRule;
$this->currentRecord = $curRecord;
$this->recordId = $recId;
if (count($dataSet) == 0) {
return new DataSet(null);
}
return $dataSet;
} | php | {
"resource": ""
} |
q264898 | BizDataObj_Lite.fetchRecords | test | public function fetchRecords($searchRule, &$resultRecords, $count = -1, $offset = 0, $clearSearchRule = true, $noAssociation = false)
{
if ($count == 0)
return;
$curRecord = $this->currentRecord;
$recId = $this->recordId;
$oldSearchRule = $this->searchRule;
$this->currentRecord = null;
if ($clearSearchRule)
$this->clearSearchRule();
$this->setSearchRule($searchRule);
if ($noAssociation) {
$oldAssociation = $this->association;
$this->association = null;
}
$limit = ($count == -1) ? null : array('count' => $count, 'offset' => $offset);
$resultRecords = array();
$resultSet = $this->_run_search($limit);
if ($resultSet !== null) {
while ($recArray = $this->_fetch_record($resultSet)) {
$resultRecords[] = $recArray;
}
}
if ($noAssociation) {
$this->association = $oldAssociation;
}
$this->searchRule = $oldSearchRule;
$this->currentRecord = $curRecord;
$this->recordId = $recId;
return true;
} | php | {
"resource": ""
} |
q264899 | BizDataObj_Lite.count | test | public function count()
{
// get database connection
$db = $this->getDBConnection("READ");
if ($this->_fetch4countQuery) {
$querySQL = $this->_fetch4countQuery;
} else {
$querySQL = $this->getSQLHelper()->buildQuerySQL($this);
}
$this->_fetch4countQuery = null;
return $this->_getNumberRecords($db, $querySQL);
} | php | {
"resource": ""
} |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.