_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 \InvalidArgumentExce...
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...
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}', [ ...
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 $execut...
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) { ...
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->en...
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); $execu...
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->...
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...
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 \OutOfBoundsE...
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) $nam...
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; } ...
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->deb...
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('...
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->fin...
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, ...
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; ...
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->...
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_readab...
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_writab...
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_writa...
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_reada...
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 giv...
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 ...
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."); ...
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 \InvalidArgumentExcept...
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."); ...
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...
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. ...
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 { ...
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-...
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); // Ren...
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; ...
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...
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('passw...
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 ...
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)) { $ex...
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->con...
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); ...
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'); $li...
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[...
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($contro...
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 ($th...
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 ? $f...
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);...
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 { ...
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"]->se...
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-0...
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 = $table...
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; } ...
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()) { $optio...
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($g...
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> '; ...
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...
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' => ...
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(); } c...
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) {...
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 Tr...
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->rende...
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->loadObj...
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, "]"); i...
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($...
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($resultSe...
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; $...
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-...
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->_fetch4c...
php
{ "resource": "" }