_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
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:
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(),
php
{ "resource": "" }
q264802
Execution.getExpressionContext
test
public function getExpressionContext() { $access = new ExecutionAccess($this); $this->engine->notify(new CreateExpressionContextEvent($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); }
php
{ "resource": "" }
q264804
Execution.registerChildExecution
test
public function registerChildExecution(Execution $execution) { $execution->parentExecution = $this; if (!in_array($execution, $this->childExecutions,
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; }
php
{ "resource": "" }
q264806
Execution.setScope
test
public function setScope($scope) { $this->setState(self::STATE_SCOPE, $scope);
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);
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);
php
{ "resource": "" }
q264809
Execution.findChildExecutions
test
public function findChildExecutions(Node $node = null) { if ($node === null) { return $this->childExecutions; }
php
{ "resource": "" }
q264810
Execution.computeVariables
test
protected function computeVariables() { if ($this->isScopeRoot()) { return $this->variables; } if ($this->isScope()) {
php
{ "resource": "" }
q264811
Execution.getVariable
test
public function getVariable($name) { $vars = $this->computeVariables(); if (array_key_exists($name, $vars)) { return $vars[$name];
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) {
php
{ "resource": "" }
q264813
Execution.setVariable
test
public function setVariable($name, $value) { if ($value === null) { return $this->removeVariable($name); }
php
{ "resource": "" }
q264814
Execution.setVariableLocal
test
public function setVariableLocal($name, $value) { if (!$this->isScope()) { return $this->getScope()->setVariableLocal($name, $value); } if ($value === null) {
php
{ "resource": "" }
q264815
Execution.removeVariable
test
public function removeVariable($name) { $exec = $this; while ($exec !== null) { if ($exec->isScope()) { $exec->removeVariableLocal($name); }
php
{ "resource": "" }
q264816
Execution.removeVariableLocal
test
public function removeVariableLocal($name) { if (!$this->isScope()) { return $this->getScope()->removeVariableLocal($name); }
php
{ "resource": "" }
q264817
Execution.execute
test
public function execute(Node $node) { if ($this->isTerminated()) { throw new \RuntimeException(sprintf('%s is terminated', $this)); }
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);
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()) {
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) {
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;
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;
php
{ "resource": "" }
q264823
Resource.getMessage
test
public static function getMessage($msgId, $params = array()) { $message = constant($msgId); if (isset($message)) { $message = I18n::t($message, $msgId,
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 . "/" .
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."); }
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."); }
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."); }
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."); }
php
{ "resource": "" }
q264829
Validator.validEmail
test
public static function validEmail($value) { if (is_object($value) || empty($value)) { throw new \InvalidArgumentException("Empty email given.");
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
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)) {
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
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)) {
php
{ "resource": "" }
q264834
ContentElementController.initializeView
test
protected function initializeView(ViewInterface $view) { $configurationManager = $this->objectManager->get(ConfigurationManager::class); $data
php
{ "resource": "" }
q264835
PublicReflection.hasAttribute
test
public static function hasAttribute(string $className, string $name):
php
{ "resource": "" }
q264836
PublicReflection.hasMethod
test
public static function hasMethod(string $className, string $name):
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
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) {
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.'&';
php
{ "resource": "" }
q264841
ConsoleErrorRenderer.getBlankLine
test
private function getBlankLine(int $count = null):string { $out = ""; for ($i = 0; $i < ($count ?: 1); $i++) {
php
{ "resource": "" }
q264842
ConsoleErrorRenderer.countTermCols
test
private function countTermCols():int { if (!$this->termCols) { if (!($this->termCols = (int)exec('tput cols'))) {
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(); }
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 ";
php
{ "resource": "" }
q264845
Arrays.slice
test
public static function slice(array &$array, int $position, $insert): void { if (isset($array[$position])) {
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();
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); }
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) {
php
{ "resource": "" }
q264849
ObjectFactory.createObject
test
public function createObject($objName, &$xmlArr = null) {
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)) {
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',
php
{ "resource": "" }
q264852
Users.Feed
test
public function Feed(Array $params = array()) { if (!empty($params)) $this->AddParams($params);
php
{ "resource": "" }
q264853
Users.Liked
test
public function Liked(Array $params = array()) { if (!empty($params))
php
{ "resource": "" }
q264854
Users.SetRelationship
test
protected function SetRelationship($user_id, $action) { $this->AddParam('action', $action);
php
{ "resource": "" }
q264855
CDatabaseModel.setProperties
test
public function setProperties($properties){ // Update object with incoming values, if any if(!empty($properties)){
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());
php
{ "resource": "" }
q264858
CDatabaseModel.find
test
public function find($id = 0){ $this->db->select() ->from($this->getSource()) ->where("id = ?");
php
{ "resource": "" }
q264859
CDatabaseModel.create
test
public function create($values = []){ $keys = array_keys($values); $values = array_values($values); $this->db->insert( $this->getSource(), $keys
php
{ "resource": "" }
q264860
CDatabaseModel.query
test
public function query($columns = "*"){ $this->db->select($columns)
php
{ "resource": "" }
q264861
CDatabaseModel.execute
test
public function execute($params = []){ $this->db->execute($this->db->getSQL(), $params);
php
{ "resource": "" }
q264862
Fluent.canProceed
test
protected function canProceed($name, $args) { $condition = $this->condition; return $condition instanceof \Closure
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; }
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) {
php
{ "resource": "" }
q264865
PickerForm._parsePickerMap
test
protected function _parsePickerMap($pickerMap) { $returnList = array(); $pickerList = explode(",", $pickerMap); foreach ($pickerList as $pair) { $controlMap = explode(":", $pair);
php
{ "resource": "" }
q264866
ReflectionClass.convertArrayOfReflectionToSelf
test
private function convertArrayOfReflectionToSelf(array $reflectionClasses): array { $return = []; foreach ($reflectionClasses as $key => $reflectionClass) {
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
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])) {
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
php
{ "resource": "" }
q264870
BizRecord.setRecordArr
test
public function setRecordArr($recArr) { if (!$recArr) { return; } foreach ($this->varValue as $key => $field) { if
php
{ "resource": "" }
q264871
BizRecord.saveOldRecord
test
final public function saveOldRecord(&$inputArr) { if (!$inputArr) return; foreach ($inputArr as $key
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]
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]); }
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
php
{ "resource": "" }
q264876
BizRecord.getJoinSearchRule
test
public function getJoinSearchRule($tableJoin, $isUseOldValue = false) { $joinFieldName = $this->getFieldByColumn($tableJoin->columnRef, $tableJoin->table); $joinField = $this->varValue[$joinFieldName];
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']); }
php
{ "resource": "" }
q264878
CoreRequest.getRequestUri
test
public function getRequestUri(): string { if (isset($_SERVER['REQUEST_URI'])) { $requestUri = $_SERVER['REQUEST_URI']; if ($requestUri!=='' && $requestUri[0]!=='/') { $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()) { $options = $options[$mappingType]; } $options = isset($options[$key][$name]) ? $options[$key][$name] : null; if (null === $options) { throw new RuntimeException( sprintf(
php
{ "resource": "" }
q264880
Singleton.make
test
public function make() { if( !$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
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 = '';
php
{ "resource": "" }
q264883
BaseJson.decode
test
public function decode($file) { $contents = $this->getFileContents($file); $result = array(); if ($contents != "") {
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
php
{ "resource": "" }
q264885
CommentController.actionIndex
test
public function actionIndex() { Url::remember('', 'actions-redirect'); $searchModel = new CommentSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
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{
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();
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 ? ", " : " ";
php
{ "resource": "" }
q264889
excelService.renderCSV
test
function renderCSV ($objName) { $this->render($objName, ",", "csv"); //Log This Export
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) {
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 =
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);
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,
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) {
php
{ "resource": "" }
q264895
BizDataObj_Lite.setActiveRecordId
test
public function setActiveRecordId($recordId) { if ($this->recordId !=
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;
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();
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 =
php
{ "resource": "" }
q264899
BizDataObj_Lite.count
test
public function count() { // get database connection $db = $this->getDBConnection("READ"); if ($this->_fetch4countQuery) { $querySQL = $this->_fetch4countQuery; } else {
php
{ "resource": "" }