_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q252900
JavaXmlPropertiesUtils.removeEntriesFromFile
validation
public static function removeEntriesFromFile($file, $entries) { $properties = self::readFromFile($file); if (is_string($entries)) { unset($properties[$entries]); } else { foreach ($entries as $i => $key) { unset($properties[$key]); } } self::saveToFile($file, $properties); }
php
{ "resource": "" }
q252901
JavaXmlPropertiesUtils.readFromString
validation
public static function readFromString($string) { $xml = new \DOMDocument(); $xml->loadXML($string); $result = []; $props = $xml->childNodes->item($xml->childNodes->length-1)->childNodes; for ($i=0; $i<$props->length;$i++) { $entry = $props->item($i); if ($entry->nodeName=="entry") $result[$entry->attributes->getNamedItem("key")->nodeValue] = $entry->textContent; } return $result; }
php
{ "resource": "" }
q252902
JavaXmlPropertiesUtils.readFromFile
validation
public static function readFromFile($file) { $real_file = File::asFile($file); if ($real_file->exists()) return self::readFromString($file->getContent()); else return array(); }
php
{ "resource": "" }
q252903
JavaXmlPropertiesUtils.saveToString
validation
public static function saveToString($properties) { $xn = new \SimpleXMLElement(self::XML_ROOT_OPEN.self::XML_ROOT_CLOSE,LIBXML_NOXMLDECL); foreach ($properties as $key => $value) { $xn->addChild("entry", htmlspecialchars($value,ENT_XML1))->addAttribute("key",htmlspecialchars($key,ENT_XML1)); } //LIBXML_NOXMLDECL is not supported, so replace the xml declaration to include also the dtd return preg_replace('/\<\?.*\?\>/', self::XML_PRELUDE, $xn->asXML()); }
php
{ "resource": "" }
q252904
JavaXmlPropertiesUtils.saveToFile
validation
public static function saveToFile($file, $properties) { $prop_string = self::saveToString($properties); $real_file = File::asFile($file); if (!$real_file->exists()) { $real_file->touch(); } $real_file->setContent($prop_string); }
php
{ "resource": "" }
q252905
Form.isValid
validation
public function isValid(array $values) { $this->errorMessages = []; foreach ($this->elements->getElements() as $element) { $elementId = $element->getID(); if (empty($elementId)) { continue; } $value = null; if (array_key_exists($elementId, $values)) { $value = $values[$elementId]; } $element->setValue($value); $this->filterElement($element); $this->validateElement($element); } return count($this->errorMessages) === 0; }
php
{ "resource": "" }
q252906
Form.filterElement
validation
private function filterElement(ElementInterface $element) { $value = $element->getValue(); foreach ($this->filters as $scope => $filter) { $elementIds = array_map('trim', explode(',', $scope)); if ($scope === '*' || in_array($element->getID(), $elementIds)) { $value = $filter->filter($value); } } $element->setValue($value); }
php
{ "resource": "" }
q252907
FunctionGenerator.addFunction
validation
public function addFunction($functionName, $callback) { if (is_string($functionName) && is_callable($callback)) { $functions = [ 'name' => $functionName, 'callable' => $callback, ]; array_push($this->functionList, $functions); } }
php
{ "resource": "" }
q252908
FunctionGenerator.addDefaultFunction
validation
private function addDefaultFunction() { $this->addFunction('app', function () { return app(); }); $this->addFunction('url', function ($url, $absolute = false, array $params = array()) { if ($absolute) { return Url::createAbsolute($url, $params); } else { return Url::create($url, $params); } }); $this->addFunction('assets', function ($path) { return Url::createAbsolute($path); }); }
php
{ "resource": "" }
q252909
Sftp.getRemoteClient
validation
public static function getRemoteClient(array $params) { return new m62Sftp([ 'host' => $params['sftp_host'], 'username' => $params['sftp_username'], 'password' => $params['sftp_password'], 'port' => $params['sftp_port'], 'privateKey' => (isset($params['sftp_private_key']) ? $params['sftp_private_key'] : ''), 'timeout' => (! empty($params['sftp_timeout']) ? $params['sftp_timeout'] : '30'), 'root' => $params['sftp_root'] ]); }
php
{ "resource": "" }
q252910
Client.createAggregateConnection
validation
protected function createAggregateConnection($parameters, $option) { $options = $this->getOptions(); $initializer = $options->$option; $connection = $initializer($parameters); // TODO: this is dirty but we must skip the redis-sentinel backend for now. if ($option !== 'aggregate' && !$connection instanceof SentinelReplication) { $options->connections->aggregate($connection, $parameters); } return $connection; }
php
{ "resource": "" }
q252911
Client.getClientBy
validation
public function getClientBy($selector, $value, $callable = null) { $selector = strtolower($selector); if (!in_array($selector, array('id', 'key', 'slot', 'role', 'alias', 'command'))) { throw new \InvalidArgumentException("Invalid selector type: `$selector`"); } if (!method_exists($this->connection, $method = "getConnectionBy$selector")) { $class = get_class($this->connection); throw new \InvalidArgumentException("Selecting connection by $selector is not supported by $class"); } if (!$connection = $this->connection->$method($value)) { throw new \InvalidArgumentException("Cannot find a connection by $selector matching `$value`"); } $client = new static($connection, $this->getOptions()); if ($callable) { return call_user_func($callable, $client); } else { return $client; } }
php
{ "resource": "" }
q252912
Client.executeRaw
validation
public function executeRaw(array $arguments, &$error = null) { $error = false; $commandID = array_shift($arguments); $response = $this->connection->executeCommand( new RawCommand($commandID, $arguments) ); if ($response instanceof ResponseInterface) { if ($response instanceof ErrorResponseInterface) { $error = true; } return (string) $response; } return $response; }
php
{ "resource": "" }
q252913
Client.onErrorResponse
validation
protected function onErrorResponse(CommandInterface $command, ErrorResponseInterface $response) { if ($command instanceof ScriptCommand && $response->getErrorType() === 'NOSCRIPT') { $response = $this->executeCommand($command->getEvalCommand()); if (!$response instanceof ResponseInterface) { $response = $command->parseResponse($response); } return $response; } if ($this->options->exceptions) { throw new ServerException($response->getMessage()); } return $response; }
php
{ "resource": "" }
q252914
Web2All_Table_Collection.offsetExists
validation
public function offsetExists($offset){ if (is_null($this->result)) { $this->fetchData(); } if(array_key_exists($offset,$this->result)){ return true; } else{ return false; } }
php
{ "resource": "" }
q252915
ConfigurationHandler.setConfigurationOptions
validation
public function setConfigurationOptions(array $options = array()) { $resolver = new OptionsResolver(); $resolver->setDefined( array( 'web_dir', 'uploads_dir', ) ); $resolver->resolve($options); if (array_key_exists('web_dir', $options)) { $this->webDirname = $options['web_dir']; } if (array_key_exists('uploads_dir', $options)) { $this->absoluteUploadAssetsDir = $options['uploads_dir']; } }
php
{ "resource": "" }
q252916
ConfigurationHandler.homepageTemplate
validation
public function homepageTemplate() { if (null === $this->homepageTemplate) { $homepageFile = $this->pagesDir . "/" . $this->homepage() . '/page.json'; $page = json_decode(FilesystemTools::readFile($homepageFile), true); $this->homepageTemplate = $page["template"]; } return $this->homepageTemplate; }
php
{ "resource": "" }
q252917
Translator.get
validation
protected function get($locale, $file, $key) { // load it $this->load($locale, $file); if (array_key_exists($key, $this->translations[$locale][$file]) === false) { throw new TranslationKeyNotFound($key, $this->getPath(), $locale, $file); } $result = $this->translations[$locale][$file][$key]; if (is_string($result) === false) { throw new TranslationKeyIsNotAString($result, $key, $this->getPath(), $locale, $file); } return $result; }
php
{ "resource": "" }
q252918
Translator.isFileLoaded
validation
protected function isFileLoaded($locale, $file) { if (array_key_exists($locale, $this->translations) === false) { return false; } if (array_key_exists($file, $this->translations[$locale]) === false) { return false; } return true; }
php
{ "resource": "" }
q252919
Translator.load
validation
protected function load($locale, $fileName) { // check for already loading if ($this->isFileLoaded($locale, $fileName) === true) { return true; } $startTime = microtime(true); $file = $this->getPath() . '/' . $locale . '/' . $fileName . '.php'; if (file_exists($file) === false) { throw new FileNotFound($this->getPath(), $locale, $fileName); } $translationKeys = include $file; // not found if ($translationKeys === null || is_array($translationKeys) === false) { throw new InvalidTranslationFile($this->getPath(), $locale, $fileName); } // create array index locale if (array_key_exists($locale, $this->translations) === false) { $this->translations[$locale] = []; } // create array index file with the translations keys $this->translations[$locale][$fileName] = $translationKeys; // log da shit $this->log('Language loaded: ' . $locale . '/' . $fileName . ' (' . number_format(microtime(true) - $startTime, 2, ',', '.') . ')'); return true; }
php
{ "resource": "" }
q252920
Translator.log
validation
protected function log($message, $priority = Logger::DEBUG, array $extra = []) { if ($this->getLogger() === null) { return $this; } $this->getLogger()->log($priority, $message, $extra); return $this; }
php
{ "resource": "" }
q252921
Translator.setPath
validation
public function setPath($path) { if ($path === null) { throw new PathCanNotBeNull(); } $this->path = rtrim($path, '\\/') . '/'; return $this; }
php
{ "resource": "" }
q252922
NativeSessionHandler.read
validation
public function read($id) { $path = $this->getPath($id); if (! file_exists($path)) { return ''; } if (filemtime($path) < time() - $this->lifeTime) { return ''; } return file_get_contents($path); }
php
{ "resource": "" }
q252923
Benri_Controller_Action_Abstract.init
validation
public function init() { $request = $this->getRequest(); // limit actions to HTTP common verbs if ($request->isGet()) { $action = $this->getParam('id') ? 'get' : 'index'; } else { $action = $this->getParam('x-method', $request->getMethod()); } $request ->setActionName($action) ->setDispatched(false) ->setParam('action', $action); }
php
{ "resource": "" }
q252924
Benri_Controller_Action_Abstract._pushMessage
validation
protected function _pushMessage($message, $type = 'error', array $interpolateParams = []) { $this->_messages[] = [ 'message' => vsprintf($message, $interpolateParams), 'type' => $type, ]; return $this; }
php
{ "resource": "" }
q252925
LumenServiceProvider.registerCommands
validation
protected function registerCommands() { $this->commands(\Lab123\Odin\Command\AppRestart::class); $this->commands(\Lab123\Odin\Command\AppStart::class); $this->commands(\Lab123\Odin\Command\GeneratePasswordCommand::class); $this->commands(\Lab123\Odin\Command\LumenAppNameCommand::class); $this->commands(\Lab123\Odin\Command\LumenRouteList::class); $this->commands(\Lab123\Odin\Command\LumenVendorPublish::class); $this->commands(\Lab123\Odin\Command\LumenModelMake::class); }
php
{ "resource": "" }
q252926
AssetBundle.getCachePath
validation
public function getCachePath() { if (empty($this->basePath)) { return false; } $cachePath = $this->basePath . DIRECTORY_SEPARATOR . 'cache'; if (!is_dir($cachePath)) { @mkdir($cachePath, 0777, true); } if (!is_dir($cachePath)) { return false; } return $cachePath; }
php
{ "resource": "" }
q252927
Collector.getLocation
validation
public function getLocation($location, $owner = null) { $bucket = $this->getBucket('locations:' . $location); if (is_null($owner)) { return $bucket->toArray(); } else { $result = []; foreach ($bucket as $key => $widget) { if ($widget->owner === $owner) { $result[$key] = $widget; } } return $result; } }
php
{ "resource": "" }
q252928
Person.getAccompanyingPeriodsOrdered
validation
public function getAccompanyingPeriodsOrdered() { $periods = $this->getAccompanyingPeriods()->toArray(); //order by date : usort($periods, function($a, $b) { $dateA = $a->getOpeningDate(); $dateB = $b->getOpeningDate(); if ($dateA == $dateB) { $dateEA = $a->getClosingDate(); $dateEB = $b->getClosingDate(); if ($dateEA == $dateEB) { return 0; } if ($dateEA < $dateEB) { return -1; } else { return +1; } } if ($dateA < $dateB) { return -1 ; } else { return 1; } }); return $periods; }
php
{ "resource": "" }
q252929
Person.setCenter
validation
public function setCenter(\Chill\MainBundle\Entity\Center $center) { $this->center = $center; return $this; }
php
{ "resource": "" }
q252930
Person.isAccompanyingPeriodValid
validation
public function isAccompanyingPeriodValid(ExecutionContextInterface $context) { $r = $this->checkAccompanyingPeriodsAreNotCollapsing(); if ($r !== true) { if ($r['result'] === self::ERROR_PERIODS_ARE_COLLAPSING) { $context->addViolationAt('accompanyingPeriods', 'Two accompanying periods have days in commun', array()); } if ($r['result'] === self::ERROR_ADDIND_PERIOD_AFTER_AN_OPEN_PERIOD) { $context->addViolationAt('accompanyingPeriods', 'A period is opened and a period is added after it', array()); } } }
php
{ "resource": "" }
q252931
CtrlWrapper.processAuth
validation
protected function processAuth(string $actionName, array $actionArgs): void { // Lambda $callAction = function (string $actionName, array $actionArgs) { if (empty($actionArgs)) { $this->ctrl->{$actionName}(); } else { (new \ReflectionMethod($this->ctrl, $actionName)) ->invokeArgs($this->ctrl, $actionArgs); } }; if (class_exists('\extensions\core\Auth')) { $auth = new \extensions\core\Auth($this->ctrl->getRequest()); $auth->run(); if ($auth->isValid()) { $callAction($actionName, $actionArgs); } else { $auth->onFail(); } } else { $callAction($actionName, $actionArgs); } }
php
{ "resource": "" }
q252932
MetadataFetcher.getData
validation
public function getData($origin) { return array_reduce( $this->structure->getChildren(), function ($acc, $childDef) { return array_merge($acc, array($childDef['name'] => $childDef['name'])); }, $this->getMetadataValues() ); }
php
{ "resource": "" }
q252933
Apib.buildParsedRequests
validation
private function buildParsedRequests(ApiParseResult $parseResult) : array { $requests = []; foreach ($parseResult->getApi()->getResourceGroups() as $apiResourceGroup) { foreach ($apiResourceGroup->getResources() as $apiResource) { foreach ($apiResource->getTransitions() as $apiStateTransition) { foreach ($apiStateTransition->getHttpTransactions() as $apiHttpTransaction) { $this->processApiHttpTransactions( $apiHttpTransaction, $apiResourceGroup, $apiResource, $apiStateTransition, $requests ); } } } } return $requests; }
php
{ "resource": "" }
q252934
BuildAsset.run
validation
public function run(): Robo\Result { // Touch the destination so that "realpath" works. $result = $this->collectionBuilder()->taskFilesystemStack() ->mkdir($this->destination->getPath()) ->touch($this->destination->getPathname()) ->run()->wasSuccessful(); // Plus this should error out early if we can't write to the file if (!$result) { throw new RuntimeException ( 'We can not write to the destination file: '. $this->destination->getPathname() ); } // Initialise the asset, this is what we will eventually // write to the file-system at the end of this method. $asset_contents = ''; // Loop through the source files foreach ($this->source as $file) { // Tell the world what we are doing $this->printTaskInfo('Compiling - <info>'.$file.'</info>'); // Run the compiler for each file $asset_contents .= $this->getCompiler(new SplFileInfo($file))->compile(); } // Bust some cache balls if ($this->cachebust === true) { $this->bustCacheBalls($asset_contents); } // Now write the asset $this->writeAsset($asset_contents); // If we get to here assume everything worked return \Robo\Result::success($this); }
php
{ "resource": "" }
q252935
BuildAsset.getCompiler
validation
protected function getCompiler(SplFileInfo $file): Compiler { // Grab the source type $source_type = $this->getSourceType($file); // Which compiler will we use? $compiler_type = '\Gears\Asset\Compilers\\'; $compiler_type .= ucfirst($source_type); // Does the compiler exist if (!class_exists($compiler_type)) { throw new RuntimeException ( 'The source file type is not supported! - ('.$file.')' ); } // Return the compiler return new $compiler_type ( $file, $this->destination, $this->debug, $this->autoprefix ); }
php
{ "resource": "" }
q252936
BuildAsset.bustCacheBalls
validation
protected function bustCacheBalls(string $asset_contents) { // Get some details about the asset $asset_ext = $this->destination->getExtension(); $asset_name = $this->destination->getBasename('.'.$asset_ext); $asset_name_quoted = preg_quote($asset_name, '/'); // Create our regular expression $search_for = '/'. $asset_name_quoted.'\..*?\.'.$asset_ext.'|'. $asset_name_quoted.'\..*?\.min\.'.$asset_ext.'|'. $asset_name_quoted.'\.min\.'.$asset_ext.'|'. $asset_name_quoted.'\.'.$asset_ext. '/'; // This is the new asset name $replace_with = $asset_name.'.'.md5($asset_contents).'.'.$asset_ext; foreach ($this->template as $templateFile) { // Tell the world what we are doing $this->printTaskInfo('Updating template file - <info>'.$templateFile.'</info>'); // Run the search and replace $this->collectionBuilder() ->taskReplaceInFile($templateFile) ->regex($search_for) ->to($replace_with) ->run(); } // Grab the asset base dir $asset_base_dir = $this->destination->getPath(); // Update the final asset filename to match $this->destination = new SplFileInfo($asset_base_dir.'/'.$replace_with); // Delete any old assets $files_to_delete = new Finder(); $files_to_delete->files(); $files_to_delete->name($asset_name.'.'.$asset_ext); $files_to_delete->name($asset_name.'.*.'.$asset_ext); $files_to_delete->name($asset_name.'.*.'.$asset_ext.'.gz'); $files_to_delete->in($asset_base_dir); $files_to_delete->depth('== 0'); foreach ($files_to_delete as $file_to_delete) { unlink($file_to_delete->getPathname()); } }
php
{ "resource": "" }
q252937
BuildAsset.normaliseSrcInput
validation
protected function normaliseSrcInput($input): array { $output = []; if ($input instanceof Finder) { foreach ($input as $fileInfo) { $output[] = $fileInfo->getRealpath(); } } else { if (!is_array($input)) $input = [$input]; if (count($input) === 0) throw new \UnexpectedValueException; if (!is_string($input[0])) throw new \UnexpectedValueException; $output = $input; } return $output; }
php
{ "resource": "" }
q252938
TranslatorAwareTrait.__
validation
public function __($key, array $parameters = [], $locale = null, $default = null, $parseBBCode = true) { return $this->translate($key, $parameters, $locale, $default, $parseBBCode); }
php
{ "resource": "" }
q252939
Registry.getService
validation
public function getService($name) { if (array_key_exists($name, $this->services)) { return $this->services[$name]; } throw new KeyNotFoundInSetException($name, array_keys($this->services), 'services'); }
php
{ "resource": "" }
q252940
Registry.addService
validation
public function addService(Service $service) { if (array_key_exists($service->getName(), $this->services)) { throw new KeyTakenInSetException($service->getName(), 'services'); } $this->services[$service->getName()] = $service; return $this; }
php
{ "resource": "" }
q252941
Registry.getCachePool
validation
public function getCachePool($name) { if (array_key_exists($name, $this->cachePools)) { return $this->cachePools[$name]; } throw new KeyNotFoundInSetException($name, array_keys($this->cachePools), 'cache pools'); }
php
{ "resource": "" }
q252942
Registry.get
validation
public function get($component) { $parts = explode('.', $component); if (count($parts) == 1) { return $this->getService($parts[0]); } elseif (count($parts) == 2) { return $this->getService($parts[0])->getGroup($parts[1]); } elseif (count($parts) == 3) { return $this->getService($parts[0])->getGroup($parts[1])->getAction($parts[2]); } throw new \LogicException('Malformed component path. Please use a dot-notated path (e.g. service.group.action)'); }
php
{ "resource": "" }
q252943
Form.add
validation
public function add($sName, $mType, $sLabel = null, $mValue = null, $mOptions = null) { if ($mType instanceof Container) { $this->_aElement[$sName] = $mType; } else if ($mType === 'text' || $mType === 'submit' || $mType === 'password' || $mType === 'file' || $mType === 'tel' || $mType === 'url' || $mType === 'email' || $mType === 'search' || $mType === 'date' || $mType === 'time' || $mType === 'datetime' || $mType === 'month' || $mType === 'week' || $mType === 'number' || $mType === 'range' || $mType === 'color' || $mType === 'hidden') { $this->_aElement[$sName] = new Input($sName, $mType, $sLabel, $mValue); } elseif ($mType === 'textarea') { $this->_aElement[$sName] = new Textarea($sName, $sLabel, $mValue); } else if ($mType === 'select') { $this->_aElement[$sName] = new Select($sName, $mOptions, $sLabel, $mValue); } else if ($mType === 'label') { $this->_aElement[$sName] = new Label($sName); } else if ($mType === 'list_checkbox') { $i = 0; $this->_aElement[$sName.'_'.$i++] = new Label($sLabel); foreach ($mValue as $mKey => $sValue) { $this->_aElement[$sName.'_'.$i++] = new Checkbox($sName, $sValue, $mKey, $mOptions); } } else if ($mType === 'checkbox') { $this->_aElement[$sName] = new Checkbox($sName, $sLabel, $mValue, $mOptions); } else if ($mType === 'radio') { $this->_aElement[$sName.rand(100000, 999999)] = new Radio($sName, $sLabel, $mValue, $mOptions); } return $this; }
php
{ "resource": "" }
q252944
Form.getForm
validation
public function getForm() { $oForm = $this->getFormInObject(); $sFormContent = $oForm->start; foreach ($oForm->form as $sValue) { $sFormContent .= $sValue.$this->_sSeparator; } $sFormContent .= $oForm->end; $oContainer = new Container; $oContainer->setView($sFormContent) ->setForm($this); return $oContainer; }
php
{ "resource": "" }
q252945
Form.getFormInObject
validation
public function getFormInObject() { $sExKey = null; if ($this->_iIdEntity > 0 && $this->_sSynchronizeEntity !== null && count($_POST) < 1) { $sModelName = str_replace('Entity', 'Model', $this->_sSynchronizeEntity); $oModel = new $sModelName; $oEntity = new $this->_sSynchronizeEntity; $sPrimaryKey = LibEntity::getPrimaryKeyNameWithoutMapping($oEntity); $sMethodName = 'findOneBy'.$sPrimaryKey; $oCompleteEntity = call_user_func_array(array(&$oModel, $sMethodName), array($this->_iIdEntity)); if (is_object($oCompleteEntity)) { foreach ($this->_aElement as $sKey => $sValue) { if ($sValue instanceof \Venus\lib\Form\Input && $sValue->getType() == 'submit') { continue; } if ($sValue instanceof \Venus\lib\Form\Radio) { $sExKey = $sKey; $sKey = substr($sKey, 0, -6); } if ($sValue instanceof Form) { ; } else { $sMethodNameInEntity = 'get_'.$sKey; if (method_exists($oCompleteEntity, $sMethodNameInEntity)) { $mValue = $oCompleteEntity->$sMethodNameInEntity(); } if ($sValue instanceof \Venus\lib\Form\Radio && method_exists($this->_aElement[$sExKey], 'setValueChecked')) { $this->_aElement[$sExKey]->setValueChecked($mValue); } else if (isset($mValue) && method_exists($this->_aElement[$sKey], 'setValue')) { $this->_aElement[$sKey]->setValue($mValue); } } } } } $oForm = new \StdClass(); $oForm->start = '<form name="form'.$this->_iFormNumber.'" method="post" enctype="multipart/form-data"><input type="hidden" value="1" name="validform'.$this->_iFormNumber.'">'; $oForm->form = array(); foreach ($this->_aElement as $sKey => $sValue) { if ($sValue instanceof Container) { $oForm->form[$sKey] = $sValue; } else { $oForm->form[$sKey] = $sValue->fetch(); } } $oForm->end = '</form>'; return $oForm; }
php
{ "resource": "" }
q252946
Form.synchronizeEntity
validation
public function synchronizeEntity($sSynchronizeEntity, $iId = null) { if ($iId !== null) { $this->_iIdEntity = $iId; } $this->_sSynchronizeEntity = $sSynchronizeEntity; return $this; }
php
{ "resource": "" }
q252947
ValidatorService.storageValidate
validation
public function storageValidate($validators,$storage){ $errors=[]; foreach($validators as $kValidate=>$validate){ if(!isset($storage[$kValidate])){ $errors[]=['field'=>$kValidate,'message'=>'Value '.$kValidate.' not found.']; continue; } $error=$this->validate($validate,$storage[$kValidate]); if($error) $errors[]=['field'=>$kValidate,'message'=>$error]; } return $errors; }
php
{ "resource": "" }
q252948
AdminController.actionIndex
validation
public function actionIndex() { $searchModel = \Yii::createObject(UserSearch::className()); $dataProvider = $searchModel->search($_GET); return $this->render('index', [ 'dataProvider' => $dataProvider, 'searchModel' => $searchModel, ]); }
php
{ "resource": "" }
q252949
AdminController.actionCreate
validation
public function actionCreate() { /** @var User $user */ $user = \Yii::createObject([ 'class' => User::className(), 'scenario' => 'create', ]); $this->performAjaxValidation($user); if ($user->load(\Yii::$app->request->post()) && $user->create()) { \Yii::$app->getSession()->setFlash('success', \Yii::t('user', 'User has been created')); return $this->redirect(['index']); } return $this->render('create', [ 'user' => $user ]); }
php
{ "resource": "" }
q252950
AdminController.actionUpdate
validation
public function actionUpdate($id) { $user = $this->findModel($id); $user->scenario = 'update'; $profile = $this->finder->findProfileById($id); $r = \Yii::$app->request; $this->performAjaxValidation([$user, $profile]); if ($user->load($r->post()) && $profile->load($r->post()) && $user->save() && $profile->save()) { \Yii::$app->getSession()->setFlash('success', \Yii::t('user', 'User has been updated')); return $this->refresh(); } return $this->render('update', [ 'user' => $user, 'profile' => $profile, 'module' => $this->module, ]); }
php
{ "resource": "" }
q252951
AdminController.actionConfirm
validation
public function actionConfirm($id, $back = 'index') { $this->findModel($id)->confirm(); \Yii::$app->getSession()->setFlash('success', \Yii::t('user', 'User has been confirmed')); $url = $back == 'index' ? ['index'] : ['update', 'id' => $id]; return $this->redirect($url); }
php
{ "resource": "" }
q252952
AdminController.actionBlock
validation
public function actionBlock($id, $back = 'index') { if ($id == \Yii::$app->user->getId()) { \Yii::$app->getSession()->setFlash('danger', \Yii::t('user', 'You can not block your own account')); } else { $user = $this->findModel($id); if ($user->getIsBlocked()) { $user->unblock(); \Yii::$app->getSession()->setFlash('success', \Yii::t('user', 'User has been unblocked')); } else { $user->block(); \Yii::$app->getSession()->setFlash('success', \Yii::t('user', 'User has been blocked')); } } $url = $back == 'index' ? ['index'] : ['update', 'id' => $id]; return $this->redirect($url); }
php
{ "resource": "" }
q252953
AdminController.performAjaxValidation
validation
protected function performAjaxValidation($models) { if (\Yii::$app->request->isAjax) { if (is_array($models)) { $result = []; foreach ($models as $model) { if ($model->load(\Yii::$app->request->post())) { \Yii::$app->response->format = Response::FORMAT_JSON; $result = array_merge($result, ActiveForm::validate($model)); } } echo json_encode($result); \Yii::$app->end(); } else { if ($models->load(\Yii::$app->request->post())) { \Yii::$app->response->format = Response::FORMAT_JSON; echo json_encode(ActiveForm::validate($models)); \Yii::$app->end(); } } } }
php
{ "resource": "" }
q252954
Downgrade.getCalcData
validation
private function getCalcData() { /** * Create Unqualified Process (Downgrade) calculation. */ $req = new AGetPeriodRequest(); $req->setBaseCalcTypeCode(Cfg::CODE_TYPE_CALC_PV_WRITE_OFF); $req->setDepCalcTypeCode(Cfg::CODE_TYPE_CALC_UNQUALIFIED_PROCESS); /** @var AGetPeriodResponse $resp */ $resp = $this->servPeriodGet->exec($req); /** @var \Praxigento\BonusBase\Repo\Data\Calculation $writeOffCalc */ $writeOffCalc = $resp->getBaseCalcData(); /** @var \Praxigento\BonusBase\Repo\Data\Calculation $pwWriteOffCalc */ $processCalc = $resp->getDepCalcData(); /** * Compose result. */ $result = [$writeOffCalc, $processCalc]; return $result; }
php
{ "resource": "" }
q252955
AccessToken.getTokenFromServer
validation
public function getTokenFromServer() { $params = [ 'appid' => $this->appId, 'secret' => $this->secret, 'grant_type' => 'client_credential', ]; $http = $this->getHttp(); $token = $http->parseJSON($http->get(self::API_TOKEN_GET, $params)); if (empty($token[$this->tokenJsonKey])) { throw new HttpException('Request AccessToken fail. response: '.json_encode($token, JSON_UNESCAPED_UNICODE)); } return $token; }
php
{ "resource": "" }
q252956
CachedIdentityService.getCachedToken
validation
protected function getCachedToken(array $options) { $authOptions = array_intersect_key($options, $this->api->postTokens()['params']); // Determine a unique key for the used authentication options. We add the authUrl // because it is possible to use the same credentials for a different OpenStack // instance, which should use a different authentication token. $optionsToHash = array_merge($authOptions, array_intersect_key($options, [ 'authUrl' => true, ])); // Do not include the password in the insecure hash. if (isset($optionsToHash['user'])) { unset($optionsToHash['user']['password']); } $key = 'openstack-token-'.md5(json_encode($optionsToHash)); if ($this->cache->has($key)) { return $this->cache->get($key); } $token = $this->generateToken($authOptions); $cachedToken = $token->export(); // Cache the token for 1 minute less than it's considered valid to avoid the edge case // discussed here: https://github.com/mzur/laravel-openstack-swift/issues/1 $expiresAt = new DateTime($cachedToken['expires_at']); $this->cache->put($key, $cachedToken, $expiresAt->sub(new DateInterval('PT1M'))); return $cachedToken; }
php
{ "resource": "" }
q252957
CommandEntry.entry
validation
public static function entry($argv): void { self::initialize(); /* Check Command Entered */ if (isset($argv[1])) { $command = $argv[1]; } else { return; } /* Check Command Defined */ if (!in_array($command, array_keys(self::$commands))) { return; } $arguments = []; $options = []; /* Parse Arguments and Options */ for ($index = 2; $index < count($argv); $index++) { /* Get Argument/Option Key and Value */ list($key, $value) = Service::parse($argv[$index]); /* Is Option */ if (Service::determineTypeOfWord($argv[$index]) == Service::OPTION_TYPE) { /* Flag */ if (!$value) { $options[$key] = true; } /* Parameter */ else { $options[$key] = $value; } } /* Is Argument */ else { $arguments[] = $key; } } /* Run Command Handle */ Service::runCommand(self::$commands[$command], $arguments, $options); }
php
{ "resource": "" }
q252958
CommandEntry.load
validation
public static function load(string $dir): void { self::initialize(); /* Make Directory */ $commandDir = $_SERVER['DOCUMENT_ROOT'] . $dir; /* Get All Files In Directory */ $files = scandir($commandDir); /* Require Files */ foreach ($files as $file) { if ($file == '.' || $file == '..') { continue; } require_once $_SERVER['DOCUMENT_ROOT'] . $dir . '/' . $file; } }
php
{ "resource": "" }
q252959
AbstractTimelineAccompanyingPeriod.basicFetchQuery
validation
protected function basicFetchQuery($context, array $args) { if ($context !== 'person') { throw new \LogicException('TimelineAccompanyingPeriod is not able ' . 'to render context '.$context); } $metadata = $this->em ->getClassMetadata('ChillPersonBundle:AccompanyingPeriod') ; return array( 'id' => $metadata->getColumnName('id'), 'date' => $metadata->getColumnName('openingDate'), 'FROM' => $metadata->getTableName(), ); }
php
{ "resource": "" }
q252960
SaveQueueController.saveAction
validation
public function saveAction(Request $request, Application $app) { $options = array( "request" => $request, "configuration_handler" => $app["red_kite_cms.configuration_handler"], 'security' => $app["security"], "queue_manager" => $app["red_kite_cms.queue_manager"], ); $response = parent::save($options); if ($app["red_kite_cms.queue_manager"]->hasQueue() && $response->getContent() == "Queue saved") { $lastRoute = $request->getSession()->get('last_uri'); return $app->redirect($lastRoute); } return $response; }
php
{ "resource": "" }
q252961
BlogExtension.countPost
validation
public function countPost($actor) { $em = $this->container->get('doctrine')->getManager(); $entities = $em->getRepository('BlogBundle:Post')->findBy(array('actor' => $actor)); return count($entities); }
php
{ "resource": "" }
q252962
BlogExtension.getCarouselItemsBlog
validation
public function getCarouselItemsBlog($entity) { $em = $this->container->get('doctrine')->getManager(); if($entity instanceof Category){ $qb = $em->getRepository('BlogBundle:Post') ->createQueryBuilder('p') ->join('p.categories', 'c') ->join('p.translations', 't') ->where('c.id = :category') ->andWhere('p.highlighted = true') ->setParameter('category', $entity->getId()) ->setMaxResults(3) ->orderBy('p.published', 'DESC'); }elseif($entity instanceof Tag){ $qb = $em->getRepository('BlogBundle:Post') ->createQueryBuilder('p') ->join('p.tags', 'tag') ->join('p.translations', 't') ->where('t.id = :tag') ->andWhere('p.highlighted = true') ->setParameter('tag', $entity->getId()) ->setMaxResults(3) ->orderBy('p.published', 'DESC'); } $entities = $qb->getQuery()->getResult(); return $entities; }
php
{ "resource": "" }
q252963
BlogExtension.getPosts
validation
public function getPosts($limit=null, $offset=null) { $em = $this->container->get('doctrine')->getManager(); if(is_null($limit) && is_null($offset)){ $entities = $em->getRepository('BlogBundle:Post')->findBy(array(),array('published' => 'DESC')); }elseif(is_null($limit) && !is_null($offset)){ $entities = $em->getRepository('BlogBundle:Post')->findBy(array(),array('published' => 'DESC'), $limit); }elseif(!is_null($limit) && !is_null($offset)){ $entities = $em->getRepository('BlogBundle:Post')->findBy(array(),array('published' => 'DESC'), $limit, $offset); } return $entities; }
php
{ "resource": "" }
q252964
ActionActivitySubscriber.collectActivity
validation
public function collectActivity(PostActionEvent $event) { $this->activity[] = array( 'action_name' => $event->getAction()->getName(), 'group_name' => $event->getAction()->getGroup()->getName(), 'service_name' => $event->getAction()->getGroup()->getService()->getName(), 'execution_time' => round($event->getExecutionTime() * 1000, 2), 'arguments' => $event->getArguments(), 'extra_data' => $event->getExtraData(), ); $this->totalExecutionTime += $event->getExecutionTime(); $this->totalCallCount += 1; }
php
{ "resource": "" }
q252965
SDIS62_Service_Generic.prepare
validation
protected function prepare($path, Zend_Http_Client $client) { $client->setUri($this->uri . '/' . $path); $client->resetParameters(); }
php
{ "resource": "" }
q252966
View.assign
validation
public function assign(string $key, $value, bool $global = false) { // Assign a new view variable (global or locale) if ($global === false) { $this->vars[$key] = $value; } else { View::$global_vars[$key] = $value; } return $this; }
php
{ "resource": "" }
q252967
View.render
validation
public function render($filter = null) : string { // Is output empty ? if (empty($this->output)) { // Extract variables as references extract(array_merge($this->vars, View::$global_vars), EXTR_REFS); // Turn on output buffering ob_start(); // Include view file include($this->view_file); // Output... $this->output = ob_get_clean(); } // Filter output ? if ($filter !== null) { $this->output = call_user_func($filter, $this->output); } // Return output return $this->output; }
php
{ "resource": "" }
q252968
ActiveTaxonomy.setTaxonomy_id
validation
public function setTaxonomy_id($value) { if (!is_array($value)) { $value = [$value]; } foreach ($value as $k => $v) { if (is_object($v)) { $value[$k] = $v->primaryKey; } elseif (is_array($v)) { unset($value[$k]); if (isset($v['systemId']) && isset($v['taxonomyType'])) { $taxonomyType = Yii::$app->collectors['taxonomies']->getOne($v['taxonomyType']); if (isset($taxonomyType) && ($taxonomy = $taxonomyType->getTaxonomy($v['systemId']))) { $value[$k] = $taxonomy->primaryKey; } } } } $this->_taxonomy_id = $value; }
php
{ "resource": "" }
q252969
CompilerContextParameterCollection._fetch
validation
private function _fetch($attrName, $default = NULL) { return $this->hasAttribute($attrName) ? $this->getAttribute($attrName)->getValue() : $default; }
php
{ "resource": "" }
q252970
CompilerContextParameterCollection._put
validation
private function _put($attrName, $value = NULL) { $this->_checkModify(); if($value === NULL) $this->removeAttribute($attrName); elseif($this->hasAttribute($attrName) && method_exists($attr = $this->getAttribute($attrName), "setValue")) { /** @var Attribute $attr */ $attr->setValue($value); } else { $this->addAttribute(new Attribute($attrName, $value)); } }
php
{ "resource": "" }
q252971
LoginForm.validatePassword
validation
public function validatePassword() { $user = User::findByEmail($this->email); if (!$user || !$user->validatePassword($this->password)) { $this->addError('password', 'Incorrect username or password.'); } }
php
{ "resource": "" }
q252972
SlotsManager.generateSlot
validation
protected function generateSlot($path, $blocks = array(), $username = null) { if (is_dir($path) && !$this->override) { return; } $folders = array(); $activeDir = $path . '/active'; $contributorsDir = $path . '/contributors'; $folders[] = $activeDir . '/blocks'; $folders[] = $activeDir . '/archive'; $folders[] = $contributorsDir; $targetDir = $activeDir; $blocksDir = $activeDir . '/blocks'; if (null !== $username) { $targetDir = $contributorsDir . '/' . $username; $blocksDir = $targetDir . '/blocks'; $folders[] = $targetDir; $folders[] = $targetDir . '/archive'; $folders[] = $blocksDir; } $this->filesystem->mkdir($folders); $this->generateBlocks($blocks, $blocksDir, $targetDir); }
php
{ "resource": "" }
q252973
SlotsManager.generateBlocks
validation
protected function generateBlocks(array $blocks, $blocksDir, $targetDir) { $c = 1; $generatedBlocks = array(); foreach ($blocks as $block) { $blockName = 'block' . $c; $fileName = sprintf('%s/%s.json', $blocksDir, $blockName); $generatedBlocks[] = $blockName; $value = $block; if (is_array($value)) { $value = json_encode($block); } FilesystemTools::writeFile($fileName, $value); $c++; } $slotDefinition = array( 'next' => $c, 'blocks' => $generatedBlocks, 'revision' => 1, ); FilesystemTools::writeFile($targetDir . '/slot.json', json_encode($slotDefinition)); }
php
{ "resource": "" }
q252974
PageManager.publish
validation
public function publish($pageName, $languageName) { $this->contributorDefined(); $baseDir = $this->pagesDir . '/' . $pageName; $pageCollectionSourceFile = $baseDir . '/' . $this->username . '.json'; $pageCollectionTargetFile = $baseDir . '/page.json'; $pageDir = $baseDir . '/' . $languageName; $pageSourceFile = $pageDir . '/' . $this->username . '.json'; $pageTargetFile = $pageDir . '/seo.json'; Dispatcher::dispatch(PageEvents::PAGE_PUBLISHING, new PagePublishingEvent()); copy($pageCollectionSourceFile, $pageCollectionTargetFile); copy($pageSourceFile, $pageTargetFile); Dispatcher::dispatch(PageEvents::PAGE_PUBLISHED, new PagePublishedEvent()); DataLogger::log(sprintf('Page "%s" for language "%s" was published in production', $pageName, $languageName)); }
php
{ "resource": "" }
q252975
PageManager.hide
validation
public function hide($pageName, $languageName) { $this->contributorDefined(); $baseDir = $this->pagesDir . '/' . $pageName . '/' . $languageName; $sourceFile = $baseDir . '/seo.json'; Dispatcher::dispatch(PageEvents::PAGE_HIDING, new PageHidingEvent()); unlink($sourceFile); Dispatcher::dispatch(PageEvents::PAGE_HID, new PageHidEvent()); DataLogger::log(sprintf('Page "%s" for language "%s" was hidden from production', $pageName, $languageName)); }
php
{ "resource": "" }
q252976
Ov.updateOv
validation
private function updateOv($dwnl) { $entity = new EBonDwnl(); /** @var EBonDwnl $one */ foreach ($dwnl as $one) { $ov = $one->getOv(); $calcId = $one->getCalculationRef(); $custId = $one->getCustomerRef(); $entity->setOv($ov); $id = [ EBonDwnl::A_CALC_REF => $calcId, EBonDwnl::A_CUST_REF => $custId ]; $this->daoBonDwnl->updateById($id, $entity); } }
php
{ "resource": "" }
q252977
Url.setAddress
validation
public function setAddress($address) { $address = trim($address, self::SEPARATOR); if (!filter_var($address, FILTER_VALIDATE_URL)) { throw new \InvalidArgumentException("$address is not valid format of url address."); } $this->address = $address; $this->parse = parse_url($address); return $this; }
php
{ "resource": "" }
q252978
Url.getDomain
validation
public function getDomain($scheme = false) { if ($scheme) { return sprintf('%s.%s', $this->get(self::PARSE_SCHEME), $this->get(self::PARSE_HOST)); } return $this->get(self::PARSE_HOST); }
php
{ "resource": "" }
q252979
Url.normalize
validation
protected function normalize($scheme = true, $www = true) { $address = $this->address; if ($scheme && null === $this->get(self::PARSE_SCHEME)) { $address = sprintf('http://%s', $this->address); } elseif (!$scheme && $this->get(self::PARSE_SCHEME)) { $address = str_replace($this->get(self::PARSE_SCHEME) . '://', '', $this->address); } if (false === $www && 0 === strpos($this->get(self::PARSE_HOST), 'www.')) { $address = substr($address, 4); } return $address; }
php
{ "resource": "" }
q252980
Url.getMd5Address
validation
public function getMd5Address($scheme = true, $www = true) { return md5($this->normalize($scheme, $www)); }
php
{ "resource": "" }
q252981
PersonController.exportAction
validation
public function exportAction() { $em = $this->getDoctrine()->getManager(); $chillSecurityHelper = $this->get('chill.main.security.authorization.helper'); $user = $this->get('security.context')->getToken()->getUser(); $reachableCenters = $chillSecurityHelper->getReachableCenters($user, new Role('CHILL_PERSON_SEE')); $personRepository = $em->getRepository('ChillPersonBundle:Person'); $qb = $personRepository->createQueryBuilder('p'); $qb->where($qb->expr()->in('p.center', ':centers')) ->setParameter('centers', $reachableCenters); $persons = $qb->getQuery()->getResult(); $response = $this->render('ChillPersonBundle:Person:export.csv.twig', array( 'persons' => $persons, 'cf_group' => $this->getCFGroup())); $response->headers->set('Content-Type', 'text/csv; charset=utf-8'); $response->headers->set('Content-Disposition', 'attachment; filename="export_person.csv"'); return $response; }
php
{ "resource": "" }
q252982
PersonController._getPerson
validation
private function _getPerson($id) { $em = $this->getDoctrine()->getManager(); $person = $em->getRepository('ChillPersonBundle:Person') ->find($id); return $person; }
php
{ "resource": "" }
q252983
PageCollectionManager.add
validation
public function add(Theme $theme, array $pageValues) { $pageName = $pageValues["name"]; $pageDir = $this->pagesDir . '/' . $pageName; $this->pageExists($pageDir); // @codeCoverageIgnoreStart if (!@mkdir($pageDir)) { $this->folderNotCreated($pageDir); } // @codeCoverageIgnoreEnd $seoValues = $pageValues["seo"]; unset($pageValues["seo"]); $encodedPage = json_encode($pageValues); $pageFile = $pageDir . '/' . $this->pageFile; $event = Dispatcher::dispatch(PageCollectionEvents::PAGE_COLLECTION_ADDING, new PageCollectionAddingEvent($pageFile, $encodedPage)); $encodedPage = $event->getFileContent(); FilesystemTools::writeFile($pageFile, $encodedPage); if ($this->pageFile != 'page.json') { FilesystemTools::writeFile($pageDir . '/page.json', $encodedPage); } foreach ($seoValues as $seoValue) { $languageName = $seoValue["language"]; unset($seoValue["language"]); $languageDir = $pageDir . '/' . $languageName; @mkdir($languageDir); FilesystemTools::writeFile($languageDir . '/' . $this->seoFile, json_encode($seoValue)); $theme->addTemplateSlots($pageValues["template"], $this->username); } Dispatcher::dispatch(PageCollectionEvents::PAGE_COLLECTION_ADDED, new PageCollectionAddedEvent($pageFile, $encodedPage)); DataLogger::log(sprintf('Page "%s" was successfully added to the website', $pageName)); return $pageValues; }
php
{ "resource": "" }
q252984
PageCollectionManager.remove
validation
public function remove($pageName) { if ($pageName == $this->configurationHandler->homepage()) { throw new RuntimeException("exception_homepage_cannot_be_removed"); } $pageDir = $this->pagesDir . '/' . $pageName; Dispatcher::dispatch(PageCollectionEvents::PAGE_COLLECTION_REMOVING, new PageCollectionRemovingEvent($this->username, $pageDir)); $filesystem = new Filesystem(); if (file_exists($pageDir . '/page.json')) { $filesystem->mirror($pageDir, $this->pagesRemovedDir . '/' . $pageName . "-" . date("Y-m-d-H.i.s")); } $filesystem->remove($pageDir); Dispatcher::dispatch(PageCollectionEvents::PAGE_COLLECTION_REMOVED, new PageCollectionRemovedEvent($this->username, $pageDir)); DataLogger::log(sprintf('Page "%s" was successfully removed from website', $pageName)); }
php
{ "resource": "" }
q252985
ShakeAround.register
validation
public function register($name, $tel, $email, $industryId, array $certUrls, $reason = '') { $params = [ 'name' => $name, 'phone_number' => strval($tel), 'email' => $email, 'industry_id' => $industryId, 'qualification_cert_urls' => $certUrls, ]; if ($reason !== '') { $params['apply_reason'] = $reason; } return $this->parseJSON('json', [self::API_ACCOUNT_REGISTER, $params]); }
php
{ "resource": "" }
q252986
ShakeAround.getShakeInfo
validation
public function getShakeInfo($ticket, $needPoi = null) { $params = [ 'ticket' => $ticket, ]; if ($needPoi !== null) { $params['need_poi'] = intval($needPoi); } return $this->parseJSON('json', [self::API_GET_SHAKE_INFO, $params]); }
php
{ "resource": "" }
q252987
ShakeAround.device
validation
public function device() { if (is_null($this->device)) { $this->device = new Device($this->accessToken); } return $this->device; }
php
{ "resource": "" }
q252988
ShakeAround.group
validation
public function group() { if (is_null($this->group)) { $this->group = new Group($this->accessToken); } return $this->group; }
php
{ "resource": "" }
q252989
ShakeAround.page
validation
public function page() { if (is_null($this->page)) { $this->page = new Page($this->accessToken); } return $this->page; }
php
{ "resource": "" }
q252990
ShakeAround.material
validation
public function material() { if (is_null($this->material)) { $this->material = new Material($this->accessToken); } return $this->material; }
php
{ "resource": "" }
q252991
ShakeAround.relation
validation
public function relation() { if (is_null($this->relation)) { $this->relation = new Relation($this->accessToken); } return $this->relation; }
php
{ "resource": "" }
q252992
ShakeAround.stats
validation
public function stats() { if (is_null($this->stats)) { $this->stats = new Stats($this->accessToken); } return $this->stats; }
php
{ "resource": "" }
q252993
Comment.open
validation
public function open($msgId, $index) { $params = [ 'msg_data_id' => $msgId, 'index' => $index, ]; return $this->parseJSON('json', [self::API_OPEN_COMMENT, $params]); }
php
{ "resource": "" }
q252994
Comment.close
validation
public function close($msgId, $index) { $params = [ 'msg_data_id' => $msgId, 'index' => $index, ]; return $this->parseJSON('json', [self::API_CLOSE_COMMENT, $params]); }
php
{ "resource": "" }
q252995
Comment.lists
validation
public function lists($msgId, $index, $begin, $count, $type = 0) { $params = [ 'msg_data_id' => $msgId, 'index' => $index, 'begin' => $begin, 'count' => $count, 'type' => $type, ]; return $this->parseJSON('json', [self::API_LIST_COMMENT, $params]); }
php
{ "resource": "" }
q252996
Comment.markElect
validation
public function markElect($msgId, $index, $commentId) { $params = [ 'msg_data_id' => $msgId, 'index' => $index, 'user_comment_id' => $commentId, ]; return $this->parseJSON('json', [self::API_MARK_ELECT, $params]); }
php
{ "resource": "" }
q252997
Comment.unmarkElect
validation
public function unmarkElect($msgId, $index, $commentId) { $params = [ 'msg_data_id' => $msgId, 'index' => $index, 'user_comment_id' => $commentId, ]; return $this->parseJSON('json', [self::API_UNMARK_ELECT, $params]); }
php
{ "resource": "" }
q252998
Comment.delete
validation
public function delete($msgId, $index, $commentId) { $params = [ 'msg_data_id' => $msgId, 'index' => $index, 'user_comment_id' => $commentId, ]; return $this->parseJSON('json', [self::API_DELETE_COMMENT, $params]); }
php
{ "resource": "" }
q252999
Comment.reply
validation
public function reply($msgId, $index, $commentId, $content) { $params = [ 'msg_data_id' => $msgId, 'index' => $index, 'user_comment_id' => $commentId, 'content' => $content, ]; return $this->parseJSON('json', [self::API_REPLY_COMMENT, $params]); }
php
{ "resource": "" }