_id
stringlengths 2
7
| title
stringlengths 3
151
| partition
stringclasses 3
values | text
stringlengths 83
13k
| language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
q265200 | Element.getText | test | protected function getText()
{
if ($this->text == null)
return null;
$formobj = $this->getFormObj();
return Expression::evaluateExpression($this->text, $formobj);
} | php | {
"resource": ""
} |
q265201 | Element.getSCKeyFuncMap | test | public function getSCKeyFuncMap()
{
if (!$this->canDisplayed()) return null;
$map = array();
/**
* @todo need to remove, not used (mr_a_ton)
*/
//$formObj = $this->getFormObj(); // not used
if ($this->eventHandlers == null)
return null;
foreach ($this->eventHandlers as $eventHandler)
{
if ($eventHandler->shortcutKey)
{
$map[$eventHandler->shortcutKey] = $eventHandler->getFormedFunction();
}
}
return $map;
} | php | {
"resource": ""
} |
q265202 | Element.getContextMenu | test | public function getContextMenu()
{
if (!$this->canDisplayed()) return null;
$menus = array();
$formObj = $this->getFormObj();
if ($this->eventHandlers == null)
return null;
$i = 0;
foreach ($this->eventHandlers as $eventHandler)
{
if ($eventHandler->contextMenu)
{
$menus[$i]['text'] = $eventHandler->contextMenu;
$menus[$i]['func'] = $eventHandler->getFormedFunction();
$menus[$i]['key'] = $eventHandler->shortcutKey;
}
$i++;
}
return $menus;
} | php | {
"resource": ""
} |
q265203 | Element.getFunction | test | protected function getFunction()
{
$events = $this->getEvents();
foreach ($events as $event=>$function){
if(is_array($function)){
foreach($function as $f){
$function_str.=$f.";";
}
$func .= " $event=\"$function_str\"";
}else{
$func .= " $event=\"$function\"";
}
}
return $func;
} | php | {
"resource": ""
} |
q265204 | Element.getRedirectPage | test | public function getRedirectPage($eventHandlerName)
{
$formObj = $this->getFormObj();
$eventHandler = $this->eventHandlers->get($eventHandlerName);
if (!$eventHandler) return null;
//echo $evthandler->redirectPage."<br>";
return Expression::evaluateExpression($eventHandler->redirectPage, $formObj);
} | php | {
"resource": ""
} |
q265205 | Element.getFunctionType | test | public function getFunctionType($eventHandlerName)
{
$eventHandler = $this->eventHandlers->get($eventHandlerName);
if (!$eventHandler) return null;
return $eventHandler->functionType;
} | php | {
"resource": ""
} |
q265206 | EventHandler.setFormName | test | public function setFormName($formName, $elemName)
{
$this->_formName = $formName;
$this->_elemName = $elemName;
if (strpos($this->function, "js:")===0)
return;
// if no class name, add default class name. i.e. NewRecord => ObjName.NewRecord
if ($this->function)
{
$pos_dot = strpos($this->function, ".");
$pos_lpt = strpos($this->function, "(");
if (!$pos_dot || $pos_lpt < $pos_dot)
$this->function = $this->_formName.".".$this->function;
}
$this->translate(); // translate for multi-language support
} | php | {
"resource": ""
} |
q265207 | EventHandler.adjustFormName | test | public function adjustFormName($formName)
{
$this->_formName = $formName;
// if no class name, add default class name. i.e. NewRecord => ObjName.NewRecord
if ($this->function)
{
if(strtolower(substr($this->function,0,3))!='js:'){
$pos0 = strpos($this->function, "(");
$len = strlen($this->function);
if ($pos0 > 0)
$pos = strrpos($this->function, ".", $pos0-$len);
else
$pos = strrpos($this->function, ".");
if ($pos > 0)
$this->function = $this->_formName.".".substr($this->function, $pos+1);
}
}
} | php | {
"resource": ""
} |
q265208 | EventHandler.getFormedFunction | test | public function getFormedFunction()
{
//return $this->getInvokeAction();
$name = $this->_elemName;
$ehName = $this->objectName;
$formobj = Openbizx::getObject($this->_formName);
if ($this->formedFunction)
{
return $this->formedFunction;
}
if (!$this->formedFunction || $isDataPanelElement==true)
{
// add direct URL support
if ($this->url)
{
$_func = "loadPage('" . $this->url . "');";
$_func = Expression::evaluateExpression($_func, $formobj);
}
else if (strpos($this->function, "js:") === 0)
{
$_func = substr($this->function, 3).";";
$_func = Expression::evaluateExpression($_func, $formobj);
}
else
{
//$temp = ($this->functionType==null) ? "" : ",'".$this->functionType."'";
//$_func = "SetOnElement('$name:$ehName'); $selectRecord CallFunction('" . $this->function . "'$temp);";
//$_func = "Openbizx.CallFunction('" . $this->function . "'$temp);";
$_func = Expression::evaluateExpression($this->function, $formobj);
$options = "{'type':'$this->functionType','target':'','evthdl':'$name:$ehName'}";
$_func = "Openbizx.CallFunction('$_func',$options);";
}
$this->formedFunction = $_func;
}
return $this->formedFunction;
} | php | {
"resource": ""
} |
q265209 | EventHandler.parseFunction | test | public function parseFunction($funcString)
{
$pos = strpos($funcString, "(");
$pos1 = strpos($funcString, ")");
if ($pos>0 && $pos1>$pos)
{
$funcName = substr($funcString,0,$pos);
$funcParams = substr($funcString,$pos+1,$pos1-$pos-1);
return array($funcName, $funcParams);
}
return null;
} | php | {
"resource": ""
} |
q265210 | Caller.call | test | public function call($method, array &$arguments = [])
{
try {
// alias for code readability
$middle = &$this->middleware;
if ($middle instanceof MiddlewareInterface) {
assert(is_string($method));
$middle->method($method);
if (is_object($this->result)) {
$middle->as($this->result);
}
$this->result = $middle->handle($arguments, $this->type);
} elseif (is_callable($middle)) {
$callback = $middle;
$this->result = $callback($method, ...$arguments);
} elseif (is_array($middle) || $middle instanceof MiddlewareCollection) {
assert(is_string($method));
$this->result = Group::wrap($middle)->call($method, $arguments, $this->type, $this->result);
}
$this->called = true;
} catch (HaltPropagationException $exception) {
$this->halt($exception);
}
return $this->result;
} | php | {
"resource": ""
} |
q265211 | Caller.clear | test | public function clear()
{
$this->result = null;
$this->middleware = new Group;
$this->called = false;
return $this;
} | php | {
"resource": ""
} |
q265212 | Caller.halt | test | public function halt(HaltPropagationException $exception = null)
{
if ($this->haltEvent !== "") {
$pointer = $this->middleware instanceof MiddlewareCollection ? $this->middleware->current() : $this->middleware;
$event = $this->haltEvent;
if (is_callable(static::$eventCallable)) {
static::$eventCallable(new $event($pointer, $exception));
}
}
if ($exception !== null && ! $this->catchHalt) {
throw $exception;
}
return $this;
} | php | {
"resource": ""
} |
q265213 | Caller.reset | test | public function reset()
{
$this->clear();
$this->called = false;
$this->catchHalt = true;
$this->haltEvent = MiddlewareHalted::class;
return $this;
} | php | {
"resource": ""
} |
q265214 | ObjectCreator.create | test | public function create($elementName, Project $project, $creatingClass) {
$typedefs = $project->getDataTypeDefinitions();
if(array_key_exists($elementName, $typedefs) && class_exists($typedefs[$elementName])) {
$object = new $typedefs[$elementName];
foreach($this->getAfterCreationCallbacksForClass($creatingClass) as $callback) {
call_user_func($callback, $object, $elementName);
}
return $object;
}
throw new MissingConfigurationException(sprintf('No class or class definition found for %s', $elementName) . PHP_EOL . sprintf('Defintions: %s', print_r($typedefs)));
} | php | {
"resource": ""
} |
q265215 | HOTP.counterToString | test | protected function counterToString($counter)
{
$tmp = "";
while ($counter != 0) {
$tmp .= chr($counter & 0xff);
$counter >>= 8;
}
return substr(str_pad(strrev($tmp), 8, "\0", STR_PAD_LEFT), 0, 8);
} | php | {
"resource": ""
} |
q265216 | Request.Get | test | public function Get($url = null, $params = array())
{
if (null !== $url)
$this->url = $url;
if (!empty($params))
$this->parameters = $params;
$query = '';
foreach ($this->parameters as $k => $v)
$query .= ((strlen ($query) == 0) ? '?' : '&') . sprintf('%s=%s', $k, $v);
$response = $this->GetResponse();
$this->response = $response;
return $this;
} | php | {
"resource": ""
} |
q265217 | Request.Post | test | public function Post($url = null, $params = array())
{
if (null !== $url)
$this->url = $url;
if (!empty($params))
$this->parameters = $params;
$this->response = $this->GetResponse('POST');
return $this;
} | php | {
"resource": ""
} |
q265218 | Request.GetResponse | test | private function GetResponse($method = 'GET')
{
//-- since there's no option to use anything other curl, this check is kinda useless
//-- I had high hopes with this one using sockets and whatnot, but alas, time is of
//-- the essence... in internet time
if ($this->useCurl) {
$response = new Response;
$http = WebRequest::Instance($this->config);
$res = $http->Create($this->url, $method, $this->parameters);
if ($res instanceof Error)
return $res;
$response->info = $res->Info;
$response->json = $res->Content;
$response = Response::Create($this, $response);
return $response;
}
} | php | {
"resource": ""
} |
q265219 | Request.WillFollowRedirects | test | private function WillFollowRedirects()
{
$open_basedir = ini_get('open_basedir');
$safe_mode = strtolower(ini_get('safe_mode'));
if (empty($open_basedir) && $safe_mode == 'off') {
return true;
}
return false;
} | php | {
"resource": ""
} |
q265220 | securityRule_Abstract.checkEffectiveTime | test | public function checkEffectiveTime()
{
sscanf( $this->effectiveTime, "%2d%2d-%2d%2d",
$start_hour, $start_min,
$end_hour, $end_min
);
$startTime = strtotime(date("Y-m-d ").$start_hour.":".$start_min) ? strtotime(date("Y-m-d ").$start_hour.":".$start_min) : strtotime(date("Y-m-d 00:00"));
$endTime = strtotime(date("Y-m-d ").$end_hour.":".$end_min) ? strtotime(date("Y-m-d ").$end_hour.":".$end_min) : strtotime(date("Y-m-d 23:59:59"));
$nowTime = time();
if($startTime>0 && $endTime>0)
{
//auto convert start time and end time
if($endTime < $startTime)
{
$tmpTime = $startTime;
$startTime = $endTime;
$endTime = $tmpTime;
}
if($startTime < $nowTime && $nowTime < $endTime )
{
return true;
}
else
{
return false;
}
}
} | php | {
"resource": ""
} |
q265221 | String.parseStr | test | public static function parseStr( $mixed ) {
return is_array($mixed) ? array_map([self, 'parse_str'], $mixed) : self::parse_str($mixed);
} | php | {
"resource": ""
} |
q265222 | String.parse_str | test | private static function parse_str( $str ) {
$output = [];
if (function_exists('mb_parse_str') && !isset($this->env['slim.tests.ignore_multibyte'])) {
mb_parse_str($str, $output);
} else {
parse_str($str, $output);
}
return $output;
} | php | {
"resource": ""
} |
q265223 | FormRenderer.render | test | static public function render($formObj)
{
$tplEngine = $formObj->templateEngine;
$tplAttributes = FormRenderer::buildTemplateAttributes($formObj);
if (isset($formObj->jsClass)) {
$subForms = ($formObj->subForms) ? implode(";", $formObj->subForms) : "";
if ($formObj->staticOutput != true) {
$formScript = "\n<script>Openbizx.newFormObject('$formObj->objectName','$formObj->jsClass','$subForms'); </script>\n";
}
if ($formObj->autoRefresh > 0) {
$formScript .= "\n<script>setTimeout(\"Openbizx.CallFunction('$formObj->objectName.UpdateForm()');\",\"" . ($formObj->autoRefresh * 1000) . "\") </script>\n";
}
}
if ($tplEngine == "Smarty" || $tplEngine == null) {
return FormRenderer::renderSmarty($formObj, $tplAttributes) . $formScript;
} else
return FormRenderer::renderPHP($formObj, $tplAttributes) . $formScript;
} | php | {
"resource": ""
} |
q265224 | FormRenderer.renderSmarty | test | static protected function renderSmarty($formObj, $tplAttributes = Array())
{
$smarty = TemplateHelper::getSmartyTemplate();
$tplFile = TemplateHelper::getTplFileWithPath($formObj->templateFile, $formObj->package);
//Translate Array of template variables to \Zend template object
foreach ($tplAttributes as $key => $value) {
$smarty->assign($key, $value);
};
return $smarty->fetch($tplFile);
} | php | {
"resource": ""
} |
q265225 | FormRenderer.renderPHP | test | static protected function renderPHP($formObj, $tplAttributes = Array())
{
$form = TemplateHelper::getZendTemplate();
$tplFile = TemplateHelper::getTplFileWithPath($formObj->templateFile, $formObj->package);
$form->addScriptPath(dirname($tplFile));
/* $formOutput = $formObj->outputAttrs();
foreach ($formOutput as $k=>$v) {
$form->$k = $v;
} */
foreach ($tplAttributes as $key => $value) {
if ($value == NULL) {
$form->$key = '';
} else {
$form->$key = $value;
}
}
// render the formobj attributes
//$form->form = $formOutput;
return $form->render($formObj->templateFile);
} | php | {
"resource": ""
} |
q265226 | CrudController.view | test | public function view(Request $request)
{
$this->request = $request;
$entity = $this->findEntity($request);
$this->authorizeView($request, $entity);
return $this->createViewEntityResponse($entity);
} | php | {
"resource": ""
} |
q265227 | CrudController.store | test | public function store(Request $request)
{
$this->request = $request;
$this->authorizeCreate($request);
$writeContext = $this->getContext(Action::CREATE);
$inputResource = $this->bodyToResource($writeContext);
try {
$inputResource->validate($writeContext);
} catch (ResourceValidationException $e) {
return $this->getValidationErrorResponse($e);
}
$entity = $this->toEntity($inputResource, $writeContext);
// Save the entity
$this->saveEntity($request, $entity);
// Turn back into a resource
return $this->createViewEntityResponse($entity);
} | php | {
"resource": ""
} |
q265228 | CrudController.callEntityMethod | test | protected function callEntityMethod(Request $request, $method)
{
// We don't want to include the first argument.
$args = func_get_args();
array_shift($args);
array_shift($args);
return call_user_func_array([ $this->getEntityClassName(), $method ], $args);
} | php | {
"resource": ""
} |
q265229 | Controller.middleware | test | public function middleware(string $key, string $group = null)
{
return $this->middleMan->middle($key, $group);
} | php | {
"resource": ""
} |
q265230 | Application.getDefaultCommands | test | protected function getDefaultCommands()
{
$commands = parent::getDefaultCommands();
$commands[] = new Command\AboutCommand();
$commands[] = new Command\CheckCommand();
return $commands;
} | php | {
"resource": ""
} |
q265231 | UserManager.updateUser | test | public function updateUser(UserInterface $user, $andFlush = true)
{
/** @var EntityManager $em */
$em = $this->objectManager;
$meta = $em->getClassMetadata(get_class($user));
$roleClass = $meta->getAssociationTargetClass('roles');
$roles = array();
foreach ($user->getRoles() as $role) {
if ($roleClass !== get_class($role)) {
/** Try to get Role */
if ($em->find($roleClass, $role->getRole())) {
try {
$_ref = $em->getReference($roleClass, $role->getRole());
$roles[] = $_ref;
} catch (ORMException $e) {
var_dump($e);
}
}else{
$_ref = new $roleClass($role->getRole());
$em->persist($_ref);
$roles[] = $_ref;
}
}else{
$roles[] = $role;
}
}
$user->setRoles($roles);
parent::updateUser($user, $andFlush);
} | php | {
"resource": ""
} |
q265232 | ExtensionService.getSettings | test | protected function getSettings(): array {
$configurationManager = $this->objectManager->get(ConfigurationManagerInterface::class);
$configuration = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
return $configuration['plugin.']['tx_t3vcontent.']['settings.'];
} | php | {
"resource": ""
} |
q265233 | Group.getGroup | test | public function getGroup()
{
/** @var null|Person $person */
if (is_null($this->regid) === true) {
try {
$resp = static::getGroupConnection()->execGET(
$this->identifier
);
} catch (\Exception $e) {
throw $e;
}
$this->parseGroup($resp->getData());
}
return $this;
} | php | {
"resource": ""
} |
q265234 | Group.getDirectMembership | test | protected function getDirectMembership()
{
if (isset($this->regid) === false) {
$this->getGroup();
}
if (is_null($this->regid) === true) {
throw new \Exception('Group Id not specified');
}
$resp = static::getGroupConnection()->execGET(
"$this->identifier/member"
);
$this->directmembers = [];
$this->parseMembership($resp->getData());
} | php | {
"resource": ""
} |
q265235 | Group.getEffectiveMembership | test | protected function getEffectiveMembership()
{
if (isset($this->regid) === false) {
$this->getGroup();
}
if (is_null($this->regid) === true) {
throw new \Exception('Group Id not specified');
}
try {
$resp = static::getGroupConnection()->execGET(
"$this->identifier/effective_member"
);
} catch (\Exception $e) {
throw $e;
}
$this->effectivemembers = [];
$this->parseMembership($resp->getData());
} | php | {
"resource": ""
} |
q265236 | Group.parseMembership | test | protected function parseMembership($data)
{
$html = HtmlDomParser::str_get_html($data);
foreach ($html->find('a.member') as $name) {
array_push($this->directmembers, $name->innertext);
}
foreach ($html->find('a.effective_member') as $name) {
array_push($this->effectivemembers, $name->innertext);
}
} | php | {
"resource": ""
} |
q265237 | Group.parseHistory | test | protected function parseHistory($data)
{
$this->history = [];
$html = HtmlDomParser::str_get_html($data);
foreach ($html->find('li.history') as $e) {
$item = array();
$item['date'] = $e->date;
$item['user'] = $e->user;
$item['actas'] = $e->actas;
$item['activity'] = $e->activity;
$item['description'] = $e->description;
array_push($this->history, $item);
}
} | php | {
"resource": ""
} |
q265238 | Group.parseAffiliate | test | protected function parseAffiliate($data)
{
$html = HtmlDomParser::str_get_html($data);
$affiliate['group_identifier'] = (empty($html->find('span.identifier', 0)) === false)
? ($html->find('span.identifier', 0)->innertext)
: ('');
$affiliate['affiliate_name'] = (empty($html->find('span.affiliate', 0)) === false)
? ($html->find('span.affiliate', 0)->name)
: ('');
$affiliate['affiliate_status'] = (empty($html->find('span.affiliate', 0)) === false)
? ($html->find('span.affiliate', 0)->status)
: ('');
$affiliate['error'] = (empty($html->find('span.error', 0)) === false)
? ($html->find('span.error', 0)->innertext)
: ('');
if ($html->find('span.error', 0) === true) {
} else {
$this->affiliates[$affiliate['affiliate_name']] = $affiliate;
}
return $affiliate;
} | php | {
"resource": ""
} |
q265239 | Group.parseSearch | test | protected function parseSearch($data)
{
$html = HtmlDomParser::str_get_html($data);
$groups = array();
foreach ($html->find('li.groupreference') as $e) {
$item = array();
$item['regid'] = $e->find('span.regid', 0)->innertext;
$item['title'] = $e->find('span.title', 0)->innertext;
$item['description'] = $e->find('span.description', 0)->innertext;
array_push($groups, $item);
}
return $groups;
} | php | {
"resource": ""
} |
q265240 | BaseForm.getWebpageObject | test | public function getWebpageObject()
{
$viewName = Openbizx::$app->getCurrentViewName();
if (!$viewName) {
return null;
}
$viewObj = Openbizx::getObject($viewName);
return $viewObj;
} | php | {
"resource": ""
} |
q265241 | BaseForm.getElement | test | public function getElement($elementName)
{
if ($this->dataPanel->get($elementName)) {
return $this->dataPanel->get($elementName);
}
if ($this->actionPanel->get($elementName)) {
return $this->actionPanel->get($elementName);
}
if ($this->navPanel->get($elementName)) {
return $this->navPanel->get($elementName);
}
if ($this->searchPanel->get($elementName)) {
return $this->searchPanel->get($elementName);
}
if ($this->wizardPanel) {
if ($this->wizardPanel->get($elementName))
return $this->wizardPanel->get($elementName);
}
} | php | {
"resource": ""
} |
q265242 | BaseForm.getErrorElements | test | public function getErrorElements($fields)
{
$errElements = array();
foreach ($fields as $field => $error) {
$element = $this->dataPanel->getByField($field);
$errElements[$element->objectName] = $error;
}
return $errElements;
} | php | {
"resource": ""
} |
q265243 | BaseForm.rerenderSubForms | test | protected function rerenderSubForms()
{
if (!$this->subForms) {
return;
}
$this->prepareSubFormsDataObj();
foreach ($this->subForms as $subForm) {
$formObj = Openbizx::getObject($subForm);
$formObj->rerender();
}
return;
} | php | {
"resource": ""
} |
q265244 | Bundle.setClass | test | public function setClass($class)
{
preg_match('/\\\([\w]+Bundle)$/', $class, $match);
if (empty($match[1])) {
throw new InvalidJsonParameterException(sprintf("The class %s does not seem to be a valid bundle class. Check your autoloader.json file", $class));
}
$this->name = basename($match[1]);
$this->class = $class;
return $this;
} | php | {
"resource": ""
} |
q265245 | Dictionary.getTranslationKey | test | public function getTranslationKey($key): string
{
return sprintf('%s.%s', $this->prefix, kebab_case($this->get($key)));
} | php | {
"resource": ""
} |
q265246 | Dictionary.lists | test | public function lists(): array
{
$data = [];
foreach (array_keys($this->words) as $key) {
$data[$key] = $this->trans($key);
}
return $data;
} | php | {
"resource": ""
} |
q265247 | cacheService.loadConfig | test | private function loadConfig(&$configs, &$options)
{
foreach ($configs as $config) {
$value_up = strtoupper($config["ATTRIBUTES"]["VALUE"]);
if ($value_up == "Y") {
$config["ATTRIBUTES"]["VALUE"] = true;
} elseif ($value_up == "N") {
$config["ATTRIBUTES"]["VALUE"] = false;
}
$options[$config["ATTRIBUTES"]["NAME"]] = $config["ATTRIBUTES"]["VALUE"];
if ($config["ATTRIBUTES"]["NAME"] == 'cache_dir') {
$options[$config["ATTRIBUTES"]["NAME"]] = OPENBIZ_CACHE_PATH . "/" . $config["ATTRIBUTES"]["VALUE"];
}
}
} | php | {
"resource": ""
} |
q265248 | cacheService.remove | test | public function remove($id)
{
if ($this->cacheObj && strtoupper($this->cache) == "ENABLED") {
return $this->cacheObj->remove($id);
} else {
return false;
}
} | php | {
"resource": ""
} |
q265249 | cacheService.getIds | test | public function getIds()
{
if ($this->cacheObj && strtoupper($this->cache) == "ENABLED") {
return $this->cacheObj->getIds();
} else {
return false;
}
} | php | {
"resource": ""
} |
q265250 | cacheService.cleanAll | test | public function cleanAll()
{
if ($this->cacheObj && strtoupper($this->cache) == "ENABLED") {
return $this->cacheObj->clean(\Zend_Cache::CLEANING_MODE_ALL);
} else {
return false;
}
} | php | {
"resource": ""
} |
q265251 | cacheService._makeDirectory | test | private function _makeDirectory($pathName, $mode)
{
is_dir(dirname($pathName)) || $this->_makeDirectory(dirname($pathName), $mode);
return is_dir($pathName) || @mkdir($pathName, $mode);
} | php | {
"resource": ""
} |
q265252 | ConfigHandler.readLocation | test | protected function readLocation($location)
{
$reader = null;
if (is_dir($location)) {
$base_location = Validator::fixPath(Validator::fixRelativePath($location));
foreach ($this->default_filenames as $filename) {
$file = $base_location . $filename;
if (is_readable($file)) {
try {
$reader = $this->getReaderByExtension($file);
break; // found possible config file \o/
} catch (\InvalidArgumentException $e) {
// next attempt as extension has no handler
}
}
// next attempt, as file is not readable or does not exist
}
if (!$reader instanceof IConfigReader) {
throw new \InvalidArgumentException(
'Could not find an environaut config file in "' . $base_location . '".' . PHP_EOL .
'Attempted files were: ' . implode(', ', $this->default_filenames) . '.' . PHP_EOL .
'Try calling from a different folder or specify a file using the "--config" option.'
);
}
} elseif (is_file($location)) {
$reader = $this->getReaderByExtension($location);
} else {
throw new \InvalidArgumentException(
'Currently only regular files and directories are supported for config file reading.'
);
}
$config_data = $reader->getConfigData($location);
return $config_data;
} | php | {
"resource": ""
} |
q265253 | ConfigHandler.getReaderByExtension | test | protected function getReaderByExtension($location)
{
$ext = pathinfo($location, PATHINFO_EXTENSION);
$reader = null;
switch ($ext) {
case 'json':
$reader = new JsonConfigReader();
break;
case 'xml':
$reader = new XmlConfigReader();
break;
case 'php':
$reader = new PhpConfigReader();
break;
default:
throw new \InvalidArgumentException(
'File could not be read: ' . $location . PHP_EOL .
'Supported config file extensions are: ' . implode(', ', $this->supported_file_extensions)
);
break;
}
return $reader;
} | php | {
"resource": ""
} |
q265254 | RouteBranch.addBranch | test | protected function addBranch(string $key): RouteBranch
{
if( array_key_exists($key, $this->branches) ){
throw new \Exception("{$key} branch already exists for this node.");
}
$this->branches[$key] = new RouteBranch("{$this->path}/{$key}");
return $this->branches[$key];
} | php | {
"resource": ""
} |
q265255 | RouteBranch.addRoute | test | public function addRoute(Route $route): void
{
foreach( $route->getMethods() as $method ){
if( array_key_exists($method, $this->routes) ){
throw new \Exception("{$method}#{$this->path} route has already been defined.");
}
$this->routes[$method] = $route;
}
} | php | {
"resource": ""
} |
q265256 | RouteBranch.findBranch | test | public function findBranch(string $part): ?RouteBranch
{
// Try finding an exact match first.
if( array_key_exists($part, $this->branches) ){
return $this->branches[$part];
}
// Loop through each branch key and match it using a regex.
foreach( $this->branches as $key => $branch ){
if( preg_match("/^{$key}$/", $part) ){
return $branch;
}
}
return null;
} | php | {
"resource": ""
} |
q265257 | RouteBranch.next | test | public function next(string $uriPart): RouteBranch
{
foreach( $this->branches as $key => $branch ){
if( $uriPart === $key ){
return $branch;
}
}
return $this->addBranch($uriPart);
} | php | {
"resource": ""
} |
q265258 | CommentRepository.findByIssue | test | public function findByIssue(
IssueInterface $issue,
\DateTime $createdAt = null,
$writtenBy = null,
$limit = null,
$offset = null
) {
$queryBuilder = $this->getQueryBuilder();
if ($createdAt instanceof \DateTime) {
$this->addCriteria($queryBuilder, ['between' => ['createdAt' => $createdAt]]);
}
if ($writtenBy !== null) {
$this->addCriteria($queryBuilder, ['wb.email' => $writtenBy]);
}
$this->addCriteria($queryBuilder, ['issue' => $issue]);
$this->orderBy($queryBuilder, ['createdAt' => 'ASC']);
if ($limit) {
$queryBuilder->setMaxResults($limit);
}
if ($offset) {
$queryBuilder->setFirstResult($offset);
}
return $queryBuilder->getQuery()->getResult();
} | php | {
"resource": ""
} |
q265259 | Wordpress.getWPContents | test | protected function getWPContents($type = 'posts', $multiple = false, $options = [], $post_id = 0, $value = '')
{
// Access WordPress contents
$wpcontents = [];
// Exclude current item
if (isset($options['exclude']) && 'current' === $options['exclude']) {
$options['exclude'] = $post;
}
// Get asked contents
$authorized = [
'categories', 'category',
'menus', 'menu',
'pages', 'page',
'posts', 'post',
'posttypes', 'posttype',
'tags', 'tag',
'taxonomies', 'taxonomy',
'terms', 'term'
];
// Check contents
if (!in_array($type, $authorized)) {
return [];
}
// Data retrieved
if (in_array($type, ['categories', 'category'])) {
$wptype = 'Categories';
} else if (in_array($type, ['menus', 'menu'])) {
$wptype = 'Menus';
} else if (in_array($type, ['pages', 'page'])) {
$wptype = 'Pages';
} else if (in_array($type, ['posts', 'post'])) {
$wptype = 'Posts';
} else if (in_array($type, ['posttypes', 'posttype'])) {
$wptype = 'Posttypes';
} else if (in_array($type, ['tags', 'tag'])) {
$wptype = 'Tags';
} else if (in_array($type, ['taxonomies', 'taxonomy'])) {
$wptype = 'Taxonomies';
} else {
$wptype = 'Terms';
}
// Get contents
$function = 'getWP'.$wptype;
$wpcontents = $this->$function($options, $value);
// Return value
return $wpcontents;
} | php | {
"resource": ""
} |
q265260 | Wordpress.getWPCategories | test | protected function getWPCategories($options = [], $value = 'cat_ID')
{
// Build contents
$contents = [];
$contents[-1] = Translate::t('wordpress.choose.category', [], 'wordpressfield');
// Build options
$args = array_merge([
'hide_empty' => 0,
'orderby' => 'name',
'order' => 'ASC',
'parent' => 0,
], $options);
// Build request
$categories_obj = get_categories($args);
// Iterate on categories
if (!empty($categories_obj)) {
foreach ($categories_obj as $cat) {
// For Wordpress version < 3.0
if (empty($cat->cat_ID)) {
continue;
}
// Check value
$item = !empty($value) && isset($cat->$value) ? $cat->$value : $cat->cat_ID;
// Get the id and the name
$contents[0][$item] = $cat->cat_name;
// Get children
$contents = $this->getWPSubCategories($contents, $cat->cat_ID, $value);
}
}
// Return all values in a well formatted way
return $contents;
} | php | {
"resource": ""
} |
q265261 | Wordpress.getWPMenus | test | protected function getWPMenus($options = [], $value = 'term_id')
{
// Build contents
$contents = [];
$contents[-1] = Translate::t('wordpress.choose.menu', [], 'wordpressfield');
// Build options
$args = array_merge([
'hide_empty' => false,
'orderby' => 'none'
], $options);
// Build request
$menus_obj = wp_get_nav_menus($args);
// Iterate on menus
if (!empty($menus_obj)) {
foreach ($menus_obj as $menu) {
// For Wordpress version < 3.0
if (empty($menu->term_id)) {
continue;
}
// Check value
$item = !empty($value) && isset($menu->$value) ? $menu->$value : $menu->term_id;
// Get the id and the name
$contents[0][$item] = $menu->name;
}
}
// Return all values in a well formatted way
return $contents;
} | php | {
"resource": ""
} |
q265262 | Wordpress.getWPPages | test | protected function getWPPages($options = [], $value = 'ID')
{
// Build contents
$contents = [];
$contents[-1] = Translate::t('wordpress.choose.page', [], 'wordpressfield');
// Build options
$args = array_merge([
'sort_column' => 'post_parent,menu_order'
], $options);
// Build request
$pages_obj = get_pages($args);
// Iterate on pages
if (!empty($pages_obj)) {
foreach ($pages_obj as $pag) {
// For Wordpress version < 3.0
if (empty($pag->ID)) {
continue;
}
// Check value
$item = !empty($value) && isset($pag->$value) ? $pag->$value : $pag->ID;
// Get the id and the name
$contents[0][$item] = $pag->post_title;
}
}
// Return all values in a well formatted way
return $contents;
} | php | {
"resource": ""
} |
q265263 | Wordpress.getWPPosts | test | protected function getWPPosts($options = [], $value = 'ID')
{
// Build contents
$contents = [];
$contents[-1] = Translate::t('wordpress.choose.post', [], 'wordpressfield');
// Build options
$args = array_merge([
'post_type' => 'post',
'post_status' => 'publish'
], $options);
// Build request
$posts_obj = wp_get_recent_posts($args, OBJECT);
// Iterate on posts
if (!empty($posts_obj)) {
foreach ($posts_obj as $pos) {
// For Wordpress version < 3.0
if (empty($pos->ID)) {
continue;
}
// Check value
$item = !empty($value) && isset($pos->$value) ? $pos->$value : $pos->ID;
// Get the id and the name
$contents[$pos->post_type][$item] = $pos->post_title;
}
}
// Return all values in a well formatted way
return $contents;
} | php | {
"resource": ""
} |
q265264 | Wordpress.getWPPosttypes | test | protected function getWPPosttypes($options = [], $value = 'name')
{
// Build contents
$contents = [];
$contents[-1] = Translate::t('wordpress.choose.posttype', [], 'wordpressfield');
// Build options
$args = array_merge([], $options);
// Build request
$types_obj = get_post_types($args, 'object');
// Iterate on posttypes
if (!empty($types_obj)) {
foreach ($types_obj as $typ) {
// Check value
$item = !empty($value) && isset($typ->$value) ? $typ->$value : $typ->name;
// Get the the name
$contents[0][$item] = $typ->labels->name.' ('.$typ->name.')';
}
}
// Return all values in a well formatted way
return $contents;
} | php | {
"resource": ""
} |
q265265 | Wordpress.getWPTags | test | protected function getWPTags($options = [], $value = 'term_id')
{
// Build contents
$contents = [];
$contents[-1] = Translate::t('wordpress.choose.tag', [], 'wordpressfield');
// Build options
$args = array_merge([], $options);
// Build request
$tags_obj = get_the_tags();
// Iterate on tags
if (!empty($tags_obj)) {
foreach ($tags_obj as $tag) {
// Check value
$item = !empty($value) && isset($tag->$value) ? $tag->$value : $tag->term_id;
// Get the id and the name
$contents[0][$item] = $tag->name;
}
}
// Return all values in a well formatted way
return $contents;
} | php | {
"resource": ""
} |
q265266 | Wordpress.getWPTaxonomies | test | protected function getWPTaxonomies($options = [], $value = '')
{
// Build contents
$contents = [];
$contents[-1] = Translate::t('wordpress.choose.taxonomy', [], 'wordpressfield');
// Build options
$args = array_merge([
'public' => 1
], $options);
// Build request
$taxs_obj = get_taxonomies($args);
// Iterate on tags
if (!empty($taxs_obj)) {
foreach ($taxs_obj as $tax) {
// Get taxonomy details
$taxo = get_taxonomy($tax);
// Get the id and the name
$contents[0][$tax] = $taxo->labels->name.' ('.$taxo->name.')';
}
}
// Return all values in a well formatted way
return $contents;
} | php | {
"resource": ""
} |
q265267 | Wordpress.getWPTerms | test | protected function getWPTerms($options = [], $value = 'term_id')
{
// Build contents
$contents = [];
$contents[-1] = Translate::t('wordpress.choose.term', [], 'wordpressfield');
// Build options
$args = array_merge([
'hide_empty' => false,
], $options);
// Build request
$terms_obj = get_terms($args);
// Iterate on tags
if (!empty($terms_obj) && ! is_wp_error($terms_obj)) {
foreach ($terms_obj as $term) {
// Check value
$item = !empty($value) && isset($term->$value) ? $term->$value : $term->term_id;
// Get the id and the name
$contents[0][$item] = $term->name;
}
}
// Return all values in a well formatted way
return $contents;
} | php | {
"resource": ""
} |
q265268 | SubResolver.addToSearchPath | test | public function addToSearchPath(string $name, string $path, int $precedence)
{
if (!is_dir($path))
throw new \InvalidArgumentException("Path does not exist: " . $path);
$this->search_path[$name] = array('path' => $path, 'precedence' => $precedence);
$this->sorted = false;
return $this;
} | php | {
"resource": ""
} |
q265269 | SubResolver.setPrecedence | test | public function setPrecedence(string $name, int $precedence)
{
if (!isset($this->search_path[$name]))
throw new \InvalidArgumentException("Unknown module: " . $name);
if ($this->search_path[$name]['precedence'] !== $precedence)
{
$this->search_path[$name]['precedence'] = $precedence;
$this->sorted = false;
}
return $this;
} | php | {
"resource": ""
} |
q265270 | SubResolver.getPrecedence | test | public function getPrecedence(string $name)
{
if (!isset($this->search_path[$name]))
throw new \InvalidArgumentException("Unknown module: " . $name);
return $this->search_path[$name]['precedence'];
} | php | {
"resource": ""
} |
q265271 | SubResolver.clearCache | test | public function clearCache()
{
if ($this->cache !== null)
$this->cache->set('resolve', $this->name, array('data' => [], 'search_path' => $this->search_path));
return $this;
} | php | {
"resource": ""
} |
q265272 | SubResolver.getCachedData | test | protected function getCachedData()
{
if ($this->cache === null)
return null;
$sp = $this->cache->get('resolve', $this->name, 'search_path');
if ($sp !== null)
$sp = $sp->toArray();
if ($this->search_path !== $sp)
$this->clearCache();
return $this->cache->get('resolve', $this->name);
} | php | {
"resource": ""
} |
q265273 | SubResolver.resolve | test | public function resolve(string $file)
{
if (!$this->sorted)
$this->sortModules();
$file = ltrim($file, '/');
if ($this->ext !== null && substr($file, -strlen($this->ext)) !== $this->ext)
$file .= $this->ext;
$cache = $this->getCachedData();
$cached = $cache !== null ? $cache->get('data', $file) : null;
if ($cached === false && $this->authorative)
return null;
if (!empty($cached))
{
if (file_exists($cached['path']) && is_readable($cached['path']))
{
self::$logger->debug(
"Resolved {0} {1} to path {2} (module: {3}) (cached)",
[$this->name, $file, $cached['path'], $cached['module']]
);
return $cached['path'];
}
else
{
self::$logger->error(
"Cached path for {0} {1} from module {2} cannot be read: {3}",
[$this->name, $file, $cached['module'], $cached['path']]
);
}
}
$path = null;
$found_module = null;
$mods = $this->search_path;
foreach ($mods as $module => $info)
{
$location = $info['path'];
self::$logger->debug("Trying {0} path: {1}/{2}", [$location, $this->name, $file]);
$path = $location . '/' . $file;
if (file_exists($path) && is_readable($path))
{
$found_module = $module;
break;
}
}
if ($found_module !== null)
{
self::$logger->debug("Resolved {0} {1} to path {2} (module: {3})", [$this->name, $file, $path, $found_module]);
if ($cache !== null)
{
$cache->set(
'data',
$file,
array("module" => $found_module, "path" => $path)
);
}
return $path;
}
elseif ($cache !== null)
{
$cache->set('data', $file, false);
}
return null;
} | php | {
"resource": ""
} |
q265274 | UrlManager.parserRequestUri | test | public function parserRequestUri($request)
{
$url = $request->getPathUri();
if ($url) {
$urlArr = preg_split("/\//si", $url);
if (preg_match("/^[a-z_]*$/si", $urlArr[1])) {
// http://localhost/?/ModuleName/ViewName/
$module_name = $urlArr[0];
$view_name = $request->pathNameToViewName($urlArr, 1);
$uriParams = $request->getUriParameters($urlArr, 1);
} elseif (preg_match("/^[a-z_]*$/si", $urlArr[0])) {
// http://localhost/?/ViewName/
$module_name = '';
$view_name = $request->pathNameToViewName($urlArr, 0);
$uriParams = $request->getUriParameters($urlArr, 0);
} else {
throw new Exception();/** @todo Change Exception class more specific. */
}
} else {
$module_name = '';
$view_name = '';
$uriParams = [];
}
return array(
'module' => $module_name,
'shortView' => $view_name,
'uriParams' => $uriParams,
);
} | php | {
"resource": ""
} |
q265275 | WebPageWizard.saveStatefullVars | test | public function saveStatefullVars($sessionContext)
{
if ($this->dropSession){
$sessionContext->cleanObj($this->objectName, true);
}else{
$sessionContext->saveObjVar($this->objectName, "FormStates", $this->formStates, true);
$sessionContext->saveObjVar($this->objectName, "CurrentStep", $this->currentStep, true);
}
} | php | {
"resource": ""
} |
q265276 | WebPageWizard.getCurrentStep | test | public function getCurrentStep()
{ if($_GET['step'])
{
$this->currentStep=$_GET['step'];
return $this->currentStep;
}
elseif($this->currentStep)
{
if($this->currentStep > $this->formRefs->count()){
return $this->formRefs->count();
}else{
return $this->currentStep;
}
}
else
{
$step = isset($_GET['step']) ? $_GET['step'] : 1;
$numForms = 0;
foreach ($this->formRefs as $formRef)
$numForms++;
if ($step < 1)
$step = 1;
if ($step > $numForms)
$step = $numForms;
$this->currentStep = $step;
return $step;
}
} | php | {
"resource": ""
} |
q265277 | WebPageWizard.getFormInputs | test | public function getFormInputs($formName)
{
$formObj = Openbizx::getObject($formName);
$rec = $formObj->getActiveRecord();
return $rec;
} | php | {
"resource": ""
} |
q265278 | WebPageWizard.cancel | test | public function cancel()
{
// call all step forms Cancel method
if(is_array($this->formStates)){
foreach ($this->formStates as $formName=>$state)
{
if ($state['visited'])
Openbizx::getObject($formName)->cancel();
}
}
$this->dropSession = true;
} | php | {
"resource": ""
} |
q265279 | ScalarEnumType.registerSubTypeEnum | test | public static function registerSubTypeEnum(string $subTypeEnumClass, string $subTypeEnumValueRegexp): bool
{
if (!static::hasSubTypeEnum($subTypeEnumClass, $subTypeEnumValueRegexp)) {
// registering same subtype enum class but with different regexp cause exception in following method
return static::addSubTypeEnum($subTypeEnumClass, $subTypeEnumValueRegexp);
}
return false;
} | php | {
"resource": ""
} |
q265280 | AbstractMiddleware.getInput | test | protected function getInput($request, $in, $name)
{
switch ($in)
{
case 'header':
return $request->header($name);
case 'query':
return $request->query($name);
case 'path':
return $request->route($name);
default:
throw new \InvalidArgumentException(
get_class($this) . " doesn't know how to handle '" . $in . "' parameters"
);
}
} | php | {
"resource": ""
} |
q265281 | Cleaner.delete | test | protected function delete($file, $expires)
{
if (!is_array($file['path'])) {
$file['path'] = [$file['path']];
}
foreach ($file['path'] as $path) {
if (File::exists($path)) {
if ((time() - File::lastModified($path)) >= $expires) {
if (!empty($file['before']) && is_callable($file['before'])) {
$file['before']($path);
}
if (File::isDirectory($path)) {
File::deleteDirectory($path);
} else {
File::delete($path);
}
if (!empty($file['after']) && is_callable($file['after'])) {
$file['after']($path);
}
}
}
}
} | php | {
"resource": ""
} |
q265282 | Cleaner.convertToSeconds | test | protected function convertToSeconds($expires)
{
$seconds = 0;
if (isset($expires['seconds'])) {
$seconds += $expires['seconds'];
}
if (isset($expires['minutes'])) {
$seconds += $expires['minutes'] * 60;
}
if (isset($expires['hours'])) {
$seconds += $expires['hours'] * 60 * 60;
}
if (isset($expires['days'])) {
$seconds += $expires['days'] * 24 * 60 * 60;
}
if (isset($expires['weeks'])) {
$seconds += $expires['weeks'] * 7 * 24 * 60 * 60;
}
if (isset($expires['months'])) {
$seconds += $expires['months'] * 30 * 7 * 24 * 60 * 60;
}
if (isset($expires['years'])) {
$seconds += $expires['years'] * 365 * 30 * 7 * 24 * 60 * 60;
}
return $seconds;
} | php | {
"resource": ""
} |
q265283 | Strings.getKeyWords | test | public static function getKeyWords(string $text, int $maxLen = 60): string
{
$keyWords = [];
// nalezeni vsech linku v textu
preg_match_all('/<a[^>]*>[^<]+<\/a>/i', $text, $found);
if (isset($found[0])) {
foreach ($found[0] as $kw) {
$keyWords[] = self::lower(self::trim(strip_tags($kw)));
}
}
// h2 a strong
preg_match_all('/<(h2|strong)[^>]*>[^<]+<\/(h2|strong)>/i', $text, $found);
if (isset($found[0])) {
foreach ($found[0] as $kw) {
$keyWords[] = self::lower(self::trim(strip_tags($kw)));
}
}
$result = implode(', ', array_unique($keyWords));
return self::truncate($result, $maxLen, '');
} | php | {
"resource": ""
} |
q265284 | Strings.findEmails | test | public static function findEmails(string $text): array
{
$result = [];
preg_match_all('/[a-z\d._%+-]+@[a-z\d.-]+\.[a-z]{2,4}\b/i', $text, $result);
return isset($result[0]) ? $result[0] : [];
} | php | {
"resource": ""
} |
q265285 | Strings.containsArray | test | public static function containsArray(string $haystack, array $needle): ?string
{
foreach ($needle as $query) {
if (parent::contains($haystack, $query)) {
return $query;
}
}
return null;
} | php | {
"resource": ""
} |
q265286 | BaseProxyConnector.redirect | test | public function redirect( Request $request, $endpoint, $path, $responseType = 'json' ) {
// Set the Endpoints
$this->getEndpoints();
// Get Endpoint config.
$this->setBaseUri( $this->getEndpointConfig( $endpoint )['endpoint'] );
// Get Endpoint AUTH
// $this->setAuthHeaders();
// Get Required variables for the endpoint.
// void
// Add Proxy to request
$request->attributes->add( [
'proxy' => [
'host' => $this->getBaseUri(),
'path' => $path,
'response_type' => $responseType,
],
] );
// Create a call to the endpoint
$this->prepareCall( null );
// Prepare headers:
$headers = $request->headers->all();
if ( isset( $headers['host'] ) ) {
unset( $headers['host'] );
}
// Set proxy headers
$headers['bizhost-request-identifier'] = [ $request->get( 'bizhost-request-identifier' , null) ];
$headers['bizhost-session-identifier'] = [ $request->get( 'bizhost-session-identifier' , null) ];
// Prepare data
$data = $request->all();
// Execute call
$this->execute( $request->getMethod(), $path, $data, $headers );
// Catch the results
return $this->getResponse( $responseType );
} | php | {
"resource": ""
} |
q265287 | MigrationManager.migrateUp | test | public function migrateUp(MigrationConfig $config, $flushDatabase = false): Awaitable
{
return new Coroutine(function () use ($config, $flushDatabase) {
$migrations = $this->instantiateMigrations($config);
if (empty($migrations)) {
$skip = false;
} else {
$skip = yield $this->platform->hasTable('#__kk_migration');
if ($skip) {
$mtime = clone $this->date;
$params = [];
foreach (\array_values($migrations) as $i => $migration) {
$params[] = $migration->getVersion();
$date = new \DateTime('@' . \filemtime((new \ReflectionClass(\get_class($migration)))->getFileName()));
if ($date > $mtime) {
$mtime = $date;
}
}
$sql = "SELECT COUNT(*) AS cnt, MAX(`migrated`) AS mtime FROM `#__kk_migration` WHERE `version` IN (";
$sql .= \implode(', ', \array_fill(0, \count($params), '?')) . ")";
$stmt = $this->conn->prepare($sql);
$stmt->bindAll($params);
try {
$result = yield $stmt->execute();
// Only skip migrations if all of them are alreay migrated up.
try {
$row = yield $result->fetch();
} finally {
$result->closeCursor();
}
} finally {
$stmt->dispose();
}
$dbcnt = (int) $row['cnt'];
$dbmtime = \DateTime::createFromFormat('YmdHis', $row['mtime']);
$skip = (\count($params) === $dbcnt) && ($dbmtime > $mtime);
}
}
if (!$skip) {
if ($flushDatabase) {
yield $this->platform->flushDatabase();
}
foreach ($migrations as $migration) {
yield from $this->executeMigrationUp($migration);
}
}
if ($skip && $flushDatabase) {
yield $this->platform->flushData();
}
});
} | php | {
"resource": ""
} |
q265288 | MigrationManager.migrateDirectoryUp | test | public function migrateDirectoryUp($dir, $flushDatabase = false): Awaitable
{
$config = new MigrationConfig();
$config->loadMigrationsFromDirectory($dir);
return $this->migrateUp($config, $flushDatabase);
} | php | {
"resource": ""
} |
q265289 | AbstractTokenEntity.setId | test | public function setId($id = null)
{
if ($id != null){
$this->isNew = false;
$this->id = $id;
}else{
$this->id = SecureKey::generate();
}
return $this;
} | php | {
"resource": ""
} |
q265290 | Worker.daemon | test | public function daemon($sleep = 60, $memoryLimit = 128)
{
$memoryLimit = $memoryLimit * 1024 * 1024;
$startTime = time();
while (true) {
$ret = $this->runNextJob();
if (! $ret) { //没有获取到job
sleep($sleep);
}
($this->memoryExceeded($memoryLimit) || $this->queueShouldRestart($startTime)) &&
$this->stop();
}
} | php | {
"resource": ""
} |
q265291 | Parameters.has | test | public function has($key)
{
if (isset($this->parameters[$key]) || array_key_exists($key, $this->parameters)) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q265292 | Oauth.getOauthRequest | test | public function getOauthRequest(array $params, $httpMethod, $baseUrl, $endPoint) : string
{
$signatureParams = array_merge($params, $this->getOauthParams());
$signatureParams['oauth_signature'] = $this->getOauthSignature($signatureParams, $httpMethod, $baseUrl . $endPoint);
$contentParams = [];
foreach ($params as $key => $param) {
$contentParams[] = $key . '=' . rawurlencode($param);
}
$content = implode('&', $contentParams);
return $httpMethod . " " . $endPoint . " HTTP/1.1\r\n"
."Accept: */*\r\n"
."Connection: close\r\n"
."User-Agent: Callisto API\r\n"
."Content-Type: application/x-www-form-urlencoded\r\n"
."Authorization: OAuth realm=\"\",oauth_consumer_key=\"" . $signatureParams['oauth_consumer_key'] . "\","
."oauth_nonce=\"" . $signatureParams['oauth_nonce'] . "\","
."oauth_signature_method=\"" . $signatureParams['oauth_signature_method'] . "\","
."oauth_timestamp=\"" . $signatureParams['oauth_timestamp'] . "\","
."oauth_version=\"" . $signatureParams['oauth_version'] . "\","
."oauth_token=\"" . $signatureParams['oauth_token'] . "\","
."oauth_signature=\"" . rawurlencode($signatureParams['oauth_signature']) . "\"\r\n"
."Content-Length: " . strlen($content) . "\r\n"
."Host: stream.twitter.com:443\r\n\r\n"
.$content;
} | php | {
"resource": ""
} |
q265293 | Oauth.getOauthSignature | test | private function getOauthSignature(array $params, $httpMethod, $url) : string
{
$urlParams = [];
foreach ($params as $key => $value) {
$params[$key] = rawurlencode($value);
$urlParams[$key] = $key . '=' . $params[$key];
}
ksort($urlParams);
$parameterString = implode('&', $urlParams);
$signatureBaseString = strtoupper($httpMethod) .
'&' . rawurlencode($url) .
'&' . rawurlencode($parameterString);
$signingKey = rawurlencode($this->consumerSecret) . '&' . rawurlencode($this->accessTokenSecret);
$oauthSignature = base64_encode(hash_hmac('sha1', $signatureBaseString, $signingKey, true));
return $oauthSignature;
} | php | {
"resource": ""
} |
q265294 | ProcessBuilder.node | test | public function node($id)
{
if (isset($this->items[$id])) {
throw new \RuntimeException(sprintf('Duplicate item ID: "%s"', $id));
}
return $this->items[$id] = new Node($id);
} | php | {
"resource": ""
} |
q265295 | ProcessBuilder.transition | test | public function transition($id, $from, $to)
{
if (isset($this->items[$id])) {
throw new \RuntimeException(sprintf('Duplicate item ID: "%s"', $id));
}
$transition = $this->items[$id] = new Transition($id, $from);
$transition->to($to);
return $transition;
} | php | {
"resource": ""
} |
q265296 | Result.addSetting | test | public function addSetting(ISetting $setting, $cachable = true)
{
$this->settings[] = $setting;
if (true === $cachable) {
$this->cachable_settings[] = $setting;
}
return $this;
} | php | {
"resource": ""
} |
q265297 | Result.addSettings | test | public function addSettings(array $settings, $cachable = true)
{
foreach ($settings as $setting) {
if ($setting instanceof ISetting) {
$this->addSetting($setting);
}
}
return $this;
} | php | {
"resource": ""
} |
q265298 | Result.getSettings | test | public function getSettings($groups = null, $flag = null)
{
return $this->getFiltered($this->settings, $groups, $flag);
} | php | {
"resource": ""
} |
q265299 | Result.getCachableSettings | test | public function getCachableSettings($groups = null, $flag = null)
{
return $this->getFiltered($this->cachable_settings, $groups, $flag);
} | 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.